This commit is contained in:
boufni95 2023-12-15 21:07:53 +01:00
parent 4a06e64278
commit f0dd9a08ac
5 changed files with 2671 additions and 2654 deletions

View file

@ -414,19 +414,162 @@ The nostr server will send back a message response, and inside the body there wi
## Messages ## Messages
### The content of requests and response from the methods ### The content of requests and response from the methods
### NewAddressRequest
- __addressType__: _[AddressType](#AddressType)_
### DecodeInvoiceResponse
- __amount__: _number_
### Product
- __id__: _string_
- __name__: _string_
- __price_sats__: _number_
### MigrationUpdate
- __closure__: _[ClosureMigration](#ClosureMigration)_ *this field is optional
- __relays__: _[RelaysMigration](#RelaysMigration)_ *this field is optional
### AuthAppRequest
- __name__: _string_
- __allow_user_creation__: _boolean_ *this field is optional
### LnurlWithdrawInfoResponse
- __tag__: _string_
- __callback__: _string_
- __k1__: _string_
- __defaultDescription__: _string_
- __minWithdrawable__: _number_
- __maxWithdrawable__: _number_
- __balanceCheck__: _string_
- __payLink__: _string_
### ClosureMigration
- __closes_at_unix__: _number_
### SetMockAppBalanceRequest
- __amount__: _number_
### SendAppUserToAppPaymentRequest
- __from_user_identifier__: _string_
- __amount__: _number_
### NewInvoiceResponse
- __invoice__: _string_
### LnurlLinkResponse
- __lnurl__: _string_
- __k1__: _string_
### AddProductRequest
- __name__: _string_
- __price_sats__: _number_
### AddAppInvoiceRequest
- __payer_identifier__: _string_
- __http_callback_url__: _string_
- __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_
### AddAppRequest
- __name__: _string_
- __allow_user_creation__: _boolean_
### PayAddressRequest
- __address__: _string_
- __amoutSats__: _number_
- __satsPerVByte__: _number_
### PayInvoiceResponse
- __preimage__: _string_
- __amount_paid__: _number_
- __operation_id__: _string_
- __service_fee__: _number_
- __network_fee__: _number_
### OpenChannelRequest
- __destination__: _string_
- __fundingAmount__: _number_
- __pushAmount__: _number_
- __closeAddress__: _string_
### LnurlPayInfoResponse
- __tag__: _string_
- __callback__: _string_
- __maxSendable__: _number_
- __minSendable__: _number_
- __metadata__: _string_
- __allowsNostr__: _boolean_
- __nostrPubkey__: _string_
### HandleLnurlPayResponse
- __pr__: _string_
- __routes__: ARRAY of: _[Empty](#Empty)_
### GetUserOperationsRequest
- __latestIncomingInvoice__: _number_
- __latestOutgoingInvoice__: _number_
- __latestIncomingTx__: _number_
- __latestOutgoingTx__: _number_
- __latestIncomingUserToUserPayment__: _number_
- __latestOutgoingUserToUserPayment__: _number_
### SetMockInvoiceAsPaidRequest
- __invoice__: _string_
- __amount__: _number_
### UserOperation
- __paidAtUnix__: _number_
- __type__: _[UserOperationType](#UserOperationType)_
- __inbound__: _boolean_
- __amount__: _number_
- __identifier__: _string_
- __operationId__: _string_
- __service_fee__: _number_
- __network_fee__: _number_
- __confirmed__: _boolean_
### OpenChannelResponse
- __channelId__: _string_
### UserOperations
- __fromIndex__: _number_
- __toIndex__: _number_
- __operations__: ARRAY of: _[UserOperation](#UserOperation)_
### AuthApp
- __app__: _[Application](#Application)_
- __auth_token__: _string_
### UsageMetrics
- __metrics__: ARRAY of: _[UsageMetric](#UsageMetric)_
### Application
- __name__: _string_
- __id__: _string_
- __balance__: _number_
- __npub__: _string_
### AddAppUserRequest
- __identifier__: _string_
- __fail_if_exists__: _boolean_
- __balance__: _number_
### AddAppUserInvoiceRequest ### AddAppUserInvoiceRequest
- __receiver_identifier__: _string_ - __receiver_identifier__: _string_
- __payer_identifier__: _string_ - __payer_identifier__: _string_
- __http_callback_url__: _string_ - __http_callback_url__: _string_
- __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_ - __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_
### GetAppUserRequest
- __user_identifier__: _string_
### SendAppUserToAppUserPaymentRequest ### SendAppUserToAppUserPaymentRequest
- __from_user_identifier__: _string_ - __from_user_identifier__: _string_
- __to_user_identifier__: _string_ - __to_user_identifier__: _string_
- __amount__: _number_ - __amount__: _number_
### OpenChannelResponse ### GetAppUserLNURLInfoRequest
- __channelId__: _string_ - __user_identifier__: _string_
- __base_url_override__: _string_
### UsageMetric ### UsageMetric
- __processed_at_nano__: _string_ - __processed_at_nano__: _string_
@ -439,16 +582,7 @@ The nostr server will send back a message response, and inside the body there wi
- __nostr__: _boolean_ - __nostr__: _boolean_
- __batch_size__: _number_ - __batch_size__: _number_
- __success__: _boolean_ - __success__: _boolean_
- __app_id__: _string_
### AppUser
- __identifier__: _string_
- __info__: _[UserInfo](#UserInfo)_
- __max_withdrawable__: _number_
### PayAppUserInvoiceRequest
- __user_identifier__: _string_
- __invoice__: _string_
- __amount__: _number_
### PayAddressResponse ### PayAddressResponse
- __txId__: _string_ - __txId__: _string_
@ -459,97 +593,6 @@ The nostr server will send back a message response, and inside the body there wi
### DecodeInvoiceRequest ### DecodeInvoiceRequest
- __invoice__: _string_ - __invoice__: _string_
### LndGetInfoRequest
- __nodeId__: _number_
### AddAppRequest
- __name__: _string_
- __allow_user_creation__: _boolean_
### LnurlLinkResponse
- __lnurl__: _string_
- __k1__: _string_
### GetProductBuyLinkResponse
- __link__: _string_
### LiveUserOperation
- __operation__: _[UserOperation](#UserOperation)_
### SetMockAppBalanceRequest
- __amount__: _number_
### NewInvoiceRequest
- __amountSats__: _number_
- __memo__: _string_
### DecodeInvoiceResponse
- __amount__: _number_
### UsageMetrics
- __metrics__: ARRAY of: _[UsageMetric](#UsageMetric)_
### LndGetInfoResponse
- __alias__: _string_
### AuthAppRequest
- __name__: _string_
- __allow_user_creation__: _boolean_ *this field is optional
### AddAppUserRequest
- __identifier__: _string_
- __fail_if_exists__: _boolean_
- __balance__: _number_
### SendAppUserToAppPaymentRequest
- __from_user_identifier__: _string_
- __amount__: _number_
### LnurlPayInfoResponse
- __tag__: _string_
- __callback__: _string_
- __maxSendable__: _number_
- __minSendable__: _number_
- __metadata__: _string_
- __allowsNostr__: _boolean_
- __nostrPubkey__: _string_
### AddProductRequest
- __name__: _string_
- __price_sats__: _number_
### MigrationUpdate
- __closure__: _[ClosureMigration](#ClosureMigration)_ *this field is optional
- __relays__: _[RelaysMigration](#RelaysMigration)_ *this field is optional
### ClosureMigration
- __closes_at_unix__: _number_
### EncryptionExchangeRequest
- __publicKey__: _string_
- __deviceId__: _string_
### PayInvoiceResponse
- __preimage__: _string_
- __amount_paid__: _number_
- __operation_id__: _string_
- __service_fee__: _number_
- __network_fee__: _number_
### LnurlWithdrawInfoResponse
- __tag__: _string_
- __callback__: _string_
- __k1__: _string_
- __defaultDescription__: _string_
- __minWithdrawable__: _number_
- __maxWithdrawable__: _number_
- __balanceCheck__: _string_
- __payLink__: _string_
### HandleLnurlPayResponse
- __pr__: _string_
- __routes__: ARRAY of: _[Empty](#Empty)_
### GetUserOperationsResponse ### GetUserOperationsResponse
- __latestOutgoingInvoiceOperations__: _[UserOperations](#UserOperations)_ - __latestOutgoingInvoiceOperations__: _[UserOperations](#UserOperations)_
- __latestIncomingInvoiceOperations__: _[UserOperations](#UserOperations)_ - __latestIncomingInvoiceOperations__: _[UserOperations](#UserOperations)_
@ -561,95 +604,53 @@ The nostr server will send back a message response, and inside the body there wi
### NewAddressResponse ### NewAddressResponse
- __address__: _string_ - __address__: _string_
### NewInvoiceResponse ### PayAppUserInvoiceRequest
- __invoice__: _string_ - __user_identifier__: _string_
### PayInvoiceRequest
- __invoice__: _string_ - __invoice__: _string_
- __amount__: _number_ - __amount__: _number_
### Empty
### Application
- __name__: _string_
- __id__: _string_
- __balance__: _number_
- __npub__: _string_
### AddAppInvoiceRequest
- __payer_identifier__: _string_
- __http_callback_url__: _string_
- __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_
### GetAppUserRequest
- __user_identifier__: _string_
### SetMockAppUserBalanceRequest ### SetMockAppUserBalanceRequest
- __user_identifier__: _string_ - __user_identifier__: _string_
- __amount__: _number_ - __amount__: _number_
### OpenChannelRequest ### NewInvoiceRequest
- __destination__: _string_ - __amountSats__: _number_
- __fundingAmount__: _number_ - __memo__: _string_
- __pushAmount__: _number_
- __closeAddress__: _string_
### GetUserOperationsRequest ### GetProductBuyLinkResponse
- __latestIncomingInvoice__: _number_ - __link__: _string_
- __latestOutgoingInvoice__: _number_
- __latestIncomingTx__: _number_
- __latestOutgoingTx__: _number_
- __latestIncomingUserToUserPayment__: _number_
- __latestOutgoingUserToUserPayment__: _number_
### Product ### Empty
- __id__: _string_
- __name__: _string_
- __price_sats__: _number_
### GetAppUserLNURLInfoRequest ### LndGetInfoRequest
- __user_identifier__: _string_ - __nodeId__: _number_
- __base_url_override__: _string_
### PayAddressRequest ### LndGetInfoResponse
- __address__: _string_ - __alias__: _string_
- __amoutSats__: _number_
- __satsPerVByte__: _number_
### UserOperations ### AppUser
- __fromIndex__: _number_ - __identifier__: _string_
- __toIndex__: _number_ - __info__: _[UserInfo](#UserInfo)_
- __operations__: ARRAY of: _[UserOperation](#UserOperation)_ - __max_withdrawable__: _number_
### RelaysMigration ### PayInvoiceRequest
- __relays__: ARRAY of: _string_
### SetMockInvoiceAsPaidRequest
- __invoice__: _string_ - __invoice__: _string_
- __amount__: _number_ - __amount__: _number_
### AuthApp
- __app__: _[Application](#Application)_
- __auth_token__: _string_
### NewAddressRequest
- __addressType__: _[AddressType](#AddressType)_
### UserInfo ### UserInfo
- __userId__: _string_ - __userId__: _string_
- __balance__: _number_ - __balance__: _number_
- __max_withdrawable__: _number_ - __max_withdrawable__: _number_
### UserOperation ### LiveUserOperation
- __paidAtUnix__: _number_ - __operation__: _[UserOperation](#UserOperation)_
- __type__: _[UserOperationType](#UserOperationType)_
- __inbound__: _boolean_ ### RelaysMigration
- __amount__: _number_ - __relays__: ARRAY of: _string_
- __identifier__: _string_
- __operationId__: _string_ ### EncryptionExchangeRequest
- __service_fee__: _number_ - __publicKey__: _string_
- __network_fee__: _number_ - __deviceId__: _string_
- __confirmed__: _boolean_
## Enums ## Enums
### The enumerators used in the messages ### The enumerators used in the messages

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -23,6 +23,7 @@ message UsageMetric {
bool nostr = 8; bool nostr = 8;
int64 batch_size = 9; int64 batch_size = 9;
bool success = 10; bool success = 10;
string app_id = 11;
} }
message UsageMetrics { message UsageMetrics {

View file

@ -2,7 +2,7 @@ import * as Types from '../../../proto/autogenerated/ts/types'
const maxEvents = 100_000 const maxEvents = 100_000
export default class Handler { export default class Handler {
metrics: Types.UsageMetric[] = [] metrics: Types.UsageMetric[] = []
AddMetrics(newMetrics: Types.RequestMetric[]) { AddMetrics(newMetrics: (Types.RequestMetric & { app_id?: string })[]) {
const parsed: Types.UsageMetric[] = newMetrics.map(m => ({ const parsed: Types.UsageMetric[] = newMetrics.map(m => ({
rpc_name: m.rpcName, rpc_name: m.rpcName,
processed_at_nano: m.start.toString(), processed_at_nano: m.start.toString(),
@ -13,7 +13,8 @@ export default class Handler {
auth_in_nano: Number(m.guard - m.parse), auth_in_nano: Number(m.guard - m.parse),
validate_in_nano: Number(m.validate - m.guard), validate_in_nano: Number(m.validate - m.guard),
handle_in_nano: Number(m.handle - m.validate), handle_in_nano: Number(m.handle - m.validate),
success: !m.error success: !m.error,
app_id: m.app_id ? m.app_id : ""
})) }))
const len = this.metrics.push(...parsed) const len = this.metrics.push(...parsed)
if (len > maxEvents) { if (len > maxEvents) {