This commit is contained in:
boufni95 2023-12-16 21:24:08 +01:00
parent 218353a8be
commit c9ea4f3dc6
5 changed files with 3048 additions and 3070 deletions

View file

@ -105,9 +105,9 @@ The nostr server will send back a message response, and inside the body there wi
- __User__: - __User__:
- expected context content - expected context content
- __app_user_id__: _string_
- __user_id__: _string_ - __user_id__: _string_
- __app_id__: _string_ - __app_id__: _string_
- __app_user_id__: _string_
- __Admin__: - __Admin__:
- expected context content - expected context content
@ -421,137 +421,42 @@ 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
### PayInvoiceRequest ### PayInvoiceResponse
- __invoice__: _string_ - __preimage__: _string_
- __amount__: _number_ - __amount_paid__: _number_
- __operation_id__: _string_
### UserOperation
- __paidAtUnix__: _number_
- __type__: _[UserOperationType](#UserOperationType)_
- __inbound__: _boolean_
- __amount__: _number_
- __identifier__: _string_
- __operationId__: _string_
- __service_fee__: _number_ - __service_fee__: _number_
- __network_fee__: _number_ - __network_fee__: _number_
- __confirmed__: _boolean_
### OpenChannelRequest
- __destination__: _string_
- __fundingAmount__: _number_
- __pushAmount__: _number_
- __closeAddress__: _string_
### LndGetInfoRequest
- __nodeId__: _number_
### SendAppUserToAppPaymentRequest
- __from_user_identifier__: _string_
- __amount__: _number_
### SetMockAppBalanceRequest
- __amount__: _number_
### UserOperations ### UserOperations
- __fromIndex__: _number_ - __fromIndex__: _number_
- __toIndex__: _number_ - __toIndex__: _number_
- __operations__: ARRAY of: _[UserOperation](#UserOperation)_ - __operations__: ARRAY of: _[UserOperation](#UserOperation)_
### RelaysMigration
- __relays__: ARRAY of: _string_
### AddAppRequest
- __name__: _string_
- __allow_user_creation__: _boolean_
### AddAppUserRequest
- __identifier__: _string_
- __fail_if_exists__: _boolean_
- __balance__: _number_
### OpenChannelResponse
- __channelId__: _string_
### SetMockInvoiceAsPaidRequest
- __invoice__: _string_
- __amount__: _number_
### AuthApp
- __app__: _[Application](#Application)_
- __auth_token__: _string_
### GetAppUserLNURLInfoRequest ### GetAppUserLNURLInfoRequest
- __user_identifier__: _string_ - __user_identifier__: _string_
- __base_url_override__: _string_ - __base_url_override__: _string_
### PayAddressRequest ### DecodeInvoiceResponse
- __address__: _string_
- __amoutSats__: _number_
- __satsPerVByte__: _number_
### NewAddressResponse
- __address__: _string_
### PayAddressResponse
- __txId__: _string_
- __operation_id__: _string_
- __service_fee__: _number_
- __network_fee__: _number_
### DecodeInvoiceRequest
- __invoice__: _string_
### LnurlWithdrawInfoResponse
- __tag__: _string_
- __callback__: _string_
- __k1__: _string_
- __defaultDescription__: _string_
- __minWithdrawable__: _number_
- __maxWithdrawable__: _number_
- __balanceCheck__: _string_
- __payLink__: _string_
### MigrationUpdate
- __closure__: _[ClosureMigration](#ClosureMigration)_ *this field is optional
- __relays__: _[RelaysMigration](#RelaysMigration)_ *this field is optional
### UsageMetrics
- __metrics__: ARRAY of: _[UsageMetric](#UsageMetric)_
### AppsMetricsRequest
- __from_unix__: _number_ *this field is optional
- __to_unix__: _number_ *this field is optional
- __big_user_sats__: _number_ *this field is optional
- __huge_user_sats__: _number_ *this field is optional
- __include_operations__: _boolean_ *this field is optional
### SendAppUserToAppUserPaymentRequest
- __from_user_identifier__: _string_
- __to_user_identifier__: _string_
- __amount__: _number_ - __amount__: _number_
### LnurlPayInfoResponse ### AddProductRequest
- __tag__: _string_
- __callback__: _string_
- __maxSendable__: _number_
- __minSendable__: _number_
- __metadata__: _string_
- __allowsNostr__: _boolean_
- __nostrPubkey__: _string_
### AppMetrics
- __app_name__: _string_
- __app_id__: _string_
- __app_npub__: _string_
- __app_balance__: _number_
- __total_received__: _number_
- __total_spent__: _number_
- __total_available__: _number_
- __total_users__: _number_
- __total_big_users__: _number_
- __total_huge_users__: _number_
- __unpaid_invoices__: _number_
- __unpaid_addresses__: _number_
- __operations__: ARRAY of: _[UserOperation](#UserOperation)_
### PayAppUserInvoiceRequest
- __user_identifier__: _string_
- __invoice__: _string_
- __amount__: _number_
### LiveUserOperation
- __operation__: _[UserOperation](#UserOperation)_
### NewInvoiceRequest
- __amountSats__: _number_
- __memo__: _string_
### Product
- __id__: _string_
- __name__: _string_ - __name__: _string_
- __price_sats__: _number_ - __price_sats__: _number_
@ -566,96 +471,35 @@ 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_
### AppsMetrics ### SetMockInvoiceAsPaidRequest
- __apps__: ARRAY of: _[AppMetrics](#AppMetrics)_
### Application
- __name__: _string_
- __id__: _string_
- __balance__: _number_
- __npub__: _string_
### LndGetInfoRequest
- __nodeId__: _number_
### SendAppUserToAppPaymentRequest
- __from_user_identifier__: _string_
- __amount__: _number_
### NewInvoiceResponse
- __invoice__: _string_ - __invoice__: _string_
- __amount__: _number_
### HandleLnurlPayResponse
- __pr__: _string_
- __routes__: ARRAY of: _[Empty](#Empty)_
### LndGetInfoResponse ### LndGetInfoResponse
- __alias__: _string_ - __alias__: _string_
### Empty
### AuthAppRequest
- __name__: _string_
- __allow_user_creation__: _boolean_ *this field is optional
### AddProductRequest
- __name__: _string_
- __price_sats__: _number_
### LnurlLinkResponse
- __lnurl__: _string_
- __k1__: _string_
### UserInfo
- __userId__: _string_
- __balance__: _number_
- __max_withdrawable__: _number_
### ClosureMigration
- __closes_at_unix__: _number_
### GetAppUserRequest
- __user_identifier__: _string_
### DecodeInvoiceResponse
- __amount__: _number_
### SetMockAppBalanceRequest
- __amount__: _number_
### EncryptionExchangeRequest
- __publicKey__: _string_
- __deviceId__: _string_
### 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)_
### PayInvoiceResponse ### GetProductBuyLinkResponse
- __preimage__: _string_ - __link__: _string_
- __amount_paid__: _number_
- __operation_id__: _string_
- __service_fee__: _number_
- __network_fee__: _number_
### GetUserOperationsRequest ### AppsMetrics
- __latestIncomingInvoice__: _number_ - __apps__: ARRAY of: _[AppMetrics](#AppMetrics)_
- __latestOutgoingInvoice__: _number_
- __latestIncomingTx__: _number_
- __latestOutgoingTx__: _number_
- __latestIncomingUserToUserPayment__: _number_
- __latestOutgoingUserToUserPayment__: _number_
### NewAddressRequest ### MigrationUpdate
- __addressType__: _[AddressType](#AddressType)_ - __closure__: _[ClosureMigration](#ClosureMigration)_ *this field is optional
- __relays__: _[RelaysMigration](#RelaysMigration)_ *this field is optional
### OpenChannelRequest ### Empty
- __destination__: _string_
- __fundingAmount__: _number_ ### AddAppUserRequest
- __pushAmount__: _number_ - __identifier__: _string_
- __closeAddress__: _string_ - __fail_if_exists__: _boolean_
- __balance__: _number_
### GetUserOperationsResponse ### GetUserOperationsResponse
- __latestOutgoingInvoiceOperations__: _[UserOperations](#UserOperations)_ - __latestOutgoingInvoiceOperations__: _[UserOperations](#UserOperations)_
@ -665,22 +509,177 @@ The nostr server will send back a message response, and inside the body there wi
- __latestOutgoingUserToUserPayemnts__: _[UserOperations](#UserOperations)_ - __latestOutgoingUserToUserPayemnts__: _[UserOperations](#UserOperations)_
- __latestIncomingUserToUserPayemnts__: _[UserOperations](#UserOperations)_ - __latestIncomingUserToUserPayemnts__: _[UserOperations](#UserOperations)_
### GetProductBuyLinkResponse ### AuthApp
- __link__: _string_ - __app__: _[Application](#Application)_
- __auth_token__: _string_
### AppUser ### AppUser
- __identifier__: _string_ - __identifier__: _string_
- __info__: _[UserInfo](#UserInfo)_ - __info__: _[UserInfo](#UserInfo)_
- __max_withdrawable__: _number_ - __max_withdrawable__: _number_
### SendAppUserToAppUserPaymentRequest
- __from_user_identifier__: _string_
- __to_user_identifier__: _string_
- __amount__: _number_
### NewAddressResponse
- __address__: _string_
### DecodeInvoiceRequest
- __invoice__: _string_
### 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)_
### RelaysMigration
- __relays__: ARRAY of: _string_
### Product
- __id__: _string_
- __name__: _string_
- __price_sats__: _number_
### UsageMetrics
- __metrics__: ARRAY of: _[UsageMetric](#UsageMetric)_
### AppsMetricsRequest
- __from_unix__: _number_ *this field is optional
- __to_unix__: _number_ *this field is optional
- __big_user_sats__: _number_ *this field is optional
- __huge_user_sats__: _number_ *this field is optional
- __include_operations__: _boolean_ *this field is optional
### AppMetrics
- __app_name__: _string_
- __app_id__: _string_
- __app_npub__: _string_
- __app_balance__: _number_
- __total_received__: _number_
- __total_spent__: _number_
- __total_available__: _number_
- __total_users__: _number_
- __total_big_users__: _number_
- __total_huge_users__: _number_
- __unpaid_invoices__: _number_
- __operations__: ARRAY of: _[UserOperation](#UserOperation)_
### AddAppRequest
- __name__: _string_
- __allow_user_creation__: _boolean_
### OpenChannelResponse
- __channelId__: _string_
### PayAddressRequest
- __address__: _string_
- __amoutSats__: _number_
- __satsPerVByte__: _number_
### UserInfo
- __userId__: _string_
- __balance__: _number_
- __max_withdrawable__: _number_
### LiveUserOperation
- __operation__: _[UserOperation](#UserOperation)_
### ClosureMigration
- __closes_at_unix__: _number_
### GetAppUserRequest
- __user_identifier__: _string_
### GetUserOperationsRequest
- __latestIncomingInvoice__: _number_
- __latestOutgoingInvoice__: _number_
- __latestIncomingTx__: _number_
- __latestOutgoingTx__: _number_
- __latestIncomingUserToUserPayment__: _number_
- __latestOutgoingUserToUserPayment__: _number_
### NewInvoiceRequest
- __amountSats__: _number_
- __memo__: _string_
### AddAppInvoiceRequest ### AddAppInvoiceRequest
- __payer_identifier__: _string_ - __payer_identifier__: _string_
- __http_callback_url__: _string_ - __http_callback_url__: _string_
- __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_ - __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_
### NewInvoiceResponse
- __invoice__: _string_
### PayInvoiceRequest
- __invoice__: _string_
- __amount__: _number_
### LnurlPayInfoResponse
- __tag__: _string_
- __callback__: _string_
- __maxSendable__: _number_
- __minSendable__: _number_
- __metadata__: _string_
- __allowsNostr__: _boolean_
- __nostrPubkey__: _string_
### LnurlLinkResponse
- __lnurl__: _string_
- __k1__: _string_
### EncryptionExchangeRequest
- __publicKey__: _string_
- __deviceId__: _string_
### AuthAppRequest
- __name__: _string_
- __allow_user_creation__: _boolean_ *this field is optional
### Application
- __name__: _string_
- __id__: _string_
- __balance__: _number_
- __npub__: _string_
### SetMockAppUserBalanceRequest ### SetMockAppUserBalanceRequest
- __user_identifier__: _string_ - __user_identifier__: _string_
- __amount__: _number_ - __amount__: _number_
### PayAddressResponse
- __txId__: _string_
- __operation_id__: _string_
- __service_fee__: _number_
- __network_fee__: _number_
### UserOperation
- __paidAtUnix__: _number_
- __type__: _[UserOperationType](#UserOperationType)_
- __inbound__: _boolean_
- __amount__: _number_
- __identifier__: _string_
- __operationId__: _string_
- __service_fee__: _number_
- __network_fee__: _number_
- __confirmed__: _boolean_
### PayAppUserInvoiceRequest
- __user_identifier__: _string_
- __invoice__: _string_
- __amount__: _number_
### NewAddressRequest
- __addressType__: _[AddressType](#AddressType)_
## 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

@ -51,7 +51,6 @@ message AppMetrics {
int64 total_huge_users = 10; int64 total_huge_users = 10;
int64 unpaid_invoices = 11; int64 unpaid_invoices = 11;
int64 unpaid_addresses = 12;
repeated UserOperation operations = 100; repeated UserOperation operations = 100;
} }

View file

@ -52,7 +52,6 @@ export default class Handler {
let totalBigUsers = 0 let totalBigUsers = 0
let totalHugeUsers = 0 let totalHugeUsers = 0
let unpaidInvoices = 0 let unpaidInvoices = 0
let paidAddresses = 0
const operations: Types.UserOperation[] = [] const operations: Types.UserOperation[] = []
receivingInvoices.forEach(i => { receivingInvoices.forEach(i => {
if (i.paid_at_unix > 0) { if (i.paid_at_unix > 0) {
@ -63,16 +62,12 @@ export default class Handler {
} }
}) })
receivingTransactions.forEach(txs => { receivingTransactions.forEach(txs => {
if (txs.length > 0) {
paidAddresses++
} else {
txs.forEach(tx => { txs.forEach(tx => {
operations.push({ type: Types.UserOperationType.INCOMING_TX, amount: tx.paid_amount, inbound: true, paidAtUnix: tx.paid_at_unix, confirmed: tx.confs > 1, service_fee: tx.service_fee, network_fee: 0, identifier: "", operationId: "" }) operations.push({ type: Types.UserOperationType.INCOMING_TX, amount: tx.paid_amount, inbound: true, paidAtUnix: tx.paid_at_unix, confirmed: tx.confs > 1, service_fee: tx.service_fee, network_fee: 0, identifier: "", operationId: "" })
if (tx.confs > 1) { if (tx.confs > 1) {
totalReceived += tx.paid_amount totalReceived += tx.paid_amount
} }
}) })
}
}) })
outgoingInvoices.forEach(i => { outgoingInvoices.forEach(i => {
operations.push({ type: Types.UserOperationType.OUTGOING_INVOICE, amount: i.paid_amount, inbound: false, paidAtUnix: i.paid_at_unix, confirmed: true, service_fee: i.service_fees, network_fee: i.routing_fees, identifier: "", operationId: "" }) operations.push({ type: Types.UserOperationType.OUTGOING_INVOICE, amount: i.paid_amount, inbound: false, paidAtUnix: i.paid_at_unix, confirmed: true, service_fee: i.service_fees, network_fee: i.routing_fees, identifier: "", operationId: "" })
@ -113,7 +108,6 @@ export default class Handler {
total_huge_users: totalHugeUsers, total_huge_users: totalHugeUsers,
unpaid_invoices: unpaidInvoices, unpaid_invoices: unpaidInvoices,
unpaid_addresses: receivingAddresses.length - paidAddresses,
operations operations
} }