max_withdrawable

This commit is contained in:
boufni95 2023-10-26 19:19:47 +02:00
parent c094d8eed3
commit 960e928cbc
5 changed files with 1936 additions and 1919 deletions

View file

@ -95,9 +95,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
@ -372,26 +372,41 @@ 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
### AddAppRequest
- __name__: _string_
- __allow_user_creation__: _boolean_
### GetAppUserLNURLInfoRequest ### GetAppUserLNURLInfoRequest
- __user_identifier__: _string_ - __user_identifier__: _string_
- __base_url_override__: _string_ - __base_url_override__: _string_
### SetMockAppBalanceRequest
- __amount__: _number_
### PayAddressResponse
- __txId__: _string_
### DecodeInvoiceRequest ### DecodeInvoiceRequest
- __invoice__: _string_ - __invoice__: _string_
### DecodeInvoiceResponse
- __amount__: _number_
### LnurlPayInfoResponse
- __tag__: _string_
- __callback__: _string_
- __maxSendable__: _number_
- __minSendable__: _number_
- __metadata__: _string_
### AddProductRequest
- __name__: _string_
- __price_sats__: _number_
### EncryptionExchangeRequest
- __publicKey__: _string_
- __deviceId__: _string_
### LndGetInfoRequest
- __nodeId__: _number_
### OpenChannelResponse ### OpenChannelResponse
- __channelId__: _string_ - __channelId__: _string_
### UserInfo
- __userId__: _string_
- __balance__: _number_
### GetUserOperationsResponse ### GetUserOperationsResponse
- __latestOutgoingInvoiceOperations__: _[UserOperations](#UserOperations)_ - __latestOutgoingInvoiceOperations__: _[UserOperations](#UserOperations)_
- __latestIncomingInvoiceOperations__: _[UserOperations](#UserOperations)_ - __latestIncomingInvoiceOperations__: _[UserOperations](#UserOperations)_
@ -400,33 +415,84 @@ 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)_
### Product ### Application
- __name__: _string_
- __id__: _string_ - __id__: _string_
- __name__: _string_ - __balance__: _number_
- __price_sats__: _number_ - __npub__: _string_
### Empty ### PayAppUserInvoiceRequest
- __user_identifier__: _string_
- __invoice__: _string_
- __amount__: _number_
### AuthAppRequest ### NewInvoiceResponse
- __name__: _string_ - __invoice__: _string_
- __allow_user_creation__: _boolean_ *this field is optional
### LnurlLinkResponse
- __lnurl__: _string_
- __k1__: _string_
### UserInfo
- __userId__: _string_
- __balance__: _number_
- __max_withdrawable__: _number_
### SendAppUserToAppUserPaymentRequest
- __from_user_identifier__: _string_
- __to_user_identifier__: _string_
- __amount__: _number_
### SetMockAppBalanceRequest
- __amount__: _number_
### NewAddressResponse
- __address__: _string_
### PayAddressResponse
- __txId__: _string_
### PayInvoiceRequest
- __invoice__: _string_
- __amount__: _number_
### LiveUserOperation
- __id__: _string_
- __operation__: _[UserOperation](#UserOperation)_
### PayAppUserInvoiceResponse
- __preimage__: _string_
- __amount_paid__: _number_
### SetMockAppUserBalanceRequest
- __user_identifier__: _string_
- __amount__: _number_
### AddAppInvoiceRequest ### AddAppInvoiceRequest
- __payer_identifier__: _string_ - __payer_identifier__: _string_
- __http_callback_url__: _string_ - __http_callback_url__: _string_
- __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_ - __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_
### PayAppUserInvoiceResponse ### LnurlWithdrawInfoResponse
- __preimage__: _string_ - __tag__: _string_
- __amount_paid__: _number_ - __callback__: _string_
- __k1__: _string_
### NewAddressRequest - __defaultDescription__: _string_
- __addressType__: _[AddressType](#AddressType)_ - __minWithdrawable__: _number_
- __maxWithdrawable__: _number_
- __balanceCheck__: _string_
- __payLink__: _string_
### PayInvoiceResponse ### PayInvoiceResponse
- __preimage__: _string_ - __preimage__: _string_
- __amount_paid__: _number_ - __amount_paid__: _number_
### OpenChannelRequest
- __destination__: _string_
- __fundingAmount__: _number_
- __pushAmount__: _number_
- __closeAddress__: _string_
### UserOperation ### UserOperation
- __paidAtUnix__: _number_ - __paidAtUnix__: _number_
- __type__: _[UserOperationType](#UserOperationType)_ - __type__: _[UserOperationType](#UserOperationType)_
@ -439,24 +505,39 @@ The nostr server will send back a message response, and inside the body there wi
- __toIndex__: _number_ - __toIndex__: _number_
- __operations__: ARRAY of: _[UserOperation](#UserOperation)_ - __operations__: ARRAY of: _[UserOperation](#UserOperation)_
### SetMockAppUserBalanceRequest ### Product
- __id__: _string_
- __name__: _string_
- __price_sats__: _number_
### GetProductBuyLinkResponse
- __link__: _string_
### Empty
### NewAddressRequest
- __addressType__: _[AddressType](#AddressType)_
### AuthApp
- __app__: _[Application](#Application)_
- __auth_token__: _string_
### GetAppUserRequest
- __user_identifier__: _string_ - __user_identifier__: _string_
### SendAppUserToAppPaymentRequest
- __from_user_identifier__: _string_
- __amount__: _number_ - __amount__: _number_
### PayAddressRequest
- __address__: _string_
- __amoutSats__: _number_
- __satsPerVByte__: _number_
### NewInvoiceRequest ### NewInvoiceRequest
- __amountSats__: _number_ - __amountSats__: _number_
- __memo__: _string_ - __memo__: _string_
### OpenChannelRequest
- __destination__: _string_
- __fundingAmount__: _number_
- __pushAmount__: _number_
- __closeAddress__: _string_
### HandleLnurlPayResponse
- __pr__: _string_
- __routes__: ARRAY of: _[Empty](#Empty)_
### GetUserOperationsRequest ### GetUserOperationsRequest
- __latestIncomingInvoice__: _number_ - __latestIncomingInvoice__: _number_
- __latestOutgoingInvoice__: _number_ - __latestOutgoingInvoice__: _number_
@ -465,9 +546,12 @@ The nostr server will send back a message response, and inside the body there wi
- __latestIncomingUserToUserPayment__: _number_ - __latestIncomingUserToUserPayment__: _number_
- __latestOutgoingUserToUserPayment__: _number_ - __latestOutgoingUserToUserPayment__: _number_
### AddAppRequest ### SetMockInvoiceAsPaidRequest
- __name__: _string_ - __invoice__: _string_
- __allow_user_creation__: _boolean_ - __amount__: _number_
### LndGetInfoResponse
- __alias__: _string_
### AppUser ### AppUser
- __identifier__: _string_ - __identifier__: _string_
@ -480,101 +564,18 @@ The nostr server will send back a message response, and inside the body there wi
- __http_callback_url__: _string_ - __http_callback_url__: _string_
- __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_ - __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_
### NewAddressResponse ### HandleLnurlPayResponse
- __address__: _string_ - __pr__: _string_
- __routes__: ARRAY of: _[Empty](#Empty)_
### PayInvoiceRequest ### AuthAppRequest
- __invoice__: _string_
- __amount__: _number_
### GetProductBuyLinkResponse
- __link__: _string_
### LndGetInfoRequest
- __nodeId__: _number_
### SetMockInvoiceAsPaidRequest
- __invoice__: _string_
- __amount__: _number_
### Application
- __name__: _string_ - __name__: _string_
- __id__: _string_ - __allow_user_creation__: _boolean_ *this field is optional
- __balance__: _number_
- __npub__: _string_
### SendAppUserToAppPaymentRequest
- __from_user_identifier__: _string_
- __amount__: _number_
### LnurlPayInfoResponse
- __tag__: _string_
- __callback__: _string_
- __maxSendable__: _number_
- __minSendable__: _number_
- __metadata__: _string_
### LndGetInfoResponse
- __alias__: _string_
### AddAppUserRequest ### AddAppUserRequest
- __identifier__: _string_ - __identifier__: _string_
- __fail_if_exists__: _boolean_ - __fail_if_exists__: _boolean_
- __balance__: _number_ - __balance__: _number_
### SendAppUserToAppUserPaymentRequest
- __from_user_identifier__: _string_
- __to_user_identifier__: _string_
- __amount__: _number_
### PayAddressRequest
- __address__: _string_
- __amoutSats__: _number_
- __satsPerVByte__: _number_
### NewInvoiceResponse
- __invoice__: _string_
### LnurlLinkResponse
- __lnurl__: _string_
- __k1__: _string_
### LnurlWithdrawInfoResponse
- __tag__: _string_
- __callback__: _string_
- __k1__: _string_
- __defaultDescription__: _string_
- __minWithdrawable__: _number_
- __maxWithdrawable__: _number_
- __balanceCheck__: _string_
- __payLink__: _string_
### LiveUserOperation
- __id__: _string_
- __operation__: _[UserOperation](#UserOperation)_
### EncryptionExchangeRequest
- __publicKey__: _string_
- __deviceId__: _string_
### AuthApp
- __app__: _[Application](#Application)_
- __auth_token__: _string_
### GetAppUserRequest
- __user_identifier__: _string_
### PayAppUserInvoiceRequest
- __user_identifier__: _string_
- __invoice__: _string_
- __amount__: _number_
### DecodeInvoiceResponse
- __amount__: _number_
### AddProductRequest
- __name__: _string_
- __price_sats__: _number_
## 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

@ -200,6 +200,7 @@ message HandleLnurlPayResponse {
message UserInfo{ message UserInfo{
string userId = 1; string userId = 1;
int64 balance = 2; int64 balance = 2;
int64 max_withdrawable = 3;
} }
message GetUserOperationsRequest{ message GetUserOperationsRequest{

View file

@ -34,7 +34,8 @@ export default class {
const user = await this.storage.userStorage.GetUser(ctx.user_id) const user = await this.storage.userStorage.GetUser(ctx.user_id)
return { return {
userId: ctx.user_id, userId: ctx.user_id,
balance: user.balance_sats balance: user.balance_sats,
max_withdrawable: this.applicationManager.paymentManager.GetMaxPayableInvoice(user.balance_sats, true)
} }
} }