diff --git a/proto/autogenerated/client.md b/proto/autogenerated/client.md index befa4843..6010da82 100644 --- a/proto/autogenerated/client.md +++ b/proto/autogenerated/client.md @@ -90,6 +90,11 @@ The nostr server will send back a message response, and inside the body there wi - This methods has an __empty__ __request__ body - output: [MigrationUpdate](#MigrationUpdate) +- BatchUser + - auth type: __User__ + - This methods has an __empty__ __request__ body + - This methods has an __empty__ __response__ body + # HTTP API DEFINITION ## Supported HTTP Auths @@ -390,54 +395,58 @@ The nostr server will send back a message response, and inside the body there wi - This methods has an __empty__ __request__ body - output: [MigrationUpdate](#MigrationUpdate) +- BatchUser + - auth type: __User__ + - http method: __post__ + - http route: __/api/user/batch__ + - This methods has an __empty__ __request__ body + - This methods has an __empty__ __response__ body + # INPUTS AND OUTPUTS ## Messages ### The content of requests and response from the methods -### PayAddressResponse - - __txId__: _string_ - - __operation_id__: _string_ - - __service_fee__: _number_ - - __network_fee__: _number_ - -### NewInvoiceRequest - - __amountSats__: _number_ - - __memo__: _string_ - -### UserOperations - - __fromIndex__: _number_ - - __toIndex__: _number_ - - __operations__: ARRAY of: _[UserOperation](#UserOperation)_ - -### AddProductRequest - - __name__: _string_ - - __price_sats__: _number_ - -### EncryptionExchangeRequest - - __publicKey__: _string_ - - __deviceId__: _string_ - -### AddAppInvoiceRequest - - __payer_identifier__: _string_ - - __http_callback_url__: _string_ - - __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_ - -### PayAppUserInvoiceRequest +### GetAppUserLNURLInfoRequest - __user_identifier__: _string_ + - __base_url_override__: _string_ + +### PayInvoiceRequest - __invoice__: _string_ - __amount__: _number_ -### NewAddressResponse +### HandleLnurlPayResponse + - __pr__: _string_ + - __routes__: ARRAY of: _[Empty](#Empty)_ + +### Product + - __id__: _string_ + - __name__: _string_ + - __price_sats__: _number_ + +### RelaysMigration + - __relays__: ARRAY of: _string_ + +### AppUser + - __identifier__: _string_ + - __info__: _[UserInfo](#UserInfo)_ + - __max_withdrawable__: _number_ + +### NewAddressRequest + - __addressType__: _[AddressType](#AddressType)_ + +### PayAddressRequest - __address__: _string_ + - __amoutSats__: _number_ + - __satsPerVByte__: _number_ + +### DecodeInvoiceRequest + - __invoice__: _string_ ### LnurlLinkResponse - __lnurl__: _string_ - __k1__: _string_ -### ClosureMigration - - __closes_at_unix__: _number_ - ### UserOperation - __paidAtUnix__: _number_ - __type__: _[UserOperationType](#UserOperationType)_ @@ -449,88 +458,34 @@ The nostr server will send back a message response, and inside the body there wi - __network_fee__: _number_ - __confirmed__: _boolean_ -### GetProductBuyLinkResponse - - __link__: _string_ - -### Empty +### EncryptionExchangeRequest + - __publicKey__: _string_ + - __deviceId__: _string_ ### AuthAppRequest - __name__: _string_ - __allow_user_creation__: _boolean_ *this field is optional -### AuthApp - - __app__: _[Application](#Application)_ - - __auth_token__: _string_ +### NewInvoiceRequest + - __amountSats__: _number_ + - __memo__: _string_ -### AppUser - - __identifier__: _string_ - - __info__: _[UserInfo](#UserInfo)_ - - __max_withdrawable__: _number_ +### GetProductBuyLinkResponse + - __link__: _string_ -### SendAppUserToAppPaymentRequest - - __from_user_identifier__: _string_ - - __amount__: _number_ +### LndGetInfoResponse + - __alias__: _string_ -### SetMockAppUserBalanceRequest +### GetAppUserRequest - __user_identifier__: _string_ - - __amount__: _number_ -### RelaysMigration - - __relays__: ARRAY of: _string_ - -### Application - - __name__: _string_ - - __id__: _string_ - - __balance__: _number_ - - __npub__: _string_ - -### GetAppUserLNURLInfoRequest - - __user_identifier__: _string_ - - __base_url_override__: _string_ - -### SetMockAppBalanceRequest - - __amount__: _number_ - -### PayInvoiceResponse - - __preimage__: _string_ - - __amount_paid__: _number_ - - __operation_id__: _string_ - - __service_fee__: _number_ - - __network_fee__: _number_ - -### OpenChannelResponse - - __channelId__: _string_ - -### LnurlPayInfoResponse - - __tag__: _string_ - - __callback__: _string_ - - __maxSendable__: _number_ - - __minSendable__: _number_ - - __metadata__: _string_ - - __allowsNostr__: _boolean_ - - __nostrPubkey__: _string_ - -### AddAppRequest - - __name__: _string_ - - __allow_user_creation__: _boolean_ - -### AddAppUserRequest - - __identifier__: _string_ - - __fail_if_exists__: _boolean_ - - __balance__: _number_ - -### NewAddressRequest - - __addressType__: _[AddressType](#AddressType)_ - -### PayInvoiceRequest +### NewInvoiceResponse - __invoice__: _string_ - - __amount__: _number_ -### OpenChannelRequest - - __destination__: _string_ - - __fundingAmount__: _number_ - - __pushAmount__: _number_ - - __closeAddress__: _string_ +### UserInfo + - __userId__: _string_ + - __balance__: _number_ + - __max_withdrawable__: _number_ ### GetUserOperationsRequest - __latestIncomingInvoice__: _number_ @@ -540,14 +495,9 @@ The nostr server will send back a message response, and inside the body there wi - __latestIncomingUserToUserPayment__: _number_ - __latestOutgoingUserToUserPayment__: _number_ -### Product - - __id__: _string_ - - __name__: _string_ - - __price_sats__: _number_ - -### SetMockInvoiceAsPaidRequest - - __invoice__: _string_ - - __amount__: _number_ +### MigrationUpdate + - __closure__: _[ClosureMigration](#ClosureMigration)_ *this field is optional + - __relays__: _[RelaysMigration](#RelaysMigration)_ *this field is optional ### AddAppUserInvoiceRequest - __receiver_identifier__: _string_ @@ -555,24 +505,26 @@ The nostr server will send back a message response, and inside the body there wi - __http_callback_url__: _string_ - __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_ -### SendAppUserToAppUserPaymentRequest - - __from_user_identifier__: _string_ - - __to_user_identifier__: _string_ +### PayAppUserInvoiceRequest + - __user_identifier__: _string_ + - __invoice__: _string_ - __amount__: _number_ -### DecodeInvoiceRequest - - __invoice__: _string_ - -### DecodeInvoiceResponse +### SetMockAppUserBalanceRequest + - __user_identifier__: _string_ - __amount__: _number_ -### UserInfo - - __userId__: _string_ - - __balance__: _number_ - - __max_withdrawable__: _number_ +### NewAddressResponse + - __address__: _string_ -### NewInvoiceResponse - - __invoice__: _string_ +### PayAddressResponse + - __txId__: _string_ + - __operation_id__: _string_ + - __service_fee__: _number_ + - __network_fee__: _number_ + +### OpenChannelResponse + - __channelId__: _string_ ### LnurlWithdrawInfoResponse - __tag__: _string_ @@ -584,27 +536,84 @@ The nostr server will send back a message response, and inside the body there wi - __balanceCheck__: _string_ - __payLink__: _string_ -### HandleLnurlPayResponse - - __pr__: _string_ - - __routes__: ARRAY of: _[Empty](#Empty)_ +### UserOperations + - __fromIndex__: _number_ + - __toIndex__: _number_ + - __operations__: ARRAY of: _[UserOperation](#UserOperation)_ -### MigrationUpdate - - __closure__: _[ClosureMigration](#ClosureMigration)_ *this field is optional - - __relays__: _[RelaysMigration](#RelaysMigration)_ *this field is optional +### AuthApp + - __app__: _[Application](#Application)_ + - __auth_token__: _string_ + +### Application + - __name__: _string_ + - __id__: _string_ + - __balance__: _number_ + - __npub__: _string_ + +### AddAppUserRequest + - __identifier__: _string_ + - __fail_if_exists__: _boolean_ + - __balance__: _number_ + +### OpenChannelRequest + - __destination__: _string_ + - __fundingAmount__: _number_ + - __pushAmount__: _number_ + - __closeAddress__: _string_ + +### Empty + +### SetMockInvoiceAsPaidRequest + - __invoice__: _string_ + - __amount__: _number_ + +### AddAppRequest + - __name__: _string_ + - __allow_user_creation__: _boolean_ + +### AddAppInvoiceRequest + - __payer_identifier__: _string_ + - __http_callback_url__: _string_ + - __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_ + +### SendAppUserToAppUserPaymentRequest + - __from_user_identifier__: _string_ + - __to_user_identifier__: _string_ + - __amount__: _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_ ### LndGetInfoRequest - __nodeId__: _number_ -### LndGetInfoResponse - - __alias__: _string_ +### LiveUserOperation + - __operation__: _[UserOperation](#UserOperation)_ -### GetAppUserRequest - - __user_identifier__: _string_ +### DecodeInvoiceResponse + - __amount__: _number_ -### PayAddressRequest - - __address__: _string_ - - __amoutSats__: _number_ - - __satsPerVByte__: _number_ +### PayInvoiceResponse + - __preimage__: _string_ + - __amount_paid__: _number_ + - __operation_id__: _string_ + - __service_fee__: _number_ + - __network_fee__: _number_ ### GetUserOperationsResponse - __latestOutgoingInvoiceOperations__: _[UserOperations](#UserOperations)_ @@ -614,8 +623,11 @@ The nostr server will send back a message response, and inside the body there wi - __latestOutgoingUserToUserPayemnts__: _[UserOperations](#UserOperations)_ - __latestIncomingUserToUserPayemnts__: _[UserOperations](#UserOperations)_ -### LiveUserOperation - - __operation__: _[UserOperation](#UserOperation)_ +### ClosureMigration + - __closes_at_unix__: _number_ + +### SetMockAppBalanceRequest + - __amount__: _number_ ## Enums ### The enumerators used in the messages diff --git a/proto/autogenerated/debug.txt b/proto/autogenerated/debug.txt index 5b05b0f4..db723d76 100644 --- a/proto/autogenerated/debug.txt +++ b/proto/autogenerated/debug.txt @@ -1,5 +1,5 @@ -([]*main.Method) (len=37 cap=64) { - (*main.Method)(0xc0002ca4b0)({ +([]*main.Method) (len=38 cap=64) { + (*main.Method)(0xc0002ca730)({ in: (main.MethodMessage) { name: (string) (len=17) "LndGetInfoRequest", hasZeroFields: (bool) false @@ -9,11 +9,10 @@ name: (string) (len=18) "LndGetInfoResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00006c3c0)({ - authType: (*main.supportedAuth)(0xc0001b0990)({ + opts: (*main.methodOptions)(0xc00006c480)({ + authType: (*main.supportedAuth)(0xc000370930)({ id: (string) (len=5) "admin", name: (string) (len=5) "Admin", - encrypted: (bool) false, context: (map[string]string) (len=1) { (string) (len=8) "admin_id": (string) (len=6) "string" } @@ -24,11 +23,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002ca730)({ + (*main.Method)(0xc0002ca8c0)({ in: (main.MethodMessage) { name: (string) (len=13) "AddAppRequest", hasZeroFields: (bool) false @@ -38,11 +38,10 @@ name: (string) (len=7) "AuthApp", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00006c540)({ - authType: (*main.supportedAuth)(0xc0001b0a20)({ + opts: (*main.methodOptions)(0xc00006c600)({ + authType: (*main.supportedAuth)(0xc0003709c0)({ id: (string) (len=5) "admin", name: (string) (len=5) "Admin", - encrypted: (bool) false, context: (map[string]string) (len=1) { (string) (len=8) "admin_id": (string) (len=6) "string" } @@ -53,11 +52,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002ca8c0)({ + (*main.Method)(0xc0002ca960)({ in: (main.MethodMessage) { name: (string) (len=14) "AuthAppRequest", hasZeroFields: (bool) false @@ -67,11 +67,10 @@ name: (string) (len=7) "AuthApp", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00006c6c0)({ - authType: (*main.supportedAuth)(0xc0001b0ab0)({ + opts: (*main.methodOptions)(0xc00006c780)({ + authType: (*main.supportedAuth)(0xc000370a50)({ id: (string) (len=5) "admin", name: (string) (len=5) "Admin", - encrypted: (bool) false, context: (map[string]string) (len=1) { (string) (len=8) "admin_id": (string) (len=6) "string" } @@ -82,11 +81,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002ca910)({ + (*main.Method)(0xc0002ca9b0)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -96,11 +96,10 @@ name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc00006c840)({ - authType: (*main.supportedAuth)(0xc0001b0b40)({ + opts: (*main.methodOptions)(0xc00006c900)({ + authType: (*main.supportedAuth)(0xc000370ae0)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", - encrypted: (bool) false, context: (map[string]string) { } }), @@ -110,11 +109,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002ca960)({ + (*main.Method)(0xc0002caa00)({ in: (main.MethodMessage) { name: (string) (len=25) "EncryptionExchangeRequest", hasZeroFields: (bool) false @@ -124,11 +124,10 @@ name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc00006c9c0)({ - authType: (*main.supportedAuth)(0xc0001b0c00)({ + opts: (*main.methodOptions)(0xc00006ca80)({ + authType: (*main.supportedAuth)(0xc000370ba0)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", - encrypted: (bool) false, context: (map[string]string) { } }), @@ -138,11 +137,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002ca9b0)({ + (*main.Method)(0xc0002caa50)({ in: (main.MethodMessage) { name: (string) (len=27) "SetMockInvoiceAsPaidRequest", hasZeroFields: (bool) false @@ -152,11 +152,10 @@ name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc00006cba0)({ - authType: (*main.supportedAuth)(0xc0001b0c90)({ + opts: (*main.methodOptions)(0xc00006cc60)({ + authType: (*main.supportedAuth)(0xc000370c30)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", - encrypted: (bool) false, context: (map[string]string) { } }), @@ -166,11 +165,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002caa50)({ + (*main.Method)(0xc0002caaf0)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -180,11 +180,10 @@ name: (string) (len=25) "LnurlWithdrawInfoResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00006cf00)({ - authType: (*main.supportedAuth)(0xc0001b0de0)({ + opts: (*main.methodOptions)(0xc00006cfc0)({ + authType: (*main.supportedAuth)(0xc000370d80)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", - encrypted: (bool) false, context: (map[string]string) { } }), @@ -196,11 +195,12 @@ query: ([]string) (len=1 cap=1) { (string) (len=2) "k1" }, - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002caaf0)({ + (*main.Method)(0xc0002cab90)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -210,11 +210,10 @@ name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc00006d260)({ - authType: (*main.supportedAuth)(0xc0001b0f30)({ + opts: (*main.methodOptions)(0xc00006d320)({ + authType: (*main.supportedAuth)(0xc000370ed0)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", - encrypted: (bool) false, context: (map[string]string) { } }), @@ -227,11 +226,12 @@ (string) (len=2) "k1", (string) (len=2) "pr" }, - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cab90)({ + (*main.Method)(0xc0002cac30)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -241,11 +241,10 @@ name: (string) (len=20) "LnurlPayInfoResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00006d5c0)({ - authType: (*main.supportedAuth)(0xc0001b1050)({ + opts: (*main.methodOptions)(0xc00006d680)({ + authType: (*main.supportedAuth)(0xc000370ff0)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", - encrypted: (bool) false, context: (map[string]string) { } }), @@ -257,11 +256,12 @@ query: ([]string) (len=1 cap=1) { (string) (len=2) "k1" }, - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cac30)({ + (*main.Method)(0xc0002cacd0)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -271,11 +271,10 @@ name: (string) (len=22) "HandleLnurlPayResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00006d980)({ - authType: (*main.supportedAuth)(0xc0001b11a0)({ + opts: (*main.methodOptions)(0xc00006da40)({ + authType: (*main.supportedAuth)(0xc000371140)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", - encrypted: (bool) false, context: (map[string]string) { } }), @@ -290,11 +289,12 @@ (string) (len=5) "nostr", (string) (len=5) "lnurl" }, - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cac80)({ + (*main.Method)(0xc0002cad20)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -304,11 +304,10 @@ name: (string) (len=20) "LnurlPayInfoResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00006db00)({ - authType: (*main.supportedAuth)(0xc0001b1230)({ + opts: (*main.methodOptions)(0xc00006dbc0)({ + authType: (*main.supportedAuth)(0xc0003711d0)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", - encrypted: (bool) false, context: (map[string]string) { } }), @@ -320,11 +319,12 @@ } }, query: ([]string) , - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cacd0)({ + (*main.Method)(0xc0002cad70)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -334,11 +334,10 @@ name: (string) (len=11) "Application", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00006dc80)({ - authType: (*main.supportedAuth)(0xc0001b12c0)({ + opts: (*main.methodOptions)(0xc00006dd40)({ + authType: (*main.supportedAuth)(0xc000371260)({ id: (string) (len=3) "app", name: (string) (len=3) "App", - encrypted: (bool) false, context: (map[string]string) (len=1) { (string) (len=6) "app_id": (string) (len=6) "string" } @@ -349,11 +348,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cad70)({ + (*main.Method)(0xc0002cae10)({ in: (main.MethodMessage) { name: (string) (len=17) "AddAppUserRequest", hasZeroFields: (bool) false @@ -363,11 +363,10 @@ name: (string) (len=7) "AppUser", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00006de00)({ - authType: (*main.supportedAuth)(0xc0001b1350)({ + opts: (*main.methodOptions)(0xc00006dec0)({ + authType: (*main.supportedAuth)(0xc0003712f0)({ id: (string) (len=3) "app", name: (string) (len=3) "App", - encrypted: (bool) false, context: (map[string]string) (len=1) { (string) (len=6) "app_id": (string) (len=6) "string" } @@ -378,11 +377,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cae10)({ + (*main.Method)(0xc0002caeb0)({ in: (main.MethodMessage) { name: (string) (len=20) "AddAppInvoiceRequest", hasZeroFields: (bool) false @@ -392,11 +392,10 @@ name: (string) (len=18) "NewInvoiceResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00006df80)({ - authType: (*main.supportedAuth)(0xc0001b13e0)({ + opts: (*main.methodOptions)(0xc00009e4e0)({ + authType: (*main.supportedAuth)(0xc000371380)({ id: (string) (len=3) "app", name: (string) (len=3) "App", - encrypted: (bool) false, context: (map[string]string) (len=1) { (string) (len=6) "app_id": (string) (len=6) "string" } @@ -407,11 +406,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cae60)({ + (*main.Method)(0xc0002caf00)({ in: (main.MethodMessage) { name: (string) (len=24) "AddAppUserInvoiceRequest", hasZeroFields: (bool) false @@ -421,11 +421,10 @@ name: (string) (len=18) "NewInvoiceResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00009c600)({ - authType: (*main.supportedAuth)(0xc0001b1470)({ + opts: (*main.methodOptions)(0xc00009e720)({ + authType: (*main.supportedAuth)(0xc000371410)({ id: (string) (len=3) "app", name: (string) (len=3) "App", - encrypted: (bool) false, context: (map[string]string) (len=1) { (string) (len=6) "app_id": (string) (len=6) "string" } @@ -436,11 +435,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002caf00)({ + (*main.Method)(0xc0002cafa0)({ in: (main.MethodMessage) { name: (string) (len=17) "GetAppUserRequest", hasZeroFields: (bool) false @@ -450,11 +450,10 @@ name: (string) (len=7) "AppUser", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00009c7e0)({ - authType: (*main.supportedAuth)(0xc0001b1500)({ + opts: (*main.methodOptions)(0xc00009e8a0)({ + authType: (*main.supportedAuth)(0xc0003714a0)({ id: (string) (len=3) "app", name: (string) (len=3) "App", - encrypted: (bool) false, context: (map[string]string) (len=1) { (string) (len=6) "app_id": (string) (len=6) "string" } @@ -465,11 +464,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cafa0)({ + (*main.Method)(0xc0002cb040)({ in: (main.MethodMessage) { name: (string) (len=24) "PayAppUserInvoiceRequest", hasZeroFields: (bool) false @@ -479,11 +479,10 @@ name: (string) (len=18) "PayInvoiceResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00009c960)({ - authType: (*main.supportedAuth)(0xc0001b1590)({ + opts: (*main.methodOptions)(0xc00009ea20)({ + authType: (*main.supportedAuth)(0xc000371530)({ id: (string) (len=3) "app", name: (string) (len=3) "App", - encrypted: (bool) false, context: (map[string]string) (len=1) { (string) (len=6) "app_id": (string) (len=6) "string" } @@ -494,11 +493,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002caff0)({ + (*main.Method)(0xc0002cb090)({ in: (main.MethodMessage) { name: (string) (len=34) "SendAppUserToAppUserPaymentRequest", hasZeroFields: (bool) false @@ -508,11 +508,10 @@ name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc00009cb40)({ - authType: (*main.supportedAuth)(0xc0001b1620)({ + opts: (*main.methodOptions)(0xc00009ec00)({ + authType: (*main.supportedAuth)(0xc0003715c0)({ id: (string) (len=3) "app", name: (string) (len=3) "App", - encrypted: (bool) false, context: (map[string]string) (len=1) { (string) (len=6) "app_id": (string) (len=6) "string" } @@ -523,11 +522,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cb090)({ + (*main.Method)(0xc0002cb130)({ in: (main.MethodMessage) { name: (string) (len=30) "SendAppUserToAppPaymentRequest", hasZeroFields: (bool) false @@ -537,11 +537,10 @@ name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc00009ccc0)({ - authType: (*main.supportedAuth)(0xc0001b16b0)({ + opts: (*main.methodOptions)(0xc00009ed80)({ + authType: (*main.supportedAuth)(0xc000371650)({ id: (string) (len=3) "app", name: (string) (len=3) "App", - encrypted: (bool) false, context: (map[string]string) (len=1) { (string) (len=6) "app_id": (string) (len=6) "string" } @@ -552,11 +551,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cb0e0)({ + (*main.Method)(0xc0002cb180)({ in: (main.MethodMessage) { name: (string) (len=26) "GetAppUserLNURLInfoRequest", hasZeroFields: (bool) false @@ -566,11 +566,10 @@ name: (string) (len=20) "LnurlPayInfoResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00009ce40)({ - authType: (*main.supportedAuth)(0xc0001b1740)({ + opts: (*main.methodOptions)(0xc00009ef60)({ + authType: (*main.supportedAuth)(0xc0003716e0)({ id: (string) (len=3) "app", name: (string) (len=3) "App", - encrypted: (bool) false, context: (map[string]string) (len=1) { (string) (len=6) "app_id": (string) (len=6) "string" } @@ -581,11 +580,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cb130)({ + (*main.Method)(0xc0002cb1d0)({ in: (main.MethodMessage) { name: (string) (len=28) "SetMockAppUserBalanceRequest", hasZeroFields: (bool) false @@ -595,11 +595,10 @@ name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc00009d080)({ - authType: (*main.supportedAuth)(0xc0001b17d0)({ + opts: (*main.methodOptions)(0xc00009f140)({ + authType: (*main.supportedAuth)(0xc000371770)({ id: (string) (len=3) "app", name: (string) (len=3) "App", - encrypted: (bool) false, context: (map[string]string) (len=1) { (string) (len=6) "app_id": (string) (len=6) "string" } @@ -610,11 +609,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cb180)({ + (*main.Method)(0xc0002cb220)({ in: (main.MethodMessage) { name: (string) (len=24) "SetMockAppBalanceRequest", hasZeroFields: (bool) false @@ -624,11 +624,10 @@ name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc00009d260)({ - authType: (*main.supportedAuth)(0xc0001b1860)({ + opts: (*main.methodOptions)(0xc00009f320)({ + authType: (*main.supportedAuth)(0xc000371800)({ id: (string) (len=3) "app", name: (string) (len=3) "App", - encrypted: (bool) false, context: (map[string]string) (len=1) { (string) (len=6) "app_id": (string) (len=6) "string" } @@ -639,11 +638,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) false + nostr: (bool) false, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cb1d0)({ + (*main.Method)(0xc0002cb270)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -653,15 +653,14 @@ name: (string) (len=8) "UserInfo", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00009d4a0)({ - authType: (*main.supportedAuth)(0xc0001b1920)({ + opts: (*main.methodOptions)(0xc000382060)({ + authType: (*main.supportedAuth)(0xc0003718c0)({ id: (string) (len=4) "user", name: (string) (len=4) "User", - encrypted: (bool) false, context: (map[string]string) (len=3) { - (string) (len=6) "app_id": (string) (len=6) "string", (string) (len=11) "app_user_id": (string) (len=6) "string", - (string) (len=7) "user_id": (string) (len=6) "string" + (string) (len=7) "user_id": (string) (len=6) "string", + (string) (len=6) "app_id": (string) (len=6) "string" } }), method: (string) (len=4) "post", @@ -670,11 +669,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) true + nostr: (bool) true, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cb270)({ + (*main.Method)(0xc0002cb310)({ in: (main.MethodMessage) { name: (string) (len=17) "AddProductRequest", hasZeroFields: (bool) false @@ -684,11 +684,10 @@ name: (string) (len=7) "Product", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0001d6180)({ - authType: (*main.supportedAuth)(0xc0001b19b0)({ + opts: (*main.methodOptions)(0xc000382240)({ + authType: (*main.supportedAuth)(0xc000371950)({ id: (string) (len=4) "user", name: (string) (len=4) "User", - encrypted: (bool) false, context: (map[string]string) (len=3) { (string) (len=7) "user_id": (string) (len=6) "string", (string) (len=6) "app_id": (string) (len=6) "string", @@ -701,11 +700,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) true + nostr: (bool) true, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cb2c0)({ + (*main.Method)(0xc0002cb360)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -715,15 +715,14 @@ name: (string) (len=18) "NewInvoiceResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0001d6600)({ - authType: (*main.supportedAuth)(0xc0001b1ad0)({ + opts: (*main.methodOptions)(0xc0003826c0)({ + authType: (*main.supportedAuth)(0xc000371a70)({ id: (string) (len=4) "user", name: (string) (len=4) "User", - encrypted: (bool) false, context: (map[string]string) (len=3) { - (string) (len=6) "app_id": (string) (len=6) "string", (string) (len=11) "app_user_id": (string) (len=6) "string", - (string) (len=7) "user_id": (string) (len=6) "string" + (string) (len=7) "user_id": (string) (len=6) "string", + (string) (len=6) "app_id": (string) (len=6) "string" } }), method: (string) (len=3) "get", @@ -734,11 +733,12 @@ query: ([]string) (len=1 cap=1) { (string) (len=2) "id" }, - nostr: (bool) true + nostr: (bool) true, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cb310)({ + (*main.Method)(0xc0002cb3b0)({ in: (main.MethodMessage) { name: (string) (len=24) "GetUserOperationsRequest", hasZeroFields: (bool) false @@ -748,15 +748,14 @@ name: (string) (len=25) "GetUserOperationsResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0001d67e0)({ - authType: (*main.supportedAuth)(0xc0001b1b60)({ + opts: (*main.methodOptions)(0xc0003828a0)({ + authType: (*main.supportedAuth)(0xc000371b00)({ id: (string) (len=4) "user", name: (string) (len=4) "User", - encrypted: (bool) false, context: (map[string]string) (len=3) { + (string) (len=7) "user_id": (string) (len=6) "string", (string) (len=6) "app_id": (string) (len=6) "string", - (string) (len=11) "app_user_id": (string) (len=6) "string", - (string) (len=7) "user_id": (string) (len=6) "string" + (string) (len=11) "app_user_id": (string) (len=6) "string" } }), method: (string) (len=4) "post", @@ -765,11 +764,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) true + nostr: (bool) true, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cb3b0)({ + (*main.Method)(0xc0002cb450)({ in: (main.MethodMessage) { name: (string) (len=17) "NewAddressRequest", hasZeroFields: (bool) false @@ -779,11 +779,10 @@ name: (string) (len=18) "NewAddressResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0001d69c0)({ - authType: (*main.supportedAuth)(0xc0001b1bf0)({ + opts: (*main.methodOptions)(0xc000382a80)({ + authType: (*main.supportedAuth)(0xc000371b90)({ id: (string) (len=4) "user", name: (string) (len=4) "User", - encrypted: (bool) false, context: (map[string]string) (len=3) { (string) (len=7) "user_id": (string) (len=6) "string", (string) (len=6) "app_id": (string) (len=6) "string", @@ -796,11 +795,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) true + nostr: (bool) true, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cb450)({ + (*main.Method)(0xc0002cb4f0)({ in: (main.MethodMessage) { name: (string) (len=17) "PayAddressRequest", hasZeroFields: (bool) false @@ -810,15 +810,14 @@ name: (string) (len=18) "PayAddressResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0001d6ba0)({ - authType: (*main.supportedAuth)(0xc0001b1c80)({ + opts: (*main.methodOptions)(0xc000382c60)({ + authType: (*main.supportedAuth)(0xc000371c20)({ id: (string) (len=4) "user", name: (string) (len=4) "User", - encrypted: (bool) false, context: (map[string]string) (len=3) { - (string) (len=6) "app_id": (string) (len=6) "string", (string) (len=11) "app_user_id": (string) (len=6) "string", - (string) (len=7) "user_id": (string) (len=6) "string" + (string) (len=7) "user_id": (string) (len=6) "string", + (string) (len=6) "app_id": (string) (len=6) "string" } }), method: (string) (len=4) "post", @@ -827,11 +826,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) true + nostr: (bool) true, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cb4f0)({ + (*main.Method)(0xc0002cb590)({ in: (main.MethodMessage) { name: (string) (len=17) "NewInvoiceRequest", hasZeroFields: (bool) false @@ -841,11 +841,10 @@ name: (string) (len=18) "NewInvoiceResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0001d6d80)({ - authType: (*main.supportedAuth)(0xc0001b1d10)({ + opts: (*main.methodOptions)(0xc000382e40)({ + authType: (*main.supportedAuth)(0xc000371cb0)({ id: (string) (len=4) "user", name: (string) (len=4) "User", - encrypted: (bool) false, context: (map[string]string) (len=3) { (string) (len=11) "app_user_id": (string) (len=6) "string", (string) (len=7) "user_id": (string) (len=6) "string", @@ -858,11 +857,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) true + nostr: (bool) true, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cb590)({ + (*main.Method)(0xc0002cb630)({ in: (main.MethodMessage) { name: (string) (len=20) "DecodeInvoiceRequest", hasZeroFields: (bool) false @@ -872,15 +872,14 @@ name: (string) (len=21) "DecodeInvoiceResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0001d6f60)({ - authType: (*main.supportedAuth)(0xc0001b1da0)({ + opts: (*main.methodOptions)(0xc000383020)({ + authType: (*main.supportedAuth)(0xc000371d40)({ id: (string) (len=4) "user", name: (string) (len=4) "User", - encrypted: (bool) false, context: (map[string]string) (len=3) { - (string) (len=11) "app_user_id": (string) (len=6) "string", (string) (len=7) "user_id": (string) (len=6) "string", - (string) (len=6) "app_id": (string) (len=6) "string" + (string) (len=6) "app_id": (string) (len=6) "string", + (string) (len=11) "app_user_id": (string) (len=6) "string" } }), method: (string) (len=4) "post", @@ -889,11 +888,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) true + nostr: (bool) true, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cb630)({ + (*main.Method)(0xc0002cb6d0)({ in: (main.MethodMessage) { name: (string) (len=17) "PayInvoiceRequest", hasZeroFields: (bool) false @@ -903,11 +903,10 @@ name: (string) (len=18) "PayInvoiceResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0001d7140)({ - authType: (*main.supportedAuth)(0xc0001b1e30)({ + opts: (*main.methodOptions)(0xc000383200)({ + authType: (*main.supportedAuth)(0xc000371dd0)({ id: (string) (len=4) "user", name: (string) (len=4) "User", - encrypted: (bool) false, context: (map[string]string) (len=3) { (string) (len=6) "app_id": (string) (len=6) "string", (string) (len=11) "app_user_id": (string) (len=6) "string", @@ -920,11 +919,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) true + nostr: (bool) true, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cb6d0)({ + (*main.Method)(0xc0002cb770)({ in: (main.MethodMessage) { name: (string) (len=18) "OpenChannelRequest", hasZeroFields: (bool) false @@ -934,15 +934,14 @@ name: (string) (len=19) "OpenChannelResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0001d7320)({ - authType: (*main.supportedAuth)(0xc0001b1ec0)({ + opts: (*main.methodOptions)(0xc0003833e0)({ + authType: (*main.supportedAuth)(0xc000371e60)({ id: (string) (len=4) "user", name: (string) (len=4) "User", - encrypted: (bool) false, context: (map[string]string) (len=3) { - (string) (len=11) "app_user_id": (string) (len=6) "string", (string) (len=7) "user_id": (string) (len=6) "string", - (string) (len=6) "app_id": (string) (len=6) "string" + (string) (len=6) "app_id": (string) (len=6) "string", + (string) (len=11) "app_user_id": (string) (len=6) "string" } }), method: (string) (len=4) "post", @@ -951,11 +950,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) true + nostr: (bool) true, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cb770)({ + (*main.Method)(0xc0002cb810)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -965,15 +965,14 @@ name: (string) (len=17) "LnurlLinkResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0001d7500)({ - authType: (*main.supportedAuth)(0xc0001b1f50)({ + opts: (*main.methodOptions)(0xc0003835c0)({ + authType: (*main.supportedAuth)(0xc000371ef0)({ id: (string) (len=4) "user", name: (string) (len=4) "User", - encrypted: (bool) false, context: (map[string]string) (len=3) { + (string) (len=7) "user_id": (string) (len=6) "string", (string) (len=6) "app_id": (string) (len=6) "string", - (string) (len=11) "app_user_id": (string) (len=6) "string", - (string) (len=7) "user_id": (string) (len=6) "string" + (string) (len=11) "app_user_id": (string) (len=6) "string" } }), method: (string) (len=3) "get", @@ -982,11 +981,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) true + nostr: (bool) true, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cb810)({ + (*main.Method)(0xc0002cb8b0)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -996,15 +996,14 @@ name: (string) (len=17) "LnurlLinkResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0001d76e0)({ - authType: (*main.supportedAuth)(0xc0001da000)({ + opts: (*main.methodOptions)(0xc0003837a0)({ + authType: (*main.supportedAuth)(0xc000371f80)({ id: (string) (len=4) "user", name: (string) (len=4) "User", - encrypted: (bool) false, context: (map[string]string) (len=3) { - (string) (len=11) "app_user_id": (string) (len=6) "string", (string) (len=7) "user_id": (string) (len=6) "string", - (string) (len=6) "app_id": (string) (len=6) "string" + (string) (len=6) "app_id": (string) (len=6) "string", + (string) (len=11) "app_user_id": (string) (len=6) "string" } }), method: (string) (len=3) "get", @@ -1013,11 +1012,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) true + nostr: (bool) true, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cb8b0)({ + (*main.Method)(0xc0002cb950)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -1027,15 +1027,14 @@ name: (string) (len=17) "LnurlLinkResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0001d78c0)({ - authType: (*main.supportedAuth)(0xc0001da090)({ + opts: (*main.methodOptions)(0xc000383980)({ + authType: (*main.supportedAuth)(0xc000386030)({ id: (string) (len=4) "user", name: (string) (len=4) "User", - encrypted: (bool) false, context: (map[string]string) (len=3) { - (string) (len=6) "app_id": (string) (len=6) "string", (string) (len=11) "app_user_id": (string) (len=6) "string", - (string) (len=7) "user_id": (string) (len=6) "string" + (string) (len=7) "user_id": (string) (len=6) "string", + (string) (len=6) "app_id": (string) (len=6) "string" } }), method: (string) (len=4) "post", @@ -1044,11 +1043,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) true + nostr: (bool) true, + batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc0002cb950)({ + (*main.Method)(0xc0002cb9f0)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -1058,15 +1058,14 @@ name: (string) (len=17) "LiveUserOperation", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0001d7aa0)({ - authType: (*main.supportedAuth)(0xc0001da120)({ + opts: (*main.methodOptions)(0xc000383b60)({ + authType: (*main.supportedAuth)(0xc0003860c0)({ id: (string) (len=4) "user", name: (string) (len=4) "User", - encrypted: (bool) false, context: (map[string]string) (len=3) { + (string) (len=7) "user_id": (string) (len=6) "string", (string) (len=6) "app_id": (string) (len=6) "string", - (string) (len=11) "app_user_id": (string) (len=6) "string", - (string) (len=7) "user_id": (string) (len=6) "string" + (string) (len=11) "app_user_id": (string) (len=6) "string" } }), method: (string) (len=4) "post", @@ -1075,11 +1074,12 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) true + nostr: (bool) true, + batch: (bool) false }), serverStream: (bool) true }), - (*main.Method)(0xc0002cb9f0)({ + (*main.Method)(0xc0002cba90)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -1089,15 +1089,14 @@ name: (string) (len=15) "MigrationUpdate", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0001d7c80)({ - authType: (*main.supportedAuth)(0xc0001da1b0)({ + opts: (*main.methodOptions)(0xc000383d40)({ + authType: (*main.supportedAuth)(0xc000386150)({ id: (string) (len=4) "user", name: (string) (len=4) "User", - encrypted: (bool) false, context: (map[string]string) (len=3) { + (string) (len=7) "user_id": (string) (len=6) "string", (string) (len=6) "app_id": (string) (len=6) "string", - (string) (len=11) "app_user_id": (string) (len=6) "string", - (string) (len=7) "user_id": (string) (len=6) "string" + (string) (len=11) "app_user_id": (string) (len=6) "string" } }), method: (string) (len=4) "post", @@ -1106,14 +1105,46 @@ params: ([]string) }, query: ([]string) , - nostr: (bool) true + nostr: (bool) true, + batch: (bool) false }), serverStream: (bool) true + }), + (*main.Method)(0xc0002cbae0)({ + in: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + name: (string) (len=9) "BatchUser", + out: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + opts: (*main.methodOptions)(0xc000383f80)({ + authType: (*main.supportedAuth)(0xc000386210)({ + id: (string) (len=4) "user", + name: (string) (len=4) "User", + context: (map[string]string) (len=3) { + (string) (len=7) "user_id": (string) (len=6) "string", + (string) (len=6) "app_id": (string) (len=6) "string", + (string) (len=11) "app_user_id": (string) (len=6) "string" + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=15) "/api/user/batch", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) true, + batch: (bool) true + }), + serverStream: (bool) false }) } ([]*main.Enum) (len=2 cap=2) { - (*main.Enum)(0xc0001b00c0)({ + (*main.Enum)(0xc000370120)({ name: (string) (len=11) "AddressType", values: ([]main.EnumValue) (len=3 cap=4) { (main.EnumValue) { @@ -1130,7 +1161,7 @@ } } }), - (*main.Enum)(0xc0001b0120)({ + (*main.Enum)(0xc000370180)({ name: (string) (len=17) "UserOperationType", values: ([]main.EnumValue) (len=6 cap=8) { (main.EnumValue) { @@ -1162,95 +1193,11 @@ } (map[string]*main.Message) (len=48) { - (string) (len=30) "SendAppUserToAppPaymentRequest": (*main.Message)(0xc00037ac40)({ - fullName: (string) (len=30) "SendAppUserToAppPaymentRequest", - name: (string) (len=30) "SendAppUserToAppPaymentRequest", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00008cf90)({ - name: (string) (len=20) "from_user_identifier", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008d080)({ - name: (string) (len=6) "amount", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=28) "SetMockAppUserBalanceRequest": (*main.Message)(0xc00037acc0)({ - fullName: (string) (len=28) "SetMockAppUserBalanceRequest", - name: (string) (len=28) "SetMockAppUserBalanceRequest", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00008d1a0)({ - name: (string) (len=15) "user_identifier", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008d1d0)({ - name: (string) (len=6) "amount", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=13) "UserOperation": (*main.Message)(0xc00037b300)({ - fullName: (string) (len=13) "UserOperation", - name: (string) (len=13) "UserOperation", - fields: ([]*main.Field) (len=9 cap=16) { - (*main.Field)(0xc0001f8c30)({ - name: (string) (len=10) "paidAtUnix", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f8c60)({ - name: (string) (len=4) "type", - kind: (string) (len=17) "UserOperationType", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) true, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f8c90)({ - name: (string) (len=7) "inbound", - kind: (string) (len=4) "bool", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f8cc0)({ - name: (string) (len=6) "amount", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f94a0)({ + (string) (len=17) "AddAppUserRequest": (*main.Message)(0xc00037aa80)({ + fullName: (string) (len=17) "AddAppUserRequest", + name: (string) (len=17) "AddAppUserRequest", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc00029ec30)({ name: (string) (len=10) "identifier", kind: (string) (len=6) "string", isMap: (bool) false, @@ -1259,50 +1206,59 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc0001f94d0)({ - name: (string) (len=11) "operationId", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f9500)({ - name: (string) (len=11) "service_fee", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f9530)({ - name: (string) (len=11) "network_fee", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f9620)({ - name: (string) (len=9) "confirmed", + (*main.Field)(0xc00029ec60)({ + name: (string) (len=14) "fail_if_exists", kind: (string) (len=4) "bool", isMap: (bool) false, isArray: (bool) false, isEnum: (bool) false, isMessage: (bool) false, isOptional: (bool) false + }), + (*main.Field)(0xc00029ec90)({ + name: (string) (len=7) "balance", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false }) } }), - (string) (len=25) "GetProductBuyLinkResponse": (*main.Message)(0xc00037b480)({ - fullName: (string) (len=25) "GetProductBuyLinkResponse", - name: (string) (len=25) "GetProductBuyLinkResponse", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc0001f9ec0)({ - name: (string) (len=4) "link", + (string) (len=18) "OpenChannelRequest": (*main.Message)(0xc00037b000)({ + fullName: (string) (len=18) "OpenChannelRequest", + name: (string) (len=18) "OpenChannelRequest", + fields: ([]*main.Field) (len=4 cap=4) { + (*main.Field)(0xc00029f530)({ + name: (string) (len=11) "destination", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f560)({ + name: (string) (len=13) "fundingAmount", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f590)({ + name: (string) (len=10) "pushAmount", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f5c0)({ + name: (string) (len=12) "closeAddress", kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, @@ -1317,191 +1273,11 @@ name: (string) (len=5) "Empty", fields: ([]*main.Field) }), - (string) (len=14) "AuthAppRequest": (*main.Message)(0xc00037a9c0)({ - fullName: (string) (len=14) "AuthAppRequest", - name: (string) (len=14) "AuthAppRequest", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00048de00)({ - name: (string) (len=4) "name", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00048de30)({ - name: (string) (len=19) "allow_user_creation", - kind: (string) (len=4) "bool", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) true - }) - } - }), - (string) (len=7) "AuthApp": (*main.Message)(0xc00037aa40)({ - fullName: (string) (len=7) "AuthApp", - name: (string) (len=7) "AuthApp", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00048df20)({ - name: (string) (len=3) "app", - kind: (string) (len=11) "Application", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false - }), - (*main.Field)(0xc00048df50)({ - name: (string) (len=10) "auth_token", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=7) "AppUser": (*main.Message)(0xc00037aac0)({ - fullName: (string) (len=7) "AppUser", - name: (string) (len=7) "AppUser", - fields: ([]*main.Field) (len=3 cap=4) { - (*main.Field)(0xc00008c210)({ - name: (string) (len=10) "identifier", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008c270)({ - name: (string) (len=4) "info", - kind: (string) (len=8) "UserInfo", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false - }), - (*main.Field)(0xc00008c2a0)({ - name: (string) (len=16) "max_withdrawable", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=15) "RelaysMigration": (*main.Message)(0xc00037b580)({ - fullName: (string) (len=15) "RelaysMigration", - name: (string) (len=15) "RelaysMigration", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc0001b0060)({ - name: (string) (len=6) "relays", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) true, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=19) "OpenChannelResponse": (*main.Message)(0xc00037b040)({ - fullName: (string) (len=19) "OpenChannelResponse", - name: (string) (len=19) "OpenChannelResponse", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00008d860)({ - name: (string) (len=9) "channelId", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=20) "LnurlPayInfoResponse": (*main.Message)(0xc00037b180)({ - fullName: (string) (len=20) "LnurlPayInfoResponse", - name: (string) (len=20) "LnurlPayInfoResponse", - fields: ([]*main.Field) (len=7 cap=8) { - (*main.Field)(0xc00008de30)({ - name: (string) (len=3) "tag", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008de60)({ - name: (string) (len=8) "callback", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f8000)({ - name: (string) (len=11) "maxSendable", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f8030)({ - name: (string) (len=11) "minSendable", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f8060)({ - name: (string) (len=8) "metadata", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f8090)({ - name: (string) (len=11) "allowsNostr", - kind: (string) (len=4) "bool", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f8630)({ - name: (string) (len=11) "nostrPubkey", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), (string) (len=11) "Application": (*main.Message)(0xc00037aa00)({ fullName: (string) (len=11) "Application", name: (string) (len=11) "Application", fields: ([]*main.Field) (len=4 cap=4) { - (*main.Field)(0xc00048de60)({ + (*main.Field)(0xc00029eb10)({ name: (string) (len=4) "name", kind: (string) (len=6) "string", isMap: (bool) false, @@ -1510,7 +1286,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00048de90)({ + (*main.Field)(0xc00029eb40)({ name: (string) (len=2) "id", kind: (string) (len=6) "string", isMap: (bool) false, @@ -1519,7 +1295,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00048dec0)({ + (*main.Field)(0xc00029eb70)({ name: (string) (len=7) "balance", kind: (string) (len=5) "int64", isMap: (bool) false, @@ -1528,7 +1304,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00048def0)({ + (*main.Field)(0xc00029eba0)({ name: (string) (len=4) "npub", kind: (string) (len=6) "string", isMap: (bool) false, @@ -1539,143 +1315,11 @@ }) } }), - (string) (len=26) "GetAppUserLNURLInfoRequest": (*main.Message)(0xc00037ac80)({ - fullName: (string) (len=26) "GetAppUserLNURLInfoRequest", - name: (string) (len=26) "GetAppUserLNURLInfoRequest", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00008d140)({ - name: (string) (len=15) "user_identifier", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008d170)({ - name: (string) (len=17) "base_url_override", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=24) "SetMockAppBalanceRequest": (*main.Message)(0xc00037ad00)({ - fullName: (string) (len=24) "SetMockAppBalanceRequest", - name: (string) (len=24) "SetMockAppBalanceRequest", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00008d200)({ - name: (string) (len=6) "amount", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=18) "PayInvoiceResponse": (*main.Message)(0xc00037afc0)({ - fullName: (string) (len=18) "PayInvoiceResponse", - name: (string) (len=18) "PayInvoiceResponse", - fields: ([]*main.Field) (len=5 cap=8) { - (*main.Field)(0xc00008d530)({ - name: (string) (len=8) "preimage", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008d560)({ - name: (string) (len=11) "amount_paid", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008d590)({ - name: (string) (len=12) "operation_id", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008d5c0)({ - name: (string) (len=11) "service_fee", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008d5f0)({ - name: (string) (len=11) "network_fee", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=18) "OpenChannelRequest": (*main.Message)(0xc00037b000)({ - fullName: (string) (len=18) "OpenChannelRequest", - name: (string) (len=18) "OpenChannelRequest", - fields: ([]*main.Field) (len=4 cap=4) { - (*main.Field)(0xc00008d620)({ - name: (string) (len=11) "destination", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008d650)({ - name: (string) (len=13) "fundingAmount", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008d680)({ - name: (string) (len=10) "pushAmount", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008d830)({ - name: (string) (len=12) "closeAddress", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), (string) (len=13) "AddAppRequest": (*main.Message)(0xc00037a980)({ fullName: (string) (len=13) "AddAppRequest", name: (string) (len=13) "AddAppRequest", fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00048dda0)({ + (*main.Field)(0xc00029ea50)({ name: (string) (len=4) "name", kind: (string) (len=6) "string", isMap: (bool) false, @@ -1684,7 +1328,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00048ddd0)({ + (*main.Field)(0xc00029ea80)({ name: (string) (len=19) "allow_user_creation", kind: (string) (len=4) "bool", isMap: (bool) false, @@ -1695,257 +1339,11 @@ }) } }), - (string) (len=17) "AddAppUserRequest": (*main.Message)(0xc00037aa80)({ - fullName: (string) (len=17) "AddAppUserRequest", - name: (string) (len=17) "AddAppUserRequest", + (string) (len=20) "AddAppInvoiceRequest": (*main.Message)(0xc00037ab00)({ + fullName: (string) (len=20) "AddAppInvoiceRequest", + name: (string) (len=20) "AddAppInvoiceRequest", fields: ([]*main.Field) (len=3 cap=4) { - (*main.Field)(0xc00048df80)({ - name: (string) (len=10) "identifier", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00048dfb0)({ - name: (string) (len=14) "fail_if_exists", - kind: (string) (len=4) "bool", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008c1e0)({ - name: (string) (len=7) "balance", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=17) "NewAddressRequest": (*main.Message)(0xc00037ad40)({ - fullName: (string) (len=17) "NewAddressRequest", - name: (string) (len=17) "NewAddressRequest", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00008d230)({ - name: (string) (len=11) "addressType", - kind: (string) (len=11) "AddressType", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) true, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=17) "PayInvoiceRequest": (*main.Message)(0xc00037af40)({ - fullName: (string) (len=17) "PayInvoiceRequest", - name: (string) (len=17) "PayInvoiceRequest", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00008d4d0)({ - name: (string) (len=7) "invoice", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008d500)({ - name: (string) (len=6) "amount", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=21) "DecodeInvoiceResponse": (*main.Message)(0xc00037af00)({ - fullName: (string) (len=21) "DecodeInvoiceResponse", - name: (string) (len=21) "DecodeInvoiceResponse", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00008d4a0)({ - name: (string) (len=6) "amount", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=8) "UserInfo": (*main.Message)(0xc00037b200)({ - fullName: (string) (len=8) "UserInfo", - name: (string) (len=8) "UserInfo", - fields: ([]*main.Field) (len=3 cap=4) { - (*main.Field)(0xc0001f86c0)({ - name: (string) (len=6) "userId", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f87e0)({ - name: (string) (len=7) "balance", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f8810)({ - name: (string) (len=16) "max_withdrawable", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=24) "GetUserOperationsRequest": (*main.Message)(0xc00037b280)({ - fullName: (string) (len=24) "GetUserOperationsRequest", - name: (string) (len=24) "GetUserOperationsRequest", - fields: ([]*main.Field) (len=6 cap=8) { - (*main.Field)(0xc0001f8840)({ - name: (string) (len=21) "latestIncomingInvoice", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f8870)({ - name: (string) (len=21) "latestOutgoingInvoice", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f8a20)({ - name: (string) (len=16) "latestIncomingTx", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f8a50)({ - name: (string) (len=16) "latestOutgoingTx", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f8a80)({ - name: (string) (len=31) "latestIncomingUserToUserPayment", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f8ab0)({ - name: (string) (len=31) "latestOutgoingUserToUserPayment", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=7) "Product": (*main.Message)(0xc00037b440)({ - fullName: (string) (len=7) "Product", - name: (string) (len=7) "Product", - fields: ([]*main.Field) (len=3 cap=4) { - (*main.Field)(0xc0001f9e30)({ - name: (string) (len=2) "id", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f9e60)({ - name: (string) (len=4) "name", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f9e90)({ - name: (string) (len=10) "price_sats", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=27) "SetMockInvoiceAsPaidRequest": (*main.Message)(0xc00037a900)({ - fullName: (string) (len=27) "SetMockInvoiceAsPaidRequest", - name: (string) (len=27) "SetMockInvoiceAsPaidRequest", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00048dd10)({ - name: (string) (len=7) "invoice", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00048dd40)({ - name: (string) (len=6) "amount", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=24) "AddAppUserInvoiceRequest": (*main.Message)(0xc00037ab40)({ - fullName: (string) (len=24) "AddAppUserInvoiceRequest", - name: (string) (len=24) "AddAppUserInvoiceRequest", - fields: ([]*main.Field) (len=4 cap=4) { - (*main.Field)(0xc00008c690)({ - name: (string) (len=19) "receiver_identifier", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008c6c0)({ + (*main.Field)(0xc00029ed50)({ name: (string) (len=16) "payer_identifier", kind: (string) (len=6) "string", isMap: (bool) false, @@ -1954,7 +1352,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00008c750)({ + (*main.Field)(0xc00029ed80)({ name: (string) (len=17) "http_callback_url", kind: (string) (len=6) "string", isMap: (bool) false, @@ -1963,7 +1361,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00008cde0)({ + (*main.Field)(0xc00029edb0)({ name: (string) (len=11) "invoice_req", kind: (string) (len=17) "NewInvoiceRequest", isMap: (bool) false, @@ -1978,7 +1376,7 @@ fullName: (string) (len=34) "SendAppUserToAppUserPaymentRequest", name: (string) (len=34) "SendAppUserToAppUserPaymentRequest", fields: ([]*main.Field) (len=3 cap=4) { - (*main.Field)(0xc00008cf00)({ + (*main.Field)(0xc00029ef60)({ name: (string) (len=20) "from_user_identifier", kind: (string) (len=6) "string", isMap: (bool) false, @@ -1987,7 +1385,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00008cf30)({ + (*main.Field)(0xc00029ef90)({ name: (string) (len=18) "to_user_identifier", kind: (string) (len=6) "string", isMap: (bool) false, @@ -1996,7 +1394,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00008cf60)({ + (*main.Field)(0xc00029efc0)({ name: (string) (len=6) "amount", kind: (string) (len=5) "int64", isMap: (bool) false, @@ -2007,41 +1405,35 @@ }) } }), - (string) (len=20) "DecodeInvoiceRequest": (*main.Message)(0xc00037aec0)({ - fullName: (string) (len=20) "DecodeInvoiceRequest", - name: (string) (len=20) "DecodeInvoiceRequest", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00008d470)({ - name: (string) (len=7) "invoice", + (string) (len=30) "SendAppUserToAppPaymentRequest": (*main.Message)(0xc00037ac40)({ + fullName: (string) (len=30) "SendAppUserToAppPaymentRequest", + name: (string) (len=30) "SendAppUserToAppPaymentRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc00029eff0)({ + name: (string) (len=20) "from_user_identifier", kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, isEnum: (bool) false, isMessage: (bool) false, isOptional: (bool) false + }), + (*main.Field)(0xc00029f020)({ + name: (string) (len=6) "amount", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false }) } }), - (string) (len=18) "NewInvoiceResponse": (*main.Message)(0xc00037ae80)({ - fullName: (string) (len=18) "NewInvoiceResponse", - name: (string) (len=18) "NewInvoiceResponse", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00008d440)({ - name: (string) (len=7) "invoice", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=25) "LnurlWithdrawInfoResponse": (*main.Message)(0xc00037b100)({ - fullName: (string) (len=25) "LnurlWithdrawInfoResponse", - name: (string) (len=25) "LnurlWithdrawInfoResponse", - fields: ([]*main.Field) (len=8 cap=8) { - (*main.Field)(0xc00008d8f0)({ + (string) (len=20) "LnurlPayInfoResponse": (*main.Message)(0xc00037b180)({ + fullName: (string) (len=20) "LnurlPayInfoResponse", + name: (string) (len=20) "LnurlPayInfoResponse", + fields: ([]*main.Field) (len=7 cap=8) { + (*main.Field)(0xc00029f800)({ name: (string) (len=3) "tag", kind: (string) (len=6) "string", isMap: (bool) false, @@ -2050,7 +1442,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00008d920)({ + (*main.Field)(0xc00029f830)({ name: (string) (len=8) "callback", kind: (string) (len=6) "string", isMap: (bool) false, @@ -2059,26 +1451,8 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00008dad0)({ - name: (string) (len=2) "k1", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008db00)({ - name: (string) (len=18) "defaultDescription", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008db30)({ - name: (string) (len=15) "minWithdrawable", + (*main.Field)(0xc00029f860)({ + name: (string) (len=11) "maxSendable", kind: (string) (len=5) "int64", isMap: (bool) false, isArray: (bool) false, @@ -2086,8 +1460,8 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00008db60)({ - name: (string) (len=15) "maxWithdrawable", + (*main.Field)(0xc00029f890)({ + name: (string) (len=11) "minSendable", kind: (string) (len=5) "int64", isMap: (bool) false, isArray: (bool) false, @@ -2095,8 +1469,8 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00008ddd0)({ - name: (string) (len=12) "balanceCheck", + (*main.Field)(0xc00029f8c0)({ + name: (string) (len=8) "metadata", kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, @@ -2104,8 +1478,17 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00008de00)({ - name: (string) (len=7) "payLink", + (*main.Field)(0xc00029f8f0)({ + name: (string) (len=11) "allowsNostr", + kind: (string) (len=4) "bool", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f920)({ + name: (string) (len=11) "nostrPubkey", kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, @@ -2115,11 +1498,269 @@ }) } }), + (string) (len=17) "AddProductRequest": (*main.Message)(0xc00037b400)({ + fullName: (string) (len=17) "AddProductRequest", + name: (string) (len=17) "AddProductRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc00029fec0)({ + name: (string) (len=4) "name", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fef0)({ + name: (string) (len=10) "price_sats", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=17) "LndGetInfoRequest": (*main.Message)(0xc00037a8c0)({ + fullName: (string) (len=17) "LndGetInfoRequest", + name: (string) (len=17) "LndGetInfoRequest", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc00029e990)({ + name: (string) (len=6) "nodeId", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=27) "SetMockInvoiceAsPaidRequest": (*main.Message)(0xc00037a900)({ + fullName: (string) (len=27) "SetMockInvoiceAsPaidRequest", + name: (string) (len=27) "SetMockInvoiceAsPaidRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc00029e9c0)({ + name: (string) (len=7) "invoice", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029e9f0)({ + name: (string) (len=6) "amount", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=17) "LiveUserOperation": (*main.Message)(0xc00037b4c0)({ + fullName: (string) (len=17) "LiveUserOperation", + name: (string) (len=17) "LiveUserOperation", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000370000)({ + name: (string) (len=9) "operation", + kind: (string) (len=13) "UserOperation", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false + }) + } + }), + (string) (len=18) "PayInvoiceResponse": (*main.Message)(0xc00037afc0)({ + fullName: (string) (len=18) "PayInvoiceResponse", + name: (string) (len=18) "PayInvoiceResponse", + fields: ([]*main.Field) (len=5 cap=8) { + (*main.Field)(0xc00029f440)({ + name: (string) (len=8) "preimage", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f470)({ + name: (string) (len=11) "amount_paid", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f4a0)({ + name: (string) (len=12) "operation_id", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f4d0)({ + name: (string) (len=11) "service_fee", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f500)({ + name: (string) (len=11) "network_fee", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=25) "GetUserOperationsResponse": (*main.Message)(0xc00037b3c0)({ + fullName: (string) (len=25) "GetUserOperationsResponse", + name: (string) (len=25) "GetUserOperationsResponse", + fields: ([]*main.Field) (len=6 cap=8) { + (*main.Field)(0xc00029fda0)({ + name: (string) (len=31) "latestOutgoingInvoiceOperations", + kind: (string) (len=14) "UserOperations", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fdd0)({ + name: (string) (len=31) "latestIncomingInvoiceOperations", + kind: (string) (len=14) "UserOperations", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fe00)({ + name: (string) (len=26) "latestOutgoingTxOperations", + kind: (string) (len=14) "UserOperations", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fe30)({ + name: (string) (len=26) "latestIncomingTxOperations", + kind: (string) (len=14) "UserOperations", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fe60)({ + name: (string) (len=32) "latestOutgoingUserToUserPayemnts", + kind: (string) (len=14) "UserOperations", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fe90)({ + name: (string) (len=32) "latestIncomingUserToUserPayemnts", + kind: (string) (len=14) "UserOperations", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false + }) + } + }), + (string) (len=16) "ClosureMigration": (*main.Message)(0xc00037b540)({ + fullName: (string) (len=16) "ClosureMigration", + name: (string) (len=16) "ClosureMigration", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000370090)({ + name: (string) (len=14) "closes_at_unix", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=24) "SetMockAppBalanceRequest": (*main.Message)(0xc00037ad00)({ + fullName: (string) (len=24) "SetMockAppBalanceRequest", + name: (string) (len=24) "SetMockAppBalanceRequest", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc00029f110)({ + name: (string) (len=6) "amount", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=21) "DecodeInvoiceResponse": (*main.Message)(0xc00037af00)({ + fullName: (string) (len=21) "DecodeInvoiceResponse", + name: (string) (len=21) "DecodeInvoiceResponse", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc00029f3b0)({ + name: (string) (len=6) "amount", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=17) "PayInvoiceRequest": (*main.Message)(0xc00037af40)({ + fullName: (string) (len=17) "PayInvoiceRequest", + name: (string) (len=17) "PayInvoiceRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc00029f3e0)({ + name: (string) (len=7) "invoice", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f410)({ + name: (string) (len=6) "amount", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), (string) (len=22) "HandleLnurlPayResponse": (*main.Message)(0xc00037b1c0)({ fullName: (string) (len=22) "HandleLnurlPayResponse", name: (string) (len=22) "HandleLnurlPayResponse", fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc0001f8660)({ + (*main.Field)(0xc00029f950)({ name: (string) (len=2) "pr", kind: (string) (len=6) "string", isMap: (bool) false, @@ -2128,7 +1769,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc0001f8690)({ + (*main.Field)(0xc00029f980)({ name: (string) (len=6) "routes", kind: (string) (len=5) "Empty", isMap: (bool) false, @@ -2139,111 +1780,30 @@ }) } }), - (string) (len=25) "GetUserOperationsResponse": (*main.Message)(0xc00037b3c0)({ - fullName: (string) (len=25) "GetUserOperationsResponse", - name: (string) (len=25) "GetUserOperationsResponse", - fields: ([]*main.Field) (len=6 cap=8) { - (*main.Field)(0xc0001f9860)({ - name: (string) (len=31) "latestOutgoingInvoiceOperations", - kind: (string) (len=14) "UserOperations", + (string) (len=7) "Product": (*main.Message)(0xc00037b440)({ + fullName: (string) (len=7) "Product", + name: (string) (len=7) "Product", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc00029ff20)({ + name: (string) (len=2) "id", + kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, isEnum: (bool) false, - isMessage: (bool) true, + isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc0001f9890)({ - name: (string) (len=31) "latestIncomingInvoiceOperations", - kind: (string) (len=14) "UserOperations", + (*main.Field)(0xc00029ff50)({ + name: (string) (len=4) "name", + kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, isEnum: (bool) false, - isMessage: (bool) true, + isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc0001f98c0)({ - name: (string) (len=26) "latestOutgoingTxOperations", - kind: (string) (len=14) "UserOperations", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f98f0)({ - name: (string) (len=26) "latestIncomingTxOperations", - kind: (string) (len=14) "UserOperations", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f9c50)({ - name: (string) (len=32) "latestOutgoingUserToUserPayemnts", - kind: (string) (len=14) "UserOperations", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f9c80)({ - name: (string) (len=32) "latestIncomingUserToUserPayemnts", - kind: (string) (len=14) "UserOperations", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false - }) - } - }), - (string) (len=17) "LiveUserOperation": (*main.Message)(0xc00037b4c0)({ - fullName: (string) (len=17) "LiveUserOperation", - name: (string) (len=17) "LiveUserOperation", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc0002feab0)({ - name: (string) (len=9) "operation", - kind: (string) (len=13) "UserOperation", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false - }) - } - }), - (string) (len=15) "MigrationUpdate": (*main.Message)(0xc00037b500)({ - fullName: (string) (len=15) "MigrationUpdate", - name: (string) (len=15) "MigrationUpdate", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc0002feae0)({ - name: (string) (len=7) "closure", - kind: (string) (len=16) "ClosureMigration", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) true - }), - (*main.Field)(0xc0001b0000)({ - name: (string) (len=6) "relays", - kind: (string) (len=15) "RelaysMigration", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) true - }) - } - }), - (string) (len=17) "LndGetInfoRequest": (*main.Message)(0xc00037a8c0)({ - fullName: (string) (len=17) "LndGetInfoRequest", - name: (string) (len=17) "LndGetInfoRequest", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00048dce0)({ - name: (string) (len=6) "nodeId", + (*main.Field)(0xc00029ff80)({ + name: (string) (len=10) "price_sats", kind: (string) (len=5) "int64", isMap: (bool) false, isArray: (bool) false, @@ -2253,14 +1813,47 @@ }) } }), - (string) (len=18) "LndGetInfoResponse": (*main.Message)(0xc00037a940)({ - fullName: (string) (len=18) "LndGetInfoResponse", - name: (string) (len=18) "LndGetInfoResponse", + (string) (len=15) "RelaysMigration": (*main.Message)(0xc00037b580)({ + fullName: (string) (len=15) "RelaysMigration", + name: (string) (len=15) "RelaysMigration", fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00048dd70)({ - name: (string) (len=5) "alias", + (*main.Field)(0xc0003700c0)({ + name: (string) (len=6) "relays", kind: (string) (len=6) "string", isMap: (bool) false, + isArray: (bool) true, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=7) "AppUser": (*main.Message)(0xc00037aac0)({ + fullName: (string) (len=7) "AppUser", + name: (string) (len=7) "AppUser", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc00029ecc0)({ + name: (string) (len=10) "identifier", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029ecf0)({ + name: (string) (len=4) "info", + kind: (string) (len=8) "UserInfo", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false + }), + (*main.Field)(0xc00029ed20)({ + name: (string) (len=16) "max_withdrawable", + kind: (string) (len=5) "int64", + isMap: (bool) false, isArray: (bool) false, isEnum: (bool) false, isMessage: (bool) false, @@ -2268,11 +1861,11 @@ }) } }), - (string) (len=17) "GetAppUserRequest": (*main.Message)(0xc00037ab80)({ - fullName: (string) (len=17) "GetAppUserRequest", - name: (string) (len=17) "GetAppUserRequest", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00008ce10)({ + (string) (len=26) "GetAppUserLNURLInfoRequest": (*main.Message)(0xc00037ac80)({ + fullName: (string) (len=26) "GetAppUserLNURLInfoRequest", + name: (string) (len=26) "GetAppUserLNURLInfoRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc00029f050)({ name: (string) (len=15) "user_identifier", kind: (string) (len=6) "string", isMap: (bool) false, @@ -2280,6 +1873,15 @@ isEnum: (bool) false, isMessage: (bool) false, isOptional: (bool) false + }), + (*main.Field)(0xc00029f080)({ + name: (string) (len=17) "base_url_override", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false }) } }), @@ -2287,7 +1889,7 @@ fullName: (string) (len=17) "PayAddressRequest", name: (string) (len=17) "PayAddressRequest", fields: ([]*main.Field) (len=3 cap=4) { - (*main.Field)(0xc00008d290)({ + (*main.Field)(0xc00029f1a0)({ name: (string) (len=7) "address", kind: (string) (len=6) "string", isMap: (bool) false, @@ -2296,7 +1898,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00008d2c0)({ + (*main.Field)(0xc00029f1d0)({ name: (string) (len=9) "amoutSats", kind: (string) (len=5) "int64", isMap: (bool) false, @@ -2305,7 +1907,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00008d2f0)({ + (*main.Field)(0xc00029f200)({ name: (string) (len=12) "satsPerVByte", kind: (string) (len=5) "int64", isMap: (bool) false, @@ -2316,126 +1918,18 @@ }) } }), - (string) (len=18) "PayAddressResponse": (*main.Message)(0xc00037ae00)({ - fullName: (string) (len=18) "PayAddressResponse", - name: (string) (len=18) "PayAddressResponse", - fields: ([]*main.Field) (len=4 cap=4) { - (*main.Field)(0xc00008d320)({ - name: (string) (len=4) "txId", + (string) (len=20) "DecodeInvoiceRequest": (*main.Message)(0xc00037aec0)({ + fullName: (string) (len=20) "DecodeInvoiceRequest", + name: (string) (len=20) "DecodeInvoiceRequest", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc00029f380)({ + name: (string) (len=7) "invoice", kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, isEnum: (bool) false, isMessage: (bool) false, isOptional: (bool) false - }), - (*main.Field)(0xc00008d350)({ - name: (string) (len=12) "operation_id", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008d380)({ - name: (string) (len=11) "service_fee", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008d3b0)({ - name: (string) (len=11) "network_fee", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=17) "NewInvoiceRequest": (*main.Message)(0xc00037ae40)({ - fullName: (string) (len=17) "NewInvoiceRequest", - name: (string) (len=17) "NewInvoiceRequest", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00008d3e0)({ - name: (string) (len=10) "amountSats", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008d410)({ - name: (string) (len=4) "memo", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=14) "UserOperations": (*main.Message)(0xc00037b340)({ - fullName: (string) (len=14) "UserOperations", - name: (string) (len=14) "UserOperations", - fields: ([]*main.Field) (len=3 cap=4) { - (*main.Field)(0xc0001f9650)({ - name: (string) (len=9) "fromIndex", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f9680)({ - name: (string) (len=7) "toIndex", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f96b0)({ - name: (string) (len=10) "operations", - kind: (string) (len=13) "UserOperation", - isMap: (bool) false, - isArray: (bool) true, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false - }) - } - }), - (string) (len=17) "AddProductRequest": (*main.Message)(0xc00037b400)({ - fullName: (string) (len=17) "AddProductRequest", - name: (string) (len=17) "AddProductRequest", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc0001f9cb0)({ - name: (string) (len=4) "name", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc0001f9ce0)({ - name: (string) (len=10) "price_sats", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false }) } }), @@ -2443,7 +1937,7 @@ fullName: (string) (len=17) "LnurlLinkResponse", name: (string) (len=17) "LnurlLinkResponse", fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00008d890)({ + (*main.Field)(0xc00029f620)({ name: (string) (len=5) "lnurl", kind: (string) (len=6) "string", isMap: (bool) false, @@ -2452,7 +1946,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00008d8c0)({ + (*main.Field)(0xc00029f650)({ name: (string) (len=2) "k1", kind: (string) (len=6) "string", isMap: (bool) false, @@ -2463,18 +1957,90 @@ }) } }), - (string) (len=16) "ClosureMigration": (*main.Message)(0xc00037b540)({ - fullName: (string) (len=16) "ClosureMigration", - name: (string) (len=16) "ClosureMigration", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc0001b0030)({ - name: (string) (len=14) "closes_at_unix", + (string) (len=13) "UserOperation": (*main.Message)(0xc00037b300)({ + fullName: (string) (len=13) "UserOperation", + name: (string) (len=13) "UserOperation", + fields: ([]*main.Field) (len=9 cap=16) { + (*main.Field)(0xc00029fb60)({ + name: (string) (len=10) "paidAtUnix", kind: (string) (len=5) "int64", isMap: (bool) false, isArray: (bool) false, isEnum: (bool) false, isMessage: (bool) false, isOptional: (bool) false + }), + (*main.Field)(0xc00029fb90)({ + name: (string) (len=4) "type", + kind: (string) (len=17) "UserOperationType", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) true, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fbc0)({ + name: (string) (len=7) "inbound", + kind: (string) (len=4) "bool", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fbf0)({ + name: (string) (len=6) "amount", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fc20)({ + name: (string) (len=10) "identifier", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fc50)({ + name: (string) (len=11) "operationId", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fc80)({ + name: (string) (len=11) "service_fee", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fcb0)({ + name: (string) (len=11) "network_fee", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fce0)({ + name: (string) (len=9) "confirmed", + kind: (string) (len=4) "bool", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false }) } }), @@ -2482,7 +2048,7 @@ fullName: (string) (len=25) "EncryptionExchangeRequest", name: (string) (len=25) "EncryptionExchangeRequest", fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00048dc80)({ + (*main.Field)(0xc00029e930)({ name: (string) (len=9) "publicKey", kind: (string) (len=6) "string", isMap: (bool) false, @@ -2491,7 +2057,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00048dcb0)({ + (*main.Field)(0xc00029e960)({ name: (string) (len=8) "deviceId", kind: (string) (len=6) "string", isMap: (bool) false, @@ -2502,11 +2068,245 @@ }) } }), - (string) (len=20) "AddAppInvoiceRequest": (*main.Message)(0xc00037ab00)({ - fullName: (string) (len=20) "AddAppInvoiceRequest", - name: (string) (len=20) "AddAppInvoiceRequest", + (string) (len=17) "NewAddressRequest": (*main.Message)(0xc00037ad40)({ + fullName: (string) (len=17) "NewAddressRequest", + name: (string) (len=17) "NewAddressRequest", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc00029f140)({ + name: (string) (len=11) "addressType", + kind: (string) (len=11) "AddressType", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) true, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=17) "NewInvoiceRequest": (*main.Message)(0xc00037ae40)({ + fullName: (string) (len=17) "NewInvoiceRequest", + name: (string) (len=17) "NewInvoiceRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc00029f2f0)({ + name: (string) (len=10) "amountSats", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f320)({ + name: (string) (len=4) "memo", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=25) "GetProductBuyLinkResponse": (*main.Message)(0xc00037b480)({ + fullName: (string) (len=25) "GetProductBuyLinkResponse", + name: (string) (len=25) "GetProductBuyLinkResponse", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc00029ffb0)({ + name: (string) (len=4) "link", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=18) "LndGetInfoResponse": (*main.Message)(0xc00037a940)({ + fullName: (string) (len=18) "LndGetInfoResponse", + name: (string) (len=18) "LndGetInfoResponse", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc00029ea20)({ + name: (string) (len=5) "alias", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=14) "AuthAppRequest": (*main.Message)(0xc00037a9c0)({ + fullName: (string) (len=14) "AuthAppRequest", + name: (string) (len=14) "AuthAppRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc00029eab0)({ + name: (string) (len=4) "name", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029eae0)({ + name: (string) (len=19) "allow_user_creation", + kind: (string) (len=4) "bool", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) true + }) + } + }), + (string) (len=18) "NewInvoiceResponse": (*main.Message)(0xc00037ae80)({ + fullName: (string) (len=18) "NewInvoiceResponse", + name: (string) (len=18) "NewInvoiceResponse", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc00029f350)({ + name: (string) (len=7) "invoice", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=8) "UserInfo": (*main.Message)(0xc00037b200)({ + fullName: (string) (len=8) "UserInfo", + name: (string) (len=8) "UserInfo", fields: ([]*main.Field) (len=3 cap=4) { - (*main.Field)(0xc00008c300)({ + (*main.Field)(0xc00029f9b0)({ + name: (string) (len=6) "userId", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f9e0)({ + name: (string) (len=7) "balance", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fa10)({ + name: (string) (len=16) "max_withdrawable", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=24) "GetUserOperationsRequest": (*main.Message)(0xc00037b280)({ + fullName: (string) (len=24) "GetUserOperationsRequest", + name: (string) (len=24) "GetUserOperationsRequest", + fields: ([]*main.Field) (len=6 cap=8) { + (*main.Field)(0xc00029fa40)({ + name: (string) (len=21) "latestIncomingInvoice", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fa70)({ + name: (string) (len=21) "latestOutgoingInvoice", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029faa0)({ + name: (string) (len=16) "latestIncomingTx", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fad0)({ + name: (string) (len=16) "latestOutgoingTx", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fb00)({ + name: (string) (len=31) "latestIncomingUserToUserPayment", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fb30)({ + name: (string) (len=31) "latestOutgoingUserToUserPayment", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=15) "MigrationUpdate": (*main.Message)(0xc00037b500)({ + fullName: (string) (len=15) "MigrationUpdate", + name: (string) (len=15) "MigrationUpdate", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc000370030)({ + name: (string) (len=7) "closure", + kind: (string) (len=16) "ClosureMigration", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) true + }), + (*main.Field)(0xc000370060)({ + name: (string) (len=6) "relays", + kind: (string) (len=15) "RelaysMigration", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) true + }) + } + }), + (string) (len=24) "AddAppUserInvoiceRequest": (*main.Message)(0xc00037ab40)({ + fullName: (string) (len=24) "AddAppUserInvoiceRequest", + name: (string) (len=24) "AddAppUserInvoiceRequest", + fields: ([]*main.Field) (len=4 cap=4) { + (*main.Field)(0xc00029ede0)({ + name: (string) (len=19) "receiver_identifier", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029ee10)({ name: (string) (len=16) "payer_identifier", kind: (string) (len=6) "string", isMap: (bool) false, @@ -2515,7 +2315,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00008c330)({ + (*main.Field)(0xc00029ee40)({ name: (string) (len=17) "http_callback_url", kind: (string) (len=6) "string", isMap: (bool) false, @@ -2524,7 +2324,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00008c570)({ + (*main.Field)(0xc00029ee70)({ name: (string) (len=11) "invoice_req", kind: (string) (len=17) "NewInvoiceRequest", isMap: (bool) false, @@ -2535,11 +2335,26 @@ }) } }), - (string) (len=24) "PayAppUserInvoiceRequest": (*main.Message)(0xc00037abc0)({ - fullName: (string) (len=24) "PayAppUserInvoiceRequest", - name: (string) (len=24) "PayAppUserInvoiceRequest", - fields: ([]*main.Field) (len=3 cap=4) { - (*main.Field)(0xc00008ce40)({ + (string) (len=17) "GetAppUserRequest": (*main.Message)(0xc00037ab80)({ + fullName: (string) (len=17) "GetAppUserRequest", + name: (string) (len=17) "GetAppUserRequest", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc00029eea0)({ + name: (string) (len=15) "user_identifier", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=28) "SetMockAppUserBalanceRequest": (*main.Message)(0xc00037acc0)({ + fullName: (string) (len=28) "SetMockAppUserBalanceRequest", + name: (string) (len=28) "SetMockAppUserBalanceRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc00029f0b0)({ name: (string) (len=15) "user_identifier", kind: (string) (len=6) "string", isMap: (bool) false, @@ -2548,16 +2363,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00008ce70)({ - name: (string) (len=7) "invoice", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00008ced0)({ + (*main.Field)(0xc00029f0e0)({ name: (string) (len=6) "amount", kind: (string) (len=5) "int64", isMap: (bool) false, @@ -2572,7 +2378,7 @@ fullName: (string) (len=18) "NewAddressResponse", name: (string) (len=18) "NewAddressResponse", fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00008d260)({ + (*main.Field)(0xc00029f170)({ name: (string) (len=7) "address", kind: (string) (len=6) "string", isMap: (bool) false, @@ -2582,10 +2388,235 @@ isOptional: (bool) false }) } + }), + (string) (len=18) "PayAddressResponse": (*main.Message)(0xc00037ae00)({ + fullName: (string) (len=18) "PayAddressResponse", + name: (string) (len=18) "PayAddressResponse", + fields: ([]*main.Field) (len=4 cap=4) { + (*main.Field)(0xc00029f230)({ + name: (string) (len=4) "txId", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f260)({ + name: (string) (len=12) "operation_id", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f290)({ + name: (string) (len=11) "service_fee", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f2c0)({ + name: (string) (len=11) "network_fee", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=19) "OpenChannelResponse": (*main.Message)(0xc00037b040)({ + fullName: (string) (len=19) "OpenChannelResponse", + name: (string) (len=19) "OpenChannelResponse", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc00029f5f0)({ + name: (string) (len=9) "channelId", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=25) "LnurlWithdrawInfoResponse": (*main.Message)(0xc00037b100)({ + fullName: (string) (len=25) "LnurlWithdrawInfoResponse", + name: (string) (len=25) "LnurlWithdrawInfoResponse", + fields: ([]*main.Field) (len=8 cap=8) { + (*main.Field)(0xc00029f680)({ + name: (string) (len=3) "tag", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f6b0)({ + name: (string) (len=8) "callback", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f6e0)({ + name: (string) (len=2) "k1", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f710)({ + name: (string) (len=18) "defaultDescription", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f740)({ + name: (string) (len=15) "minWithdrawable", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f770)({ + name: (string) (len=15) "maxWithdrawable", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f7a0)({ + name: (string) (len=12) "balanceCheck", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029f7d0)({ + name: (string) (len=7) "payLink", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=14) "UserOperations": (*main.Message)(0xc00037b340)({ + fullName: (string) (len=14) "UserOperations", + name: (string) (len=14) "UserOperations", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc00029fd10)({ + name: (string) (len=9) "fromIndex", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fd40)({ + name: (string) (len=7) "toIndex", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029fd70)({ + name: (string) (len=10) "operations", + kind: (string) (len=13) "UserOperation", + isMap: (bool) false, + isArray: (bool) true, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false + }) + } + }), + (string) (len=7) "AuthApp": (*main.Message)(0xc00037aa40)({ + fullName: (string) (len=7) "AuthApp", + name: (string) (len=7) "AuthApp", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc00029ebd0)({ + name: (string) (len=3) "app", + kind: (string) (len=11) "Application", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false + }), + (*main.Field)(0xc00029ec00)({ + name: (string) (len=10) "auth_token", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=24) "PayAppUserInvoiceRequest": (*main.Message)(0xc00037abc0)({ + fullName: (string) (len=24) "PayAppUserInvoiceRequest", + name: (string) (len=24) "PayAppUserInvoiceRequest", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc00029eed0)({ + name: (string) (len=15) "user_identifier", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029ef00)({ + name: (string) (len=7) "invoice", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc00029ef30)({ + name: (string) (len=6) "amount", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } }) } parsing file: structs 48 parsing file: methods 2 --> [{guest Guest false map[]} {user User false map[app_id:string app_user_id:string user_id:string]} {admin Admin false map[admin_id:string]} {app App false map[app_id:string]}] +-> [{guest Guest map[]} {user User map[app_id:string app_user_id:string user_id:string]} {admin Admin map[admin_id:string]} {app App map[app_id:string]}] diff --git a/proto/autogenerated/ts/express_server.ts b/proto/autogenerated/ts/express_server.ts index 08e87ce8..0772f337 100644 --- a/proto/autogenerated/ts/express_server.ts +++ b/proto/autogenerated/ts/express_server.ts @@ -10,15 +10,12 @@ export type ServerOptions = { allowNotImplementedMethods?: true logger?: Logger throwErrors?: true - overrides?: MethodsOverride logMethod?: true logBody?: true GuestAuthGuard: (authorizationHeader?: string) => Promise UserAuthGuard: (authorizationHeader?: string) => Promise AdminAuthGuard: (authorizationHeader?: string) => Promise AppAuthGuard: (authorizationHeader?: string) => Promise - decryptCallback: (encryptionDeviceId: string, body: any) => Promise - encryptCallback: (encryptionDeviceId: string, plain: any) => Promise } const logErrorAndReturnResponse = (error: Error, response: string, res: Response, logger: Logger) => { logger.error(error.message || error); res.json({ status: 'ERROR', reason: response }) } export default (methods: Types.ServerMethods, opts: ServerOptions) => { @@ -30,7 +27,6 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { app.use(json()) app.use(urlencoded({ extended: true })) if (opts.logMethod) app.use((req, _, next) => { console.log(req.method, req.path); if (opts.logBody) console.log(req.body); next() }) - const overrides = opts.overrides || {} as MethodsOverride if (!opts.allowNotImplementedMethods && !methods.LndGetInfo) throw new Error('method: LndGetInfo is not implemented') app.post('/api/admin/lnd/getinfo', async (req, res) => { try { @@ -41,8 +37,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - const response = await methods.LndGetInfo({ ...authContext, ...query, ...params }, request) - if (overrides.LndGetInfo_Override) await overrides.LndGetInfo_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.LndGetInfo({rpcName:'LndGetInfo', ctx:authContext , req: request}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.AddApp) throw new Error('method: AddApp is not implemented') @@ -55,8 +51,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - const response = await methods.AddApp({ ...authContext, ...query, ...params }, request) - if (overrides.AddApp_Override) await overrides.AddApp_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.AddApp({rpcName:'AddApp', ctx:authContext , req: request}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.AuthApp) throw new Error('method: AuthApp is not implemented') @@ -69,8 +65,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - const response = await methods.AuthApp({ ...authContext, ...query, ...params }, request) - if (overrides.AuthApp_Override) await overrides.AuthApp_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.AuthApp({rpcName:'AuthApp', ctx:authContext , req: request}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.Health) throw new Error('method: Health is not implemented') @@ -80,8 +76,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { const authContext = await opts.GuestAuthGuard(req.headers['authorization']) const query = req.query const params = req.params - await methods.Health({ ...authContext, ...query, ...params }) - if (overrides.Health_Override) await overrides.Health_Override(res); else res.json({status: 'OK'}) + await methods.Health({rpcName:'Health', ctx:authContext }) + res.json({status: 'OK'}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.EncryptionExchange) throw new Error('method: EncryptionExchange is not implemented') @@ -94,8 +90,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - await methods.EncryptionExchange({ ...authContext, ...query, ...params }, request) - if (overrides.EncryptionExchange_Override) await overrides.EncryptionExchange_Override(res); else res.json({status: 'OK'}) + await methods.EncryptionExchange({rpcName:'EncryptionExchange', ctx:authContext , req: request}) + res.json({status: 'OK'}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.SetMockInvoiceAsPaid) throw new Error('method: SetMockInvoiceAsPaid is not implemented') @@ -108,8 +104,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - await methods.SetMockInvoiceAsPaid({ ...authContext, ...query, ...params }, request) - if (overrides.SetMockInvoiceAsPaid_Override) await overrides.SetMockInvoiceAsPaid_Override(res); else res.json({status: 'OK'}) + await methods.SetMockInvoiceAsPaid({rpcName:'SetMockInvoiceAsPaid', ctx:authContext , req: request}) + res.json({status: 'OK'}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.GetLnurlWithdrawInfo) throw new Error('method: GetLnurlWithdrawInfo is not implemented') @@ -119,8 +115,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { const authContext = await opts.GuestAuthGuard(req.headers['authorization']) const query = req.query const params = req.params - const response = await methods.GetLnurlWithdrawInfo({ ...authContext, ...query, ...params }) - if (overrides.GetLnurlWithdrawInfo_Override) await overrides.GetLnurlWithdrawInfo_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.GetLnurlWithdrawInfo({rpcName:'GetLnurlWithdrawInfo', ctx:authContext ,query: req.query}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.HandleLnurlWithdraw) throw new Error('method: HandleLnurlWithdraw is not implemented') @@ -130,8 +126,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { const authContext = await opts.GuestAuthGuard(req.headers['authorization']) const query = req.query const params = req.params - await methods.HandleLnurlWithdraw({ ...authContext, ...query, ...params }) - if (overrides.HandleLnurlWithdraw_Override) await overrides.HandleLnurlWithdraw_Override(res); else res.json({status: 'OK'}) + await methods.HandleLnurlWithdraw({rpcName:'HandleLnurlWithdraw', ctx:authContext ,query: req.query}) + res.json({status: 'OK'}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.GetLnurlPayInfo) throw new Error('method: GetLnurlPayInfo is not implemented') @@ -141,8 +137,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { const authContext = await opts.GuestAuthGuard(req.headers['authorization']) const query = req.query const params = req.params - const response = await methods.GetLnurlPayInfo({ ...authContext, ...query, ...params }) - if (overrides.GetLnurlPayInfo_Override) await overrides.GetLnurlPayInfo_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.GetLnurlPayInfo({rpcName:'GetLnurlPayInfo', ctx:authContext ,query: req.query}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.HandleLnurlPay) throw new Error('method: HandleLnurlPay is not implemented') @@ -152,8 +148,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { const authContext = await opts.GuestAuthGuard(req.headers['authorization']) const query = req.query const params = req.params - const response = await methods.HandleLnurlPay({ ...authContext, ...query, ...params }) - if (overrides.HandleLnurlPay_Override) await overrides.HandleLnurlPay_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.HandleLnurlPay({rpcName:'HandleLnurlPay', ctx:authContext ,query: req.query}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.HandleLnurlAddress) throw new Error('method: HandleLnurlAddress is not implemented') @@ -163,8 +159,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { const authContext = await opts.GuestAuthGuard(req.headers['authorization']) const query = req.query const params = req.params - const response = await methods.HandleLnurlAddress({ ...authContext, ...query, ...params }) - if (overrides.HandleLnurlAddress_Override) await overrides.HandleLnurlAddress_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.HandleLnurlAddress({rpcName:'HandleLnurlAddress', ctx:authContext ,params: req.params}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.GetApp) throw new Error('method: GetApp is not implemented') @@ -174,8 +170,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { const authContext = await opts.AppAuthGuard(req.headers['authorization']) const query = req.query const params = req.params - const response = await methods.GetApp({ ...authContext, ...query, ...params }) - if (overrides.GetApp_Override) await overrides.GetApp_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.GetApp({rpcName:'GetApp', ctx:authContext }) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.AddAppUser) throw new Error('method: AddAppUser is not implemented') @@ -188,8 +184,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - const response = await methods.AddAppUser({ ...authContext, ...query, ...params }, request) - if (overrides.AddAppUser_Override) await overrides.AddAppUser_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.AddAppUser({rpcName:'AddAppUser', ctx:authContext , req: request}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.AddAppInvoice) throw new Error('method: AddAppInvoice is not implemented') @@ -202,8 +198,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - const response = await methods.AddAppInvoice({ ...authContext, ...query, ...params }, request) - if (overrides.AddAppInvoice_Override) await overrides.AddAppInvoice_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.AddAppInvoice({rpcName:'AddAppInvoice', ctx:authContext , req: request}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.AddAppUserInvoice) throw new Error('method: AddAppUserInvoice is not implemented') @@ -216,8 +212,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - const response = await methods.AddAppUserInvoice({ ...authContext, ...query, ...params }, request) - if (overrides.AddAppUserInvoice_Override) await overrides.AddAppUserInvoice_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.AddAppUserInvoice({rpcName:'AddAppUserInvoice', ctx:authContext , req: request}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.GetAppUser) throw new Error('method: GetAppUser is not implemented') @@ -230,8 +226,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - const response = await methods.GetAppUser({ ...authContext, ...query, ...params }, request) - if (overrides.GetAppUser_Override) await overrides.GetAppUser_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.GetAppUser({rpcName:'GetAppUser', ctx:authContext , req: request}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.PayAppUserInvoice) throw new Error('method: PayAppUserInvoice is not implemented') @@ -244,8 +240,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - const response = await methods.PayAppUserInvoice({ ...authContext, ...query, ...params }, request) - if (overrides.PayAppUserInvoice_Override) await overrides.PayAppUserInvoice_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.PayAppUserInvoice({rpcName:'PayAppUserInvoice', ctx:authContext , req: request}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.SendAppUserToAppUserPayment) throw new Error('method: SendAppUserToAppUserPayment is not implemented') @@ -258,8 +254,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - await methods.SendAppUserToAppUserPayment({ ...authContext, ...query, ...params }, request) - if (overrides.SendAppUserToAppUserPayment_Override) await overrides.SendAppUserToAppUserPayment_Override(res); else res.json({status: 'OK'}) + await methods.SendAppUserToAppUserPayment({rpcName:'SendAppUserToAppUserPayment', ctx:authContext , req: request}) + res.json({status: 'OK'}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.SendAppUserToAppPayment) throw new Error('method: SendAppUserToAppPayment is not implemented') @@ -272,8 +268,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - await methods.SendAppUserToAppPayment({ ...authContext, ...query, ...params }, request) - if (overrides.SendAppUserToAppPayment_Override) await overrides.SendAppUserToAppPayment_Override(res); else res.json({status: 'OK'}) + await methods.SendAppUserToAppPayment({rpcName:'SendAppUserToAppPayment', ctx:authContext , req: request}) + res.json({status: 'OK'}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.GetAppUserLNURLInfo) throw new Error('method: GetAppUserLNURLInfo is not implemented') @@ -286,8 +282,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - const response = await methods.GetAppUserLNURLInfo({ ...authContext, ...query, ...params }, request) - if (overrides.GetAppUserLNURLInfo_Override) await overrides.GetAppUserLNURLInfo_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.GetAppUserLNURLInfo({rpcName:'GetAppUserLNURLInfo', ctx:authContext , req: request}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.SetMockAppUserBalance) throw new Error('method: SetMockAppUserBalance is not implemented') @@ -300,8 +296,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - await methods.SetMockAppUserBalance({ ...authContext, ...query, ...params }, request) - if (overrides.SetMockAppUserBalance_Override) await overrides.SetMockAppUserBalance_Override(res); else res.json({status: 'OK'}) + await methods.SetMockAppUserBalance({rpcName:'SetMockAppUserBalance', ctx:authContext , req: request}) + res.json({status: 'OK'}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.SetMockAppBalance) throw new Error('method: SetMockAppBalance is not implemented') @@ -314,8 +310,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - await methods.SetMockAppBalance({ ...authContext, ...query, ...params }, request) - if (overrides.SetMockAppBalance_Override) await overrides.SetMockAppBalance_Override(res); else res.json({status: 'OK'}) + await methods.SetMockAppBalance({rpcName:'SetMockAppBalance', ctx:authContext , req: request}) + res.json({status: 'OK'}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.GetUserInfo) throw new Error('method: GetUserInfo is not implemented') @@ -325,8 +321,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { const authContext = await opts.UserAuthGuard(req.headers['authorization']) const query = req.query const params = req.params - const response = await methods.GetUserInfo({ ...authContext, ...query, ...params }) - if (overrides.GetUserInfo_Override) await overrides.GetUserInfo_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.GetUserInfo({rpcName:'GetUserInfo', ctx:authContext }) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.AddProduct) throw new Error('method: AddProduct is not implemented') @@ -339,8 +335,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - const response = await methods.AddProduct({ ...authContext, ...query, ...params }, request) - if (overrides.AddProduct_Override) await overrides.AddProduct_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.AddProduct({rpcName:'AddProduct', ctx:authContext , req: request}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.NewProductInvoice) throw new Error('method: NewProductInvoice is not implemented') @@ -350,8 +346,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { const authContext = await opts.UserAuthGuard(req.headers['authorization']) const query = req.query const params = req.params - const response = await methods.NewProductInvoice({ ...authContext, ...query, ...params }) - if (overrides.NewProductInvoice_Override) await overrides.NewProductInvoice_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.NewProductInvoice({rpcName:'NewProductInvoice', ctx:authContext ,query: req.query}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.GetUserOperations) throw new Error('method: GetUserOperations is not implemented') @@ -364,8 +360,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - const response = await methods.GetUserOperations({ ...authContext, ...query, ...params }, request) - if (overrides.GetUserOperations_Override) await overrides.GetUserOperations_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.GetUserOperations({rpcName:'GetUserOperations', ctx:authContext , req: request}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.NewAddress) throw new Error('method: NewAddress is not implemented') @@ -378,8 +374,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - const response = await methods.NewAddress({ ...authContext, ...query, ...params }, request) - if (overrides.NewAddress_Override) await overrides.NewAddress_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.NewAddress({rpcName:'NewAddress', ctx:authContext , req: request}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.PayAddress) throw new Error('method: PayAddress is not implemented') @@ -392,8 +388,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - const response = await methods.PayAddress({ ...authContext, ...query, ...params }, request) - if (overrides.PayAddress_Override) await overrides.PayAddress_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.PayAddress({rpcName:'PayAddress', ctx:authContext , req: request}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.NewInvoice) throw new Error('method: NewInvoice is not implemented') @@ -406,8 +402,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - const response = await methods.NewInvoice({ ...authContext, ...query, ...params }, request) - if (overrides.NewInvoice_Override) await overrides.NewInvoice_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.NewInvoice({rpcName:'NewInvoice', ctx:authContext , req: request}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.DecodeInvoice) throw new Error('method: DecodeInvoice is not implemented') @@ -420,8 +416,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - const response = await methods.DecodeInvoice({ ...authContext, ...query, ...params }, request) - if (overrides.DecodeInvoice_Override) await overrides.DecodeInvoice_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.DecodeInvoice({rpcName:'DecodeInvoice', ctx:authContext , req: request}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.PayInvoice) throw new Error('method: PayInvoice is not implemented') @@ -434,8 +430,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - const response = await methods.PayInvoice({ ...authContext, ...query, ...params }, request) - if (overrides.PayInvoice_Override) await overrides.PayInvoice_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.PayInvoice({rpcName:'PayInvoice', ctx:authContext , req: request}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.OpenChannel) throw new Error('method: OpenChannel is not implemented') @@ -448,8 +444,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) const query = req.query const params = req.params - const response = await methods.OpenChannel({ ...authContext, ...query, ...params }, request) - if (overrides.OpenChannel_Override) await overrides.OpenChannel_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.OpenChannel({rpcName:'OpenChannel', ctx:authContext , req: request}) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.GetLnurlWithdrawLink) throw new Error('method: GetLnurlWithdrawLink is not implemented') @@ -459,8 +455,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { const authContext = await opts.UserAuthGuard(req.headers['authorization']) const query = req.query const params = req.params - const response = await methods.GetLnurlWithdrawLink({ ...authContext, ...query, ...params }) - if (overrides.GetLnurlWithdrawLink_Override) await overrides.GetLnurlWithdrawLink_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.GetLnurlWithdrawLink({rpcName:'GetLnurlWithdrawLink', ctx:authContext }) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.GetLnurlPayLink) throw new Error('method: GetLnurlPayLink is not implemented') @@ -470,8 +466,8 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { const authContext = await opts.UserAuthGuard(req.headers['authorization']) const query = req.query const params = req.params - const response = await methods.GetLnurlPayLink({ ...authContext, ...query, ...params }) - if (overrides.GetLnurlPayLink_Override) await overrides.GetLnurlPayLink_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.GetLnurlPayLink({rpcName:'GetLnurlPayLink', ctx:authContext }) + res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.GetLNURLChannelLink) throw new Error('method: GetLNURLChannelLink is not implemented') @@ -481,8 +477,118 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { const authContext = await opts.UserAuthGuard(req.headers['authorization']) const query = req.query const params = req.params - const response = await methods.GetLNURLChannelLink({ ...authContext, ...query, ...params }) - if (overrides.GetLNURLChannelLink_Override) await overrides.GetLNURLChannelLink_Override(res, response); else res.json({status: 'OK', ...response}) + const response = await methods.GetLNURLChannelLink({rpcName:'GetLNURLChannelLink', ctx:authContext }) + res.json({status: 'OK', ...response}) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } + }) + app.post('/api/user/batch', async (req, res) => { + try { + const requests = req.body.requests as Types.UserMethodInputs[] + if (!Array.isArray(requests))throw new Error('invalid body, is not an array') + if (requests.length > 10) throw new Error('too many requests in the batch') + const ctx = await opts.UserAuthGuard(req.headers['authorization']) + const responses = [] + for (let i = 0; i < requests.length; i++) { + const operation = requests[i] + try { + switch(operation.rpcName) { + case 'GetUserInfo': + if (!methods.GetUserInfo) { + responses.push({ status: 'ERROR', reason: 'method not defined: GetUserInfo' }) + } else { + const res = await methods.GetUserInfo({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'AddProduct': + if (!methods.AddProduct) { + responses.push({ status: 'ERROR', reason: 'method not defined: AddProduct' }) + } else { + const res = await methods.AddProduct({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'NewProductInvoice': + if (!methods.NewProductInvoice) { + responses.push({ status: 'ERROR', reason: 'method not defined: NewProductInvoice' }) + } else { + const res = await methods.NewProductInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'GetUserOperations': + if (!methods.GetUserOperations) { + responses.push({ status: 'ERROR', reason: 'method not defined: GetUserOperations' }) + } else { + const res = await methods.GetUserOperations({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'NewAddress': + if (!methods.NewAddress) { + responses.push({ status: 'ERROR', reason: 'method not defined: NewAddress' }) + } else { + const res = await methods.NewAddress({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'PayAddress': + if (!methods.PayAddress) { + responses.push({ status: 'ERROR', reason: 'method not defined: PayAddress' }) + } else { + const res = await methods.PayAddress({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'NewInvoice': + if (!methods.NewInvoice) { + responses.push({ status: 'ERROR', reason: 'method not defined: NewInvoice' }) + } else { + const res = await methods.NewInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'DecodeInvoice': + if (!methods.DecodeInvoice) { + responses.push({ status: 'ERROR', reason: 'method not defined: DecodeInvoice' }) + } else { + const res = await methods.DecodeInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'PayInvoice': + if (!methods.PayInvoice) { + responses.push({ status: 'ERROR', reason: 'method not defined: PayInvoice' }) + } else { + const res = await methods.PayInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'OpenChannel': + if (!methods.OpenChannel) { + responses.push({ status: 'ERROR', reason: 'method not defined: OpenChannel' }) + } else { + const res = await methods.OpenChannel({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'GetLnurlWithdrawLink': + if (!methods.GetLnurlWithdrawLink) { + responses.push({ status: 'ERROR', reason: 'method not defined: GetLnurlWithdrawLink' }) + } else { + const res = await methods.GetLnurlWithdrawLink({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'GetLnurlPayLink': + if (!methods.GetLnurlPayLink) { + responses.push({ status: 'ERROR', reason: 'method not defined: GetLnurlPayLink' }) + } else { + const res = await methods.GetLnurlPayLink({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'GetLNURLChannelLink': + if (!methods.GetLNURLChannelLink) { + responses.push({ status: 'ERROR', reason: 'method not defined: GetLNURLChannelLink' }) + } else { + const res = await methods.GetLNURLChannelLink({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + default: + throw new Error('unkown rpcName') + } + } catch(ex) {const e = ex as any; logger.error(e.message || e); responses.push({ status: 'ERROR', reason: e.message || e })} + } + res.json({ status: 'OK', responses }) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (opts.staticFiles) { @@ -495,42 +601,3 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { Listen: (port: number) => { server = app.listen(port, () => logger.log('Example app listening on port ' + port)) } } } -export type MethodsOverride = { - LndGetInfo_Override?: (httpRes:Response, handlerRes:Types.LndGetInfoResponse) => Promise - AddApp_Override?: (httpRes:Response, handlerRes:Types.AuthApp) => Promise - AuthApp_Override?: (httpRes:Response, handlerRes:Types.AuthApp) => Promise - Health_Override?: (httpRes:Response) => Promise - EncryptionExchange_Override?: (httpRes:Response) => Promise - SetMockInvoiceAsPaid_Override?: (httpRes:Response) => Promise - GetLnurlWithdrawInfo_Override?: (httpRes:Response, handlerRes:Types.LnurlWithdrawInfoResponse) => Promise - HandleLnurlWithdraw_Override?: (httpRes:Response) => Promise - GetLnurlPayInfo_Override?: (httpRes:Response, handlerRes:Types.LnurlPayInfoResponse) => Promise - HandleLnurlPay_Override?: (httpRes:Response, handlerRes:Types.HandleLnurlPayResponse) => Promise - HandleLnurlAddress_Override?: (httpRes:Response, handlerRes:Types.LnurlPayInfoResponse) => Promise - GetApp_Override?: (httpRes:Response, handlerRes:Types.Application) => Promise - AddAppUser_Override?: (httpRes:Response, handlerRes:Types.AppUser) => Promise - AddAppInvoice_Override?: (httpRes:Response, handlerRes:Types.NewInvoiceResponse) => Promise - AddAppUserInvoice_Override?: (httpRes:Response, handlerRes:Types.NewInvoiceResponse) => Promise - GetAppUser_Override?: (httpRes:Response, handlerRes:Types.AppUser) => Promise - PayAppUserInvoice_Override?: (httpRes:Response, handlerRes:Types.PayInvoiceResponse) => Promise - SendAppUserToAppUserPayment_Override?: (httpRes:Response) => Promise - SendAppUserToAppPayment_Override?: (httpRes:Response) => Promise - GetAppUserLNURLInfo_Override?: (httpRes:Response, handlerRes:Types.LnurlPayInfoResponse) => Promise - SetMockAppUserBalance_Override?: (httpRes:Response) => Promise - SetMockAppBalance_Override?: (httpRes:Response) => Promise - GetUserInfo_Override?: (httpRes:Response, handlerRes:Types.UserInfo) => Promise - AddProduct_Override?: (httpRes:Response, handlerRes:Types.Product) => Promise - NewProductInvoice_Override?: (httpRes:Response, handlerRes:Types.NewInvoiceResponse) => Promise - GetUserOperations_Override?: (httpRes:Response, handlerRes:Types.GetUserOperationsResponse) => Promise - NewAddress_Override?: (httpRes:Response, handlerRes:Types.NewAddressResponse) => Promise - PayAddress_Override?: (httpRes:Response, handlerRes:Types.PayAddressResponse) => Promise - NewInvoice_Override?: (httpRes:Response, handlerRes:Types.NewInvoiceResponse) => Promise - DecodeInvoice_Override?: (httpRes:Response, handlerRes:Types.DecodeInvoiceResponse) => Promise - PayInvoice_Override?: (httpRes:Response, handlerRes:Types.PayInvoiceResponse) => Promise - OpenChannel_Override?: (httpRes:Response, handlerRes:Types.OpenChannelResponse) => Promise - GetLnurlWithdrawLink_Override?: (httpRes:Response, handlerRes:Types.LnurlLinkResponse) => Promise - GetLnurlPayLink_Override?: (httpRes:Response, handlerRes:Types.LnurlLinkResponse) => Promise - GetLNURLChannelLink_Override?: (httpRes:Response, handlerRes:Types.LnurlLinkResponse) => Promise - GetLiveUserOperations_Override?: (httpRes:Response, handlerRes:Types.LiveUserOperation) => Promise - GetMigrationUpdate_Override?: (httpRes:Response, handlerRes:Types.MigrationUpdate) => Promise -} diff --git a/proto/autogenerated/ts/http_client.ts b/proto/autogenerated/ts/http_client.ts index 7b762d8e..ebe472b2 100644 --- a/proto/autogenerated/ts/http_client.ts +++ b/proto/autogenerated/ts/http_client.ts @@ -494,4 +494,15 @@ export default (params: ClientParams) => ({ }, GetLiveUserOperations: async (cb: (v:ResultError | ({ status: 'OK' }& Types.LiveUserOperation)) => void): Promise => { throw new Error('http streams are not supported')}, GetMigrationUpdate: async (cb: (v:ResultError | ({ status: 'OK' }& Types.MigrationUpdate)) => void): Promise => { throw new Error('http streams are not supported')}, + BatchUser: async (requests:Types.UserMethodInputs): Promise => { + const auth = await params.retrieveUserAuth() + if (auth === null) throw new Error('retrieveUserAuth() returned null') + let finalRoute = '/api/user/batch' + const { data } = await axios.post(params.baseUrl + finalRoute, {requests}, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + return { status: 'OK', ...data } + } + return { status: 'ERROR', reason: 'invalid response' } + } }) diff --git a/proto/autogenerated/ts/nostr_client.ts b/proto/autogenerated/ts/nostr_client.ts index 2e35e937..76d9539d 100644 --- a/proto/autogenerated/ts/nostr_client.ts +++ b/proto/autogenerated/ts/nostr_client.ts @@ -230,4 +230,15 @@ export default (params: NostrClientParams, send: (to:string, message: NostrRequ return cb({ status: 'ERROR', reason: 'invalid response' }) }) }, + BatchUser: async (requests:Types.UserMethodInputs): Promise => { + const auth = await params.retrieveNostrUserAuth() + if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') + const nostrRequest: NostrRequest = {body:{requests}} + const data = await send(params.pubDestination, {rpcName:'BatchUser',authIdentifier:auth, ...nostrRequest }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + return data + } + return { status: 'ERROR', reason: 'invalid response' } + } }) diff --git a/proto/autogenerated/ts/nostr_transport.ts b/proto/autogenerated/ts/nostr_transport.ts index 04b29dff..2c3d4e9b 100644 --- a/proto/autogenerated/ts/nostr_transport.ts +++ b/proto/autogenerated/ts/nostr_transport.ts @@ -26,9 +26,7 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { try { if (!methods.GetUserInfo) throw new Error('method: GetUserInfo is not implemented') const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - const query = req.query - const params = req.params - const response = await methods.GetUserInfo({ ...authContext, ...query, ...params }) + const response = await methods.GetUserInfo({rpcName:'GetUserInfo', ctx:authContext }) res({status: 'OK', ...response}) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } break @@ -39,9 +37,7 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { const request = req.body const error = Types.AddProductRequestValidate(request) if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) - const query = req.query - const params = req.params - const response = await methods.AddProduct({ ...authContext, ...query, ...params }, request) + const response = await methods.AddProduct({rpcName:'AddProduct', ctx:authContext , req: request}) res({status: 'OK', ...response}) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } break @@ -49,9 +45,7 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { try { if (!methods.NewProductInvoice) throw new Error('method: NewProductInvoice is not implemented') const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - const query = req.query - const params = req.params - const response = await methods.NewProductInvoice({ ...authContext, ...query, ...params }) + const response = await methods.NewProductInvoice({rpcName:'NewProductInvoice', ctx:authContext ,query: req.query||{}}) res({status: 'OK', ...response}) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } break @@ -62,9 +56,7 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { const request = req.body const error = Types.GetUserOperationsRequestValidate(request) if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) - const query = req.query - const params = req.params - const response = await methods.GetUserOperations({ ...authContext, ...query, ...params }, request) + const response = await methods.GetUserOperations({rpcName:'GetUserOperations', ctx:authContext , req: request}) res({status: 'OK', ...response}) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } break @@ -75,9 +67,7 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { const request = req.body const error = Types.NewAddressRequestValidate(request) if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) - const query = req.query - const params = req.params - const response = await methods.NewAddress({ ...authContext, ...query, ...params }, request) + const response = await methods.NewAddress({rpcName:'NewAddress', ctx:authContext , req: request}) res({status: 'OK', ...response}) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } break @@ -88,9 +78,7 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { const request = req.body const error = Types.PayAddressRequestValidate(request) if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) - const query = req.query - const params = req.params - const response = await methods.PayAddress({ ...authContext, ...query, ...params }, request) + const response = await methods.PayAddress({rpcName:'PayAddress', ctx:authContext , req: request}) res({status: 'OK', ...response}) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } break @@ -101,9 +89,7 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { const request = req.body const error = Types.NewInvoiceRequestValidate(request) if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) - const query = req.query - const params = req.params - const response = await methods.NewInvoice({ ...authContext, ...query, ...params }, request) + const response = await methods.NewInvoice({rpcName:'NewInvoice', ctx:authContext , req: request}) res({status: 'OK', ...response}) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } break @@ -114,9 +100,7 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { const request = req.body const error = Types.DecodeInvoiceRequestValidate(request) if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) - const query = req.query - const params = req.params - const response = await methods.DecodeInvoice({ ...authContext, ...query, ...params }, request) + const response = await methods.DecodeInvoice({rpcName:'DecodeInvoice', ctx:authContext , req: request}) res({status: 'OK', ...response}) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } break @@ -127,9 +111,7 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { const request = req.body const error = Types.PayInvoiceRequestValidate(request) if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) - const query = req.query - const params = req.params - const response = await methods.PayInvoice({ ...authContext, ...query, ...params }, request) + const response = await methods.PayInvoice({rpcName:'PayInvoice', ctx:authContext , req: request}) res({status: 'OK', ...response}) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } break @@ -140,9 +122,7 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { const request = req.body const error = Types.OpenChannelRequestValidate(request) if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) - const query = req.query - const params = req.params - const response = await methods.OpenChannel({ ...authContext, ...query, ...params }, request) + const response = await methods.OpenChannel({rpcName:'OpenChannel', ctx:authContext , req: request}) res({status: 'OK', ...response}) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } break @@ -150,9 +130,7 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { try { if (!methods.GetLnurlWithdrawLink) throw new Error('method: GetLnurlWithdrawLink is not implemented') const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - const query = req.query - const params = req.params - const response = await methods.GetLnurlWithdrawLink({ ...authContext, ...query, ...params }) + const response = await methods.GetLnurlWithdrawLink({rpcName:'GetLnurlWithdrawLink', ctx:authContext }) res({status: 'OK', ...response}) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } break @@ -160,9 +138,7 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { try { if (!methods.GetLnurlPayLink) throw new Error('method: GetLnurlPayLink is not implemented') const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - const query = req.query - const params = req.params - const response = await methods.GetLnurlPayLink({ ...authContext, ...query, ...params }) + const response = await methods.GetLnurlPayLink({rpcName:'GetLnurlPayLink', ctx:authContext }) res({status: 'OK', ...response}) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } break @@ -170,9 +146,7 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { try { if (!methods.GetLNURLChannelLink) throw new Error('method: GetLNURLChannelLink is not implemented') const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - const query = req.query - const params = req.params - const response = await methods.GetLNURLChannelLink({ ...authContext, ...query, ...params }) + const response = await methods.GetLNURLChannelLink({rpcName:'GetLNURLChannelLink', ctx:authContext }) res({status: 'OK', ...response}) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } break @@ -180,22 +154,128 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { try { if (!methods.GetLiveUserOperations) throw new Error('method: GetLiveUserOperations is not implemented') const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - const query = req.query - const params = req.params - methods.GetLiveUserOperations({ ...authContext, ...query, ...params }, (response, err) => { + methods.GetLiveUserOperations({rpcName:'GetLiveUserOperations', ctx:authContext ,cb: (response, err) => { if (err) { logErrorAndReturnResponse(err, err.message, res, logger)} else { res({status: 'OK', ...response})} - }) + }}) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } break case 'GetMigrationUpdate': try { if (!methods.GetMigrationUpdate) throw new Error('method: GetMigrationUpdate is not implemented') const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - const query = req.query - const params = req.params - methods.GetMigrationUpdate({ ...authContext, ...query, ...params }, (response, err) => { + methods.GetMigrationUpdate({rpcName:'GetMigrationUpdate', ctx:authContext ,cb: (response, err) => { if (err) { logErrorAndReturnResponse(err, err.message, res, logger)} else { res({status: 'OK', ...response})} - }) + }}) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } + break + case 'BatchUser': + try { + const requests = req.body.requests as Types.UserMethodInputs[] + if (!Array.isArray(requests))throw new Error('invalid body, is not an array') + if (requests.length > 10) throw new Error('too many requests in the batch') + const ctx = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) + const responses = [] + for (let i = 0; i < requests.length; i++) { + const operation = requests[i] + try { + switch(operation.rpcName) { + case 'GetUserInfo': + if (!methods.GetUserInfo) { + responses.push({ status: 'ERROR', reason: 'method not defined: GetUserInfo' }) + } else { + const res = await methods.GetUserInfo({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'AddProduct': + if (!methods.AddProduct) { + responses.push({ status: 'ERROR', reason: 'method not defined: AddProduct' }) + } else { + const res = await methods.AddProduct({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'NewProductInvoice': + if (!methods.NewProductInvoice) { + responses.push({ status: 'ERROR', reason: 'method not defined: NewProductInvoice' }) + } else { + const res = await methods.NewProductInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'GetUserOperations': + if (!methods.GetUserOperations) { + responses.push({ status: 'ERROR', reason: 'method not defined: GetUserOperations' }) + } else { + const res = await methods.GetUserOperations({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'NewAddress': + if (!methods.NewAddress) { + responses.push({ status: 'ERROR', reason: 'method not defined: NewAddress' }) + } else { + const res = await methods.NewAddress({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'PayAddress': + if (!methods.PayAddress) { + responses.push({ status: 'ERROR', reason: 'method not defined: PayAddress' }) + } else { + const res = await methods.PayAddress({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'NewInvoice': + if (!methods.NewInvoice) { + responses.push({ status: 'ERROR', reason: 'method not defined: NewInvoice' }) + } else { + const res = await methods.NewInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'DecodeInvoice': + if (!methods.DecodeInvoice) { + responses.push({ status: 'ERROR', reason: 'method not defined: DecodeInvoice' }) + } else { + const res = await methods.DecodeInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'PayInvoice': + if (!methods.PayInvoice) { + responses.push({ status: 'ERROR', reason: 'method not defined: PayInvoice' }) + } else { + const res = await methods.PayInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'OpenChannel': + if (!methods.OpenChannel) { + responses.push({ status: 'ERROR', reason: 'method not defined: OpenChannel' }) + } else { + const res = await methods.OpenChannel({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'GetLnurlWithdrawLink': + if (!methods.GetLnurlWithdrawLink) { + responses.push({ status: 'ERROR', reason: 'method not defined: GetLnurlWithdrawLink' }) + } else { + const res = await methods.GetLnurlWithdrawLink({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'GetLnurlPayLink': + if (!methods.GetLnurlPayLink) { + responses.push({ status: 'ERROR', reason: 'method not defined: GetLnurlPayLink' }) + } else { + const res = await methods.GetLnurlPayLink({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + case 'GetLNURLChannelLink': + if (!methods.GetLNURLChannelLink) { + responses.push({ status: 'ERROR', reason: 'method not defined: GetLNURLChannelLink' }) + } else { + const res = await methods.GetLNURLChannelLink({...operation, ctx}); responses.push({ status: 'OK', ...res }) + } + break + default: + throw new Error('unkown rpcName') + } + } catch(ex) {const e = ex as any; logger.error(e.message || e); responses.push({ status: 'ERROR', reason: e.message || e })} + } + res({ status: 'OK', responses }) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } break default: logger.error('unknown rpc call name from nostr event:'+req.rpcName) diff --git a/proto/autogenerated/ts/types.ts b/proto/autogenerated/ts/types.ts index 94a7f912..75647dea 100644 --- a/proto/autogenerated/ts/types.ts +++ b/proto/autogenerated/ts/types.ts @@ -2,252 +2,201 @@ export type GuestContext = { } +export type GuestMethodInputs = Health_Input | EncryptionExchange_Input | SetMockInvoiceAsPaid_Input | GetLnurlWithdrawInfo_Input | HandleLnurlWithdraw_Input | GetLnurlPayInfo_Input | HandleLnurlPay_Input | HandleLnurlAddress_Input +export type GuestMethodOutputs = Health_Output | EncryptionExchange_Output | SetMockInvoiceAsPaid_Output | GetLnurlWithdrawInfo_Output | HandleLnurlWithdraw_Output | GetLnurlPayInfo_Output | HandleLnurlPay_Output | HandleLnurlAddress_Output export type UserContext = { + user_id: string app_id: string app_user_id: string - user_id: string } +export type UserMethodInputs = GetUserInfo_Input | AddProduct_Input | NewProductInvoice_Input | GetUserOperations_Input | NewAddress_Input | PayAddress_Input | NewInvoice_Input | DecodeInvoice_Input | PayInvoice_Input | OpenChannel_Input | GetLnurlWithdrawLink_Input | GetLnurlPayLink_Input | GetLNURLChannelLink_Input +export type UserMethodOutputs = GetUserInfo_Output | AddProduct_Output | NewProductInvoice_Output | GetUserOperations_Output | NewAddress_Output | PayAddress_Output | NewInvoice_Output | DecodeInvoice_Output | PayInvoice_Output | OpenChannel_Output | GetLnurlWithdrawLink_Output | GetLnurlPayLink_Output | GetLNURLChannelLink_Output export type AdminContext = { admin_id: string } +export type AdminMethodInputs = LndGetInfo_Input | AddApp_Input | AuthApp_Input +export type AdminMethodOutputs = LndGetInfo_Output | AddApp_Output | AuthApp_Output export type AppContext = { app_id: string } +export type AppMethodInputs = GetApp_Input | AddAppUser_Input | AddAppInvoice_Input | AddAppUserInvoice_Input | GetAppUser_Input | PayAppUserInvoice_Input | SendAppUserToAppUserPayment_Input | SendAppUserToAppPayment_Input | GetAppUserLNURLInfo_Input | SetMockAppUserBalance_Input | SetMockAppBalance_Input +export type AppMethodOutputs = GetApp_Output | AddAppUser_Output | AddAppInvoice_Output | AddAppUserInvoice_Output | GetAppUser_Output | PayAppUserInvoice_Output | SendAppUserToAppUserPayment_Output | SendAppUserToAppPayment_Output | GetAppUserLNURLInfo_Output | SetMockAppUserBalance_Output | SetMockAppBalance_Output export type AuthContext = GuestContext | UserContext | AdminContext | AppContext -export type LndGetInfo_Query = { -} -export type LndGetInfo_RouteParams = { -} -export type LndGetInfo_Context = LndGetInfo_Query & LndGetInfo_RouteParams & AdminContext -export type AddApp_Query = { -} -export type AddApp_RouteParams = { -} -export type AddApp_Context = AddApp_Query & AddApp_RouteParams & AdminContext -export type AuthApp_Query = { -} -export type AuthApp_RouteParams = { -} -export type AuthApp_Context = AuthApp_Query & AuthApp_RouteParams & AdminContext -export type Health_Query = { -} -export type Health_RouteParams = { -} -export type Health_Context = Health_Query & Health_RouteParams & GuestContext -export type EncryptionExchange_Query = { -} -export type EncryptionExchange_RouteParams = { -} -export type EncryptionExchange_Context = EncryptionExchange_Query & EncryptionExchange_RouteParams & GuestContext -export type SetMockInvoiceAsPaid_Query = { -} -export type SetMockInvoiceAsPaid_RouteParams = { -} -export type SetMockInvoiceAsPaid_Context = SetMockInvoiceAsPaid_Query & SetMockInvoiceAsPaid_RouteParams & GuestContext +export type LndGetInfo_Input = {rpcName:'LndGetInfo',ctx: AdminContext , req: LndGetInfoRequest} +export type LndGetInfo_Output = LndGetInfoResponse + +export type AddApp_Input = {rpcName:'AddApp',ctx: AdminContext , req: AddAppRequest} +export type AddApp_Output = AuthApp + +export type AuthApp_Input = {rpcName:'AuthApp',ctx: AdminContext , req: AuthAppRequest} +export type AuthApp_Output = AuthApp + +export type Health_Input = {rpcName:'Health',ctx: GuestContext } +export type Health_Output = void + +export type EncryptionExchange_Input = {rpcName:'EncryptionExchange',ctx: GuestContext , req: EncryptionExchangeRequest} +export type EncryptionExchange_Output = void + +export type SetMockInvoiceAsPaid_Input = {rpcName:'SetMockInvoiceAsPaid',ctx: GuestContext , req: SetMockInvoiceAsPaidRequest} +export type SetMockInvoiceAsPaid_Output = void + export type GetLnurlWithdrawInfo_Query = { k1?: string } -export type GetLnurlWithdrawInfo_RouteParams = { -} -export type GetLnurlWithdrawInfo_Context = GetLnurlWithdrawInfo_Query & GetLnurlWithdrawInfo_RouteParams & GuestContext +export type GetLnurlWithdrawInfo_Input = {rpcName:'GetLnurlWithdrawInfo',ctx: GuestContext , query: GetLnurlWithdrawInfo_Query} +export type GetLnurlWithdrawInfo_Output = LnurlWithdrawInfoResponse + export type HandleLnurlWithdraw_Query = { k1?: string pr?: string } -export type HandleLnurlWithdraw_RouteParams = { -} -export type HandleLnurlWithdraw_Context = HandleLnurlWithdraw_Query & HandleLnurlWithdraw_RouteParams & GuestContext +export type HandleLnurlWithdraw_Input = {rpcName:'HandleLnurlWithdraw',ctx: GuestContext , query: HandleLnurlWithdraw_Query} +export type HandleLnurlWithdraw_Output = void + export type GetLnurlPayInfo_Query = { k1?: string } -export type GetLnurlPayInfo_RouteParams = { -} -export type GetLnurlPayInfo_Context = GetLnurlPayInfo_Query & GetLnurlPayInfo_RouteParams & GuestContext +export type GetLnurlPayInfo_Input = {rpcName:'GetLnurlPayInfo',ctx: GuestContext , query: GetLnurlPayInfo_Query} +export type GetLnurlPayInfo_Output = LnurlPayInfoResponse + export type HandleLnurlPay_Query = { k1?: string amount?: string nostr?: string lnurl?: string } -export type HandleLnurlPay_RouteParams = { -} -export type HandleLnurlPay_Context = HandleLnurlPay_Query & HandleLnurlPay_RouteParams & GuestContext -export type HandleLnurlAddress_Query = { -} +export type HandleLnurlPay_Input = {rpcName:'HandleLnurlPay',ctx: GuestContext , query: HandleLnurlPay_Query} +export type HandleLnurlPay_Output = HandleLnurlPayResponse + export type HandleLnurlAddress_RouteParams = { address_name: string } -export type HandleLnurlAddress_Context = HandleLnurlAddress_Query & HandleLnurlAddress_RouteParams & GuestContext -export type GetApp_Query = { -} -export type GetApp_RouteParams = { -} -export type GetApp_Context = GetApp_Query & GetApp_RouteParams & AppContext -export type AddAppUser_Query = { -} -export type AddAppUser_RouteParams = { -} -export type AddAppUser_Context = AddAppUser_Query & AddAppUser_RouteParams & AppContext -export type AddAppInvoice_Query = { -} -export type AddAppInvoice_RouteParams = { -} -export type AddAppInvoice_Context = AddAppInvoice_Query & AddAppInvoice_RouteParams & AppContext -export type AddAppUserInvoice_Query = { -} -export type AddAppUserInvoice_RouteParams = { -} -export type AddAppUserInvoice_Context = AddAppUserInvoice_Query & AddAppUserInvoice_RouteParams & AppContext -export type GetAppUser_Query = { -} -export type GetAppUser_RouteParams = { -} -export type GetAppUser_Context = GetAppUser_Query & GetAppUser_RouteParams & AppContext -export type PayAppUserInvoice_Query = { -} -export type PayAppUserInvoice_RouteParams = { -} -export type PayAppUserInvoice_Context = PayAppUserInvoice_Query & PayAppUserInvoice_RouteParams & AppContext -export type SendAppUserToAppUserPayment_Query = { -} -export type SendAppUserToAppUserPayment_RouteParams = { -} -export type SendAppUserToAppUserPayment_Context = SendAppUserToAppUserPayment_Query & SendAppUserToAppUserPayment_RouteParams & AppContext -export type SendAppUserToAppPayment_Query = { -} -export type SendAppUserToAppPayment_RouteParams = { -} -export type SendAppUserToAppPayment_Context = SendAppUserToAppPayment_Query & SendAppUserToAppPayment_RouteParams & AppContext -export type GetAppUserLNURLInfo_Query = { -} -export type GetAppUserLNURLInfo_RouteParams = { -} -export type GetAppUserLNURLInfo_Context = GetAppUserLNURLInfo_Query & GetAppUserLNURLInfo_RouteParams & AppContext -export type SetMockAppUserBalance_Query = { -} -export type SetMockAppUserBalance_RouteParams = { -} -export type SetMockAppUserBalance_Context = SetMockAppUserBalance_Query & SetMockAppUserBalance_RouteParams & AppContext -export type SetMockAppBalance_Query = { -} -export type SetMockAppBalance_RouteParams = { -} -export type SetMockAppBalance_Context = SetMockAppBalance_Query & SetMockAppBalance_RouteParams & AppContext -export type GetUserInfo_Query = { -} -export type GetUserInfo_RouteParams = { -} -export type GetUserInfo_Context = GetUserInfo_Query & GetUserInfo_RouteParams & UserContext -export type AddProduct_Query = { -} -export type AddProduct_RouteParams = { -} -export type AddProduct_Context = AddProduct_Query & AddProduct_RouteParams & UserContext +export type HandleLnurlAddress_Input = {rpcName:'HandleLnurlAddress',ctx: GuestContext , params: HandleLnurlAddress_RouteParams} +export type HandleLnurlAddress_Output = LnurlPayInfoResponse + +export type GetApp_Input = {rpcName:'GetApp',ctx: AppContext } +export type GetApp_Output = Application + +export type AddAppUser_Input = {rpcName:'AddAppUser',ctx: AppContext , req: AddAppUserRequest} +export type AddAppUser_Output = AppUser + +export type AddAppInvoice_Input = {rpcName:'AddAppInvoice',ctx: AppContext , req: AddAppInvoiceRequest} +export type AddAppInvoice_Output = NewInvoiceResponse + +export type AddAppUserInvoice_Input = {rpcName:'AddAppUserInvoice',ctx: AppContext , req: AddAppUserInvoiceRequest} +export type AddAppUserInvoice_Output = NewInvoiceResponse + +export type GetAppUser_Input = {rpcName:'GetAppUser',ctx: AppContext , req: GetAppUserRequest} +export type GetAppUser_Output = AppUser + +export type PayAppUserInvoice_Input = {rpcName:'PayAppUserInvoice',ctx: AppContext , req: PayAppUserInvoiceRequest} +export type PayAppUserInvoice_Output = PayInvoiceResponse + +export type SendAppUserToAppUserPayment_Input = {rpcName:'SendAppUserToAppUserPayment',ctx: AppContext , req: SendAppUserToAppUserPaymentRequest} +export type SendAppUserToAppUserPayment_Output = void + +export type SendAppUserToAppPayment_Input = {rpcName:'SendAppUserToAppPayment',ctx: AppContext , req: SendAppUserToAppPaymentRequest} +export type SendAppUserToAppPayment_Output = void + +export type GetAppUserLNURLInfo_Input = {rpcName:'GetAppUserLNURLInfo',ctx: AppContext , req: GetAppUserLNURLInfoRequest} +export type GetAppUserLNURLInfo_Output = LnurlPayInfoResponse + +export type SetMockAppUserBalance_Input = {rpcName:'SetMockAppUserBalance',ctx: AppContext , req: SetMockAppUserBalanceRequest} +export type SetMockAppUserBalance_Output = void + +export type SetMockAppBalance_Input = {rpcName:'SetMockAppBalance',ctx: AppContext , req: SetMockAppBalanceRequest} +export type SetMockAppBalance_Output = void + +export type GetUserInfo_Input = {rpcName:'GetUserInfo',ctx: UserContext } +export type GetUserInfo_Output = UserInfo + +export type AddProduct_Input = {rpcName:'AddProduct',ctx: UserContext , req: AddProductRequest} +export type AddProduct_Output = Product + export type NewProductInvoice_Query = { id?: string } -export type NewProductInvoice_RouteParams = { -} -export type NewProductInvoice_Context = NewProductInvoice_Query & NewProductInvoice_RouteParams & UserContext -export type GetUserOperations_Query = { -} -export type GetUserOperations_RouteParams = { -} -export type GetUserOperations_Context = GetUserOperations_Query & GetUserOperations_RouteParams & UserContext -export type NewAddress_Query = { -} -export type NewAddress_RouteParams = { -} -export type NewAddress_Context = NewAddress_Query & NewAddress_RouteParams & UserContext -export type PayAddress_Query = { -} -export type PayAddress_RouteParams = { -} -export type PayAddress_Context = PayAddress_Query & PayAddress_RouteParams & UserContext -export type NewInvoice_Query = { -} -export type NewInvoice_RouteParams = { -} -export type NewInvoice_Context = NewInvoice_Query & NewInvoice_RouteParams & UserContext -export type DecodeInvoice_Query = { -} -export type DecodeInvoice_RouteParams = { -} -export type DecodeInvoice_Context = DecodeInvoice_Query & DecodeInvoice_RouteParams & UserContext -export type PayInvoice_Query = { -} -export type PayInvoice_RouteParams = { -} -export type PayInvoice_Context = PayInvoice_Query & PayInvoice_RouteParams & UserContext -export type OpenChannel_Query = { -} -export type OpenChannel_RouteParams = { -} -export type OpenChannel_Context = OpenChannel_Query & OpenChannel_RouteParams & UserContext -export type GetLnurlWithdrawLink_Query = { -} -export type GetLnurlWithdrawLink_RouteParams = { -} -export type GetLnurlWithdrawLink_Context = GetLnurlWithdrawLink_Query & GetLnurlWithdrawLink_RouteParams & UserContext -export type GetLnurlPayLink_Query = { -} -export type GetLnurlPayLink_RouteParams = { -} -export type GetLnurlPayLink_Context = GetLnurlPayLink_Query & GetLnurlPayLink_RouteParams & UserContext -export type GetLNURLChannelLink_Query = { -} -export type GetLNURLChannelLink_RouteParams = { -} -export type GetLNURLChannelLink_Context = GetLNURLChannelLink_Query & GetLNURLChannelLink_RouteParams & UserContext -export type GetLiveUserOperations_Query = { -} -export type GetLiveUserOperations_RouteParams = { -} -export type GetLiveUserOperations_Context = GetLiveUserOperations_Query & GetLiveUserOperations_RouteParams & UserContext -export type GetMigrationUpdate_Query = { -} -export type GetMigrationUpdate_RouteParams = { -} -export type GetMigrationUpdate_Context = GetMigrationUpdate_Query & GetMigrationUpdate_RouteParams & UserContext +export type NewProductInvoice_Input = {rpcName:'NewProductInvoice',ctx: UserContext , query: NewProductInvoice_Query} +export type NewProductInvoice_Output = NewInvoiceResponse + +export type GetUserOperations_Input = {rpcName:'GetUserOperations',ctx: UserContext , req: GetUserOperationsRequest} +export type GetUserOperations_Output = GetUserOperationsResponse + +export type NewAddress_Input = {rpcName:'NewAddress',ctx: UserContext , req: NewAddressRequest} +export type NewAddress_Output = NewAddressResponse + +export type PayAddress_Input = {rpcName:'PayAddress',ctx: UserContext , req: PayAddressRequest} +export type PayAddress_Output = PayAddressResponse + +export type NewInvoice_Input = {rpcName:'NewInvoice',ctx: UserContext , req: NewInvoiceRequest} +export type NewInvoice_Output = NewInvoiceResponse + +export type DecodeInvoice_Input = {rpcName:'DecodeInvoice',ctx: UserContext , req: DecodeInvoiceRequest} +export type DecodeInvoice_Output = DecodeInvoiceResponse + +export type PayInvoice_Input = {rpcName:'PayInvoice',ctx: UserContext , req: PayInvoiceRequest} +export type PayInvoice_Output = PayInvoiceResponse + +export type OpenChannel_Input = {rpcName:'OpenChannel',ctx: UserContext , req: OpenChannelRequest} +export type OpenChannel_Output = OpenChannelResponse + +export type GetLnurlWithdrawLink_Input = {rpcName:'GetLnurlWithdrawLink',ctx: UserContext } +export type GetLnurlWithdrawLink_Output = LnurlLinkResponse + +export type GetLnurlPayLink_Input = {rpcName:'GetLnurlPayLink',ctx: UserContext } +export type GetLnurlPayLink_Output = LnurlLinkResponse + +export type GetLNURLChannelLink_Input = {rpcName:'GetLNURLChannelLink',ctx: UserContext } +export type GetLNURLChannelLink_Output = LnurlLinkResponse + +export type GetLiveUserOperations_Input = {rpcName:'GetLiveUserOperations',ctx: UserContext , cb:(res: LiveUserOperation, err:Error|null)=> void} +export type GetLiveUserOperations_Output = void + +export type GetMigrationUpdate_Input = {rpcName:'GetMigrationUpdate',ctx: UserContext , cb:(res: MigrationUpdate, err:Error|null)=> void} +export type GetMigrationUpdate_Output = void + +export type BatchUser_Input = UserMethodInputs +export type BatchUser_Output = UserMethodOutputs + export type ServerMethods = { - LndGetInfo?: (ctx: LndGetInfo_Context, req: LndGetInfoRequest) => Promise - AddApp?: (ctx: AddApp_Context, req: AddAppRequest) => Promise - AuthApp?: (ctx: AuthApp_Context, req: AuthAppRequest) => Promise - Health?: (ctx: Health_Context) => Promise - EncryptionExchange?: (ctx: EncryptionExchange_Context, req: EncryptionExchangeRequest) => Promise - SetMockInvoiceAsPaid?: (ctx: SetMockInvoiceAsPaid_Context, req: SetMockInvoiceAsPaidRequest) => Promise - GetLnurlWithdrawInfo?: (ctx: GetLnurlWithdrawInfo_Context) => Promise - HandleLnurlWithdraw?: (ctx: HandleLnurlWithdraw_Context) => Promise - GetLnurlPayInfo?: (ctx: GetLnurlPayInfo_Context) => Promise - HandleLnurlPay?: (ctx: HandleLnurlPay_Context) => Promise - HandleLnurlAddress?: (ctx: HandleLnurlAddress_Context) => Promise - GetApp?: (ctx: GetApp_Context) => Promise - AddAppUser?: (ctx: AddAppUser_Context, req: AddAppUserRequest) => Promise - AddAppInvoice?: (ctx: AddAppInvoice_Context, req: AddAppInvoiceRequest) => Promise - AddAppUserInvoice?: (ctx: AddAppUserInvoice_Context, req: AddAppUserInvoiceRequest) => Promise - GetAppUser?: (ctx: GetAppUser_Context, req: GetAppUserRequest) => Promise - PayAppUserInvoice?: (ctx: PayAppUserInvoice_Context, req: PayAppUserInvoiceRequest) => Promise - SendAppUserToAppUserPayment?: (ctx: SendAppUserToAppUserPayment_Context, req: SendAppUserToAppUserPaymentRequest) => Promise - SendAppUserToAppPayment?: (ctx: SendAppUserToAppPayment_Context, req: SendAppUserToAppPaymentRequest) => Promise - GetAppUserLNURLInfo?: (ctx: GetAppUserLNURLInfo_Context, req: GetAppUserLNURLInfoRequest) => Promise - SetMockAppUserBalance?: (ctx: SetMockAppUserBalance_Context, req: SetMockAppUserBalanceRequest) => Promise - SetMockAppBalance?: (ctx: SetMockAppBalance_Context, req: SetMockAppBalanceRequest) => Promise - GetUserInfo?: (ctx: GetUserInfo_Context) => Promise - AddProduct?: (ctx: AddProduct_Context, req: AddProductRequest) => Promise - NewProductInvoice?: (ctx: NewProductInvoice_Context) => Promise - GetUserOperations?: (ctx: GetUserOperations_Context, req: GetUserOperationsRequest) => Promise - NewAddress?: (ctx: NewAddress_Context, req: NewAddressRequest) => Promise - PayAddress?: (ctx: PayAddress_Context, req: PayAddressRequest) => Promise - NewInvoice?: (ctx: NewInvoice_Context, req: NewInvoiceRequest) => Promise - DecodeInvoice?: (ctx: DecodeInvoice_Context, req: DecodeInvoiceRequest) => Promise - PayInvoice?: (ctx: PayInvoice_Context, req: PayInvoiceRequest) => Promise - OpenChannel?: (ctx: OpenChannel_Context, req: OpenChannelRequest) => Promise - GetLnurlWithdrawLink?: (ctx: GetLnurlWithdrawLink_Context) => Promise - GetLnurlPayLink?: (ctx: GetLnurlPayLink_Context) => Promise - GetLNURLChannelLink?: (ctx: GetLNURLChannelLink_Context) => Promise - GetLiveUserOperations?: (ctx: GetLiveUserOperations_Context, cb:(res: LiveUserOperation, err:Error|null)=> void) => void - GetMigrationUpdate?: (ctx: GetMigrationUpdate_Context, cb:(res: MigrationUpdate, err:Error|null)=> void) => void + LndGetInfo?: (req: LndGetInfo_Input) => Promise + AddApp?: (req: AddApp_Input) => Promise + AuthApp?: (req: AuthApp_Input) => Promise + Health?: (req: Health_Input) => Promise + EncryptionExchange?: (req: EncryptionExchange_Input) => Promise + SetMockInvoiceAsPaid?: (req: SetMockInvoiceAsPaid_Input) => Promise + GetLnurlWithdrawInfo?: (req: GetLnurlWithdrawInfo_Input) => Promise + HandleLnurlWithdraw?: (req: HandleLnurlWithdraw_Input) => Promise + GetLnurlPayInfo?: (req: GetLnurlPayInfo_Input) => Promise + HandleLnurlPay?: (req: HandleLnurlPay_Input) => Promise + HandleLnurlAddress?: (req: HandleLnurlAddress_Input) => Promise + GetApp?: (req: GetApp_Input) => Promise + AddAppUser?: (req: AddAppUser_Input) => Promise + AddAppInvoice?: (req: AddAppInvoice_Input) => Promise + AddAppUserInvoice?: (req: AddAppUserInvoice_Input) => Promise + GetAppUser?: (req: GetAppUser_Input) => Promise + PayAppUserInvoice?: (req: PayAppUserInvoice_Input) => Promise + SendAppUserToAppUserPayment?: (req: SendAppUserToAppUserPayment_Input) => Promise + SendAppUserToAppPayment?: (req: SendAppUserToAppPayment_Input) => Promise + GetAppUserLNURLInfo?: (req: GetAppUserLNURLInfo_Input) => Promise + SetMockAppUserBalance?: (req: SetMockAppUserBalance_Input) => Promise + SetMockAppBalance?: (req: SetMockAppBalance_Input) => Promise + GetUserInfo?: (req: GetUserInfo_Input) => Promise + AddProduct?: (req: AddProduct_Input) => Promise + NewProductInvoice?: (req: NewProductInvoice_Input) => Promise + GetUserOperations?: (req: GetUserOperations_Input) => Promise + NewAddress?: (req: NewAddress_Input) => Promise + PayAddress?: (req: PayAddress_Input) => Promise + NewInvoice?: (req: NewInvoice_Input) => Promise + DecodeInvoice?: (req: DecodeInvoice_Input) => Promise + PayInvoice?: (req: PayInvoice_Input) => Promise + OpenChannel?: (req: OpenChannel_Input) => Promise + GetLnurlWithdrawLink?: (req: GetLnurlWithdrawLink_Input) => Promise + GetLnurlPayLink?: (req: GetLnurlPayLink_Input) => Promise + GetLNURLChannelLink?: (req: GetLNURLChannelLink_Input) => Promise + GetLiveUserOperations?: (req: GetLiveUserOperations_Input) => Promise + GetMigrationUpdate?: (req: GetMigrationUpdate_Input) => Promise } export enum AddressType { @@ -276,131 +225,89 @@ export type OptionsBaseMessage = { allOptionalsAreSet?: true } -export type AddAppUserRequest = { - identifier: string - fail_if_exists: boolean - balance: number +export type LndGetInfoResponse = { + alias: string } -export const AddAppUserRequestOptionalFields: [] = [] -export type AddAppUserRequestOptions = OptionsBaseMessage & { +export const LndGetInfoResponseOptionalFields: [] = [] +export type LndGetInfoResponseOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - identifier_CustomCheck?: (v: string) => boolean - fail_if_exists_CustomCheck?: (v: boolean) => boolean - balance_CustomCheck?: (v: number) => boolean + alias_CustomCheck?: (v: string) => boolean } -export const AddAppUserRequestValidate = (o?: AddAppUserRequest, opts: AddAppUserRequestOptions = {}, path: string = 'AddAppUserRequest::root.'): Error | null => { +export const LndGetInfoResponseValidate = (o?: LndGetInfoResponse, opts: LndGetInfoResponseOptions = {}, path: string = 'LndGetInfoResponse::root.'): Error | null => { if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - if (typeof o.identifier !== 'string') return new Error(`${path}.identifier: is not a string`) - if (opts.identifier_CustomCheck && !opts.identifier_CustomCheck(o.identifier)) return new Error(`${path}.identifier: custom check failed`) - - if (typeof o.fail_if_exists !== 'boolean') return new Error(`${path}.fail_if_exists: is not a boolean`) - if (opts.fail_if_exists_CustomCheck && !opts.fail_if_exists_CustomCheck(o.fail_if_exists)) return new Error(`${path}.fail_if_exists: custom check failed`) - - if (typeof o.balance !== 'number') return new Error(`${path}.balance: is not a number`) - if (opts.balance_CustomCheck && !opts.balance_CustomCheck(o.balance)) return new Error(`${path}.balance: custom check failed`) + if (typeof o.alias !== 'string') return new Error(`${path}.alias: is not a string`) + if (opts.alias_CustomCheck && !opts.alias_CustomCheck(o.alias)) return new Error(`${path}.alias: custom check failed`) return null } -export type NewAddressRequest = { - addressType: AddressType -} -export const NewAddressRequestOptionalFields: [] = [] -export type NewAddressRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - addressType_CustomCheck?: (v: AddressType) => boolean -} -export const NewAddressRequestValidate = (o?: NewAddressRequest, opts: NewAddressRequestOptions = {}, path: string = 'NewAddressRequest::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (!enumCheckAddressType(o.addressType)) return new Error(`${path}.addressType: is not a valid AddressType`) - if (opts.addressType_CustomCheck && !opts.addressType_CustomCheck(o.addressType)) return new Error(`${path}.addressType: custom check failed`) - - return null -} - -export type PayInvoiceRequest = { - invoice: string - amount: number -} -export const PayInvoiceRequestOptionalFields: [] = [] -export type PayInvoiceRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - invoice_CustomCheck?: (v: string) => boolean - amount_CustomCheck?: (v: number) => boolean -} -export const PayInvoiceRequestValidate = (o?: PayInvoiceRequest, opts: PayInvoiceRequestOptions = {}, path: string = 'PayInvoiceRequest::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.invoice !== 'string') return new Error(`${path}.invoice: is not a string`) - if (opts.invoice_CustomCheck && !opts.invoice_CustomCheck(o.invoice)) return new Error(`${path}.invoice: custom check failed`) - - if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`) - if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`) - - return null -} - -export type OpenChannelRequest = { - destination: string - fundingAmount: number - pushAmount: number - closeAddress: string -} -export const OpenChannelRequestOptionalFields: [] = [] -export type OpenChannelRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - destination_CustomCheck?: (v: string) => boolean - fundingAmount_CustomCheck?: (v: number) => boolean - pushAmount_CustomCheck?: (v: number) => boolean - closeAddress_CustomCheck?: (v: string) => boolean -} -export const OpenChannelRequestValidate = (o?: OpenChannelRequest, opts: OpenChannelRequestOptions = {}, path: string = 'OpenChannelRequest::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.destination !== 'string') return new Error(`${path}.destination: is not a string`) - if (opts.destination_CustomCheck && !opts.destination_CustomCheck(o.destination)) return new Error(`${path}.destination: custom check failed`) - - if (typeof o.fundingAmount !== 'number') return new Error(`${path}.fundingAmount: is not a number`) - if (opts.fundingAmount_CustomCheck && !opts.fundingAmount_CustomCheck(o.fundingAmount)) return new Error(`${path}.fundingAmount: custom check failed`) - - if (typeof o.pushAmount !== 'number') return new Error(`${path}.pushAmount: is not a number`) - if (opts.pushAmount_CustomCheck && !opts.pushAmount_CustomCheck(o.pushAmount)) return new Error(`${path}.pushAmount: custom check failed`) - - if (typeof o.closeAddress !== 'string') return new Error(`${path}.closeAddress: is not a string`) - if (opts.closeAddress_CustomCheck && !opts.closeAddress_CustomCheck(o.closeAddress)) return new Error(`${path}.closeAddress: custom check failed`) - - return null -} - -export type AddAppRequest = { +export type AuthAppRequest = { name: string - allow_user_creation: boolean + allow_user_creation?: boolean } -export const AddAppRequestOptionalFields: [] = [] -export type AddAppRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] +export type AuthAppRequestOptionalField = 'allow_user_creation' +export const AuthAppRequestOptionalFields: AuthAppRequestOptionalField[] = ['allow_user_creation'] +export type AuthAppRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: AuthAppRequestOptionalField[] name_CustomCheck?: (v: string) => boolean - allow_user_creation_CustomCheck?: (v: boolean) => boolean + allow_user_creation_CustomCheck?: (v?: boolean) => boolean } -export const AddAppRequestValidate = (o?: AddAppRequest, opts: AddAppRequestOptions = {}, path: string = 'AddAppRequest::root.'): Error | null => { +export const AuthAppRequestValidate = (o?: AuthAppRequest, opts: AuthAppRequestOptions = {}, path: string = 'AuthAppRequest::root.'): Error | null => { if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') if (typeof o.name !== 'string') return new Error(`${path}.name: is not a string`) if (opts.name_CustomCheck && !opts.name_CustomCheck(o.name)) return new Error(`${path}.name: custom check failed`) - if (typeof o.allow_user_creation !== 'boolean') return new Error(`${path}.allow_user_creation: is not a boolean`) + if ((o.allow_user_creation || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('allow_user_creation')) && typeof o.allow_user_creation !== 'boolean') return new Error(`${path}.allow_user_creation: is not a boolean`) if (opts.allow_user_creation_CustomCheck && !opts.allow_user_creation_CustomCheck(o.allow_user_creation)) return new Error(`${path}.allow_user_creation: custom check failed`) return null } +export type NewInvoiceRequest = { + amountSats: number + memo: string +} +export const NewInvoiceRequestOptionalFields: [] = [] +export type NewInvoiceRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + amountSats_CustomCheck?: (v: number) => boolean + memo_CustomCheck?: (v: string) => boolean +} +export const NewInvoiceRequestValidate = (o?: NewInvoiceRequest, opts: NewInvoiceRequestOptions = {}, path: string = 'NewInvoiceRequest::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.amountSats !== 'number') return new Error(`${path}.amountSats: is not a number`) + if (opts.amountSats_CustomCheck && !opts.amountSats_CustomCheck(o.amountSats)) return new Error(`${path}.amountSats: custom check failed`) + + if (typeof o.memo !== 'string') return new Error(`${path}.memo: is not a string`) + if (opts.memo_CustomCheck && !opts.memo_CustomCheck(o.memo)) return new Error(`${path}.memo: custom check failed`) + + return null +} + +export type GetProductBuyLinkResponse = { + link: string +} +export const GetProductBuyLinkResponseOptionalFields: [] = [] +export type GetProductBuyLinkResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + link_CustomCheck?: (v: string) => boolean +} +export const GetProductBuyLinkResponseValidate = (o?: GetProductBuyLinkResponse, opts: GetProductBuyLinkResponseOptions = {}, path: string = 'GetProductBuyLinkResponse::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.link !== 'string') return new Error(`${path}.link: is not a string`) + if (opts.link_CustomCheck && !opts.link_CustomCheck(o.link)) return new Error(`${path}.link: custom check failed`) + + return null +} + export type AddAppUserInvoiceRequest = { receiver_identifier: string payer_identifier: string @@ -435,43 +342,33 @@ export const AddAppUserInvoiceRequestValidate = (o?: AddAppUserInvoiceRequest, o return null } -export type SendAppUserToAppUserPaymentRequest = { - from_user_identifier: string - to_user_identifier: string - amount: number +export type GetAppUserRequest = { + user_identifier: string } -export const SendAppUserToAppUserPaymentRequestOptionalFields: [] = [] -export type SendAppUserToAppUserPaymentRequestOptions = OptionsBaseMessage & { +export const GetAppUserRequestOptionalFields: [] = [] +export type GetAppUserRequestOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - from_user_identifier_CustomCheck?: (v: string) => boolean - to_user_identifier_CustomCheck?: (v: string) => boolean - amount_CustomCheck?: (v: number) => boolean + user_identifier_CustomCheck?: (v: string) => boolean } -export const SendAppUserToAppUserPaymentRequestValidate = (o?: SendAppUserToAppUserPaymentRequest, opts: SendAppUserToAppUserPaymentRequestOptions = {}, path: string = 'SendAppUserToAppUserPaymentRequest::root.'): Error | null => { +export const GetAppUserRequestValidate = (o?: GetAppUserRequest, opts: GetAppUserRequestOptions = {}, path: string = 'GetAppUserRequest::root.'): Error | null => { if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - if (typeof o.from_user_identifier !== 'string') return new Error(`${path}.from_user_identifier: is not a string`) - if (opts.from_user_identifier_CustomCheck && !opts.from_user_identifier_CustomCheck(o.from_user_identifier)) return new Error(`${path}.from_user_identifier: custom check failed`) - - if (typeof o.to_user_identifier !== 'string') return new Error(`${path}.to_user_identifier: is not a string`) - if (opts.to_user_identifier_CustomCheck && !opts.to_user_identifier_CustomCheck(o.to_user_identifier)) return new Error(`${path}.to_user_identifier: custom check failed`) - - if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`) - if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`) + if (typeof o.user_identifier !== 'string') return new Error(`${path}.user_identifier: is not a string`) + if (opts.user_identifier_CustomCheck && !opts.user_identifier_CustomCheck(o.user_identifier)) return new Error(`${path}.user_identifier: custom check failed`) return null } -export type DecodeInvoiceRequest = { +export type NewInvoiceResponse = { invoice: string } -export const DecodeInvoiceRequestOptionalFields: [] = [] -export type DecodeInvoiceRequestOptions = OptionsBaseMessage & { +export const NewInvoiceResponseOptionalFields: [] = [] +export type NewInvoiceResponseOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] invoice_CustomCheck?: (v: string) => boolean } -export const DecodeInvoiceRequestValidate = (o?: DecodeInvoiceRequest, opts: DecodeInvoiceRequestOptions = {}, path: string = 'DecodeInvoiceRequest::root.'): Error | null => { +export const NewInvoiceResponseValidate = (o?: NewInvoiceResponse, opts: NewInvoiceResponseOptions = {}, path: string = 'NewInvoiceResponse::root.'): Error | null => { if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') @@ -481,24 +378,6 @@ export const DecodeInvoiceRequestValidate = (o?: DecodeInvoiceRequest, opts: Dec return null } -export type DecodeInvoiceResponse = { - amount: number -} -export const DecodeInvoiceResponseOptionalFields: [] = [] -export type DecodeInvoiceResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - amount_CustomCheck?: (v: number) => boolean -} -export const DecodeInvoiceResponseValidate = (o?: DecodeInvoiceResponse, opts: DecodeInvoiceResponseOptions = {}, path: string = 'DecodeInvoiceResponse::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`) - if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`) - - return null -} - export type UserInfo = { userId: string balance: number @@ -570,48 +449,79 @@ export const GetUserOperationsRequestValidate = (o?: GetUserOperationsRequest, o return null } -export type Product = { - id: string - name: string - price_sats: number +export type MigrationUpdate = { + closure?: ClosureMigration + relays?: RelaysMigration } -export const ProductOptionalFields: [] = [] -export type ProductOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - id_CustomCheck?: (v: string) => boolean - name_CustomCheck?: (v: string) => boolean - price_sats_CustomCheck?: (v: number) => boolean +export type MigrationUpdateOptionalField = 'closure' | 'relays' +export const MigrationUpdateOptionalFields: MigrationUpdateOptionalField[] = ['closure', 'relays'] +export type MigrationUpdateOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: MigrationUpdateOptionalField[] + closure_Options?: ClosureMigrationOptions + relays_Options?: RelaysMigrationOptions } -export const ProductValidate = (o?: Product, opts: ProductOptions = {}, path: string = 'Product::root.'): Error | null => { +export const MigrationUpdateValidate = (o?: MigrationUpdate, opts: MigrationUpdateOptions = {}, path: string = 'MigrationUpdate::root.'): Error | null => { if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - if (typeof o.id !== 'string') return new Error(`${path}.id: is not a string`) - if (opts.id_CustomCheck && !opts.id_CustomCheck(o.id)) return new Error(`${path}.id: custom check failed`) + if (typeof o.closure === 'object' || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('closure')) { + const closureErr = ClosureMigrationValidate(o.closure, opts.closure_Options, `${path}.closure`) + if (closureErr !== null) return closureErr + } + - if (typeof o.name !== 'string') return new Error(`${path}.name: is not a string`) - if (opts.name_CustomCheck && !opts.name_CustomCheck(o.name)) return new Error(`${path}.name: custom check failed`) - - if (typeof o.price_sats !== 'number') return new Error(`${path}.price_sats: is not a number`) - if (opts.price_sats_CustomCheck && !opts.price_sats_CustomCheck(o.price_sats)) return new Error(`${path}.price_sats: custom check failed`) + if (typeof o.relays === 'object' || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('relays')) { + const relaysErr = RelaysMigrationValidate(o.relays, opts.relays_Options, `${path}.relays`) + if (relaysErr !== null) return relaysErr + } + return null } -export type SetMockInvoiceAsPaidRequest = { +export type AuthApp = { + app: Application + auth_token: string +} +export const AuthAppOptionalFields: [] = [] +export type AuthAppOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + app_Options?: ApplicationOptions + auth_token_CustomCheck?: (v: string) => boolean +} +export const AuthAppValidate = (o?: AuthApp, opts: AuthAppOptions = {}, path: string = 'AuthApp::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + const appErr = ApplicationValidate(o.app, opts.app_Options, `${path}.app`) + if (appErr !== null) return appErr + + + if (typeof o.auth_token !== 'string') return new Error(`${path}.auth_token: is not a string`) + if (opts.auth_token_CustomCheck && !opts.auth_token_CustomCheck(o.auth_token)) return new Error(`${path}.auth_token: custom check failed`) + + return null +} + +export type PayAppUserInvoiceRequest = { + user_identifier: string invoice: string amount: number } -export const SetMockInvoiceAsPaidRequestOptionalFields: [] = [] -export type SetMockInvoiceAsPaidRequestOptions = OptionsBaseMessage & { +export const PayAppUserInvoiceRequestOptionalFields: [] = [] +export type PayAppUserInvoiceRequestOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] + user_identifier_CustomCheck?: (v: string) => boolean invoice_CustomCheck?: (v: string) => boolean amount_CustomCheck?: (v: number) => boolean } -export const SetMockInvoiceAsPaidRequestValidate = (o?: SetMockInvoiceAsPaidRequest, opts: SetMockInvoiceAsPaidRequestOptions = {}, path: string = 'SetMockInvoiceAsPaidRequest::root.'): Error | null => { +export const PayAppUserInvoiceRequestValidate = (o?: PayAppUserInvoiceRequest, opts: PayAppUserInvoiceRequestOptions = {}, path: string = 'PayAppUserInvoiceRequest::root.'): Error | null => { if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + if (typeof o.user_identifier !== 'string') return new Error(`${path}.user_identifier: is not a string`) + if (opts.user_identifier_CustomCheck && !opts.user_identifier_CustomCheck(o.user_identifier)) return new Error(`${path}.user_identifier: custom check failed`) + if (typeof o.invoice !== 'string') return new Error(`${path}.invoice: is not a string`) if (opts.invoice_CustomCheck && !opts.invoice_CustomCheck(o.invoice)) return new Error(`${path}.invoice: custom check failed`) @@ -621,6 +531,98 @@ export const SetMockInvoiceAsPaidRequestValidate = (o?: SetMockInvoiceAsPaidRequ return null } +export type SetMockAppUserBalanceRequest = { + user_identifier: string + amount: number +} +export const SetMockAppUserBalanceRequestOptionalFields: [] = [] +export type SetMockAppUserBalanceRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + user_identifier_CustomCheck?: (v: string) => boolean + amount_CustomCheck?: (v: number) => boolean +} +export const SetMockAppUserBalanceRequestValidate = (o?: SetMockAppUserBalanceRequest, opts: SetMockAppUserBalanceRequestOptions = {}, path: string = 'SetMockAppUserBalanceRequest::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.user_identifier !== 'string') return new Error(`${path}.user_identifier: is not a string`) + if (opts.user_identifier_CustomCheck && !opts.user_identifier_CustomCheck(o.user_identifier)) return new Error(`${path}.user_identifier: custom check failed`) + + if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`) + if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`) + + return null +} + +export type NewAddressResponse = { + address: string +} +export const NewAddressResponseOptionalFields: [] = [] +export type NewAddressResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + address_CustomCheck?: (v: string) => boolean +} +export const NewAddressResponseValidate = (o?: NewAddressResponse, opts: NewAddressResponseOptions = {}, path: string = 'NewAddressResponse::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.address !== 'string') return new Error(`${path}.address: is not a string`) + if (opts.address_CustomCheck && !opts.address_CustomCheck(o.address)) return new Error(`${path}.address: custom check failed`) + + return null +} + +export type PayAddressResponse = { + txId: string + operation_id: string + service_fee: number + network_fee: number +} +export const PayAddressResponseOptionalFields: [] = [] +export type PayAddressResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + txId_CustomCheck?: (v: string) => boolean + operation_id_CustomCheck?: (v: string) => boolean + service_fee_CustomCheck?: (v: number) => boolean + network_fee_CustomCheck?: (v: number) => boolean +} +export const PayAddressResponseValidate = (o?: PayAddressResponse, opts: PayAddressResponseOptions = {}, path: string = 'PayAddressResponse::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.txId !== 'string') return new Error(`${path}.txId: is not a string`) + if (opts.txId_CustomCheck && !opts.txId_CustomCheck(o.txId)) return new Error(`${path}.txId: custom check failed`) + + if (typeof o.operation_id !== 'string') return new Error(`${path}.operation_id: is not a string`) + if (opts.operation_id_CustomCheck && !opts.operation_id_CustomCheck(o.operation_id)) return new Error(`${path}.operation_id: custom check failed`) + + if (typeof o.service_fee !== 'number') return new Error(`${path}.service_fee: is not a number`) + if (opts.service_fee_CustomCheck && !opts.service_fee_CustomCheck(o.service_fee)) return new Error(`${path}.service_fee: custom check failed`) + + if (typeof o.network_fee !== 'number') return new Error(`${path}.network_fee: is not a number`) + if (opts.network_fee_CustomCheck && !opts.network_fee_CustomCheck(o.network_fee)) return new Error(`${path}.network_fee: custom check failed`) + + return null +} + +export type OpenChannelResponse = { + channelId: string +} +export const OpenChannelResponseOptionalFields: [] = [] +export type OpenChannelResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + channelId_CustomCheck?: (v: string) => boolean +} +export const OpenChannelResponseValidate = (o?: OpenChannelResponse, opts: OpenChannelResponseOptions = {}, path: string = 'OpenChannelResponse::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.channelId !== 'string') return new Error(`${path}.channelId: is not a string`) + if (opts.channelId_CustomCheck && !opts.channelId_CustomCheck(o.channelId)) return new Error(`${path}.channelId: custom check failed`) + + return null +} + export type LnurlWithdrawInfoResponse = { tag: string callback: string @@ -674,112 +676,450 @@ export const LnurlWithdrawInfoResponseValidate = (o?: LnurlWithdrawInfoResponse, return null } -export type HandleLnurlPayResponse = { - pr: string - routes: Empty[] +export type UserOperations = { + fromIndex: number + toIndex: number + operations: UserOperation[] } -export const HandleLnurlPayResponseOptionalFields: [] = [] -export type HandleLnurlPayResponseOptions = OptionsBaseMessage & { +export const UserOperationsOptionalFields: [] = [] +export type UserOperationsOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - pr_CustomCheck?: (v: string) => boolean - routes_ItemOptions?: EmptyOptions - routes_CustomCheck?: (v: Empty[]) => boolean + fromIndex_CustomCheck?: (v: number) => boolean + toIndex_CustomCheck?: (v: number) => boolean + operations_ItemOptions?: UserOperationOptions + operations_CustomCheck?: (v: UserOperation[]) => boolean } -export const HandleLnurlPayResponseValidate = (o?: HandleLnurlPayResponse, opts: HandleLnurlPayResponseOptions = {}, path: string = 'HandleLnurlPayResponse::root.'): Error | null => { +export const UserOperationsValidate = (o?: UserOperations, opts: UserOperationsOptions = {}, path: string = 'UserOperations::root.'): Error | null => { if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - if (typeof o.pr !== 'string') return new Error(`${path}.pr: is not a string`) - if (opts.pr_CustomCheck && !opts.pr_CustomCheck(o.pr)) return new Error(`${path}.pr: custom check failed`) + if (typeof o.fromIndex !== 'number') return new Error(`${path}.fromIndex: is not a number`) + if (opts.fromIndex_CustomCheck && !opts.fromIndex_CustomCheck(o.fromIndex)) return new Error(`${path}.fromIndex: custom check failed`) - if (!Array.isArray(o.routes)) return new Error(`${path}.routes: is not an array`) - for (let index = 0; index < o.routes.length; index++) { - const routesErr = EmptyValidate(o.routes[index], opts.routes_ItemOptions, `${path}.routes[${index}]`) - if (routesErr !== null) return routesErr + if (typeof o.toIndex !== 'number') return new Error(`${path}.toIndex: is not a number`) + if (opts.toIndex_CustomCheck && !opts.toIndex_CustomCheck(o.toIndex)) return new Error(`${path}.toIndex: custom check failed`) + + if (!Array.isArray(o.operations)) return new Error(`${path}.operations: is not an array`) + for (let index = 0; index < o.operations.length; index++) { + const operationsErr = UserOperationValidate(o.operations[index], opts.operations_ItemOptions, `${path}.operations[${index}]`) + if (operationsErr !== null) return operationsErr } - if (opts.routes_CustomCheck && !opts.routes_CustomCheck(o.routes)) return new Error(`${path}.routes: custom check failed`) + if (opts.operations_CustomCheck && !opts.operations_CustomCheck(o.operations)) return new Error(`${path}.operations: custom check failed`) return null } -export type NewInvoiceResponse = { - invoice: string +export type Empty = { } -export const NewInvoiceResponseOptionalFields: [] = [] -export type NewInvoiceResponseOptions = OptionsBaseMessage & { +export const EmptyOptionalFields: [] = [] +export type EmptyOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] +} +export const EmptyValidate = (o?: Empty, opts: EmptyOptions = {}, path: string = 'Empty::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + return null +} + +export type Application = { + name: string + id: string + balance: number + npub: string +} +export const ApplicationOptionalFields: [] = [] +export type ApplicationOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + name_CustomCheck?: (v: string) => boolean + id_CustomCheck?: (v: string) => boolean + balance_CustomCheck?: (v: number) => boolean + npub_CustomCheck?: (v: string) => boolean +} +export const ApplicationValidate = (o?: Application, opts: ApplicationOptions = {}, path: string = 'Application::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.name !== 'string') return new Error(`${path}.name: is not a string`) + if (opts.name_CustomCheck && !opts.name_CustomCheck(o.name)) return new Error(`${path}.name: custom check failed`) + + if (typeof o.id !== 'string') return new Error(`${path}.id: is not a string`) + if (opts.id_CustomCheck && !opts.id_CustomCheck(o.id)) return new Error(`${path}.id: custom check failed`) + + if (typeof o.balance !== 'number') return new Error(`${path}.balance: is not a number`) + if (opts.balance_CustomCheck && !opts.balance_CustomCheck(o.balance)) return new Error(`${path}.balance: custom check failed`) + + if (typeof o.npub !== 'string') return new Error(`${path}.npub: is not a string`) + if (opts.npub_CustomCheck && !opts.npub_CustomCheck(o.npub)) return new Error(`${path}.npub: custom check failed`) + + return null +} + +export type AddAppUserRequest = { + identifier: string + fail_if_exists: boolean + balance: number +} +export const AddAppUserRequestOptionalFields: [] = [] +export type AddAppUserRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + identifier_CustomCheck?: (v: string) => boolean + fail_if_exists_CustomCheck?: (v: boolean) => boolean + balance_CustomCheck?: (v: number) => boolean +} +export const AddAppUserRequestValidate = (o?: AddAppUserRequest, opts: AddAppUserRequestOptions = {}, path: string = 'AddAppUserRequest::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.identifier !== 'string') return new Error(`${path}.identifier: is not a string`) + if (opts.identifier_CustomCheck && !opts.identifier_CustomCheck(o.identifier)) return new Error(`${path}.identifier: custom check failed`) + + if (typeof o.fail_if_exists !== 'boolean') return new Error(`${path}.fail_if_exists: is not a boolean`) + if (opts.fail_if_exists_CustomCheck && !opts.fail_if_exists_CustomCheck(o.fail_if_exists)) return new Error(`${path}.fail_if_exists: custom check failed`) + + if (typeof o.balance !== 'number') return new Error(`${path}.balance: is not a number`) + if (opts.balance_CustomCheck && !opts.balance_CustomCheck(o.balance)) return new Error(`${path}.balance: custom check failed`) + + return null +} + +export type OpenChannelRequest = { + destination: string + fundingAmount: number + pushAmount: number + closeAddress: string +} +export const OpenChannelRequestOptionalFields: [] = [] +export type OpenChannelRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + destination_CustomCheck?: (v: string) => boolean + fundingAmount_CustomCheck?: (v: number) => boolean + pushAmount_CustomCheck?: (v: number) => boolean + closeAddress_CustomCheck?: (v: string) => boolean +} +export const OpenChannelRequestValidate = (o?: OpenChannelRequest, opts: OpenChannelRequestOptions = {}, path: string = 'OpenChannelRequest::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.destination !== 'string') return new Error(`${path}.destination: is not a string`) + if (opts.destination_CustomCheck && !opts.destination_CustomCheck(o.destination)) return new Error(`${path}.destination: custom check failed`) + + if (typeof o.fundingAmount !== 'number') return new Error(`${path}.fundingAmount: is not a number`) + if (opts.fundingAmount_CustomCheck && !opts.fundingAmount_CustomCheck(o.fundingAmount)) return new Error(`${path}.fundingAmount: custom check failed`) + + if (typeof o.pushAmount !== 'number') return new Error(`${path}.pushAmount: is not a number`) + if (opts.pushAmount_CustomCheck && !opts.pushAmount_CustomCheck(o.pushAmount)) return new Error(`${path}.pushAmount: custom check failed`) + + if (typeof o.closeAddress !== 'string') return new Error(`${path}.closeAddress: is not a string`) + if (opts.closeAddress_CustomCheck && !opts.closeAddress_CustomCheck(o.closeAddress)) return new Error(`${path}.closeAddress: custom check failed`) + + return null +} + +export type LndGetInfoRequest = { + nodeId: number +} +export const LndGetInfoRequestOptionalFields: [] = [] +export type LndGetInfoRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + nodeId_CustomCheck?: (v: number) => boolean +} +export const LndGetInfoRequestValidate = (o?: LndGetInfoRequest, opts: LndGetInfoRequestOptions = {}, path: string = 'LndGetInfoRequest::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.nodeId !== 'number') return new Error(`${path}.nodeId: is not a number`) + if (opts.nodeId_CustomCheck && !opts.nodeId_CustomCheck(o.nodeId)) return new Error(`${path}.nodeId: custom check failed`) + + return null +} + +export type SetMockInvoiceAsPaidRequest = { + invoice: string + amount: number +} +export const SetMockInvoiceAsPaidRequestOptionalFields: [] = [] +export type SetMockInvoiceAsPaidRequestOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] invoice_CustomCheck?: (v: string) => boolean + amount_CustomCheck?: (v: number) => boolean } -export const NewInvoiceResponseValidate = (o?: NewInvoiceResponse, opts: NewInvoiceResponseOptions = {}, path: string = 'NewInvoiceResponse::root.'): Error | null => { +export const SetMockInvoiceAsPaidRequestValidate = (o?: SetMockInvoiceAsPaidRequest, opts: SetMockInvoiceAsPaidRequestOptions = {}, path: string = 'SetMockInvoiceAsPaidRequest::root.'): Error | null => { if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') if (typeof o.invoice !== 'string') return new Error(`${path}.invoice: is not a string`) if (opts.invoice_CustomCheck && !opts.invoice_CustomCheck(o.invoice)) return new Error(`${path}.invoice: custom check failed`) - return null -} - -export type LndGetInfoResponse = { - alias: string -} -export const LndGetInfoResponseOptionalFields: [] = [] -export type LndGetInfoResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - alias_CustomCheck?: (v: string) => boolean -} -export const LndGetInfoResponseValidate = (o?: LndGetInfoResponse, opts: LndGetInfoResponseOptions = {}, path: string = 'LndGetInfoResponse::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.alias !== 'string') return new Error(`${path}.alias: is not a string`) - if (opts.alias_CustomCheck && !opts.alias_CustomCheck(o.alias)) return new Error(`${path}.alias: custom check failed`) + if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`) + if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`) return null } -export type GetAppUserRequest = { - user_identifier: string +export type AddAppRequest = { + name: string + allow_user_creation: boolean } -export const GetAppUserRequestOptionalFields: [] = [] -export type GetAppUserRequestOptions = OptionsBaseMessage & { +export const AddAppRequestOptionalFields: [] = [] +export type AddAppRequestOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - user_identifier_CustomCheck?: (v: string) => boolean + name_CustomCheck?: (v: string) => boolean + allow_user_creation_CustomCheck?: (v: boolean) => boolean } -export const GetAppUserRequestValidate = (o?: GetAppUserRequest, opts: GetAppUserRequestOptions = {}, path: string = 'GetAppUserRequest::root.'): Error | null => { +export const AddAppRequestValidate = (o?: AddAppRequest, opts: AddAppRequestOptions = {}, path: string = 'AddAppRequest::root.'): Error | null => { if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - if (typeof o.user_identifier !== 'string') return new Error(`${path}.user_identifier: is not a string`) - if (opts.user_identifier_CustomCheck && !opts.user_identifier_CustomCheck(o.user_identifier)) return new Error(`${path}.user_identifier: custom check failed`) + if (typeof o.name !== 'string') return new Error(`${path}.name: is not a string`) + if (opts.name_CustomCheck && !opts.name_CustomCheck(o.name)) return new Error(`${path}.name: custom check failed`) + + if (typeof o.allow_user_creation !== 'boolean') return new Error(`${path}.allow_user_creation: is not a boolean`) + if (opts.allow_user_creation_CustomCheck && !opts.allow_user_creation_CustomCheck(o.allow_user_creation)) return new Error(`${path}.allow_user_creation: custom check failed`) return null } -export type PayAddressRequest = { - address: string - amoutSats: number - satsPerVByte: number +export type AddAppInvoiceRequest = { + payer_identifier: string + http_callback_url: string + invoice_req: NewInvoiceRequest } -export const PayAddressRequestOptionalFields: [] = [] -export type PayAddressRequestOptions = OptionsBaseMessage & { +export const AddAppInvoiceRequestOptionalFields: [] = [] +export type AddAppInvoiceRequestOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - address_CustomCheck?: (v: string) => boolean - amoutSats_CustomCheck?: (v: number) => boolean - satsPerVByte_CustomCheck?: (v: number) => boolean + payer_identifier_CustomCheck?: (v: string) => boolean + http_callback_url_CustomCheck?: (v: string) => boolean + invoice_req_Options?: NewInvoiceRequestOptions } -export const PayAddressRequestValidate = (o?: PayAddressRequest, opts: PayAddressRequestOptions = {}, path: string = 'PayAddressRequest::root.'): Error | null => { +export const AddAppInvoiceRequestValidate = (o?: AddAppInvoiceRequest, opts: AddAppInvoiceRequestOptions = {}, path: string = 'AddAppInvoiceRequest::root.'): Error | null => { if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - if (typeof o.address !== 'string') return new Error(`${path}.address: is not a string`) - if (opts.address_CustomCheck && !opts.address_CustomCheck(o.address)) return new Error(`${path}.address: custom check failed`) + if (typeof o.payer_identifier !== 'string') return new Error(`${path}.payer_identifier: is not a string`) + if (opts.payer_identifier_CustomCheck && !opts.payer_identifier_CustomCheck(o.payer_identifier)) return new Error(`${path}.payer_identifier: custom check failed`) - if (typeof o.amoutSats !== 'number') return new Error(`${path}.amoutSats: is not a number`) - if (opts.amoutSats_CustomCheck && !opts.amoutSats_CustomCheck(o.amoutSats)) return new Error(`${path}.amoutSats: custom check failed`) + if (typeof o.http_callback_url !== 'string') return new Error(`${path}.http_callback_url: is not a string`) + if (opts.http_callback_url_CustomCheck && !opts.http_callback_url_CustomCheck(o.http_callback_url)) return new Error(`${path}.http_callback_url: custom check failed`) - if (typeof o.satsPerVByte !== 'number') return new Error(`${path}.satsPerVByte: is not a number`) - if (opts.satsPerVByte_CustomCheck && !opts.satsPerVByte_CustomCheck(o.satsPerVByte)) return new Error(`${path}.satsPerVByte: custom check failed`) + const invoice_reqErr = NewInvoiceRequestValidate(o.invoice_req, opts.invoice_req_Options, `${path}.invoice_req`) + if (invoice_reqErr !== null) return invoice_reqErr + + + return null +} + +export type SendAppUserToAppUserPaymentRequest = { + from_user_identifier: string + to_user_identifier: string + amount: number +} +export const SendAppUserToAppUserPaymentRequestOptionalFields: [] = [] +export type SendAppUserToAppUserPaymentRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + from_user_identifier_CustomCheck?: (v: string) => boolean + to_user_identifier_CustomCheck?: (v: string) => boolean + amount_CustomCheck?: (v: number) => boolean +} +export const SendAppUserToAppUserPaymentRequestValidate = (o?: SendAppUserToAppUserPaymentRequest, opts: SendAppUserToAppUserPaymentRequestOptions = {}, path: string = 'SendAppUserToAppUserPaymentRequest::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.from_user_identifier !== 'string') return new Error(`${path}.from_user_identifier: is not a string`) + if (opts.from_user_identifier_CustomCheck && !opts.from_user_identifier_CustomCheck(o.from_user_identifier)) return new Error(`${path}.from_user_identifier: custom check failed`) + + if (typeof o.to_user_identifier !== 'string') return new Error(`${path}.to_user_identifier: is not a string`) + if (opts.to_user_identifier_CustomCheck && !opts.to_user_identifier_CustomCheck(o.to_user_identifier)) return new Error(`${path}.to_user_identifier: custom check failed`) + + if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`) + if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`) + + return null +} + +export type SendAppUserToAppPaymentRequest = { + from_user_identifier: string + amount: number +} +export const SendAppUserToAppPaymentRequestOptionalFields: [] = [] +export type SendAppUserToAppPaymentRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + from_user_identifier_CustomCheck?: (v: string) => boolean + amount_CustomCheck?: (v: number) => boolean +} +export const SendAppUserToAppPaymentRequestValidate = (o?: SendAppUserToAppPaymentRequest, opts: SendAppUserToAppPaymentRequestOptions = {}, path: string = 'SendAppUserToAppPaymentRequest::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.from_user_identifier !== 'string') return new Error(`${path}.from_user_identifier: is not a string`) + if (opts.from_user_identifier_CustomCheck && !opts.from_user_identifier_CustomCheck(o.from_user_identifier)) return new Error(`${path}.from_user_identifier: custom check failed`) + + if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`) + if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`) + + return null +} + +export type LnurlPayInfoResponse = { + tag: string + callback: string + maxSendable: number + minSendable: number + metadata: string + allowsNostr: boolean + nostrPubkey: string +} +export const LnurlPayInfoResponseOptionalFields: [] = [] +export type LnurlPayInfoResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + tag_CustomCheck?: (v: string) => boolean + callback_CustomCheck?: (v: string) => boolean + maxSendable_CustomCheck?: (v: number) => boolean + minSendable_CustomCheck?: (v: number) => boolean + metadata_CustomCheck?: (v: string) => boolean + allowsNostr_CustomCheck?: (v: boolean) => boolean + nostrPubkey_CustomCheck?: (v: string) => boolean +} +export const LnurlPayInfoResponseValidate = (o?: LnurlPayInfoResponse, opts: LnurlPayInfoResponseOptions = {}, path: string = 'LnurlPayInfoResponse::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.tag !== 'string') return new Error(`${path}.tag: is not a string`) + if (opts.tag_CustomCheck && !opts.tag_CustomCheck(o.tag)) return new Error(`${path}.tag: custom check failed`) + + if (typeof o.callback !== 'string') return new Error(`${path}.callback: is not a string`) + if (opts.callback_CustomCheck && !opts.callback_CustomCheck(o.callback)) return new Error(`${path}.callback: custom check failed`) + + if (typeof o.maxSendable !== 'number') return new Error(`${path}.maxSendable: is not a number`) + if (opts.maxSendable_CustomCheck && !opts.maxSendable_CustomCheck(o.maxSendable)) return new Error(`${path}.maxSendable: custom check failed`) + + if (typeof o.minSendable !== 'number') return new Error(`${path}.minSendable: is not a number`) + if (opts.minSendable_CustomCheck && !opts.minSendable_CustomCheck(o.minSendable)) return new Error(`${path}.minSendable: custom check failed`) + + if (typeof o.metadata !== 'string') return new Error(`${path}.metadata: is not a string`) + if (opts.metadata_CustomCheck && !opts.metadata_CustomCheck(o.metadata)) return new Error(`${path}.metadata: custom check failed`) + + if (typeof o.allowsNostr !== 'boolean') return new Error(`${path}.allowsNostr: is not a boolean`) + if (opts.allowsNostr_CustomCheck && !opts.allowsNostr_CustomCheck(o.allowsNostr)) return new Error(`${path}.allowsNostr: custom check failed`) + + if (typeof o.nostrPubkey !== 'string') return new Error(`${path}.nostrPubkey: is not a string`) + if (opts.nostrPubkey_CustomCheck && !opts.nostrPubkey_CustomCheck(o.nostrPubkey)) return new Error(`${path}.nostrPubkey: custom check failed`) + + return null +} + +export type AddProductRequest = { + name: string + price_sats: number +} +export const AddProductRequestOptionalFields: [] = [] +export type AddProductRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + name_CustomCheck?: (v: string) => boolean + price_sats_CustomCheck?: (v: number) => boolean +} +export const AddProductRequestValidate = (o?: AddProductRequest, opts: AddProductRequestOptions = {}, path: string = 'AddProductRequest::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.name !== 'string') return new Error(`${path}.name: is not a string`) + if (opts.name_CustomCheck && !opts.name_CustomCheck(o.name)) return new Error(`${path}.name: custom check failed`) + + if (typeof o.price_sats !== 'number') return new Error(`${path}.price_sats: is not a number`) + if (opts.price_sats_CustomCheck && !opts.price_sats_CustomCheck(o.price_sats)) return new Error(`${path}.price_sats: custom check failed`) + + return null +} + +export type LiveUserOperation = { + operation: UserOperation +} +export const LiveUserOperationOptionalFields: [] = [] +export type LiveUserOperationOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + operation_Options?: UserOperationOptions +} +export const LiveUserOperationValidate = (o?: LiveUserOperation, opts: LiveUserOperationOptions = {}, path: string = 'LiveUserOperation::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + const operationErr = UserOperationValidate(o.operation, opts.operation_Options, `${path}.operation`) + if (operationErr !== null) return operationErr + + + return null +} + +export type SetMockAppBalanceRequest = { + amount: number +} +export const SetMockAppBalanceRequestOptionalFields: [] = [] +export type SetMockAppBalanceRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + amount_CustomCheck?: (v: number) => boolean +} +export const SetMockAppBalanceRequestValidate = (o?: SetMockAppBalanceRequest, opts: SetMockAppBalanceRequestOptions = {}, path: string = 'SetMockAppBalanceRequest::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`) + if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`) + + return null +} + +export type DecodeInvoiceResponse = { + amount: number +} +export const DecodeInvoiceResponseOptionalFields: [] = [] +export type DecodeInvoiceResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + amount_CustomCheck?: (v: number) => boolean +} +export const DecodeInvoiceResponseValidate = (o?: DecodeInvoiceResponse, opts: DecodeInvoiceResponseOptions = {}, path: string = 'DecodeInvoiceResponse::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`) + if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`) + + return null +} + +export type PayInvoiceResponse = { + preimage: string + amount_paid: number + operation_id: string + service_fee: number + network_fee: number +} +export const PayInvoiceResponseOptionalFields: [] = [] +export type PayInvoiceResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + preimage_CustomCheck?: (v: string) => boolean + amount_paid_CustomCheck?: (v: number) => boolean + operation_id_CustomCheck?: (v: string) => boolean + service_fee_CustomCheck?: (v: number) => boolean + network_fee_CustomCheck?: (v: number) => boolean +} +export const PayInvoiceResponseValidate = (o?: PayInvoiceResponse, opts: PayInvoiceResponseOptions = {}, path: string = 'PayInvoiceResponse::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.preimage !== 'string') return new Error(`${path}.preimage: is not a string`) + if (opts.preimage_CustomCheck && !opts.preimage_CustomCheck(o.preimage)) return new Error(`${path}.preimage: custom check failed`) + + if (typeof o.amount_paid !== 'number') return new Error(`${path}.amount_paid: is not a number`) + if (opts.amount_paid_CustomCheck && !opts.amount_paid_CustomCheck(o.amount_paid)) return new Error(`${path}.amount_paid: custom check failed`) + + if (typeof o.operation_id !== 'string') return new Error(`${path}.operation_id: is not a string`) + if (opts.operation_id_CustomCheck && !opts.operation_id_CustomCheck(o.operation_id)) return new Error(`${path}.operation_id: custom check failed`) + + if (typeof o.service_fee !== 'number') return new Error(`${path}.service_fee: is not a number`) + if (opts.service_fee_CustomCheck && !opts.service_fee_CustomCheck(o.service_fee)) return new Error(`${path}.service_fee: custom check failed`) + + if (typeof o.network_fee !== 'number') return new Error(`${path}.network_fee: is not a number`) + if (opts.network_fee_CustomCheck && !opts.network_fee_CustomCheck(o.network_fee)) return new Error(`${path}.network_fee: custom check failed`) return null } @@ -833,283 +1173,6 @@ export const GetUserOperationsResponseValidate = (o?: GetUserOperationsResponse, return null } -export type LiveUserOperation = { - operation: UserOperation -} -export const LiveUserOperationOptionalFields: [] = [] -export type LiveUserOperationOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - operation_Options?: UserOperationOptions -} -export const LiveUserOperationValidate = (o?: LiveUserOperation, opts: LiveUserOperationOptions = {}, path: string = 'LiveUserOperation::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - const operationErr = UserOperationValidate(o.operation, opts.operation_Options, `${path}.operation`) - if (operationErr !== null) return operationErr - - - return null -} - -export type MigrationUpdate = { - closure?: ClosureMigration - relays?: RelaysMigration -} -export type MigrationUpdateOptionalField = 'closure' | 'relays' -export const MigrationUpdateOptionalFields: MigrationUpdateOptionalField[] = ['closure', 'relays'] -export type MigrationUpdateOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: MigrationUpdateOptionalField[] - closure_Options?: ClosureMigrationOptions - relays_Options?: RelaysMigrationOptions -} -export const MigrationUpdateValidate = (o?: MigrationUpdate, opts: MigrationUpdateOptions = {}, path: string = 'MigrationUpdate::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.closure === 'object' || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('closure')) { - const closureErr = ClosureMigrationValidate(o.closure, opts.closure_Options, `${path}.closure`) - if (closureErr !== null) return closureErr - } - - - if (typeof o.relays === 'object' || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('relays')) { - const relaysErr = RelaysMigrationValidate(o.relays, opts.relays_Options, `${path}.relays`) - if (relaysErr !== null) return relaysErr - } - - - return null -} - -export type LndGetInfoRequest = { - nodeId: number -} -export const LndGetInfoRequestOptionalFields: [] = [] -export type LndGetInfoRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - nodeId_CustomCheck?: (v: number) => boolean -} -export const LndGetInfoRequestValidate = (o?: LndGetInfoRequest, opts: LndGetInfoRequestOptions = {}, path: string = 'LndGetInfoRequest::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.nodeId !== 'number') return new Error(`${path}.nodeId: is not a number`) - if (opts.nodeId_CustomCheck && !opts.nodeId_CustomCheck(o.nodeId)) return new Error(`${path}.nodeId: custom check failed`) - - return null -} - -export type NewInvoiceRequest = { - amountSats: number - memo: string -} -export const NewInvoiceRequestOptionalFields: [] = [] -export type NewInvoiceRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - amountSats_CustomCheck?: (v: number) => boolean - memo_CustomCheck?: (v: string) => boolean -} -export const NewInvoiceRequestValidate = (o?: NewInvoiceRequest, opts: NewInvoiceRequestOptions = {}, path: string = 'NewInvoiceRequest::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.amountSats !== 'number') return new Error(`${path}.amountSats: is not a number`) - if (opts.amountSats_CustomCheck && !opts.amountSats_CustomCheck(o.amountSats)) return new Error(`${path}.amountSats: custom check failed`) - - if (typeof o.memo !== 'string') return new Error(`${path}.memo: is not a string`) - if (opts.memo_CustomCheck && !opts.memo_CustomCheck(o.memo)) return new Error(`${path}.memo: custom check failed`) - - return null -} - -export type UserOperations = { - fromIndex: number - toIndex: number - operations: UserOperation[] -} -export const UserOperationsOptionalFields: [] = [] -export type UserOperationsOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - fromIndex_CustomCheck?: (v: number) => boolean - toIndex_CustomCheck?: (v: number) => boolean - operations_ItemOptions?: UserOperationOptions - operations_CustomCheck?: (v: UserOperation[]) => boolean -} -export const UserOperationsValidate = (o?: UserOperations, opts: UserOperationsOptions = {}, path: string = 'UserOperations::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.fromIndex !== 'number') return new Error(`${path}.fromIndex: is not a number`) - if (opts.fromIndex_CustomCheck && !opts.fromIndex_CustomCheck(o.fromIndex)) return new Error(`${path}.fromIndex: custom check failed`) - - if (typeof o.toIndex !== 'number') return new Error(`${path}.toIndex: is not a number`) - if (opts.toIndex_CustomCheck && !opts.toIndex_CustomCheck(o.toIndex)) return new Error(`${path}.toIndex: custom check failed`) - - if (!Array.isArray(o.operations)) return new Error(`${path}.operations: is not an array`) - for (let index = 0; index < o.operations.length; index++) { - const operationsErr = UserOperationValidate(o.operations[index], opts.operations_ItemOptions, `${path}.operations[${index}]`) - if (operationsErr !== null) return operationsErr - } - if (opts.operations_CustomCheck && !opts.operations_CustomCheck(o.operations)) return new Error(`${path}.operations: custom check failed`) - - return null -} - -export type AddProductRequest = { - name: string - price_sats: number -} -export const AddProductRequestOptionalFields: [] = [] -export type AddProductRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - name_CustomCheck?: (v: string) => boolean - price_sats_CustomCheck?: (v: number) => boolean -} -export const AddProductRequestValidate = (o?: AddProductRequest, opts: AddProductRequestOptions = {}, path: string = 'AddProductRequest::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.name !== 'string') return new Error(`${path}.name: is not a string`) - if (opts.name_CustomCheck && !opts.name_CustomCheck(o.name)) return new Error(`${path}.name: custom check failed`) - - if (typeof o.price_sats !== 'number') return new Error(`${path}.price_sats: is not a number`) - if (opts.price_sats_CustomCheck && !opts.price_sats_CustomCheck(o.price_sats)) return new Error(`${path}.price_sats: custom check failed`) - - return null -} - -export type PayAddressResponse = { - txId: string - operation_id: string - service_fee: number - network_fee: number -} -export const PayAddressResponseOptionalFields: [] = [] -export type PayAddressResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - txId_CustomCheck?: (v: string) => boolean - operation_id_CustomCheck?: (v: string) => boolean - service_fee_CustomCheck?: (v: number) => boolean - network_fee_CustomCheck?: (v: number) => boolean -} -export const PayAddressResponseValidate = (o?: PayAddressResponse, opts: PayAddressResponseOptions = {}, path: string = 'PayAddressResponse::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.txId !== 'string') return new Error(`${path}.txId: is not a string`) - if (opts.txId_CustomCheck && !opts.txId_CustomCheck(o.txId)) return new Error(`${path}.txId: custom check failed`) - - if (typeof o.operation_id !== 'string') return new Error(`${path}.operation_id: is not a string`) - if (opts.operation_id_CustomCheck && !opts.operation_id_CustomCheck(o.operation_id)) return new Error(`${path}.operation_id: custom check failed`) - - if (typeof o.service_fee !== 'number') return new Error(`${path}.service_fee: is not a number`) - if (opts.service_fee_CustomCheck && !opts.service_fee_CustomCheck(o.service_fee)) return new Error(`${path}.service_fee: custom check failed`) - - if (typeof o.network_fee !== 'number') return new Error(`${path}.network_fee: is not a number`) - if (opts.network_fee_CustomCheck && !opts.network_fee_CustomCheck(o.network_fee)) return new Error(`${path}.network_fee: custom check failed`) - - return null -} - -export type AddAppInvoiceRequest = { - payer_identifier: string - http_callback_url: string - invoice_req: NewInvoiceRequest -} -export const AddAppInvoiceRequestOptionalFields: [] = [] -export type AddAppInvoiceRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - payer_identifier_CustomCheck?: (v: string) => boolean - http_callback_url_CustomCheck?: (v: string) => boolean - invoice_req_Options?: NewInvoiceRequestOptions -} -export const AddAppInvoiceRequestValidate = (o?: AddAppInvoiceRequest, opts: AddAppInvoiceRequestOptions = {}, path: string = 'AddAppInvoiceRequest::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.payer_identifier !== 'string') return new Error(`${path}.payer_identifier: is not a string`) - if (opts.payer_identifier_CustomCheck && !opts.payer_identifier_CustomCheck(o.payer_identifier)) return new Error(`${path}.payer_identifier: custom check failed`) - - if (typeof o.http_callback_url !== 'string') return new Error(`${path}.http_callback_url: is not a string`) - if (opts.http_callback_url_CustomCheck && !opts.http_callback_url_CustomCheck(o.http_callback_url)) return new Error(`${path}.http_callback_url: custom check failed`) - - const invoice_reqErr = NewInvoiceRequestValidate(o.invoice_req, opts.invoice_req_Options, `${path}.invoice_req`) - if (invoice_reqErr !== null) return invoice_reqErr - - - return null -} - -export type PayAppUserInvoiceRequest = { - user_identifier: string - invoice: string - amount: number -} -export const PayAppUserInvoiceRequestOptionalFields: [] = [] -export type PayAppUserInvoiceRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - user_identifier_CustomCheck?: (v: string) => boolean - invoice_CustomCheck?: (v: string) => boolean - amount_CustomCheck?: (v: number) => boolean -} -export const PayAppUserInvoiceRequestValidate = (o?: PayAppUserInvoiceRequest, opts: PayAppUserInvoiceRequestOptions = {}, path: string = 'PayAppUserInvoiceRequest::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.user_identifier !== 'string') return new Error(`${path}.user_identifier: is not a string`) - if (opts.user_identifier_CustomCheck && !opts.user_identifier_CustomCheck(o.user_identifier)) return new Error(`${path}.user_identifier: custom check failed`) - - if (typeof o.invoice !== 'string') return new Error(`${path}.invoice: is not a string`) - if (opts.invoice_CustomCheck && !opts.invoice_CustomCheck(o.invoice)) return new Error(`${path}.invoice: custom check failed`) - - if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`) - if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`) - - return null -} - -export type NewAddressResponse = { - address: string -} -export const NewAddressResponseOptionalFields: [] = [] -export type NewAddressResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - address_CustomCheck?: (v: string) => boolean -} -export const NewAddressResponseValidate = (o?: NewAddressResponse, opts: NewAddressResponseOptions = {}, path: string = 'NewAddressResponse::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.address !== 'string') return new Error(`${path}.address: is not a string`) - if (opts.address_CustomCheck && !opts.address_CustomCheck(o.address)) return new Error(`${path}.address: custom check failed`) - - return null -} - -export type LnurlLinkResponse = { - lnurl: string - k1: string -} -export const LnurlLinkResponseOptionalFields: [] = [] -export type LnurlLinkResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - lnurl_CustomCheck?: (v: string) => boolean - k1_CustomCheck?: (v: string) => boolean -} -export const LnurlLinkResponseValidate = (o?: LnurlLinkResponse, opts: LnurlLinkResponseOptions = {}, path: string = 'LnurlLinkResponse::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.lnurl !== 'string') return new Error(`${path}.lnurl: is not a string`) - if (opts.lnurl_CustomCheck && !opts.lnurl_CustomCheck(o.lnurl)) return new Error(`${path}.lnurl: custom check failed`) - - if (typeof o.k1 !== 'string') return new Error(`${path}.k1: is not a string`) - if (opts.k1_CustomCheck && !opts.k1_CustomCheck(o.k1)) return new Error(`${path}.k1: custom check failed`) - - return null -} - export type ClosureMigration = { closes_at_unix: number } @@ -1128,77 +1191,6 @@ export const ClosureMigrationValidate = (o?: ClosureMigration, opts: ClosureMigr return null } -export type EncryptionExchangeRequest = { - publicKey: string - deviceId: string -} -export const EncryptionExchangeRequestOptionalFields: [] = [] -export type EncryptionExchangeRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - publicKey_CustomCheck?: (v: string) => boolean - deviceId_CustomCheck?: (v: string) => boolean -} -export const EncryptionExchangeRequestValidate = (o?: EncryptionExchangeRequest, opts: EncryptionExchangeRequestOptions = {}, path: string = 'EncryptionExchangeRequest::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.publicKey !== 'string') return new Error(`${path}.publicKey: is not a string`) - if (opts.publicKey_CustomCheck && !opts.publicKey_CustomCheck(o.publicKey)) return new Error(`${path}.publicKey: custom check failed`) - - if (typeof o.deviceId !== 'string') return new Error(`${path}.deviceId: is not a string`) - if (opts.deviceId_CustomCheck && !opts.deviceId_CustomCheck(o.deviceId)) return new Error(`${path}.deviceId: custom check failed`) - - return null -} - -export type AuthAppRequest = { - name: string - allow_user_creation?: boolean -} -export type AuthAppRequestOptionalField = 'allow_user_creation' -export const AuthAppRequestOptionalFields: AuthAppRequestOptionalField[] = ['allow_user_creation'] -export type AuthAppRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: AuthAppRequestOptionalField[] - name_CustomCheck?: (v: string) => boolean - allow_user_creation_CustomCheck?: (v?: boolean) => boolean -} -export const AuthAppRequestValidate = (o?: AuthAppRequest, opts: AuthAppRequestOptions = {}, path: string = 'AuthAppRequest::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.name !== 'string') return new Error(`${path}.name: is not a string`) - if (opts.name_CustomCheck && !opts.name_CustomCheck(o.name)) return new Error(`${path}.name: custom check failed`) - - if ((o.allow_user_creation || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('allow_user_creation')) && typeof o.allow_user_creation !== 'boolean') return new Error(`${path}.allow_user_creation: is not a boolean`) - if (opts.allow_user_creation_CustomCheck && !opts.allow_user_creation_CustomCheck(o.allow_user_creation)) return new Error(`${path}.allow_user_creation: custom check failed`) - - return null -} - -export type AuthApp = { - app: Application - auth_token: string -} -export const AuthAppOptionalFields: [] = [] -export type AuthAppOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - app_Options?: ApplicationOptions - auth_token_CustomCheck?: (v: string) => boolean -} -export const AuthAppValidate = (o?: AuthApp, opts: AuthAppOptions = {}, path: string = 'AuthApp::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - const appErr = ApplicationValidate(o.app, opts.app_Options, `${path}.app`) - if (appErr !== null) return appErr - - - if (typeof o.auth_token !== 'string') return new Error(`${path}.auth_token: is not a string`) - if (opts.auth_token_CustomCheck && !opts.auth_token_CustomCheck(o.auth_token)) return new Error(`${path}.auth_token: custom check failed`) - - return null -} - export type AppUser = { identifier: string info: UserInfo @@ -1228,22 +1220,45 @@ export const AppUserValidate = (o?: AppUser, opts: AppUserOptions = {}, path: st return null } -export type SendAppUserToAppPaymentRequest = { - from_user_identifier: string - amount: number +export type GetAppUserLNURLInfoRequest = { + user_identifier: string + base_url_override: string } -export const SendAppUserToAppPaymentRequestOptionalFields: [] = [] -export type SendAppUserToAppPaymentRequestOptions = OptionsBaseMessage & { +export const GetAppUserLNURLInfoRequestOptionalFields: [] = [] +export type GetAppUserLNURLInfoRequestOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - from_user_identifier_CustomCheck?: (v: string) => boolean - amount_CustomCheck?: (v: number) => boolean + user_identifier_CustomCheck?: (v: string) => boolean + base_url_override_CustomCheck?: (v: string) => boolean } -export const SendAppUserToAppPaymentRequestValidate = (o?: SendAppUserToAppPaymentRequest, opts: SendAppUserToAppPaymentRequestOptions = {}, path: string = 'SendAppUserToAppPaymentRequest::root.'): Error | null => { +export const GetAppUserLNURLInfoRequestValidate = (o?: GetAppUserLNURLInfoRequest, opts: GetAppUserLNURLInfoRequestOptions = {}, path: string = 'GetAppUserLNURLInfoRequest::root.'): Error | null => { if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - if (typeof o.from_user_identifier !== 'string') return new Error(`${path}.from_user_identifier: is not a string`) - if (opts.from_user_identifier_CustomCheck && !opts.from_user_identifier_CustomCheck(o.from_user_identifier)) return new Error(`${path}.from_user_identifier: custom check failed`) + if (typeof o.user_identifier !== 'string') return new Error(`${path}.user_identifier: is not a string`) + if (opts.user_identifier_CustomCheck && !opts.user_identifier_CustomCheck(o.user_identifier)) return new Error(`${path}.user_identifier: custom check failed`) + + if (typeof o.base_url_override !== 'string') return new Error(`${path}.base_url_override: is not a string`) + if (opts.base_url_override_CustomCheck && !opts.base_url_override_CustomCheck(o.base_url_override)) return new Error(`${path}.base_url_override: custom check failed`) + + return null +} + +export type PayInvoiceRequest = { + invoice: string + amount: number +} +export const PayInvoiceRequestOptionalFields: [] = [] +export type PayInvoiceRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + invoice_CustomCheck?: (v: string) => boolean + amount_CustomCheck?: (v: number) => boolean +} +export const PayInvoiceRequestValidate = (o?: PayInvoiceRequest, opts: PayInvoiceRequestOptions = {}, path: string = 'PayInvoiceRequest::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.invoice !== 'string') return new Error(`${path}.invoice: is not a string`) + if (opts.invoice_CustomCheck && !opts.invoice_CustomCheck(o.invoice)) return new Error(`${path}.invoice: custom check failed`) if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`) if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`) @@ -1251,25 +1266,189 @@ export const SendAppUserToAppPaymentRequestValidate = (o?: SendAppUserToAppPayme return null } -export type SetMockAppUserBalanceRequest = { - user_identifier: string - amount: number +export type HandleLnurlPayResponse = { + pr: string + routes: Empty[] } -export const SetMockAppUserBalanceRequestOptionalFields: [] = [] -export type SetMockAppUserBalanceRequestOptions = OptionsBaseMessage & { +export const HandleLnurlPayResponseOptionalFields: [] = [] +export type HandleLnurlPayResponseOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - user_identifier_CustomCheck?: (v: string) => boolean - amount_CustomCheck?: (v: number) => boolean + pr_CustomCheck?: (v: string) => boolean + routes_ItemOptions?: EmptyOptions + routes_CustomCheck?: (v: Empty[]) => boolean } -export const SetMockAppUserBalanceRequestValidate = (o?: SetMockAppUserBalanceRequest, opts: SetMockAppUserBalanceRequestOptions = {}, path: string = 'SetMockAppUserBalanceRequest::root.'): Error | null => { +export const HandleLnurlPayResponseValidate = (o?: HandleLnurlPayResponse, opts: HandleLnurlPayResponseOptions = {}, path: string = 'HandleLnurlPayResponse::root.'): Error | null => { if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - if (typeof o.user_identifier !== 'string') return new Error(`${path}.user_identifier: is not a string`) - if (opts.user_identifier_CustomCheck && !opts.user_identifier_CustomCheck(o.user_identifier)) return new Error(`${path}.user_identifier: custom check failed`) + if (typeof o.pr !== 'string') return new Error(`${path}.pr: is not a string`) + if (opts.pr_CustomCheck && !opts.pr_CustomCheck(o.pr)) return new Error(`${path}.pr: custom check failed`) - if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`) - if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`) + if (!Array.isArray(o.routes)) return new Error(`${path}.routes: is not an array`) + for (let index = 0; index < o.routes.length; index++) { + const routesErr = EmptyValidate(o.routes[index], opts.routes_ItemOptions, `${path}.routes[${index}]`) + if (routesErr !== null) return routesErr + } + if (opts.routes_CustomCheck && !opts.routes_CustomCheck(o.routes)) return new Error(`${path}.routes: custom check failed`) + + return null +} + +export type Product = { + id: string + name: string + price_sats: number +} +export const ProductOptionalFields: [] = [] +export type ProductOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + id_CustomCheck?: (v: string) => boolean + name_CustomCheck?: (v: string) => boolean + price_sats_CustomCheck?: (v: number) => boolean +} +export const ProductValidate = (o?: Product, opts: ProductOptions = {}, path: string = 'Product::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.id !== 'string') return new Error(`${path}.id: is not a string`) + if (opts.id_CustomCheck && !opts.id_CustomCheck(o.id)) return new Error(`${path}.id: custom check failed`) + + if (typeof o.name !== 'string') return new Error(`${path}.name: is not a string`) + if (opts.name_CustomCheck && !opts.name_CustomCheck(o.name)) return new Error(`${path}.name: custom check failed`) + + if (typeof o.price_sats !== 'number') return new Error(`${path}.price_sats: is not a number`) + if (opts.price_sats_CustomCheck && !opts.price_sats_CustomCheck(o.price_sats)) return new Error(`${path}.price_sats: custom check failed`) + + return null +} + +export type RelaysMigration = { + relays: string[] +} +export const RelaysMigrationOptionalFields: [] = [] +export type RelaysMigrationOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + relays_CustomCheck?: (v: string[]) => boolean +} +export const RelaysMigrationValidate = (o?: RelaysMigration, opts: RelaysMigrationOptions = {}, path: string = 'RelaysMigration::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (!Array.isArray(o.relays)) return new Error(`${path}.relays: is not an array`) + for (let index = 0; index < o.relays.length; index++) { + if (typeof o.relays[index] !== 'string') return new Error(`${path}.relays[${index}]: is not a string`) + } + if (opts.relays_CustomCheck && !opts.relays_CustomCheck(o.relays)) return new Error(`${path}.relays: custom check failed`) + + return null +} + +export type EncryptionExchangeRequest = { + publicKey: string + deviceId: string +} +export const EncryptionExchangeRequestOptionalFields: [] = [] +export type EncryptionExchangeRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + publicKey_CustomCheck?: (v: string) => boolean + deviceId_CustomCheck?: (v: string) => boolean +} +export const EncryptionExchangeRequestValidate = (o?: EncryptionExchangeRequest, opts: EncryptionExchangeRequestOptions = {}, path: string = 'EncryptionExchangeRequest::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.publicKey !== 'string') return new Error(`${path}.publicKey: is not a string`) + if (opts.publicKey_CustomCheck && !opts.publicKey_CustomCheck(o.publicKey)) return new Error(`${path}.publicKey: custom check failed`) + + if (typeof o.deviceId !== 'string') return new Error(`${path}.deviceId: is not a string`) + if (opts.deviceId_CustomCheck && !opts.deviceId_CustomCheck(o.deviceId)) return new Error(`${path}.deviceId: custom check failed`) + + return null +} + +export type NewAddressRequest = { + addressType: AddressType +} +export const NewAddressRequestOptionalFields: [] = [] +export type NewAddressRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + addressType_CustomCheck?: (v: AddressType) => boolean +} +export const NewAddressRequestValidate = (o?: NewAddressRequest, opts: NewAddressRequestOptions = {}, path: string = 'NewAddressRequest::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (!enumCheckAddressType(o.addressType)) return new Error(`${path}.addressType: is not a valid AddressType`) + if (opts.addressType_CustomCheck && !opts.addressType_CustomCheck(o.addressType)) return new Error(`${path}.addressType: custom check failed`) + + return null +} + +export type PayAddressRequest = { + address: string + amoutSats: number + satsPerVByte: number +} +export const PayAddressRequestOptionalFields: [] = [] +export type PayAddressRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + address_CustomCheck?: (v: string) => boolean + amoutSats_CustomCheck?: (v: number) => boolean + satsPerVByte_CustomCheck?: (v: number) => boolean +} +export const PayAddressRequestValidate = (o?: PayAddressRequest, opts: PayAddressRequestOptions = {}, path: string = 'PayAddressRequest::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.address !== 'string') return new Error(`${path}.address: is not a string`) + if (opts.address_CustomCheck && !opts.address_CustomCheck(o.address)) return new Error(`${path}.address: custom check failed`) + + if (typeof o.amoutSats !== 'number') return new Error(`${path}.amoutSats: is not a number`) + if (opts.amoutSats_CustomCheck && !opts.amoutSats_CustomCheck(o.amoutSats)) return new Error(`${path}.amoutSats: custom check failed`) + + if (typeof o.satsPerVByte !== 'number') return new Error(`${path}.satsPerVByte: is not a number`) + if (opts.satsPerVByte_CustomCheck && !opts.satsPerVByte_CustomCheck(o.satsPerVByte)) return new Error(`${path}.satsPerVByte: custom check failed`) + + return null +} + +export type DecodeInvoiceRequest = { + invoice: string +} +export const DecodeInvoiceRequestOptionalFields: [] = [] +export type DecodeInvoiceRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + invoice_CustomCheck?: (v: string) => boolean +} +export const DecodeInvoiceRequestValidate = (o?: DecodeInvoiceRequest, opts: DecodeInvoiceRequestOptions = {}, path: string = 'DecodeInvoiceRequest::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.invoice !== 'string') return new Error(`${path}.invoice: is not a string`) + if (opts.invoice_CustomCheck && !opts.invoice_CustomCheck(o.invoice)) return new Error(`${path}.invoice: custom check failed`) + + return null +} + +export type LnurlLinkResponse = { + lnurl: string + k1: string +} +export const LnurlLinkResponseOptionalFields: [] = [] +export type LnurlLinkResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + lnurl_CustomCheck?: (v: string) => boolean + k1_CustomCheck?: (v: string) => boolean +} +export const LnurlLinkResponseValidate = (o?: LnurlLinkResponse, opts: LnurlLinkResponseOptions = {}, path: string = 'LnurlLinkResponse::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.lnurl !== 'string') return new Error(`${path}.lnurl: is not a string`) + if (opts.lnurl_CustomCheck && !opts.lnurl_CustomCheck(o.lnurl)) return new Error(`${path}.lnurl: custom check failed`) + + if (typeof o.k1 !== 'string') return new Error(`${path}.k1: is not a string`) + if (opts.k1_CustomCheck && !opts.k1_CustomCheck(o.k1)) return new Error(`${path}.k1: custom check failed`) return null } @@ -1332,233 +1511,3 @@ export const UserOperationValidate = (o?: UserOperation, opts: UserOperationOpti return null } -export type GetProductBuyLinkResponse = { - link: string -} -export const GetProductBuyLinkResponseOptionalFields: [] = [] -export type GetProductBuyLinkResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - link_CustomCheck?: (v: string) => boolean -} -export const GetProductBuyLinkResponseValidate = (o?: GetProductBuyLinkResponse, opts: GetProductBuyLinkResponseOptions = {}, path: string = 'GetProductBuyLinkResponse::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.link !== 'string') return new Error(`${path}.link: is not a string`) - if (opts.link_CustomCheck && !opts.link_CustomCheck(o.link)) return new Error(`${path}.link: custom check failed`) - - return null -} - -export type Empty = { -} -export const EmptyOptionalFields: [] = [] -export type EmptyOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] -} -export const EmptyValidate = (o?: Empty, opts: EmptyOptions = {}, path: string = 'Empty::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - return null -} - -export type RelaysMigration = { - relays: string[] -} -export const RelaysMigrationOptionalFields: [] = [] -export type RelaysMigrationOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - relays_CustomCheck?: (v: string[]) => boolean -} -export const RelaysMigrationValidate = (o?: RelaysMigration, opts: RelaysMigrationOptions = {}, path: string = 'RelaysMigration::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (!Array.isArray(o.relays)) return new Error(`${path}.relays: is not an array`) - for (let index = 0; index < o.relays.length; index++) { - if (typeof o.relays[index] !== 'string') return new Error(`${path}.relays[${index}]: is not a string`) - } - if (opts.relays_CustomCheck && !opts.relays_CustomCheck(o.relays)) return new Error(`${path}.relays: custom check failed`) - - return null -} - -export type GetAppUserLNURLInfoRequest = { - user_identifier: string - base_url_override: string -} -export const GetAppUserLNURLInfoRequestOptionalFields: [] = [] -export type GetAppUserLNURLInfoRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - user_identifier_CustomCheck?: (v: string) => boolean - base_url_override_CustomCheck?: (v: string) => boolean -} -export const GetAppUserLNURLInfoRequestValidate = (o?: GetAppUserLNURLInfoRequest, opts: GetAppUserLNURLInfoRequestOptions = {}, path: string = 'GetAppUserLNURLInfoRequest::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.user_identifier !== 'string') return new Error(`${path}.user_identifier: is not a string`) - if (opts.user_identifier_CustomCheck && !opts.user_identifier_CustomCheck(o.user_identifier)) return new Error(`${path}.user_identifier: custom check failed`) - - if (typeof o.base_url_override !== 'string') return new Error(`${path}.base_url_override: is not a string`) - if (opts.base_url_override_CustomCheck && !opts.base_url_override_CustomCheck(o.base_url_override)) return new Error(`${path}.base_url_override: custom check failed`) - - return null -} - -export type SetMockAppBalanceRequest = { - amount: number -} -export const SetMockAppBalanceRequestOptionalFields: [] = [] -export type SetMockAppBalanceRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - amount_CustomCheck?: (v: number) => boolean -} -export const SetMockAppBalanceRequestValidate = (o?: SetMockAppBalanceRequest, opts: SetMockAppBalanceRequestOptions = {}, path: string = 'SetMockAppBalanceRequest::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`) - if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`) - - return null -} - -export type PayInvoiceResponse = { - preimage: string - amount_paid: number - operation_id: string - service_fee: number - network_fee: number -} -export const PayInvoiceResponseOptionalFields: [] = [] -export type PayInvoiceResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - preimage_CustomCheck?: (v: string) => boolean - amount_paid_CustomCheck?: (v: number) => boolean - operation_id_CustomCheck?: (v: string) => boolean - service_fee_CustomCheck?: (v: number) => boolean - network_fee_CustomCheck?: (v: number) => boolean -} -export const PayInvoiceResponseValidate = (o?: PayInvoiceResponse, opts: PayInvoiceResponseOptions = {}, path: string = 'PayInvoiceResponse::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.preimage !== 'string') return new Error(`${path}.preimage: is not a string`) - if (opts.preimage_CustomCheck && !opts.preimage_CustomCheck(o.preimage)) return new Error(`${path}.preimage: custom check failed`) - - if (typeof o.amount_paid !== 'number') return new Error(`${path}.amount_paid: is not a number`) - if (opts.amount_paid_CustomCheck && !opts.amount_paid_CustomCheck(o.amount_paid)) return new Error(`${path}.amount_paid: custom check failed`) - - if (typeof o.operation_id !== 'string') return new Error(`${path}.operation_id: is not a string`) - if (opts.operation_id_CustomCheck && !opts.operation_id_CustomCheck(o.operation_id)) return new Error(`${path}.operation_id: custom check failed`) - - if (typeof o.service_fee !== 'number') return new Error(`${path}.service_fee: is not a number`) - if (opts.service_fee_CustomCheck && !opts.service_fee_CustomCheck(o.service_fee)) return new Error(`${path}.service_fee: custom check failed`) - - if (typeof o.network_fee !== 'number') return new Error(`${path}.network_fee: is not a number`) - if (opts.network_fee_CustomCheck && !opts.network_fee_CustomCheck(o.network_fee)) return new Error(`${path}.network_fee: custom check failed`) - - return null -} - -export type OpenChannelResponse = { - channelId: string -} -export const OpenChannelResponseOptionalFields: [] = [] -export type OpenChannelResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - channelId_CustomCheck?: (v: string) => boolean -} -export const OpenChannelResponseValidate = (o?: OpenChannelResponse, opts: OpenChannelResponseOptions = {}, path: string = 'OpenChannelResponse::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.channelId !== 'string') return new Error(`${path}.channelId: is not a string`) - if (opts.channelId_CustomCheck && !opts.channelId_CustomCheck(o.channelId)) return new Error(`${path}.channelId: custom check failed`) - - return null -} - -export type LnurlPayInfoResponse = { - tag: string - callback: string - maxSendable: number - minSendable: number - metadata: string - allowsNostr: boolean - nostrPubkey: string -} -export const LnurlPayInfoResponseOptionalFields: [] = [] -export type LnurlPayInfoResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - tag_CustomCheck?: (v: string) => boolean - callback_CustomCheck?: (v: string) => boolean - maxSendable_CustomCheck?: (v: number) => boolean - minSendable_CustomCheck?: (v: number) => boolean - metadata_CustomCheck?: (v: string) => boolean - allowsNostr_CustomCheck?: (v: boolean) => boolean - nostrPubkey_CustomCheck?: (v: string) => boolean -} -export const LnurlPayInfoResponseValidate = (o?: LnurlPayInfoResponse, opts: LnurlPayInfoResponseOptions = {}, path: string = 'LnurlPayInfoResponse::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.tag !== 'string') return new Error(`${path}.tag: is not a string`) - if (opts.tag_CustomCheck && !opts.tag_CustomCheck(o.tag)) return new Error(`${path}.tag: custom check failed`) - - if (typeof o.callback !== 'string') return new Error(`${path}.callback: is not a string`) - if (opts.callback_CustomCheck && !opts.callback_CustomCheck(o.callback)) return new Error(`${path}.callback: custom check failed`) - - if (typeof o.maxSendable !== 'number') return new Error(`${path}.maxSendable: is not a number`) - if (opts.maxSendable_CustomCheck && !opts.maxSendable_CustomCheck(o.maxSendable)) return new Error(`${path}.maxSendable: custom check failed`) - - if (typeof o.minSendable !== 'number') return new Error(`${path}.minSendable: is not a number`) - if (opts.minSendable_CustomCheck && !opts.minSendable_CustomCheck(o.minSendable)) return new Error(`${path}.minSendable: custom check failed`) - - if (typeof o.metadata !== 'string') return new Error(`${path}.metadata: is not a string`) - if (opts.metadata_CustomCheck && !opts.metadata_CustomCheck(o.metadata)) return new Error(`${path}.metadata: custom check failed`) - - if (typeof o.allowsNostr !== 'boolean') return new Error(`${path}.allowsNostr: is not a boolean`) - if (opts.allowsNostr_CustomCheck && !opts.allowsNostr_CustomCheck(o.allowsNostr)) return new Error(`${path}.allowsNostr: custom check failed`) - - if (typeof o.nostrPubkey !== 'string') return new Error(`${path}.nostrPubkey: is not a string`) - if (opts.nostrPubkey_CustomCheck && !opts.nostrPubkey_CustomCheck(o.nostrPubkey)) return new Error(`${path}.nostrPubkey: custom check failed`) - - return null -} - -export type Application = { - name: string - id: string - balance: number - npub: string -} -export const ApplicationOptionalFields: [] = [] -export type ApplicationOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - name_CustomCheck?: (v: string) => boolean - id_CustomCheck?: (v: string) => boolean - balance_CustomCheck?: (v: number) => boolean - npub_CustomCheck?: (v: string) => boolean -} -export const ApplicationValidate = (o?: Application, opts: ApplicationOptions = {}, path: string = 'Application::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.name !== 'string') return new Error(`${path}.name: is not a string`) - if (opts.name_CustomCheck && !opts.name_CustomCheck(o.name)) return new Error(`${path}.name: custom check failed`) - - if (typeof o.id !== 'string') return new Error(`${path}.id: is not a string`) - if (opts.id_CustomCheck && !opts.id_CustomCheck(o.id)) return new Error(`${path}.id: custom check failed`) - - if (typeof o.balance !== 'number') return new Error(`${path}.balance: is not a number`) - if (opts.balance_CustomCheck && !opts.balance_CustomCheck(o.balance)) return new Error(`${path}.balance: custom check failed`) - - if (typeof o.npub !== 'string') return new Error(`${path}.npub: is not a string`) - if (opts.npub_CustomCheck && !opts.npub_CustomCheck(o.npub)) return new Error(`${path}.npub: custom check failed`) - - return null -} - diff --git a/proto/protoc-gen-pub b/proto/protoc-gen-pub index 33d68e54..4b3ddb44 100755 Binary files a/proto/protoc-gen-pub and b/proto/protoc-gen-pub differ diff --git a/proto/service/methods.proto b/proto/service/methods.proto index 3fe8a10d..cce0f31b 100644 --- a/proto/service/methods.proto +++ b/proto/service/methods.proto @@ -58,6 +58,7 @@ extend google.protobuf.MethodOptions { // TODO: move this stuff to dep repo? string http_route = 50005; MethodQueryOptions query = 50006; bool nostr = 50007; + bool batch = 50008; } @@ -315,5 +316,12 @@ service LightningPub { option (http_route) = "/api/user/migrations/sub"; option (nostr) = true; } + rpc BatchUser(structs.Empty) returns (structs.Empty){ + option (auth_type) = "User"; + option (http_method) = "post"; + option (http_route) = "/api/user/batch"; + option (nostr) = true; + option (batch) = true; + } // } \ No newline at end of file diff --git a/src/auth.ts b/src/auth.ts index 892adab2..fdc65285 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -10,8 +10,6 @@ const serverOptions = (mainHandler: Main): ServerOptions => { AppAuthGuard: async (authHeader) => { return { app_id: mainHandler.applicationManager.DecodeAppToken(stripBearer(authHeader)) } }, UserAuthGuard: async (authHeader) => { return mainHandler.appUserManager.DecodeUserToken(stripBearer(authHeader)) }, GuestAuthGuard: async (_) => ({}), - encryptCallback: async (_, b) => b, - decryptCallback: async (_, b) => b, //throwErrors: true } } diff --git a/src/services/main/paymentManager.ts b/src/services/main/paymentManager.ts index b5713c76..db528619 100644 --- a/src/services/main/paymentManager.ts +++ b/src/services/main/paymentManager.ts @@ -355,7 +355,7 @@ export default class { return { pub: p[0], eventId: e.length > 0 ? e[0] : "", relays, description: event } } - async HandleLnurlPay(ctx: Types.HandleLnurlPay_Context): Promise { + async HandleLnurlPay(ctx: Types.HandleLnurlPay_Query): Promise { if (!ctx.k1 || !ctx.amount) { throw new Error("invalid lnurl pay to handle") } @@ -392,8 +392,8 @@ export default class { } } - async HandleLnurlAddress(ctx: Types.HandleLnurlAddress_Context): Promise { - const linkedUser = await this.storage.applicationStorage.FindNostrAppUser(ctx.address_name) + async HandleLnurlAddress(addressName: string): Promise { + const linkedUser = await this.storage.applicationStorage.FindNostrAppUser(addressName) if (!linkedUser) { throw new Error("this address is not linked to any user") } diff --git a/src/services/serverMethods/index.ts b/src/services/serverMethods/index.ts index 7b4e8403..a93142a4 100644 --- a/src/services/serverMethods/index.ts +++ b/src/services/serverMethods/index.ts @@ -3,24 +3,24 @@ import { getLogger } from '../helpers/logger.js' import Main from '../main/index.js' export default (mainHandler: Main): Types.ServerMethods => { return { - EncryptionExchange: async (ctx, req) => { }, - Health: async (ctx) => { await mainHandler.lnd.Health() }, - LndGetInfo: async (ctx) => { + EncryptionExchange: async () => { }, + Health: async () => { await mainHandler.lnd.Health() }, + LndGetInfo: async ({ ctx }) => { const info = await mainHandler.lnd.GetInfo() return { alias: info.alias } }, - SetMockInvoiceAsPaid: async (ctx, req) => { + SetMockInvoiceAsPaid: async ({ ctx, req }) => { const err = Types.SetMockInvoiceAsPaidRequestValidate(req, { invoice_CustomCheck: invoice => invoice !== '', }) if (err != null) throw new Error(err.message) await mainHandler.paymentManager.SetMockInvoiceAsPaid(req) }, - GetUserInfo: (ctx) => mainHandler.appUserManager.GetUserInfo(ctx), - GetUserOperations: async (ctx, req) => { + GetUserInfo: ({ ctx }) => mainHandler.appUserManager.GetUserInfo(ctx), + GetUserOperations: async ({ ctx, req }) => { return mainHandler.paymentManager.GetUserOperations(ctx.user_id, req) }, - OpenChannel: async (ctx, req) => { + OpenChannel: async ({ ctx, req }) => { const err = Types.OpenChannelRequestValidate(req, { fundingAmount_CustomCheck: amt => amt > 0, pushAmount_CustomCheck: amt => amt > 0, @@ -29,8 +29,8 @@ export default (mainHandler: Main): Types.ServerMethods => { if (err != null) throw new Error(err.message) return mainHandler.paymentManager.OpenChannel(ctx.user_id, req) }, - NewAddress: (ctx, req) => mainHandler.paymentManager.NewAddress(ctx, req), - PayAddress: async (ctx, req) => { + NewAddress: ({ ctx, req }) => mainHandler.paymentManager.NewAddress(ctx, req), + PayAddress: async ({ ctx, req }) => { const err = Types.PayAddressRequestValidate(req, { address_CustomCheck: addr => addr !== '', amoutSats_CustomCheck: amt => amt > 0, @@ -39,90 +39,90 @@ export default (mainHandler: Main): Types.ServerMethods => { if (err != null) throw new Error(err.message) return mainHandler.paymentManager.PayAddress(ctx, req) }, - NewInvoice: (ctx, req) => mainHandler.appUserManager.NewInvoice(ctx, req), - DecodeInvoice: async (ctx, req) => { + NewInvoice: ({ ctx, req }) => mainHandler.appUserManager.NewInvoice(ctx, req), + DecodeInvoice: async ({ ctx, req }) => { return mainHandler.paymentManager.DecodeInvoice(req) }, - PayInvoice: async (ctx, req) => { + PayInvoice: async ({ ctx, req }) => { const err = Types.PayInvoiceRequestValidate(req, { invoice_CustomCheck: invoice => invoice !== '' }) if (err != null) throw new Error(err.message) return mainHandler.appUserManager.PayInvoice(ctx, req) }, - GetLnurlWithdrawLink: (ctx) => mainHandler.paymentManager.GetLnurlWithdrawLink(ctx), - GetLnurlWithdrawInfo: async (ctx) => { - if (!ctx.k1) { + GetLnurlWithdrawLink: ({ ctx }) => mainHandler.paymentManager.GetLnurlWithdrawLink(ctx), + GetLnurlWithdrawInfo: async ({ ctx, query }) => { + if (!query.k1) { throw new Error("invalid lnurl withdraw to get info") } - return mainHandler.paymentManager.GetLnurlWithdrawInfo(ctx.k1) + return mainHandler.paymentManager.GetLnurlWithdrawInfo(query.k1) }, - HandleLnurlWithdraw: async (ctx) => { - if (!ctx.k1 || !ctx.pr) { + HandleLnurlWithdraw: async ({ query }) => { + if (!query.k1 || !query.pr) { throw new Error("invalid lnurl withdraw to handle") } - return mainHandler.paymentManager.HandleLnurlWithdraw(ctx.k1, ctx.pr) + return mainHandler.paymentManager.HandleLnurlWithdraw(query.k1, query.pr) }, - GetLnurlPayLink: (ctx) => mainHandler.paymentManager.GetLnurlPayLink(ctx), - GetLnurlPayInfo: async (ctx) => { - if (!ctx.k1) { + GetLnurlPayLink: ({ ctx }) => mainHandler.paymentManager.GetLnurlPayLink(ctx), + GetLnurlPayInfo: async ({ ctx, query }) => { + if (!query.k1) { throw new Error("invalid lnurl pay to get info") } - return mainHandler.paymentManager.GetLnurlPayInfo(ctx.k1) + return mainHandler.paymentManager.GetLnurlPayInfo(query.k1) }, - HandleLnurlPay: async (ctx) => { - return mainHandler.paymentManager.HandleLnurlPay(ctx) + HandleLnurlPay: async ({ ctx, query }) => { + return mainHandler.paymentManager.HandleLnurlPay(query) }, - HandleLnurlAddress: async (ctx) => { - if (!ctx.address_name) { + HandleLnurlAddress: async ({ ctx, params }) => { + if (!params.address_name) { throw new Error("invalid address_name to lnurl address") } - return mainHandler.paymentManager.HandleLnurlAddress(ctx) + return mainHandler.paymentManager.HandleLnurlAddress(params.address_name) }, - AddProduct: async (ctx, req) => { + AddProduct: async ({ ctx, req }) => { return mainHandler.productManager.AddProduct(ctx.user_id, req) }, - NewProductInvoice: async (ctx) => { - if (!ctx.id) { + NewProductInvoice: async ({ query }) => { + if (!query.id) { throw new Error("product id must be non empty") } - return mainHandler.productManager.NewProductInvoice(ctx.id) + return mainHandler.productManager.NewProductInvoice(query.id) }, - GetLNURLChannelLink: async (ctx) => { + GetLNURLChannelLink: async ({ ctx }) => { throw new Error("unimplemented") }, - AddApp: async (ctx, req) => { + AddApp: async ({ ctx, req }) => { const err = Types.AuthAppRequestValidate(req, { name_CustomCheck: name => name !== '' }) if (err != null) throw new Error(err.message) return mainHandler.applicationManager.AddApp(req) }, - AuthApp: async (ctx, req) => { + AuthApp: async ({ ctx, req }) => { const err = Types.AuthAppRequestValidate(req, { name_CustomCheck: name => name !== '' }) if (err != null) throw new Error(err.message) return mainHandler.applicationManager.AuthApp(req) }, - GetApp: async (ctx) => { + GetApp: async ({ ctx }) => { return mainHandler.applicationManager.GetApp(ctx.app_id) }, - AddAppUser: async (ctx, req) => { + AddAppUser: async ({ ctx, req }) => { const err = Types.AddAppUserRequestValidate(req, { identifier_CustomCheck: id => id !== '' }) if (err != null) throw new Error(err.message) return mainHandler.applicationManager.AddAppUser(ctx.app_id, req) }, - AddAppInvoice: async (ctx, req) => { + AddAppInvoice: async ({ ctx, req }) => { const err = Types.AddAppInvoiceRequestValidate(req, { payer_identifier_CustomCheck: id => id !== '', }) if (err != null) throw new Error(err.message) return mainHandler.applicationManager.AddAppInvoice(ctx.app_id, req) }, - AddAppUserInvoice: async (ctx, req) => { + AddAppUserInvoice: async ({ ctx, req }) => { const err = Types.AddAppUserInvoiceRequestValidate(req, { payer_identifier_CustomCheck: id => id !== '', receiver_identifier_CustomCheck: id => id !== '', @@ -130,21 +130,21 @@ export default (mainHandler: Main): Types.ServerMethods => { if (err != null) throw new Error(err.message) return mainHandler.applicationManager.AddAppUserInvoice(ctx.app_id, req) }, - GetAppUser: async (ctx, req) => { + GetAppUser: async ({ ctx, req }) => { const err = Types.GetAppUserRequestValidate(req, { user_identifier_CustomCheck: id => id !== '', }) if (err != null) throw new Error(err.message) return mainHandler.applicationManager.GetAppUser(ctx.app_id, req) }, - PayAppUserInvoice: async (ctx, req) => { + PayAppUserInvoice: async ({ ctx, req }) => { const err = Types.PayAppUserInvoiceRequestValidate(req, { user_identifier_CustomCheck: id => id !== '', }) if (err != null) throw new Error(err.message) return mainHandler.applicationManager.PayAppUserInvoice(ctx.app_id, req) }, - SendAppUserToAppUserPayment: async (ctx, req) => { + SendAppUserToAppUserPayment: async ({ ctx, req }) => { const err = Types.SendAppUserToAppUserPaymentRequestValidate(req, { to_user_identifier_CustomCheck: id => id !== '', from_user_identifier_CustomCheck: id => id !== '', @@ -153,7 +153,7 @@ export default (mainHandler: Main): Types.ServerMethods => { if (err != null) throw new Error(err.message) await mainHandler.applicationManager.SendAppUserToAppUserPayment(ctx.app_id, req) }, - SendAppUserToAppPayment: async (ctx, req) => { + SendAppUserToAppPayment: async ({ ctx, req }) => { const err = Types.SendAppUserToAppPaymentRequestValidate(req, { from_user_identifier_CustomCheck: id => id !== '', amount_CustomCheck: amount => amount > 0 @@ -161,26 +161,26 @@ export default (mainHandler: Main): Types.ServerMethods => { if (err != null) throw new Error(err.message) await mainHandler.applicationManager.SendAppUserToAppPayment(ctx.app_id, req) }, - GetAppUserLNURLInfo: async (ctx, req) => { + GetAppUserLNURLInfo: async ({ ctx, req }) => { const err = Types.GetAppUserLNURLInfoRequestValidate(req, { user_identifier_CustomCheck: id => id !== '' }) if (err != null) throw new Error(err.message) return mainHandler.applicationManager.GetAppUserLNURLInfo(ctx.app_id, req) }, - SetMockAppUserBalance: async (ctx, req) => { + SetMockAppUserBalance: async ({ ctx, req }) => { const err = Types.SetMockAppUserBalanceRequestValidate(req, { user_identifier_CustomCheck: id => id !== '' }) if (err != null) throw new Error(err.message) await mainHandler.applicationManager.SetMockAppUserBalance(ctx.app_id, req) }, - SetMockAppBalance: async (ctx, req) => { + SetMockAppBalance: async ({ ctx, req }) => { await mainHandler.applicationManager.SetMockAppBalance(ctx.app_id, req) }, - GetLiveUserOperations: async (ctx, cb) => { + GetLiveUserOperations: async ({ ctx, cb }) => { }, - GetMigrationUpdate: async (ctx, cb) => { + GetMigrationUpdate: async ({ ctx, cb }) => { } } } \ No newline at end of file