diff --git a/proto/autogenerated/client.md b/proto/autogenerated/client.md index 92ffce61..0ff4d1c4 100644 --- a/proto/autogenerated/client.md +++ b/proto/autogenerated/client.md @@ -13,16 +13,16 @@ The nostr server will send back a message response, and inside the body there wi ## NOSTR Methods ### These are the nostr methods the client implements to communicate with the API via nostr -- LndGetInfo - - auth type: __Admin__ - - input: [LndGetInfoRequest](#LndGetInfoRequest) - - output: [LndGetInfoResponse](#LndGetInfoResponse) - - AddApp - auth type: __Admin__ - input: [AddAppRequest](#AddAppRequest) - output: [AuthApp](#AuthApp) +- AddProduct + - auth type: __User__ + - input: [AddProductRequest](#AddProductRequest) + - output: [Product](#Product) + - AuthApp - auth type: __Admin__ - input: [AuthAppRequest](#AuthAppRequest) @@ -33,127 +33,40 @@ The nostr server will send back a message response, and inside the body there wi - input: [BanUserRequest](#BanUserRequest) - output: [BanUserResponse](#BanUserResponse) -- GetSeed - - auth type: __Admin__ +- BatchUser + - auth type: __User__ - This methods has an __empty__ __request__ body - - output: [LndSeed](#LndSeed) - -- ListChannels - - auth type: __Admin__ - - This methods has an __empty__ __request__ body - - output: [LndChannels](#LndChannels) - -- GetUsageMetrics - - auth type: __Metrics__ - - This methods has an __empty__ __request__ body - - output: [UsageMetrics](#UsageMetrics) - -- GetAppsMetrics - - auth type: __Metrics__ - - input: [AppsMetricsRequest](#AppsMetricsRequest) - - output: [AppsMetrics](#AppsMetrics) - -- GetLndMetrics - - auth type: __Metrics__ - - input: [LndMetricsRequest](#LndMetricsRequest) - - output: [LndMetrics](#LndMetrics) + - This methods has an __empty__ __response__ body - CreateOneTimeInviteLink - auth type: __Admin__ - input: [CreateOneTimeInviteLinkRequest](#CreateOneTimeInviteLinkRequest) - output: [CreateOneTimeInviteLinkResponse](#CreateOneTimeInviteLinkResponse) -- GetInviteLinkState - - auth type: __Admin__ - - input: [GetInviteTokenStateRequest](#GetInviteTokenStateRequest) - - output: [GetInviteTokenStateResponse](#GetInviteTokenStateResponse) +- DecodeInvoice + - auth type: __User__ + - input: [DecodeInvoiceRequest](#DecodeInvoiceRequest) + - output: [DecodeInvoiceResponse](#DecodeInvoiceResponse) - EnrollAdminToken - auth type: __User__ - input: [EnrollAdminTokenRequest](#EnrollAdminTokenRequest) - This methods has an __empty__ __response__ body -- LinkNPubThroughToken - - auth type: __GuestWithPub__ - - input: [LinkNPubThroughTokenRequest](#LinkNPubThroughTokenRequest) - - This methods has an __empty__ __response__ body +- GetAppsMetrics + - auth type: __Metrics__ + - input: [AppsMetricsRequest](#AppsMetricsRequest) + - output: [AppsMetrics](#AppsMetrics) -- UseInviteLink - - auth type: __GuestWithPub__ - - input: [UseInviteLinkRequest](#UseInviteLinkRequest) - - This methods has an __empty__ __response__ body - -- UserHealth +- GetHttpCreds - auth type: __User__ - This methods has an __empty__ __request__ body - - This methods has an __empty__ __response__ body + - output: [HttpCreds](#HttpCreds) -- GetUserInfo - - auth type: __User__ - - This methods has an __empty__ __request__ body - - output: [UserInfo](#UserInfo) - -- AddProduct - - auth type: __User__ - - input: [AddProductRequest](#AddProductRequest) - - output: [Product](#Product) - -- NewProductInvoice - - auth type: __User__ - - the request url __query__ can take the following string items: - - id - - This methods has an __empty__ __request__ body - - output: [NewInvoiceResponse](#NewInvoiceResponse) - -- GetUserOperations - - auth type: __User__ - - input: [GetUserOperationsRequest](#GetUserOperationsRequest) - - output: [GetUserOperationsResponse](#GetUserOperationsResponse) - -- NewAddress - - auth type: __User__ - - input: [NewAddressRequest](#NewAddressRequest) - - output: [NewAddressResponse](#NewAddressResponse) - -- PayAddress - - auth type: __User__ - - input: [PayAddressRequest](#PayAddressRequest) - - output: [PayAddressResponse](#PayAddressResponse) - -- NewInvoice - - auth type: __User__ - - input: [NewInvoiceRequest](#NewInvoiceRequest) - - output: [NewInvoiceResponse](#NewInvoiceResponse) - -- DecodeInvoice - - auth type: __User__ - - input: [DecodeInvoiceRequest](#DecodeInvoiceRequest) - - output: [DecodeInvoiceResponse](#DecodeInvoiceResponse) - -- PayInvoice - - auth type: __User__ - - input: [PayInvoiceRequest](#PayInvoiceRequest) - - output: [PayInvoiceResponse](#PayInvoiceResponse) - -- GetPaymentState - - auth type: __User__ - - input: [GetPaymentStateRequest](#GetPaymentStateRequest) - - output: [PaymentState](#PaymentState) - -- OpenChannel - - auth type: __User__ - - input: [OpenChannelRequest](#OpenChannelRequest) - - output: [OpenChannelResponse](#OpenChannelResponse) - -- GetLnurlWithdrawLink - - auth type: __User__ - - This methods has an __empty__ __request__ body - - output: [LnurlLinkResponse](#LnurlLinkResponse) - -- GetLnurlPayLink - - auth type: __User__ - - This methods has an __empty__ __request__ body - - output: [LnurlLinkResponse](#LnurlLinkResponse) +- GetInviteLinkState + - auth type: __Admin__ + - input: [GetInviteTokenStateRequest](#GetInviteTokenStateRequest) + - output: [GetInviteTokenStateResponse](#GetInviteTokenStateResponse) - GetLNURLChannelLink - auth type: __User__ @@ -165,17 +78,104 @@ The nostr server will send back a message response, and inside the body there wi - This methods has an __empty__ __request__ body - output: [LiveUserOperation](#LiveUserOperation) +- GetLndMetrics + - auth type: __Metrics__ + - input: [LndMetricsRequest](#LndMetricsRequest) + - output: [LndMetrics](#LndMetrics) + +- GetLnurlPayLink + - auth type: __User__ + - This methods has an __empty__ __request__ body + - output: [LnurlLinkResponse](#LnurlLinkResponse) + +- GetLnurlWithdrawLink + - auth type: __User__ + - This methods has an __empty__ __request__ body + - output: [LnurlLinkResponse](#LnurlLinkResponse) + - GetMigrationUpdate - auth type: __User__ - This methods has an __empty__ __request__ body - output: [MigrationUpdate](#MigrationUpdate) -- GetHttpCreds +- GetPaymentState + - auth type: __User__ + - input: [GetPaymentStateRequest](#GetPaymentStateRequest) + - output: [PaymentState](#PaymentState) + +- GetSeed + - auth type: __Admin__ + - This methods has an __empty__ __request__ body + - output: [LndSeed](#LndSeed) + +- GetUsageMetrics + - auth type: __Metrics__ + - This methods has an __empty__ __request__ body + - output: [UsageMetrics](#UsageMetrics) + +- GetUserInfo - auth type: __User__ - This methods has an __empty__ __request__ body - - output: [HttpCreds](#HttpCreds) + - output: [UserInfo](#UserInfo) -- BatchUser +- GetUserOperations + - auth type: __User__ + - input: [GetUserOperationsRequest](#GetUserOperationsRequest) + - output: [GetUserOperationsResponse](#GetUserOperationsResponse) + +- LinkNPubThroughToken + - auth type: __GuestWithPub__ + - input: [LinkNPubThroughTokenRequest](#LinkNPubThroughTokenRequest) + - This methods has an __empty__ __response__ body + +- ListChannels + - auth type: __Admin__ + - This methods has an __empty__ __request__ body + - output: [LndChannels](#LndChannels) + +- LndGetInfo + - auth type: __Admin__ + - input: [LndGetInfoRequest](#LndGetInfoRequest) + - output: [LndGetInfoResponse](#LndGetInfoResponse) + +- NewAddress + - auth type: __User__ + - input: [NewAddressRequest](#NewAddressRequest) + - output: [NewAddressResponse](#NewAddressResponse) + +- NewInvoice + - auth type: __User__ + - input: [NewInvoiceRequest](#NewInvoiceRequest) + - output: [NewInvoiceResponse](#NewInvoiceResponse) + +- NewProductInvoice + - auth type: __User__ + - the request url __query__ can take the following string items: + - id + - This methods has an __empty__ __request__ body + - output: [NewInvoiceResponse](#NewInvoiceResponse) + +- OpenChannel + - auth type: __User__ + - input: [OpenChannelRequest](#OpenChannelRequest) + - output: [OpenChannelResponse](#OpenChannelResponse) + +- PayAddress + - auth type: __User__ + - input: [PayAddressRequest](#PayAddressRequest) + - output: [PayAddressResponse](#PayAddressResponse) + +- PayInvoice + - auth type: __User__ + - input: [PayInvoiceRequest](#PayInvoiceRequest) + - output: [PayInvoiceResponse](#PayInvoiceResponse) + +- UseInviteLink + - auth type: __GuestWithPub__ + - input: [UseInviteLinkRequest](#UseInviteLinkRequest) + - This methods has an __empty__ __response__ body + +- UserHealth - auth type: __User__ - This methods has an __empty__ __request__ body - This methods has an __empty__ __response__ body @@ -185,42 +185,35 @@ The nostr server will send back a message response, and inside the body there wi ## Supported HTTP Auths ### These are the supported http auth types, to give different type of access to the API users -- __Guest__: - - expected context content - -- __User__: - - expected context content - - __user_id__: _string_ - - __app_id__: _string_ - - __app_user_id__: _string_ - - __Admin__: - expected context content - __admin_id__: _string_ -- __Metrics__: - - expected context content - - __operator_id__: _string_ - - __App__: - expected context content - __app_id__: _string_ +- __Guest__: + - expected context content + - __GuestWithPub__: - expected context content - __app_id__: _string_ - __pub__: _string_ +- __Metrics__: + - expected context content + - __operator_id__: _string_ + +- __User__: + - expected context content + - __app_id__: _string_ + - __app_user_id__: _string_ + - __user_id__: _string_ + ## HTTP Methods ### These are the http methods the client implements to communicate with the API -- LndGetInfo - - auth type: __Admin__ - - http method: __post__ - - http route: __/api/admin/lnd/getinfo__ - - input: [LndGetInfoRequest](#LndGetInfoRequest) - - output: [LndGetInfoResponse](#LndGetInfoResponse) - - AddApp - auth type: __Admin__ - http method: __post__ @@ -228,6 +221,34 @@ The nostr server will send back a message response, and inside the body there wi - input: [AddAppRequest](#AddAppRequest) - output: [AuthApp](#AuthApp) +- AddAppInvoice + - auth type: __App__ + - http method: __post__ + - http route: __/api/app/add/invoice__ + - input: [AddAppInvoiceRequest](#AddAppInvoiceRequest) + - output: [NewInvoiceResponse](#NewInvoiceResponse) + +- AddAppUser + - auth type: __App__ + - http method: __post__ + - http route: __/api/app/user/add__ + - input: [AddAppUserRequest](#AddAppUserRequest) + - output: [AppUser](#AppUser) + +- AddAppUserInvoice + - auth type: __App__ + - http method: __post__ + - http route: __/api/app/user/add/invoice__ + - input: [AddAppUserInvoiceRequest](#AddAppUserInvoiceRequest) + - output: [NewInvoiceResponse](#NewInvoiceResponse) + +- AddProduct + - auth type: __User__ + - http method: __post__ + - http route: __/api/user/product/add__ + - input: [AddProductRequest](#AddProductRequest) + - output: [Product](#Product) + - AuthApp - auth type: __Admin__ - http method: __post__ @@ -242,40 +263,12 @@ The nostr server will send back a message response, and inside the body there wi - input: [BanUserRequest](#BanUserRequest) - output: [BanUserResponse](#BanUserResponse) -- GetSeed - - auth type: __Admin__ - - http method: __get__ - - http route: __/api/admin/seed__ - - This methods has an __empty__ __request__ body - - output: [LndSeed](#LndSeed) - -- ListChannels - - auth type: __Admin__ - - http method: __get__ - - http route: __/api/admin/channels__ - - This methods has an __empty__ __request__ body - - output: [LndChannels](#LndChannels) - -- GetUsageMetrics - - auth type: __Metrics__ +- BatchUser + - auth type: __User__ - http method: __post__ - - http route: __/api/reports/usage__ + - http route: __/api/user/batch__ - This methods has an __empty__ __request__ body - - output: [UsageMetrics](#UsageMetrics) - -- GetAppsMetrics - - auth type: __Metrics__ - - http method: __post__ - - http route: __/api/reports/apps__ - - input: [AppsMetricsRequest](#AppsMetricsRequest) - - output: [AppsMetrics](#AppsMetrics) - -- GetLndMetrics - - auth type: __Metrics__ - - http method: __post__ - - http route: __/api/reports/lnd__ - - input: [LndMetricsRequest](#LndMetricsRequest) - - output: [LndMetrics](#LndMetrics) + - This methods has an __empty__ __response__ body - CreateOneTimeInviteLink - auth type: __Admin__ @@ -284,19 +277,12 @@ The nostr server will send back a message response, and inside the body there wi - input: [CreateOneTimeInviteLinkRequest](#CreateOneTimeInviteLinkRequest) - output: [CreateOneTimeInviteLinkResponse](#CreateOneTimeInviteLinkResponse) -- GetInviteLinkState - - auth type: __Admin__ +- DecodeInvoice + - auth type: __User__ - http method: __post__ - - http route: __/api/admin/app/invite/get__ - - input: [GetInviteTokenStateRequest](#GetInviteTokenStateRequest) - - output: [GetInviteTokenStateResponse](#GetInviteTokenStateResponse) - -- Health - - auth type: __Guest__ - - http method: __get__ - - http route: __/api/health__ - - This methods has an __empty__ __request__ body - - This methods has an __empty__ __response__ body + - http route: __/api/user/invoice/decode__ + - input: [DecodeInvoiceRequest](#DecodeInvoiceRequest) + - output: [DecodeInvoiceResponse](#DecodeInvoiceResponse) - EncryptionExchange - auth type: __Guest__ @@ -305,62 +291,6 @@ The nostr server will send back a message response, and inside the body there wi - input: [EncryptionExchangeRequest](#EncryptionExchangeRequest) - This methods has an __empty__ __response__ body -- SetMockInvoiceAsPaid - - auth type: __Guest__ - - http method: __post__ - - http route: __/api/lnd/mock/invoice/paid__ - - input: [SetMockInvoiceAsPaidRequest](#SetMockInvoiceAsPaidRequest) - - This methods has an __empty__ __response__ body - -- GetLnurlWithdrawInfo - - auth type: __Guest__ - - http method: __get__ - - http route: __/api/guest/lnurl_withdraw/info__ - - the request url __query__ can take the following string items: - - k1 - - This methods has an __empty__ __request__ body - - output: [LnurlWithdrawInfoResponse](#LnurlWithdrawInfoResponse) - -- HandleLnurlWithdraw - - auth type: __Guest__ - - http method: __get__ - - http route: __/api/guest/lnurl_withdraw/handle__ - - the request url __query__ can take the following string items: - - k1 - - pr - - This methods has an __empty__ __request__ body - - This methods has an __empty__ __response__ body - -- GetLnurlPayInfo - - auth type: __Guest__ - - http method: __get__ - - http route: __/api/guest/lnurl_pay/info__ - - the request url __query__ can take the following string items: - - k1 - - This methods has an __empty__ __request__ body - - output: [LnurlPayInfoResponse](#LnurlPayInfoResponse) - -- HandleLnurlPay - - auth type: __Guest__ - - http method: __get__ - - http route: __/api/guest/lnurl_pay/handle__ - - the request url __query__ can take the following string items: - - k1 - - amount - - nostr - - lnurl - - This methods has an __empty__ __request__ body - - output: [HandleLnurlPayResponse](#HandleLnurlPayResponse) - -- HandleLnurlAddress - - auth type: __Guest__ - - http method: __get__ - - http route: __/.well-known/lnurlp/:address_name__ - - the request url __params__ are the following string items: - - address_name - - This methods has an __empty__ __request__ body - - output: [LnurlPayInfoResponse](#LnurlPayInfoResponse) - - EnrollAdminToken - auth type: __User__ - http method: __post__ @@ -368,20 +298,6 @@ The nostr server will send back a message response, and inside the body there wi - input: [EnrollAdminTokenRequest](#EnrollAdminTokenRequest) - This methods has an __empty__ __response__ body -- LinkNPubThroughToken - - auth type: __GuestWithPub__ - - http method: __post__ - - http route: __/api/guest/npub/link__ - - input: [LinkNPubThroughTokenRequest](#LinkNPubThroughTokenRequest) - - This methods has an __empty__ __response__ body - -- UseInviteLink - - auth type: __GuestWithPub__ - - http method: __post__ - - http route: __/api/guest/invite__ - - input: [UseInviteLinkRequest](#UseInviteLinkRequest) - - This methods has an __empty__ __response__ body - - GetApp - auth type: __App__ - http method: __post__ @@ -389,27 +305,6 @@ The nostr server will send back a message response, and inside the body there wi - This methods has an __empty__ __request__ body - output: [Application](#Application) -- AddAppUser - - auth type: __App__ - - http method: __post__ - - http route: __/api/app/user/add__ - - input: [AddAppUserRequest](#AddAppUserRequest) - - output: [AppUser](#AppUser) - -- AddAppInvoice - - auth type: __App__ - - http method: __post__ - - http route: __/api/app/add/invoice__ - - input: [AddAppInvoiceRequest](#AddAppInvoiceRequest) - - output: [NewInvoiceResponse](#NewInvoiceResponse) - -- AddAppUserInvoice - - auth type: __App__ - - http method: __post__ - - http route: __/api/app/user/add/invoice__ - - input: [AddAppUserInvoiceRequest](#AddAppUserInvoiceRequest) - - output: [NewInvoiceResponse](#NewInvoiceResponse) - - GetAppUser - auth type: __App__ - http method: __post__ @@ -417,27 +312,6 @@ The nostr server will send back a message response, and inside the body there wi - input: [GetAppUserRequest](#GetAppUserRequest) - output: [AppUser](#AppUser) -- PayAppUserInvoice - - auth type: __App__ - - http method: __post__ - - http route: __/api/app/invoice/pay__ - - input: [PayAppUserInvoiceRequest](#PayAppUserInvoiceRequest) - - output: [PayInvoiceResponse](#PayInvoiceResponse) - -- SendAppUserToAppUserPayment - - auth type: __App__ - - http method: __post__ - - http route: __/api/app/user/internal/pay__ - - input: [SendAppUserToAppUserPaymentRequest](#SendAppUserToAppUserPaymentRequest) - - This methods has an __empty__ __response__ body - -- SendAppUserToAppPayment - - auth type: __App__ - - http method: __post__ - - http route: __/api/app/internal/pay__ - - input: [SendAppUserToAppPaymentRequest](#SendAppUserToAppPaymentRequest) - - This methods has an __empty__ __response__ body - - GetAppUserLNURLInfo - auth type: __App__ - http method: __post__ @@ -445,133 +319,26 @@ The nostr server will send back a message response, and inside the body there wi - input: [GetAppUserLNURLInfoRequest](#GetAppUserLNURLInfoRequest) - output: [LnurlPayInfoResponse](#LnurlPayInfoResponse) -- SetMockAppUserBalance - - auth type: __App__ +- GetAppsMetrics + - auth type: __Metrics__ - http method: __post__ - - http route: __/api/app/mock/user/blance/set__ - - input: [SetMockAppUserBalanceRequest](#SetMockAppUserBalanceRequest) - - This methods has an __empty__ __response__ body + - http route: __/api/reports/apps__ + - input: [AppsMetricsRequest](#AppsMetricsRequest) + - output: [AppsMetrics](#AppsMetrics) -- SetMockAppBalance - - auth type: __App__ - - http method: __post__ - - http route: __/api/app/mock/blance/set__ - - input: [SetMockAppBalanceRequest](#SetMockAppBalanceRequest) - - This methods has an __empty__ __response__ body - -- RequestNPubLinkingToken - - auth type: __App__ - - http method: __post__ - - http route: __/api/app/user/npub/token__ - - input: [RequestNPubLinkingTokenRequest](#RequestNPubLinkingTokenRequest) - - output: [RequestNPubLinkingTokenResponse](#RequestNPubLinkingTokenResponse) - -- ResetNPubLinkingToken - - auth type: __App__ - - http method: __post__ - - http route: __/api/app/user/npub/token/reset__ - - input: [RequestNPubLinkingTokenRequest](#RequestNPubLinkingTokenRequest) - - output: [RequestNPubLinkingTokenResponse](#RequestNPubLinkingTokenResponse) - -- UserHealth +- GetHttpCreds - auth type: __User__ - http method: __post__ - - http route: __/api/user/health__ + - http route: __/api/user/http_creds__ - This methods has an __empty__ __request__ body - - This methods has an __empty__ __response__ body + - output: [HttpCreds](#HttpCreds) -- GetUserInfo - - auth type: __User__ +- GetInviteLinkState + - auth type: __Admin__ - http method: __post__ - - http route: __/api/user/info__ - - This methods has an __empty__ __request__ body - - output: [UserInfo](#UserInfo) - -- AddProduct - - auth type: __User__ - - http method: __post__ - - http route: __/api/user/product/add__ - - input: [AddProductRequest](#AddProductRequest) - - output: [Product](#Product) - -- NewProductInvoice - - auth type: __User__ - - http method: __get__ - - http route: __/api/user/product/get/invoice__ - - the request url __query__ can take the following string items: - - id - - This methods has an __empty__ __request__ body - - output: [NewInvoiceResponse](#NewInvoiceResponse) - -- GetUserOperations - - auth type: __User__ - - http method: __post__ - - http route: __/api/user/operations__ - - input: [GetUserOperationsRequest](#GetUserOperationsRequest) - - output: [GetUserOperationsResponse](#GetUserOperationsResponse) - -- NewAddress - - auth type: __User__ - - http method: __post__ - - http route: __/api/user/chain/new__ - - input: [NewAddressRequest](#NewAddressRequest) - - output: [NewAddressResponse](#NewAddressResponse) - -- PayAddress - - auth type: __User__ - - http method: __post__ - - http route: __/api/user/chain/pay__ - - input: [PayAddressRequest](#PayAddressRequest) - - output: [PayAddressResponse](#PayAddressResponse) - -- NewInvoice - - auth type: __User__ - - http method: __post__ - - http route: __/api/user/invoice/new__ - - input: [NewInvoiceRequest](#NewInvoiceRequest) - - output: [NewInvoiceResponse](#NewInvoiceResponse) - -- DecodeInvoice - - auth type: __User__ - - http method: __post__ - - http route: __/api/user/invoice/decode__ - - input: [DecodeInvoiceRequest](#DecodeInvoiceRequest) - - output: [DecodeInvoiceResponse](#DecodeInvoiceResponse) - -- PayInvoice - - auth type: __User__ - - http method: __post__ - - http route: __/api/user/invoice/pay__ - - input: [PayInvoiceRequest](#PayInvoiceRequest) - - output: [PayInvoiceResponse](#PayInvoiceResponse) - -- GetPaymentState - - auth type: __User__ - - http method: __post__ - - http route: __/api/user/payment/state__ - - input: [GetPaymentStateRequest](#GetPaymentStateRequest) - - output: [PaymentState](#PaymentState) - -- OpenChannel - - auth type: __User__ - - http method: __post__ - - http route: __/api/user/open/channel__ - - input: [OpenChannelRequest](#OpenChannelRequest) - - output: [OpenChannelResponse](#OpenChannelResponse) - -- GetLnurlWithdrawLink - - auth type: __User__ - - http method: __get__ - - http route: __/api/user/lnurl_withdraw/link__ - - This methods has an __empty__ __request__ body - - output: [LnurlLinkResponse](#LnurlLinkResponse) - -- GetLnurlPayLink - - auth type: __User__ - - http method: __get__ - - http route: __/api/user/lnurl_pay/link__ - - This methods has an __empty__ __request__ body - - output: [LnurlLinkResponse](#LnurlLinkResponse) + - http route: __/api/admin/app/invite/get__ + - input: [GetInviteTokenStateRequest](#GetInviteTokenStateRequest) + - output: [GetInviteTokenStateResponse](#GetInviteTokenStateResponse) - GetLNURLChannelLink - auth type: __User__ @@ -587,6 +354,45 @@ The nostr server will send back a message response, and inside the body there wi - This methods has an __empty__ __request__ body - output: [LiveUserOperation](#LiveUserOperation) +- GetLndMetrics + - auth type: __Metrics__ + - http method: __post__ + - http route: __/api/reports/lnd__ + - input: [LndMetricsRequest](#LndMetricsRequest) + - output: [LndMetrics](#LndMetrics) + +- GetLnurlPayInfo + - auth type: __Guest__ + - http method: __get__ + - http route: __/api/guest/lnurl_pay/info__ + - the request url __query__ can take the following string items: + - k1 + - This methods has an __empty__ __request__ body + - output: [LnurlPayInfoResponse](#LnurlPayInfoResponse) + +- GetLnurlPayLink + - auth type: __User__ + - http method: __get__ + - http route: __/api/user/lnurl_pay/link__ + - This methods has an __empty__ __request__ body + - output: [LnurlLinkResponse](#LnurlLinkResponse) + +- GetLnurlWithdrawInfo + - auth type: __Guest__ + - http method: __get__ + - http route: __/api/guest/lnurl_withdraw/info__ + - the request url __query__ can take the following string items: + - k1 + - This methods has an __empty__ __request__ body + - output: [LnurlWithdrawInfoResponse](#LnurlWithdrawInfoResponse) + +- GetLnurlWithdrawLink + - auth type: __User__ + - http method: __get__ + - http route: __/api/user/lnurl_withdraw/link__ + - This methods has an __empty__ __request__ body + - output: [LnurlLinkResponse](#LnurlLinkResponse) + - GetMigrationUpdate - auth type: __User__ - http method: __post__ @@ -594,17 +400,211 @@ 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) -- GetHttpCreds +- GetPaymentState - auth type: __User__ - http method: __post__ - - http route: __/api/user/http_creds__ - - This methods has an __empty__ __request__ body - - output: [HttpCreds](#HttpCreds) + - http route: __/api/user/payment/state__ + - input: [GetPaymentStateRequest](#GetPaymentStateRequest) + - output: [PaymentState](#PaymentState) -- BatchUser +- GetSeed + - auth type: __Admin__ + - http method: __get__ + - http route: __/api/admin/seed__ + - This methods has an __empty__ __request__ body + - output: [LndSeed](#LndSeed) + +- GetUsageMetrics + - auth type: __Metrics__ + - http method: __post__ + - http route: __/api/reports/usage__ + - This methods has an __empty__ __request__ body + - output: [UsageMetrics](#UsageMetrics) + +- GetUserInfo - auth type: __User__ - http method: __post__ - - http route: __/api/user/batch__ + - http route: __/api/user/info__ + - This methods has an __empty__ __request__ body + - output: [UserInfo](#UserInfo) + +- GetUserOperations + - auth type: __User__ + - http method: __post__ + - http route: __/api/user/operations__ + - input: [GetUserOperationsRequest](#GetUserOperationsRequest) + - output: [GetUserOperationsResponse](#GetUserOperationsResponse) + +- HandleLnurlAddress + - auth type: __Guest__ + - http method: __get__ + - http route: __/.well-known/lnurlp/:address_name__ + - the request url __params__ are the following string items: + - address_name + - This methods has an __empty__ __request__ body + - output: [LnurlPayInfoResponse](#LnurlPayInfoResponse) + +- HandleLnurlPay + - auth type: __Guest__ + - http method: __get__ + - http route: __/api/guest/lnurl_pay/handle__ + - the request url __query__ can take the following string items: + - amount + - k1 + - lnurl + - nostr + - This methods has an __empty__ __request__ body + - output: [HandleLnurlPayResponse](#HandleLnurlPayResponse) + +- HandleLnurlWithdraw + - auth type: __Guest__ + - http method: __get__ + - http route: __/api/guest/lnurl_withdraw/handle__ + - the request url __query__ can take the following string items: + - k1 + - pr + - This methods has an __empty__ __request__ body + - This methods has an __empty__ __response__ body + +- Health + - auth type: __Guest__ + - http method: __get__ + - http route: __/api/health__ + - This methods has an __empty__ __request__ body + - This methods has an __empty__ __response__ body + +- LinkNPubThroughToken + - auth type: __GuestWithPub__ + - http method: __post__ + - http route: __/api/guest/npub/link__ + - input: [LinkNPubThroughTokenRequest](#LinkNPubThroughTokenRequest) + - This methods has an __empty__ __response__ body + +- ListChannels + - auth type: __Admin__ + - http method: __get__ + - http route: __/api/admin/channels__ + - This methods has an __empty__ __request__ body + - output: [LndChannels](#LndChannels) + +- LndGetInfo + - auth type: __Admin__ + - http method: __post__ + - http route: __/api/admin/lnd/getinfo__ + - input: [LndGetInfoRequest](#LndGetInfoRequest) + - output: [LndGetInfoResponse](#LndGetInfoResponse) + +- NewAddress + - auth type: __User__ + - http method: __post__ + - http route: __/api/user/chain/new__ + - input: [NewAddressRequest](#NewAddressRequest) + - output: [NewAddressResponse](#NewAddressResponse) + +- NewInvoice + - auth type: __User__ + - http method: __post__ + - http route: __/api/user/invoice/new__ + - input: [NewInvoiceRequest](#NewInvoiceRequest) + - output: [NewInvoiceResponse](#NewInvoiceResponse) + +- NewProductInvoice + - auth type: __User__ + - http method: __get__ + - http route: __/api/user/product/get/invoice__ + - the request url __query__ can take the following string items: + - id + - This methods has an __empty__ __request__ body + - output: [NewInvoiceResponse](#NewInvoiceResponse) + +- OpenChannel + - auth type: __User__ + - http method: __post__ + - http route: __/api/user/open/channel__ + - input: [OpenChannelRequest](#OpenChannelRequest) + - output: [OpenChannelResponse](#OpenChannelResponse) + +- PayAddress + - auth type: __User__ + - http method: __post__ + - http route: __/api/user/chain/pay__ + - input: [PayAddressRequest](#PayAddressRequest) + - output: [PayAddressResponse](#PayAddressResponse) + +- PayAppUserInvoice + - auth type: __App__ + - http method: __post__ + - http route: __/api/app/invoice/pay__ + - input: [PayAppUserInvoiceRequest](#PayAppUserInvoiceRequest) + - output: [PayInvoiceResponse](#PayInvoiceResponse) + +- PayInvoice + - auth type: __User__ + - http method: __post__ + - http route: __/api/user/invoice/pay__ + - input: [PayInvoiceRequest](#PayInvoiceRequest) + - output: [PayInvoiceResponse](#PayInvoiceResponse) + +- RequestNPubLinkingToken + - auth type: __App__ + - http method: __post__ + - http route: __/api/app/user/npub/token__ + - input: [RequestNPubLinkingTokenRequest](#RequestNPubLinkingTokenRequest) + - output: [RequestNPubLinkingTokenResponse](#RequestNPubLinkingTokenResponse) + +- ResetNPubLinkingToken + - auth type: __App__ + - http method: __post__ + - http route: __/api/app/user/npub/token/reset__ + - input: [RequestNPubLinkingTokenRequest](#RequestNPubLinkingTokenRequest) + - output: [RequestNPubLinkingTokenResponse](#RequestNPubLinkingTokenResponse) + +- SendAppUserToAppPayment + - auth type: __App__ + - http method: __post__ + - http route: __/api/app/internal/pay__ + - input: [SendAppUserToAppPaymentRequest](#SendAppUserToAppPaymentRequest) + - This methods has an __empty__ __response__ body + +- SendAppUserToAppUserPayment + - auth type: __App__ + - http method: __post__ + - http route: __/api/app/user/internal/pay__ + - input: [SendAppUserToAppUserPaymentRequest](#SendAppUserToAppUserPaymentRequest) + - This methods has an __empty__ __response__ body + +- SetMockAppBalance + - auth type: __App__ + - http method: __post__ + - http route: __/api/app/mock/blance/set__ + - input: [SetMockAppBalanceRequest](#SetMockAppBalanceRequest) + - This methods has an __empty__ __response__ body + +- SetMockAppUserBalance + - auth type: __App__ + - http method: __post__ + - http route: __/api/app/mock/user/blance/set__ + - input: [SetMockAppUserBalanceRequest](#SetMockAppUserBalanceRequest) + - This methods has an __empty__ __response__ body + +- SetMockInvoiceAsPaid + - auth type: __Guest__ + - http method: __post__ + - http route: __/api/lnd/mock/invoice/paid__ + - input: [SetMockInvoiceAsPaidRequest](#SetMockInvoiceAsPaidRequest) + - This methods has an __empty__ __response__ body + +- UseInviteLink + - auth type: __GuestWithPub__ + - http method: __post__ + - http route: __/api/guest/invite__ + - input: [UseInviteLinkRequest](#UseInviteLinkRequest) + - This methods has an __empty__ __response__ body + +- UserHealth + - auth type: __User__ + - http method: __post__ + - http route: __/api/user/health__ - This methods has an __empty__ __request__ body - This methods has an __empty__ __response__ body @@ -613,398 +613,398 @@ The nostr server will send back a message response, and inside the body there wi ## Messages ### The content of requests and response from the methods -### GetUserOperationsResponse - - __latestIncomingUserToUserPayemnts__: _[UserOperations](#UserOperations)_ - - __latestOutgoingInvoiceOperations__: _[UserOperations](#UserOperations)_ - - __latestIncomingInvoiceOperations__: _[UserOperations](#UserOperations)_ - - __latestOutgoingTxOperations__: _[UserOperations](#UserOperations)_ - - __latestIncomingTxOperations__: _[UserOperations](#UserOperations)_ - - __latestOutgoingUserToUserPayemnts__: _[UserOperations](#UserOperations)_ - -### AuthAppRequest - - __name__: _string_ - - __allow_user_creation__: _boolean_ *this field is optional - -### GetAppUserLNURLInfoRequest - - __user_identifier__: _string_ - - __base_url_override__: _string_ - -### AddAppUserInvoiceRequest - - __receiver_identifier__: _string_ - - __payer_identifier__: _string_ +### AddAppInvoiceRequest - __http_callback_url__: _string_ - __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_ + - __payer_identifier__: _string_ -### NewAddressResponse - - __address__: _string_ +### AddAppRequest + - __allow_user_creation__: _boolean_ + - __name__: _string_ -### Product - - __id__: _string_ +### AddAppUserInvoiceRequest + - __http_callback_url__: _string_ + - __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_ + - __payer_identifier__: _string_ + - __receiver_identifier__: _string_ + +### AddAppUserRequest + - __balance__: _number_ + - __fail_if_exists__: _boolean_ + - __identifier__: _string_ + +### AddProductRequest - __name__: _string_ - __price_sats__: _number_ -### CreateOneTimeInviteLinkResponse - - __invitation_link__: _string_ - -### AppsMetricsRequest - - __include_operations__: _boolean_ *this field is optional - - __from_unix__: _number_ *this field is optional - - __to_unix__: _number_ *this field is optional - -### LndGetInfoRequest - - __nodeId__: _number_ - -### SetMockAppBalanceRequest - - __amount__: _number_ - -### LnurlLinkResponse - - __lnurl__: _string_ - - __k1__: _string_ - -### LnurlWithdrawInfoResponse - - __tag__: _string_ - - __callback__: _string_ - - __k1__: _string_ - - __defaultDescription__: _string_ - - __minWithdrawable__: _number_ - - __maxWithdrawable__: _number_ - - __balanceCheck__: _string_ - - __payLink__: _string_ - -### AddAppUserRequest - - __identifier__: _string_ - - __fail_if_exists__: _boolean_ - - __balance__: _number_ - -### AddAppInvoiceRequest - - __payer_identifier__: _string_ - - __http_callback_url__: _string_ - - __invoice_req__: _[NewInvoiceRequest](#NewInvoiceRequest)_ - -### AddAppRequest - - __name__: _string_ - - __allow_user_creation__: _boolean_ - -### PayAddressResponse - - __service_fee__: _number_ - - __network_fee__: _number_ - - __txId__: _string_ - - __operation_id__: _string_ - -### RequestNPubLinkingTokenResponse - - __token__: _string_ - -### UsageMetric - - __parsed_in_nano__: _number_ - - __rpc_name__: _string_ - - __batch_size__: _number_ - - __processed_at_ms__: _number_ - - __auth_in_nano__: _number_ - - __validate_in_nano__: _number_ - - __handle_in_nano__: _number_ - - __batch__: _boolean_ - - __nostr__: _boolean_ - -### SetMockInvoiceAsPaidRequest - - __invoice__: _string_ - - __amount__: _number_ - -### LndGetInfoResponse - - __alias__: _string_ - -### HttpCreds - - __url__: _string_ - - __token__: _string_ - -### OpenChannel - - __capacity__: _number_ - - __active__: _boolean_ - - __lifetime__: _number_ - - __local_balance__: _number_ - - __remote_balance__: _number_ - - __label__: _string_ - - __channel_id__: _string_ - -### LndNodeMetrics - - __pending_channels__: _number_ - - __closing_channels__: _number_ - - __forwarding_events__: _number_ - - __forwarding_fees__: _number_ - - __chain_balance__: ARRAY of: _[GraphPoint](#GraphPoint)_ - - __channel_balance__: ARRAY of: _[GraphPoint](#GraphPoint)_ - - __external_balance__: ARRAY of: _[GraphPoint](#GraphPoint)_ - - __offline_channels__: _number_ - - __online_channels__: _number_ - - __open_channels__: ARRAY of: _[OpenChannel](#OpenChannel)_ - - __closed_channels__: ARRAY of: _[ClosedChannel](#ClosedChannel)_ - -### OpenChannelResponse - - __channelId__: _string_ - -### LinkNPubThroughTokenRequest - - __token__: _string_ - -### LndMetricsRequest - - __from_unix__: _number_ *this field is optional - - __to_unix__: _number_ *this field is optional - -### DecodeInvoiceResponse - - __amount__: _number_ - -### BanUserRequest - - __user_id__: _string_ +### AppMetrics + - __app__: _[Application](#Application)_ + - __available__: _number_ + - __fees__: _number_ + - __invoices__: _number_ + - __operations__: ARRAY of: _[UserOperation](#UserOperation)_ + - __received__: _number_ + - __spent__: _number_ + - __total_fees__: _number_ + - __users__: _[UsersInfo](#UsersInfo)_ ### AppUser - __identifier__: _string_ - __info__: _[UserInfo](#UserInfo)_ - __max_withdrawable__: _number_ -### NewInvoiceRequest - - __amountSats__: _number_ - - __memo__: _string_ +### Application + - __balance__: _number_ + - __id__: _string_ + - __name__: _string_ + - __npub__: _string_ + +### AppsMetrics + - __apps__: ARRAY of: _[AppMetrics](#AppMetrics)_ + +### AppsMetricsRequest + - __from_unix__: _number_ *this field is optional + - __include_operations__: _boolean_ *this field is optional + - __to_unix__: _number_ *this field is optional + +### AuthApp + - __app__: _[Application](#Application)_ + - __auth_token__: _string_ + +### AuthAppRequest + - __allow_user_creation__: _boolean_ *this field is optional + - __name__: _string_ + +### BanUserRequest + - __user_id__: _string_ + +### BanUserResponse + - __balance_sats__: _number_ + - __banned_app_users__: ARRAY of: _[BannedAppUser](#BannedAppUser)_ + +### BannedAppUser + - __app_id__: _string_ + - __app_name__: _string_ + - __nostr_pub__: _string_ + - __user_identifier__: _string_ + +### ClosedChannel + - __capacity__: _number_ + - __channel_id__: _string_ + - __closed_height__: _number_ + +### ClosureMigration + - __closes_at_unix__: _number_ + +### CreateOneTimeInviteLinkRequest + - __sats__: _number_ *this field is optional + +### CreateOneTimeInviteLinkResponse + - __invitation_link__: _string_ ### DecodeInvoiceRequest - __invoice__: _string_ -### UsersInfo - - __total__: _number_ - - __no_balance__: _number_ - - __negative_balance__: _number_ - - __always_been_inactive__: _number_ - - __balance_avg__: _number_ - - __balance_median__: _number_ +### DecodeInvoiceResponse + - __amount__: _number_ + +### Empty + +### EncryptionExchangeRequest + - __deviceId__: _string_ + - __publicKey__: _string_ + +### EnrollAdminTokenRequest + - __admin_token__: _string_ + +### GetAppUserLNURLInfoRequest + - __base_url_override__: _string_ + - __user_identifier__: _string_ + +### GetAppUserRequest + - __user_identifier__: _string_ + +### GetInviteTokenStateRequest + - __invite_token__: _string_ + +### GetInviteTokenStateResponse + - __used__: _boolean_ + +### GetPaymentStateRequest + - __invoice__: _string_ + +### GetProductBuyLinkResponse + - __link__: _string_ + +### GetUserOperationsRequest + - __latestIncomingInvoice__: _number_ + - __latestIncomingTx__: _number_ + - __latestIncomingUserToUserPayment__: _number_ + - __latestOutgoingInvoice__: _number_ + - __latestOutgoingTx__: _number_ + - __latestOutgoingUserToUserPayment__: _number_ + - __max_size__: _number_ + +### GetUserOperationsResponse + - __latestIncomingInvoiceOperations__: _[UserOperations](#UserOperations)_ + - __latestIncomingTxOperations__: _[UserOperations](#UserOperations)_ + - __latestIncomingUserToUserPayemnts__: _[UserOperations](#UserOperations)_ + - __latestOutgoingInvoiceOperations__: _[UserOperations](#UserOperations)_ + - __latestOutgoingTxOperations__: _[UserOperations](#UserOperations)_ + - __latestOutgoingUserToUserPayemnts__: _[UserOperations](#UserOperations)_ + +### GraphPoint + - __x__: _number_ + - __y__: _number_ + +### HandleLnurlPayResponse + - __pr__: _string_ + - __routes__: ARRAY of: _[Empty](#Empty)_ + +### HttpCreds + - __token__: _string_ + - __url__: _string_ + +### LinkNPubThroughTokenRequest + - __token__: _string_ + +### LiveUserOperation + - __operation__: _[UserOperation](#UserOperation)_ + +### LndChannels + - __open_channels__: ARRAY of: _[OpenChannel](#OpenChannel)_ + +### LndGetInfoRequest + - __nodeId__: _number_ + +### LndGetInfoResponse + - __alias__: _string_ ### LndMetrics - __nodes__: ARRAY of: _[LndNodeMetrics](#LndNodeMetrics)_ +### LndMetricsRequest + - __from_unix__: _number_ *this field is optional + - __to_unix__: _number_ *this field is optional + +### LndNodeMetrics + - __chain_balance__: ARRAY of: _[GraphPoint](#GraphPoint)_ + - __channel_balance__: ARRAY of: _[GraphPoint](#GraphPoint)_ + - __closed_channels__: ARRAY of: _[ClosedChannel](#ClosedChannel)_ + - __closing_channels__: _number_ + - __external_balance__: ARRAY of: _[GraphPoint](#GraphPoint)_ + - __forwarding_events__: _number_ + - __forwarding_fees__: _number_ + - __offline_channels__: _number_ + - __online_channels__: _number_ + - __open_channels__: ARRAY of: _[OpenChannel](#OpenChannel)_ + - __pending_channels__: _number_ + +### LndSeed + - __seed__: ARRAY of: _string_ + +### LnurlLinkResponse + - __k1__: _string_ + - __lnurl__: _string_ + +### LnurlPayInfoResponse + - __allowsNostr__: _boolean_ + - __callback__: _string_ + - __maxSendable__: _number_ + - __metadata__: _string_ + - __minSendable__: _number_ + - __nostrPubkey__: _string_ + - __tag__: _string_ + +### LnurlWithdrawInfoResponse + - __balanceCheck__: _string_ + - __callback__: _string_ + - __defaultDescription__: _string_ + - __k1__: _string_ + - __maxWithdrawable__: _number_ + - __minWithdrawable__: _number_ + - __payLink__: _string_ + - __tag__: _string_ + +### MigrationUpdate + - __closure__: _[ClosureMigration](#ClosureMigration)_ *this field is optional + - __relays__: _[RelaysMigration](#RelaysMigration)_ *this field is optional + +### NewAddressRequest + - __addressType__: _[AddressType](#AddressType)_ + +### NewAddressResponse + - __address__: _string_ + +### NewInvoiceRequest + - __amountSats__: _number_ + - __memo__: _string_ + +### NewInvoiceResponse + - __invoice__: _string_ + +### OpenChannel + - __active__: _boolean_ + - __capacity__: _number_ + - __channel_id__: _string_ + - __label__: _string_ + - __lifetime__: _number_ + - __local_balance__: _number_ + - __remote_balance__: _number_ + +### OpenChannelRequest + - __closeAddress__: _string_ + - __destination__: _string_ + - __fundingAmount__: _number_ + - __pushAmount__: _number_ + +### OpenChannelResponse + - __channelId__: _string_ + ### PayAddressRequest - __address__: _string_ - __amoutSats__: _number_ - __satsPerVByte__: _number_ -### PaymentState - - __paid_at_unix__: _number_ - - __amount__: _number_ - - __service_fee__: _number_ +### PayAddressResponse - __network_fee__: _number_ - -### UserOperations - - __fromIndex__: _number_ - - __toIndex__: _number_ - - __operations__: ARRAY of: _[UserOperation](#UserOperation)_ - -### UsageMetrics - - __metrics__: ARRAY of: _[UsageMetric](#UsageMetric)_ - -### LndChannels - - __open_channels__: ARRAY of: _[OpenChannel](#OpenChannel)_ - -### RequestNPubLinkingTokenRequest - - __user_identifier__: _string_ - -### SendAppUserToAppUserPaymentRequest - - __from_user_identifier__: _string_ - - __to_user_identifier__: _string_ - - __amount__: _number_ - -### GetUserOperationsRequest - - __latestIncomingTx__: _number_ - - __latestOutgoingTx__: _number_ - - __latestIncomingUserToUserPayment__: _number_ - - __latestOutgoingUserToUserPayment__: _number_ - - __max_size__: _number_ - - __latestIncomingInvoice__: _number_ - - __latestOutgoingInvoice__: _number_ - -### GraphPoint - - __x__: _number_ - - __y__: _number_ - -### GetAppUserRequest - - __user_identifier__: _string_ - -### OpenChannelRequest - - __pushAmount__: _number_ - - __closeAddress__: _string_ - - __destination__: _string_ - - __fundingAmount__: _number_ - -### EnrollAdminTokenRequest - - __admin_token__: _string_ - -### LndSeed - - __seed__: ARRAY of: _string_ - -### RoutingEvent - - __outgoing_amt_msat__: _number_ - - __settled__: _boolean_ - - __forward_fail_event__: _boolean_ - - __incoming_htlc_id__: _number_ - - __outgoing_htlc_id__: _number_ - - __event_type__: _string_ - - __incoming_amt_msat__: _number_ - - __offchain__: _boolean_ - - __incoming_channel_id__: _number_ - - __outgoing_channel_id__: _number_ - - __timestamp_ns__: _number_ - - __failure_string__: _string_ - -### HandleLnurlPayResponse - - __routes__: ARRAY of: _[Empty](#Empty)_ - - __pr__: _string_ - -### GetProductBuyLinkResponse - - __link__: _string_ - -### GetInviteTokenStateResponse - - __used__: _boolean_ + - __operation_id__: _string_ + - __service_fee__: _number_ + - __txId__: _string_ ### PayAppUserInvoiceRequest - __amount__: _number_ - - __user_identifier__: _string_ - __invoice__: _string_ + - __user_identifier__: _string_ ### PayInvoiceRequest - __amount__: _number_ - __invoice__: _string_ -### LnurlPayInfoResponse - - __maxSendable__: _number_ - - __minSendable__: _number_ - - __metadata__: _string_ - - __allowsNostr__: _boolean_ - - __nostrPubkey__: _string_ - - __tag__: _string_ - - __callback__: _string_ - -### UserOperation - - __confirmed__: _boolean_ - - __internal__: _boolean_ - - __paidAtUnix__: _number_ - - __inbound__: _boolean_ - - __operationId__: _string_ - - __service_fee__: _number_ +### PayInvoiceResponse + - __amount_paid__: _number_ - __network_fee__: _number_ - - __type__: _[UserOperationType](#UserOperationType)_ - - __amount__: _number_ - - __identifier__: _string_ - - __tx_hash__: _string_ + - __operation_id__: _string_ + - __preimage__: _string_ + - __service_fee__: _number_ -### LiveUserOperation - - __operation__: _[UserOperation](#UserOperation)_ +### PaymentState + - __amount__: _number_ + - __network_fee__: _number_ + - __paid_at_unix__: _number_ + - __service_fee__: _number_ + +### Product + - __id__: _string_ + - __name__: _string_ + - __price_sats__: _number_ ### RelaysMigration - __relays__: ARRAY of: _string_ -### GetInviteTokenStateRequest - - __invite_token__: _string_ - -### AppsMetrics - - __apps__: ARRAY of: _[AppMetrics](#AppMetrics)_ - -### BannedAppUser - - __app_name__: _string_ - - __app_id__: _string_ +### RequestNPubLinkingTokenRequest - __user_identifier__: _string_ - - __nostr_pub__: _string_ -### NewAddressRequest - - __addressType__: _[AddressType](#AddressType)_ +### RequestNPubLinkingTokenResponse + - __token__: _string_ -### CreateOneTimeInviteLinkRequest - - __sats__: _number_ *this field is optional +### RoutingEvent + - __event_type__: _string_ + - __failure_string__: _string_ + - __forward_fail_event__: _boolean_ + - __incoming_amt_msat__: _number_ + - __incoming_channel_id__: _number_ + - __incoming_htlc_id__: _number_ + - __offchain__: _boolean_ + - __outgoing_amt_msat__: _number_ + - __outgoing_channel_id__: _number_ + - __outgoing_htlc_id__: _number_ + - __settled__: _boolean_ + - __timestamp_ns__: _number_ + +### SendAppUserToAppPaymentRequest + - __amount__: _number_ + - __from_user_identifier__: _string_ + +### SendAppUserToAppUserPaymentRequest + - __amount__: _number_ + - __from_user_identifier__: _string_ + - __to_user_identifier__: _string_ + +### SetMockAppBalanceRequest + - __amount__: _number_ + +### SetMockAppUserBalanceRequest + - __amount__: _number_ + - __user_identifier__: _string_ + +### SetMockInvoiceAsPaidRequest + - __amount__: _number_ + - __invoice__: _string_ + +### UsageMetric + - __auth_in_nano__: _number_ + - __batch__: _boolean_ + - __batch_size__: _number_ + - __handle_in_nano__: _number_ + - __nostr__: _boolean_ + - __parsed_in_nano__: _number_ + - __processed_at_ms__: _number_ + - __rpc_name__: _string_ + - __validate_in_nano__: _number_ + +### UsageMetrics + - __metrics__: ARRAY of: _[UsageMetric](#UsageMetric)_ ### UseInviteLinkRequest - __invite_token__: _string_ -### Application - - __name__: _string_ - - __id__: _string_ - - __balance__: _number_ - - __npub__: _string_ - -### SetMockAppUserBalanceRequest - - __user_identifier__: _string_ - - __amount__: _number_ - -### NewInvoiceResponse - - __invoice__: _string_ - -### PayInvoiceResponse - - __operation_id__: _string_ - - __service_fee__: _number_ - - __network_fee__: _number_ - - __preimage__: _string_ - - __amount_paid__: _number_ - -### GetPaymentStateRequest - - __invoice__: _string_ - -### AppMetrics - - __app__: _[Application](#Application)_ - - __users__: _[UsersInfo](#UsersInfo)_ - - __invoices__: _number_ - - __fees__: _number_ - - __total_fees__: _number_ - - __operations__: ARRAY of: _[UserOperation](#UserOperation)_ - - __received__: _number_ - - __spent__: _number_ - - __available__: _number_ - -### AuthApp - - __app__: _[Application](#Application)_ - - __auth_token__: _string_ - -### AddProductRequest - - __name__: _string_ - - __price_sats__: _number_ - -### ClosureMigration - - __closes_at_unix__: _number_ - -### SendAppUserToAppPaymentRequest - - __from_user_identifier__: _string_ - - __amount__: _number_ - ### UserInfo - __balance__: _number_ - __max_withdrawable__: _number_ - - __user_identifier__: _string_ - - __service_fee_bps__: _number_ - __network_max_fee_bps__: _number_ - __network_max_fee_fixed__: _number_ + - __service_fee_bps__: _number_ - __userId__: _string_ + - __user_identifier__: _string_ -### ClosedChannel - - __channel_id__: _string_ - - __capacity__: _number_ - - __closed_height__: _number_ +### UserOperation + - __amount__: _number_ + - __confirmed__: _boolean_ + - __identifier__: _string_ + - __inbound__: _boolean_ + - __internal__: _boolean_ + - __network_fee__: _number_ + - __operationId__: _string_ + - __paidAtUnix__: _number_ + - __service_fee__: _number_ + - __tx_hash__: _string_ + - __type__: _[UserOperationType](#UserOperationType)_ -### BanUserResponse - - __balance_sats__: _number_ - - __banned_app_users__: ARRAY of: _[BannedAppUser](#BannedAppUser)_ +### UserOperations + - __fromIndex__: _number_ + - __operations__: ARRAY of: _[UserOperation](#UserOperation)_ + - __toIndex__: _number_ -### MigrationUpdate - - __closure__: _[ClosureMigration](#ClosureMigration)_ *this field is optional - - __relays__: _[RelaysMigration](#RelaysMigration)_ *this field is optional - -### Empty - -### EncryptionExchangeRequest - - __publicKey__: _string_ - - __deviceId__: _string_ +### UsersInfo + - __always_been_inactive__: _number_ + - __balance_avg__: _number_ + - __balance_median__: _number_ + - __negative_balance__: _number_ + - __no_balance__: _number_ + - __total__: _number_ ## Enums ### The enumerators used in the messages ### AddressType - - __WITNESS_PUBKEY_HASH__ - __NESTED_PUBKEY_HASH__ - __TAPROOT_PUBKEY__ + - __WITNESS_PUBKEY_HASH__ ### UserOperationType - - __INCOMING_TX__ - - __OUTGOING_TX__ - __INCOMING_INVOICE__ - - __OUTGOING_INVOICE__ - - __OUTGOING_USER_TO_USER__ + - __INCOMING_TX__ - __INCOMING_USER_TO_USER__ + - __OUTGOING_INVOICE__ + - __OUTGOING_TX__ + - __OUTGOING_USER_TO_USER__ diff --git a/proto/autogenerated/debug.txt b/proto/autogenerated/debug.txt index 20033b38..2f890983 100644 --- a/proto/autogenerated/debug.txt +++ b/proto/autogenerated/debug.txt @@ -1,34 +1,5 @@ ([]*main.Method) (len=54 cap=64) { - (*main.Method)(0xc00007a1e0)({ - in: (main.MethodMessage) { - name: (string) (len=17) "LndGetInfoRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=10) "LndGetInfo", - out: (main.MethodMessage) { - name: (string) (len=18) "LndGetInfoResponse", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0004ca720)({ - authType: (*main.supportedAuth)(0xc00049d680)({ - id: (string) (len=5) "admin", - name: (string) (len=5) "Admin", - context: (map[string]string) (len=1) { - (string) (len=8) "admin_id": (string) (len=6) "string" - } - }), - method: (string) (len=4) "post", - route: (main.decodedRoute) { - route: (string) (len=22) "/api/admin/lnd/getinfo", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) true, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007a280)({ + (*main.Method)(0xc0002ae4b0)({ in: (main.MethodMessage) { name: (string) (len=13) "AddAppRequest", hasZeroFields: (bool) false @@ -38,12 +9,15 @@ name: (string) (len=7) "AuthApp", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0004ca900)({ - authType: (*main.supportedAuth)(0xc00049d710)({ + opts: (*main.methodOptions)(0xc000519920)({ + authType: (*main.supportedAuth)(0xc0001565c0)({ id: (string) (len=5) "admin", name: (string) (len=5) "Admin", - context: (map[string]string) (len=1) { - (string) (len=8) "admin_id": (string) (len=6) "string" + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040b00)({ + itemName: (string) (len=8) "admin_id", + itemType: (string) (len=6) "string" + }) } }), method: (string) (len=4) "post", @@ -57,7 +31,143 @@ }), serverStream: (bool) false }), - (*main.Method)(0xc00007a320)({ + (*main.Method)(0xc0002af180)({ + in: (main.MethodMessage) { + name: (string) (len=20) "AddAppInvoiceRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=13) "AddAppInvoice", + out: (main.MethodMessage) { + name: (string) (len=18) "NewInvoiceResponse", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc000167aa0)({ + authType: (*main.supportedAuth)(0xc000157ac0)({ + id: (string) (len=3) "app", + name: (string) (len=3) "App", + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040bc0)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=20) "/api/app/add/invoice", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) false, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002af0e0)({ + in: (main.MethodMessage) { + name: (string) (len=17) "AddAppUserRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=10) "AddAppUser", + out: (main.MethodMessage) { + name: (string) (len=7) "AppUser", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc000167920)({ + authType: (*main.supportedAuth)(0xc000157a00)({ + id: (string) (len=3) "app", + name: (string) (len=3) "App", + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040bc0)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=17) "/api/app/user/add", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) false, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002af1d0)({ + in: (main.MethodMessage) { + name: (string) (len=24) "AddAppUserInvoiceRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=17) "AddAppUserInvoice", + out: (main.MethodMessage) { + name: (string) (len=18) "NewInvoiceResponse", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc000167c80)({ + authType: (*main.supportedAuth)(0xc000157b80)({ + id: (string) (len=3) "app", + name: (string) (len=3) "App", + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040bc0)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=25) "/api/app/user/add/invoice", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) false, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002af6d0)({ + in: (main.MethodMessage) { + name: (string) (len=17) "AddProductRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=10) "AddProduct", + out: (main.MethodMessage) { + name: (string) (len=7) "Product", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc0001950e0)({ + authType: (*main.supportedAuth)(0xc000196500)({ + id: (string) (len=4) "user", + name: (string) (len=4) "User", + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=21) "/api/user/product/add", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) true, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002ae730)({ in: (main.MethodMessage) { name: (string) (len=14) "AuthAppRequest", hasZeroFields: (bool) false @@ -67,12 +177,15 @@ name: (string) (len=7) "AuthApp", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0004caae0)({ - authType: (*main.supportedAuth)(0xc00049d7a0)({ + opts: (*main.methodOptions)(0xc000519b00)({ + authType: (*main.supportedAuth)(0xc000156680)({ id: (string) (len=5) "admin", name: (string) (len=5) "Admin", - context: (map[string]string) (len=1) { - (string) (len=8) "admin_id": (string) (len=6) "string" + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040b00)({ + itemName: (string) (len=8) "admin_id", + itemType: (string) (len=6) "string" + }) } }), method: (string) (len=4) "post", @@ -86,7 +199,7 @@ }), serverStream: (bool) false }), - (*main.Method)(0xc00007a3c0)({ + (*main.Method)(0xc0002ae8c0)({ in: (main.MethodMessage) { name: (string) (len=14) "BanUserRequest", hasZeroFields: (bool) false @@ -96,12 +209,15 @@ name: (string) (len=15) "BanUserResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0004cacc0)({ - authType: (*main.supportedAuth)(0xc00049d830)({ + opts: (*main.methodOptions)(0xc000519ce0)({ + authType: (*main.supportedAuth)(0xc000156740)({ id: (string) (len=5) "admin", name: (string) (len=5) "Admin", - context: (map[string]string) (len=1) { - (string) (len=8) "admin_id": (string) (len=6) "string" + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040b00)({ + itemName: (string) (len=8) "admin_id", + itemType: (string) (len=6) "string" + }) } }), method: (string) (len=4) "post", @@ -115,152 +231,47 @@ }), serverStream: (bool) false }), - (*main.Method)(0xc00007a410)({ + (*main.Method)(0xc0002aff90)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - name: (string) (len=7) "GetSeed", + name: (string) (len=9) "BatchUser", out: (main.MethodMessage) { - name: (string) (len=7) "LndSeed", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0004caea0)({ - authType: (*main.supportedAuth)(0xc00049d8c0)({ - id: (string) (len=5) "admin", - name: (string) (len=5) "Admin", - context: (map[string]string) (len=1) { - (string) (len=8) "admin_id": (string) (len=6) "string" - } - }), - method: (string) (len=3) "get", - route: (main.decodedRoute) { - route: (string) (len=15) "/api/admin/seed", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) true, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007a460)({ - in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - name: (string) (len=12) "ListChannels", - out: (main.MethodMessage) { - name: (string) (len=11) "LndChannels", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0004cb080)({ - authType: (*main.supportedAuth)(0xc00049d950)({ - id: (string) (len=5) "admin", - name: (string) (len=5) "Admin", - context: (map[string]string) (len=1) { - (string) (len=8) "admin_id": (string) (len=6) "string" - } - }), - method: (string) (len=3) "get", - route: (main.decodedRoute) { - route: (string) (len=19) "/api/admin/channels", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) true, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007a4b0)({ - in: (main.MethodMessage) { - name: (string) (len=5) "Empty", - hasZeroFields: (bool) true - }, - name: (string) (len=15) "GetUsageMetrics", - out: (main.MethodMessage) { - name: (string) (len=12) "UsageMetrics", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0004cb260)({ - authType: (*main.supportedAuth)(0xc00049d9e0)({ - id: (string) (len=7) "metrics", - name: (string) (len=7) "Metrics", - context: (map[string]string) (len=1) { - (string) (len=11) "operator_id": (string) (len=6) "string" + opts: (*main.methodOptions)(0xc00019b200)({ + authType: (*main.supportedAuth)(0xc0001971c0)({ + id: (string) (len=4) "user", + name: (string) (len=4) "User", + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) } }), method: (string) (len=4) "post", route: (main.decodedRoute) { - route: (string) (len=18) "/api/reports/usage", + route: (string) (len=15) "/api/user/batch", params: ([]string) }, query: ([]string) , nostr: (bool) true, - batch: (bool) false + batch: (bool) true }), serverStream: (bool) false }), - (*main.Method)(0xc00007a500)({ - in: (main.MethodMessage) { - name: (string) (len=18) "AppsMetricsRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=14) "GetAppsMetrics", - out: (main.MethodMessage) { - name: (string) (len=11) "AppsMetrics", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0004cb440)({ - authType: (*main.supportedAuth)(0xc00049da70)({ - id: (string) (len=7) "metrics", - name: (string) (len=7) "Metrics", - context: (map[string]string) (len=1) { - (string) (len=11) "operator_id": (string) (len=6) "string" - } - }), - method: (string) (len=4) "post", - route: (main.decodedRoute) { - route: (string) (len=17) "/api/reports/apps", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) true, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007a550)({ - in: (main.MethodMessage) { - name: (string) (len=17) "LndMetricsRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=13) "GetLndMetrics", - out: (main.MethodMessage) { - name: (string) (len=10) "LndMetrics", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0004cb620)({ - authType: (*main.supportedAuth)(0xc00049db00)({ - id: (string) (len=7) "metrics", - name: (string) (len=7) "Metrics", - context: (map[string]string) (len=1) { - (string) (len=11) "operator_id": (string) (len=6) "string" - } - }), - method: (string) (len=4) "post", - route: (main.decodedRoute) { - route: (string) (len=16) "/api/reports/lnd", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) true, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007a5a0)({ + (*main.Method)(0xc0002aeaa0)({ in: (main.MethodMessage) { name: (string) (len=30) "CreateOneTimeInviteLinkRequest", hasZeroFields: (bool) false @@ -270,12 +281,15 @@ name: (string) (len=31) "CreateOneTimeInviteLinkResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0004cb860)({ - authType: (*main.supportedAuth)(0xc00049db90)({ + opts: (*main.methodOptions)(0xc000070de0)({ + authType: (*main.supportedAuth)(0xc000156d40)({ id: (string) (len=5) "admin", name: (string) (len=5) "Admin", - context: (map[string]string) (len=1) { - (string) (len=8) "admin_id": (string) (len=6) "string" + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040b00)({ + itemName: (string) (len=8) "admin_id", + itemType: (string) (len=6) "string" + }) } }), method: (string) (len=4) "post", @@ -289,7 +303,282 @@ }), serverStream: (bool) false }), - (*main.Method)(0xc00007a5f0)({ + (*main.Method)(0xc0002af9f0)({ + in: (main.MethodMessage) { + name: (string) (len=20) "DecodeInvoiceRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=13) "DecodeInvoice", + out: (main.MethodMessage) { + name: (string) (len=21) "DecodeInvoiceResponse", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc000195ec0)({ + authType: (*main.supportedAuth)(0xc000196a00)({ + id: (string) (len=4) "user", + name: (string) (len=4) "User", + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=24) "/api/user/invoice/decode", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) true, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002aeb90)({ + in: (main.MethodMessage) { + name: (string) (len=25) "EncryptionExchangeRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=18) "EncryptionExchange", + out: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + opts: (*main.methodOptions)(0xc0000713e0)({ + authType: (*main.supportedAuth)(0xc000156f80)({ + id: (string) (len=5) "guest", + name: (string) (len=5) "Guest", + context: ([]*main.authContext) + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=24) "/api/encryption/exchange", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) false, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002aef00)({ + in: (main.MethodMessage) { + name: (string) (len=23) "EnrollAdminTokenRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=16) "EnrollAdminToken", + out: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + opts: (*main.methodOptions)(0xc000167260)({ + authType: (*main.supportedAuth)(0xc000157680)({ + id: (string) (len=4) "user", + name: (string) (len=4) "User", + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=28) "/api/guest/npub/enroll/admin", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) true, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002af040)({ + in: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + name: (string) (len=6) "GetApp", + out: (main.MethodMessage) { + name: (string) (len=11) "Application", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc0001677a0)({ + authType: (*main.supportedAuth)(0xc000157900)({ + id: (string) (len=3) "app", + name: (string) (len=3) "App", + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040bc0)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=12) "/api/app/get", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) false, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002af270)({ + in: (main.MethodMessage) { + name: (string) (len=17) "GetAppUserRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=10) "GetAppUser", + out: (main.MethodMessage) { + name: (string) (len=7) "AppUser", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc000167e00)({ + authType: (*main.supportedAuth)(0xc000157c40)({ + id: (string) (len=3) "app", + name: (string) (len=3) "App", + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040bc0)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=17) "/api/app/user/get", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) false, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002af450)({ + in: (main.MethodMessage) { + name: (string) (len=26) "GetAppUserLNURLInfoRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=19) "GetAppUserLNURLInfo", + out: (main.MethodMessage) { + name: (string) (len=20) "LnurlPayInfoResponse", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc000194480)({ + authType: (*main.supportedAuth)(0xc000157f40)({ + id: (string) (len=3) "app", + name: (string) (len=3) "App", + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040bc0)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=28) "/api/app/user/lnurl/pay/info", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) false, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002aea00)({ + in: (main.MethodMessage) { + name: (string) (len=18) "AppsMetricsRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=14) "GetAppsMetrics", + out: (main.MethodMessage) { + name: (string) (len=11) "AppsMetrics", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc0000709c0)({ + authType: (*main.supportedAuth)(0xc000156b40)({ + id: (string) (len=7) "metrics", + name: (string) (len=7) "Metrics", + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040b80)({ + itemName: (string) (len=11) "operator_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=17) "/api/reports/apps", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) true, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002aff40)({ + in: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + name: (string) (len=12) "GetHttpCreds", + out: (main.MethodMessage) { + name: (string) (len=9) "HttpCreds", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc00019afc0)({ + authType: (*main.supportedAuth)(0xc0001970c0)({ + id: (string) (len=4) "user", + name: (string) (len=4) "User", + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=20) "/api/user/http_creds", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) true, + batch: (bool) false + }), + serverStream: (bool) true + }), + (*main.Method)(0xc0002aeaf0)({ in: (main.MethodMessage) { name: (string) (len=26) "GetInviteTokenStateRequest", hasZeroFields: (bool) false @@ -299,12 +588,15 @@ name: (string) (len=27) "GetInviteTokenStateResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0004cbaa0)({ - authType: (*main.supportedAuth)(0xc00049dc20)({ + opts: (*main.methodOptions)(0xc0000710e0)({ + authType: (*main.supportedAuth)(0xc000156e00)({ id: (string) (len=5) "admin", name: (string) (len=5) "Admin", - context: (map[string]string) (len=1) { - (string) (len=8) "admin_id": (string) (len=6) "string" + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040b00)({ + itemName: (string) (len=8) "admin_id", + itemType: (string) (len=6) "string" + }) } }), method: (string) (len=4) "post", @@ -318,91 +610,188 @@ }), serverStream: (bool) false }), - (*main.Method)(0xc00007a640)({ + (*main.Method)(0xc0002afdb0)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - name: (string) (len=6) "Health", + name: (string) (len=19) "GetLNURLChannelLink", out: (main.MethodMessage) { + name: (string) (len=17) "LnurlLinkResponse", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc00019aa20)({ + authType: (*main.supportedAuth)(0xc000196e80)({ + id: (string) (len=4) "user", + name: (string) (len=4) "User", + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=27) "/api/user/lnurl_channel/url", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) true, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002afe50)({ + in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc0004cbc20)({ - authType: (*main.supportedAuth)(0xc00049dcb0)({ + name: (string) (len=21) "GetLiveUserOperations", + out: (main.MethodMessage) { + name: (string) (len=17) "LiveUserOperation", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc00019ac00)({ + authType: (*main.supportedAuth)(0xc000196f40)({ + id: (string) (len=4) "user", + name: (string) (len=4) "User", + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=24) "/api/user/operations/sub", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) true, + batch: (bool) false + }), + serverStream: (bool) true + }), + (*main.Method)(0xc0002aea50)({ + in: (main.MethodMessage) { + name: (string) (len=17) "LndMetricsRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=13) "GetLndMetrics", + out: (main.MethodMessage) { + name: (string) (len=10) "LndMetrics", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc000070ba0)({ + authType: (*main.supportedAuth)(0xc000156c40)({ + id: (string) (len=7) "metrics", + name: (string) (len=7) "Metrics", + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040b80)({ + itemName: (string) (len=11) "operator_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=16) "/api/reports/lnd", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) true, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002aedc0)({ + in: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + name: (string) (len=15) "GetLnurlPayInfo", + out: (main.MethodMessage) { + name: (string) (len=20) "LnurlPayInfoResponse", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc000166ae0)({ + authType: (*main.supportedAuth)(0xc000157380)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", - context: (map[string]string) { + context: ([]*main.authContext) + }), + method: (string) (len=3) "get", + route: (main.decodedRoute) { + route: (string) (len=25) "/api/guest/lnurl_pay/info", + params: ([]string) + }, + query: ([]string) (len=1 cap=1) { + (string) (len=2) "k1" + }, + nostr: (bool) false, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002afd10)({ + in: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + name: (string) (len=15) "GetLnurlPayLink", + out: (main.MethodMessage) { + name: (string) (len=17) "LnurlLinkResponse", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc00019a840)({ + authType: (*main.supportedAuth)(0xc000196dc0)({ + id: (string) (len=4) "user", + name: (string) (len=4) "User", + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) } }), method: (string) (len=3) "get", route: (main.decodedRoute) { - route: (string) (len=11) "/api/health", + route: (string) (len=24) "/api/user/lnurl_pay/link", params: ([]string) }, query: ([]string) , - nostr: (bool) false, + nostr: (bool) true, batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc00007a690)({ - in: (main.MethodMessage) { - name: (string) (len=25) "EncryptionExchangeRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=18) "EncryptionExchange", - out: (main.MethodMessage) { - name: (string) (len=5) "Empty", - hasZeroFields: (bool) true - }, - opts: (*main.methodOptions)(0xc0004cbda0)({ - authType: (*main.supportedAuth)(0xc00049dd70)({ - id: (string) (len=5) "guest", - name: (string) (len=5) "Guest", - context: (map[string]string) { - } - }), - method: (string) (len=4) "post", - route: (main.decodedRoute) { - route: (string) (len=24) "/api/encryption/exchange", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) false, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007a6e0)({ - in: (main.MethodMessage) { - name: (string) (len=27) "SetMockInvoiceAsPaidRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=20) "SetMockInvoiceAsPaid", - out: (main.MethodMessage) { - name: (string) (len=5) "Empty", - hasZeroFields: (bool) true - }, - opts: (*main.methodOptions)(0xc0004cbf80)({ - authType: (*main.supportedAuth)(0xc00049de00)({ - id: (string) (len=5) "guest", - name: (string) (len=5) "Guest", - context: (map[string]string) { - } - }), - method: (string) (len=4) "post", - route: (main.decodedRoute) { - route: (string) (len=26) "/api/lnd/mock/invoice/paid", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) false, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007a780)({ + (*main.Method)(0xc0002aec80)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -412,12 +801,11 @@ name: (string) (len=25) "LnurlWithdrawInfoResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0000703c0)({ - authType: (*main.supportedAuth)(0xc00049df50)({ + opts: (*main.methodOptions)(0xc000166420)({ + authType: (*main.supportedAuth)(0xc000157180)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", - context: (map[string]string) { - } + context: ([]*main.authContext) }), method: (string) (len=3) "get", route: (main.decodedRoute) { @@ -432,7 +820,332 @@ }), serverStream: (bool) false }), - (*main.Method)(0xc00007a820)({ + (*main.Method)(0xc0002afc70)({ + in: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + name: (string) (len=20) "GetLnurlWithdrawLink", + out: (main.MethodMessage) { + name: (string) (len=17) "LnurlLinkResponse", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc00019a660)({ + authType: (*main.supportedAuth)(0xc000196d00)({ + id: (string) (len=4) "user", + name: (string) (len=4) "User", + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=3) "get", + route: (main.decodedRoute) { + route: (string) (len=29) "/api/user/lnurl_withdraw/link", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) true, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002afef0)({ + in: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + name: (string) (len=18) "GetMigrationUpdate", + out: (main.MethodMessage) { + name: (string) (len=15) "MigrationUpdate", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc00019ade0)({ + authType: (*main.supportedAuth)(0xc000197000)({ + id: (string) (len=4) "user", + name: (string) (len=4) "User", + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=24) "/api/user/migrations/sub", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) true, + batch: (bool) false + }), + serverStream: (bool) true + }), + (*main.Method)(0xc0002afb30)({ + in: (main.MethodMessage) { + name: (string) (len=22) "GetPaymentStateRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=15) "GetPaymentState", + out: (main.MethodMessage) { + name: (string) (len=12) "PaymentState", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc00019a2a0)({ + authType: (*main.supportedAuth)(0xc000196b80)({ + id: (string) (len=4) "user", + name: (string) (len=4) "User", + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=23) "/api/user/payment/state", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) true, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002ae910)({ + in: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + name: (string) (len=7) "GetSeed", + out: (main.MethodMessage) { + name: (string) (len=7) "LndSeed", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc000519ec0)({ + authType: (*main.supportedAuth)(0xc000156800)({ + id: (string) (len=5) "admin", + name: (string) (len=5) "Admin", + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040b00)({ + itemName: (string) (len=8) "admin_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=3) "get", + route: (main.decodedRoute) { + route: (string) (len=15) "/api/admin/seed", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) true, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002ae9b0)({ + in: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + name: (string) (len=15) "GetUsageMetrics", + out: (main.MethodMessage) { + name: (string) (len=12) "UsageMetrics", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc0000707e0)({ + authType: (*main.supportedAuth)(0xc000156a40)({ + id: (string) (len=7) "metrics", + name: (string) (len=7) "Metrics", + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040b80)({ + itemName: (string) (len=11) "operator_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=18) "/api/reports/usage", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) true, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002af630)({ + in: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + name: (string) (len=11) "GetUserInfo", + out: (main.MethodMessage) { + name: (string) (len=8) "UserInfo", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc000194f00)({ + authType: (*main.supportedAuth)(0xc000196400)({ + id: (string) (len=4) "user", + name: (string) (len=4) "User", + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=14) "/api/user/info", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) true, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002af770)({ + in: (main.MethodMessage) { + name: (string) (len=24) "GetUserOperationsRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=17) "GetUserOperations", + out: (main.MethodMessage) { + name: (string) (len=25) "GetUserOperationsResponse", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc000195740)({ + authType: (*main.supportedAuth)(0xc0001966c0)({ + id: (string) (len=4) "user", + name: (string) (len=4) "User", + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=20) "/api/user/operations", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) true, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002aeeb0)({ + in: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + name: (string) (len=18) "HandleLnurlAddress", + out: (main.MethodMessage) { + name: (string) (len=20) "LnurlPayInfoResponse", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc000167020)({ + authType: (*main.supportedAuth)(0xc000157580)({ + id: (string) (len=5) "guest", + name: (string) (len=5) "Guest", + context: ([]*main.authContext) + }), + method: (string) (len=3) "get", + route: (main.decodedRoute) { + route: (string) (len=33) "/.well-known/lnurlp/:address_name", + params: ([]string) (len=1 cap=1) { + (string) (len=12) "address_name" + } + }, + query: ([]string) , + nostr: (bool) false, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002aee60)({ + in: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + name: (string) (len=14) "HandleLnurlPay", + out: (main.MethodMessage) { + name: (string) (len=22) "HandleLnurlPayResponse", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc000166ea0)({ + authType: (*main.supportedAuth)(0xc0001574c0)({ + id: (string) (len=5) "guest", + name: (string) (len=5) "Guest", + context: ([]*main.authContext) + }), + method: (string) (len=3) "get", + route: (main.decodedRoute) { + route: (string) (len=27) "/api/guest/lnurl_pay/handle", + params: ([]string) + }, + query: ([]string) (len=4 cap=4) { + (string) (len=6) "amount", + (string) (len=2) "k1", + (string) (len=5) "lnurl", + (string) (len=5) "nostr" + }, + nostr: (bool) false, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002aed20)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -442,12 +1155,11 @@ name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc000070720)({ - authType: (*main.supportedAuth)(0xc0003b7ce0)({ + opts: (*main.methodOptions)(0xc000166780)({ + authType: (*main.supportedAuth)(0xc000157280)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", - context: (map[string]string) { - } + context: ([]*main.authContext) }), method: (string) (len=3) "get", route: (main.decodedRoute) { @@ -463,131 +1175,34 @@ }), serverStream: (bool) false }), - (*main.Method)(0xc00007a8c0)({ + (*main.Method)(0xc0002aeb40)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - name: (string) (len=15) "GetLnurlPayInfo", + name: (string) (len=6) "Health", out: (main.MethodMessage) { - name: (string) (len=20) "LnurlPayInfoResponse", - hasZeroFields: (bool) false + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc000070a80)({ - authType: (*main.supportedAuth)(0xc0003b7e00)({ + opts: (*main.methodOptions)(0xc000071260)({ + authType: (*main.supportedAuth)(0xc000156ec0)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", - context: (map[string]string) { - } + context: ([]*main.authContext) }), method: (string) (len=3) "get", route: (main.decodedRoute) { - route: (string) (len=25) "/api/guest/lnurl_pay/info", - params: ([]string) - }, - query: ([]string) (len=1 cap=1) { - (string) (len=2) "k1" - }, - nostr: (bool) false, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007a960)({ - in: (main.MethodMessage) { - name: (string) (len=5) "Empty", - hasZeroFields: (bool) true - }, - name: (string) (len=14) "HandleLnurlPay", - out: (main.MethodMessage) { - name: (string) (len=22) "HandleLnurlPayResponse", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc000070e40)({ - authType: (*main.supportedAuth)(0xc0003b7f50)({ - id: (string) (len=5) "guest", - name: (string) (len=5) "Guest", - context: (map[string]string) { - } - }), - method: (string) (len=3) "get", - route: (main.decodedRoute) { - route: (string) (len=27) "/api/guest/lnurl_pay/handle", - params: ([]string) - }, - query: ([]string) (len=4 cap=4) { - (string) (len=2) "k1", - (string) (len=6) "amount", - (string) (len=5) "nostr", - (string) (len=5) "lnurl" - }, - nostr: (bool) false, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007a9b0)({ - in: (main.MethodMessage) { - name: (string) (len=5) "Empty", - hasZeroFields: (bool) true - }, - name: (string) (len=18) "HandleLnurlAddress", - out: (main.MethodMessage) { - name: (string) (len=20) "LnurlPayInfoResponse", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc000070fc0)({ - authType: (*main.supportedAuth)(0xc000480000)({ - id: (string) (len=5) "guest", - name: (string) (len=5) "Guest", - context: (map[string]string) { - } - }), - method: (string) (len=3) "get", - route: (main.decodedRoute) { - route: (string) (len=33) "/.well-known/lnurlp/:address_name", - params: ([]string) (len=1 cap=1) { - (string) (len=12) "address_name" - } - }, - query: ([]string) , - nostr: (bool) false, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007aa00)({ - in: (main.MethodMessage) { - name: (string) (len=23) "EnrollAdminTokenRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=16) "EnrollAdminToken", - out: (main.MethodMessage) { - name: (string) (len=5) "Empty", - hasZeroFields: (bool) true - }, - opts: (*main.methodOptions)(0xc000071200)({ - authType: (*main.supportedAuth)(0xc00035d170)({ - 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=28) "/api/guest/npub/enroll/admin", + route: (string) (len=11) "/api/health", params: ([]string) }, query: ([]string) , - nostr: (bool) true, + nostr: (bool) false, batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc00007aaa0)({ + (*main.Method)(0xc0002aefa0)({ in: (main.MethodMessage) { name: (string) (len=27) "LinkNPubThroughTokenRequest", hasZeroFields: (bool) false @@ -597,13 +1212,19 @@ name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc0000713e0)({ - authType: (*main.supportedAuth)(0xc0005e8060)({ + opts: (*main.methodOptions)(0xc000167440)({ + authType: (*main.supportedAuth)(0xc000157740)({ id: (string) (len=8) "guestPub", name: (string) (len=12) "GuestWithPub", - context: (map[string]string) (len=2) { - (string) (len=6) "app_id": (string) (len=6) "string", - (string) (len=3) "pub": (string) (len=6) "string" + context: ([]*main.authContext) (len=2 cap=2) { + (*main.authContext)(0xc000040ca0)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040c80)({ + itemName: (string) (len=3) "pub", + itemType: (string) (len=6) "string" + }) } }), method: (string) (len=4) "post", @@ -617,28 +1238,30 @@ }), serverStream: (bool) false }), - (*main.Method)(0xc00007aaf0)({ + (*main.Method)(0xc0002ae960)({ in: (main.MethodMessage) { - name: (string) (len=20) "UseInviteLinkRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=13) "UseInviteLink", - out: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc0000715c0)({ - authType: (*main.supportedAuth)(0xc0005e80f0)({ - id: (string) (len=8) "guestPub", - name: (string) (len=12) "GuestWithPub", - context: (map[string]string) (len=2) { - (string) (len=6) "app_id": (string) (len=6) "string", - (string) (len=3) "pub": (string) (len=6) "string" + name: (string) (len=12) "ListChannels", + out: (main.MethodMessage) { + name: (string) (len=11) "LndChannels", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc0000705a0)({ + authType: (*main.supportedAuth)(0xc000156940)({ + id: (string) (len=5) "admin", + name: (string) (len=5) "Admin", + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040b00)({ + itemName: (string) (len=8) "admin_id", + itemType: (string) (len=6) "string" + }) } }), - method: (string) (len=4) "post", + method: (string) (len=3) "get", route: (main.decodedRoute) { - route: (string) (len=17) "/api/guest/invite", + route: (string) (len=19) "/api/admin/channels", params: ([]string) }, query: ([]string) , @@ -647,406 +1270,110 @@ }), serverStream: (bool) false }), - (*main.Method)(0xc00007ab40)({ + (*main.Method)(0xc0002ae0f0)({ in: (main.MethodMessage) { - name: (string) (len=5) "Empty", - hasZeroFields: (bool) true - }, - name: (string) (len=6) "GetApp", - out: (main.MethodMessage) { - name: (string) (len=11) "Application", + name: (string) (len=17) "LndGetInfoRequest", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc000071740)({ - authType: (*main.supportedAuth)(0xc0005e8180)({ - id: (string) (len=3) "app", - name: (string) (len=3) "App", - context: (map[string]string) (len=1) { - (string) (len=6) "app_id": (string) (len=6) "string" + name: (string) (len=10) "LndGetInfo", + out: (main.MethodMessage) { + name: (string) (len=18) "LndGetInfoResponse", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc000519740)({ + authType: (*main.supportedAuth)(0xc000156500)({ + id: (string) (len=5) "admin", + name: (string) (len=5) "Admin", + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040b00)({ + itemName: (string) (len=8) "admin_id", + itemType: (string) (len=6) "string" + }) } }), method: (string) (len=4) "post", route: (main.decodedRoute) { - route: (string) (len=12) "/api/app/get", + route: (string) (len=22) "/api/admin/lnd/getinfo", params: ([]string) }, query: ([]string) , - nostr: (bool) false, + nostr: (bool) true, batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc00007abe0)({ + (*main.Method)(0xc0002af810)({ in: (main.MethodMessage) { - name: (string) (len=17) "AddAppUserRequest", + name: (string) (len=17) "NewAddressRequest", hasZeroFields: (bool) false }, - name: (string) (len=10) "AddAppUser", + name: (string) (len=10) "NewAddress", out: (main.MethodMessage) { - name: (string) (len=7) "AppUser", + name: (string) (len=18) "NewAddressResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0000718c0)({ - authType: (*main.supportedAuth)(0xc0005e8210)({ - id: (string) (len=3) "app", - name: (string) (len=3) "App", - context: (map[string]string) (len=1) { - (string) (len=6) "app_id": (string) (len=6) "string" + opts: (*main.methodOptions)(0xc000195920)({ + authType: (*main.supportedAuth)(0xc0001967c0)({ + id: (string) (len=4) "user", + name: (string) (len=4) "User", + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) } }), method: (string) (len=4) "post", route: (main.decodedRoute) { - route: (string) (len=17) "/api/app/user/add", + route: (string) (len=19) "/api/user/chain/new", params: ([]string) }, query: ([]string) , - nostr: (bool) false, + nostr: (bool) true, batch: (bool) false }), serverStream: (bool) false }), - (*main.Method)(0xc00007ac80)({ + (*main.Method)(0xc0002af950)({ in: (main.MethodMessage) { - name: (string) (len=20) "AddAppInvoiceRequest", + name: (string) (len=17) "NewInvoiceRequest", hasZeroFields: (bool) false }, - name: (string) (len=13) "AddAppInvoice", + name: (string) (len=10) "NewInvoice", out: (main.MethodMessage) { name: (string) (len=18) "NewInvoiceResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc000071a40)({ - authType: (*main.supportedAuth)(0xc0005e82a0)({ - id: (string) (len=3) "app", - name: (string) (len=3) "App", - context: (map[string]string) (len=1) { - (string) (len=6) "app_id": (string) (len=6) "string" - } - }), - method: (string) (len=4) "post", - route: (main.decodedRoute) { - route: (string) (len=20) "/api/app/add/invoice", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) false, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007acd0)({ - in: (main.MethodMessage) { - name: (string) (len=24) "AddAppUserInvoiceRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=17) "AddAppUserInvoice", - out: (main.MethodMessage) { - name: (string) (len=18) "NewInvoiceResponse", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc000071c20)({ - authType: (*main.supportedAuth)(0xc0005e8330)({ - id: (string) (len=3) "app", - name: (string) (len=3) "App", - context: (map[string]string) (len=1) { - (string) (len=6) "app_id": (string) (len=6) "string" - } - }), - method: (string) (len=4) "post", - route: (main.decodedRoute) { - route: (string) (len=25) "/api/app/user/add/invoice", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) false, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007ad70)({ - in: (main.MethodMessage) { - name: (string) (len=17) "GetAppUserRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=10) "GetAppUser", - out: (main.MethodMessage) { - name: (string) (len=7) "AppUser", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc000071da0)({ - authType: (*main.supportedAuth)(0xc0005e83c0)({ - id: (string) (len=3) "app", - name: (string) (len=3) "App", - context: (map[string]string) (len=1) { - (string) (len=6) "app_id": (string) (len=6) "string" - } - }), - method: (string) (len=4) "post", - route: (main.decodedRoute) { - route: (string) (len=17) "/api/app/user/get", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) false, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007ae10)({ - in: (main.MethodMessage) { - name: (string) (len=24) "PayAppUserInvoiceRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=17) "PayAppUserInvoice", - out: (main.MethodMessage) { - name: (string) (len=18) "PayInvoiceResponse", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc000071f20)({ - authType: (*main.supportedAuth)(0xc0005e8450)({ - id: (string) (len=3) "app", - name: (string) (len=3) "App", - context: (map[string]string) (len=1) { - (string) (len=6) "app_id": (string) (len=6) "string" - } - }), - method: (string) (len=4) "post", - route: (main.decodedRoute) { - route: (string) (len=20) "/api/app/invoice/pay", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) false, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007ae60)({ - in: (main.MethodMessage) { - name: (string) (len=34) "SendAppUserToAppUserPaymentRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=27) "SendAppUserToAppUserPayment", - out: (main.MethodMessage) { - name: (string) (len=5) "Empty", - hasZeroFields: (bool) true - }, - opts: (*main.methodOptions)(0xc0005ec120)({ - authType: (*main.supportedAuth)(0xc0005e84e0)({ - id: (string) (len=3) "app", - name: (string) (len=3) "App", - context: (map[string]string) (len=1) { - (string) (len=6) "app_id": (string) (len=6) "string" - } - }), - method: (string) (len=4) "post", - route: (main.decodedRoute) { - route: (string) (len=26) "/api/app/user/internal/pay", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) false, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007af00)({ - in: (main.MethodMessage) { - name: (string) (len=30) "SendAppUserToAppPaymentRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=23) "SendAppUserToAppPayment", - out: (main.MethodMessage) { - name: (string) (len=5) "Empty", - hasZeroFields: (bool) true - }, - opts: (*main.methodOptions)(0xc0005ec2a0)({ - authType: (*main.supportedAuth)(0xc0005e8570)({ - id: (string) (len=3) "app", - name: (string) (len=3) "App", - context: (map[string]string) (len=1) { - (string) (len=6) "app_id": (string) (len=6) "string" - } - }), - method: (string) (len=4) "post", - route: (main.decodedRoute) { - route: (string) (len=21) "/api/app/internal/pay", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) false, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007af50)({ - in: (main.MethodMessage) { - name: (string) (len=26) "GetAppUserLNURLInfoRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=19) "GetAppUserLNURLInfo", - out: (main.MethodMessage) { - name: (string) (len=20) "LnurlPayInfoResponse", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0005ec420)({ - authType: (*main.supportedAuth)(0xc0005e8600)({ - id: (string) (len=3) "app", - name: (string) (len=3) "App", - context: (map[string]string) (len=1) { - (string) (len=6) "app_id": (string) (len=6) "string" - } - }), - method: (string) (len=4) "post", - route: (main.decodedRoute) { - route: (string) (len=28) "/api/app/user/lnurl/pay/info", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) false, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007afa0)({ - in: (main.MethodMessage) { - name: (string) (len=28) "SetMockAppUserBalanceRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=21) "SetMockAppUserBalance", - out: (main.MethodMessage) { - name: (string) (len=5) "Empty", - hasZeroFields: (bool) true - }, - opts: (*main.methodOptions)(0xc0005ec5a0)({ - authType: (*main.supportedAuth)(0xc0005e8690)({ - id: (string) (len=3) "app", - name: (string) (len=3) "App", - context: (map[string]string) (len=1) { - (string) (len=6) "app_id": (string) (len=6) "string" - } - }), - method: (string) (len=4) "post", - route: (main.decodedRoute) { - route: (string) (len=29) "/api/app/mock/user/blance/set", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) false, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007aff0)({ - in: (main.MethodMessage) { - name: (string) (len=24) "SetMockAppBalanceRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=17) "SetMockAppBalance", - out: (main.MethodMessage) { - name: (string) (len=5) "Empty", - hasZeroFields: (bool) true - }, - opts: (*main.methodOptions)(0xc0005ec780)({ - authType: (*main.supportedAuth)(0xc0005e8720)({ - id: (string) (len=3) "app", - name: (string) (len=3) "App", - context: (map[string]string) (len=1) { - (string) (len=6) "app_id": (string) (len=6) "string" - } - }), - method: (string) (len=4) "post", - route: (main.decodedRoute) { - route: (string) (len=24) "/api/app/mock/blance/set", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) false, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007b040)({ - in: (main.MethodMessage) { - name: (string) (len=30) "RequestNPubLinkingTokenRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=23) "RequestNPubLinkingToken", - out: (main.MethodMessage) { - name: (string) (len=31) "RequestNPubLinkingTokenResponse", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0005ec960)({ - authType: (*main.supportedAuth)(0xc0005e87b0)({ - id: (string) (len=3) "app", - name: (string) (len=3) "App", - context: (map[string]string) (len=1) { - (string) (len=6) "app_id": (string) (len=6) "string" - } - }), - method: (string) (len=4) "post", - route: (main.decodedRoute) { - route: (string) (len=24) "/api/app/user/npub/token", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) false, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007b090)({ - in: (main.MethodMessage) { - name: (string) (len=30) "RequestNPubLinkingTokenRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=21) "ResetNPubLinkingToken", - out: (main.MethodMessage) { - name: (string) (len=31) "RequestNPubLinkingTokenResponse", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0005ecae0)({ - authType: (*main.supportedAuth)(0xc0005e8840)({ - id: (string) (len=3) "app", - name: (string) (len=3) "App", - context: (map[string]string) (len=1) { - (string) (len=6) "app_id": (string) (len=6) "string" - } - }), - method: (string) (len=4) "post", - route: (main.decodedRoute) { - route: (string) (len=30) "/api/app/user/npub/token/reset", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) false, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007b0e0)({ - in: (main.MethodMessage) { - name: (string) (len=5) "Empty", - hasZeroFields: (bool) true - }, - name: (string) (len=10) "UserHealth", - out: (main.MethodMessage) { - name: (string) (len=5) "Empty", - hasZeroFields: (bool) true - }, - opts: (*main.methodOptions)(0xc0005eccc0)({ - authType: (*main.supportedAuth)(0xc0005e88d0)({ + opts: (*main.methodOptions)(0xc000195ce0)({ + authType: (*main.supportedAuth)(0xc000196940)({ id: (string) (len=4) "user", name: (string) (len=4) "User", - 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" + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) } }), method: (string) (len=4) "post", route: (main.decodedRoute) { - route: (string) (len=16) "/api/user/health", + route: (string) (len=21) "/api/user/invoice/new", params: ([]string) }, query: ([]string) , @@ -1055,69 +1382,7 @@ }), serverStream: (bool) false }), - (*main.Method)(0xc00007b130)({ - in: (main.MethodMessage) { - name: (string) (len=5) "Empty", - hasZeroFields: (bool) true - }, - name: (string) (len=11) "GetUserInfo", - out: (main.MethodMessage) { - name: (string) (len=8) "UserInfo", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0005ecea0)({ - authType: (*main.supportedAuth)(0xc0005e8960)({ - 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=14) "/api/user/info", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) true, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007b1d0)({ - in: (main.MethodMessage) { - name: (string) (len=17) "AddProductRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=10) "AddProduct", - out: (main.MethodMessage) { - name: (string) (len=7) "Product", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0005ed080)({ - authType: (*main.supportedAuth)(0xc0005e89f0)({ - 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=21) "/api/user/product/add", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) true, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007b220)({ + (*main.Method)(0xc0002af720)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -1127,14 +1392,23 @@ name: (string) (len=18) "NewInvoiceResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0005ed500)({ - authType: (*main.supportedAuth)(0xc0005e8b10)({ + opts: (*main.methodOptions)(0xc000195560)({ + authType: (*main.supportedAuth)(0xc000196600)({ 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" + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) } }), method: (string) (len=3) "get", @@ -1150,224 +1424,7 @@ }), serverStream: (bool) false }), - (*main.Method)(0xc00007b270)({ - in: (main.MethodMessage) { - name: (string) (len=24) "GetUserOperationsRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=17) "GetUserOperations", - out: (main.MethodMessage) { - name: (string) (len=25) "GetUserOperationsResponse", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0005ed6e0)({ - authType: (*main.supportedAuth)(0xc0005e8ba0)({ - 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=20) "/api/user/operations", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) true, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007b310)({ - in: (main.MethodMessage) { - name: (string) (len=17) "NewAddressRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=10) "NewAddress", - out: (main.MethodMessage) { - name: (string) (len=18) "NewAddressResponse", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0005ed8c0)({ - authType: (*main.supportedAuth)(0xc0005e8c30)({ - 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=19) "/api/user/chain/new", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) true, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007b3b0)({ - in: (main.MethodMessage) { - name: (string) (len=17) "PayAddressRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=10) "PayAddress", - out: (main.MethodMessage) { - name: (string) (len=18) "PayAddressResponse", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0005edaa0)({ - authType: (*main.supportedAuth)(0xc0005e8cc0)({ - id: (string) (len=4) "user", - name: (string) (len=4) "User", - 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" - } - }), - method: (string) (len=4) "post", - route: (main.decodedRoute) { - route: (string) (len=19) "/api/user/chain/pay", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) true, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007b450)({ - in: (main.MethodMessage) { - name: (string) (len=17) "NewInvoiceRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=10) "NewInvoice", - out: (main.MethodMessage) { - name: (string) (len=18) "NewInvoiceResponse", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0005edc80)({ - authType: (*main.supportedAuth)(0xc0005e8d50)({ - 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=21) "/api/user/invoice/new", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) true, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007b4f0)({ - in: (main.MethodMessage) { - name: (string) (len=20) "DecodeInvoiceRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=13) "DecodeInvoice", - out: (main.MethodMessage) { - name: (string) (len=21) "DecodeInvoiceResponse", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0005ede60)({ - authType: (*main.supportedAuth)(0xc0005e8de0)({ - 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=24) "/api/user/invoice/decode", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) true, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007b590)({ - in: (main.MethodMessage) { - name: (string) (len=17) "PayInvoiceRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=10) "PayInvoice", - out: (main.MethodMessage) { - name: (string) (len=18) "PayInvoiceResponse", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0005f2060)({ - authType: (*main.supportedAuth)(0xc0005e8e70)({ - id: (string) (len=4) "user", - name: (string) (len=4) "User", - 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" - } - }), - method: (string) (len=4) "post", - route: (main.decodedRoute) { - route: (string) (len=21) "/api/user/invoice/pay", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) true, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007b630)({ - in: (main.MethodMessage) { - name: (string) (len=22) "GetPaymentStateRequest", - hasZeroFields: (bool) false - }, - name: (string) (len=15) "GetPaymentState", - out: (main.MethodMessage) { - name: (string) (len=12) "PaymentState", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0005f2240)({ - authType: (*main.supportedAuth)(0xc0005e8f00)({ - 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=23) "/api/user/payment/state", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) true, - batch: (bool) false - }), - serverStream: (bool) false - }), - (*main.Method)(0xc00007b6d0)({ + (*main.Method)(0xc0002afbd0)({ in: (main.MethodMessage) { name: (string) (len=18) "OpenChannelRequest", hasZeroFields: (bool) false @@ -1377,14 +1434,23 @@ name: (string) (len=19) "OpenChannelResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0005f2420)({ - authType: (*main.supportedAuth)(0xc0005e8f90)({ + opts: (*main.methodOptions)(0xc00019a480)({ + authType: (*main.supportedAuth)(0xc000196c40)({ 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" + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) } }), method: (string) (len=4) "post", @@ -1398,29 +1464,38 @@ }), serverStream: (bool) false }), - (*main.Method)(0xc00007b770)({ + (*main.Method)(0xc0002af8b0)({ in: (main.MethodMessage) { - name: (string) (len=5) "Empty", - hasZeroFields: (bool) true - }, - name: (string) (len=20) "GetLnurlWithdrawLink", - out: (main.MethodMessage) { - name: (string) (len=17) "LnurlLinkResponse", + name: (string) (len=17) "PayAddressRequest", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0005f2600)({ - authType: (*main.supportedAuth)(0xc0005e9020)({ + name: (string) (len=10) "PayAddress", + out: (main.MethodMessage) { + name: (string) (len=18) "PayAddressResponse", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc000195b00)({ + authType: (*main.supportedAuth)(0xc000196880)({ 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" + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) } }), - method: (string) (len=3) "get", + method: (string) (len=4) "post", route: (main.decodedRoute) { - route: (string) (len=29) "/api/user/lnurl_withdraw/link", + route: (string) (len=19) "/api/user/chain/pay", params: ([]string) }, query: ([]string) , @@ -1429,29 +1504,70 @@ }), serverStream: (bool) false }), - (*main.Method)(0xc00007b810)({ + (*main.Method)(0xc0002af310)({ in: (main.MethodMessage) { - name: (string) (len=5) "Empty", - hasZeroFields: (bool) true - }, - name: (string) (len=15) "GetLnurlPayLink", - out: (main.MethodMessage) { - name: (string) (len=17) "LnurlLinkResponse", + name: (string) (len=24) "PayAppUserInvoiceRequest", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0005f27e0)({ - authType: (*main.supportedAuth)(0xc0005e90b0)({ - 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" + name: (string) (len=17) "PayAppUserInvoice", + out: (main.MethodMessage) { + name: (string) (len=18) "PayInvoiceResponse", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc000167f80)({ + authType: (*main.supportedAuth)(0xc000157d00)({ + id: (string) (len=3) "app", + name: (string) (len=3) "App", + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040bc0)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }) } }), - method: (string) (len=3) "get", + method: (string) (len=4) "post", route: (main.decodedRoute) { - route: (string) (len=24) "/api/user/lnurl_pay/link", + route: (string) (len=20) "/api/app/invoice/pay", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) false, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002afa90)({ + in: (main.MethodMessage) { + name: (string) (len=17) "PayInvoiceRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=10) "PayInvoice", + out: (main.MethodMessage) { + name: (string) (len=18) "PayInvoiceResponse", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc00019a0c0)({ + authType: (*main.supportedAuth)(0xc000196ac0)({ + id: (string) (len=4) "user", + name: (string) (len=4) "User", + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=21) "/api/user/invoice/pay", params: ([]string) }, query: ([]string) , @@ -1460,29 +1576,253 @@ }), serverStream: (bool) false }), - (*main.Method)(0xc00007b8b0)({ + (*main.Method)(0xc0002af540)({ in: (main.MethodMessage) { - name: (string) (len=5) "Empty", - hasZeroFields: (bool) true - }, - name: (string) (len=19) "GetLNURLChannelLink", - out: (main.MethodMessage) { - name: (string) (len=17) "LnurlLinkResponse", + name: (string) (len=30) "RequestNPubLinkingTokenRequest", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0005f29c0)({ - authType: (*main.supportedAuth)(0xc0005e9140)({ - 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" + name: (string) (len=23) "RequestNPubLinkingToken", + out: (main.MethodMessage) { + name: (string) (len=31) "RequestNPubLinkingTokenResponse", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc0001949c0)({ + authType: (*main.supportedAuth)(0xc000196180)({ + id: (string) (len=3) "app", + name: (string) (len=3) "App", + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040bc0)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }) } }), method: (string) (len=4) "post", route: (main.decodedRoute) { - route: (string) (len=27) "/api/user/lnurl_channel/url", + route: (string) (len=24) "/api/app/user/npub/token", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) false, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002af590)({ + in: (main.MethodMessage) { + name: (string) (len=30) "RequestNPubLinkingTokenRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=21) "ResetNPubLinkingToken", + out: (main.MethodMessage) { + name: (string) (len=31) "RequestNPubLinkingTokenResponse", + hasZeroFields: (bool) false + }, + opts: (*main.methodOptions)(0xc000194b40)({ + authType: (*main.supportedAuth)(0xc000196240)({ + id: (string) (len=3) "app", + name: (string) (len=3) "App", + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040bc0)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=30) "/api/app/user/npub/token/reset", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) false, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002af400)({ + in: (main.MethodMessage) { + name: (string) (len=30) "SendAppUserToAppPaymentRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=23) "SendAppUserToAppPayment", + out: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + opts: (*main.methodOptions)(0xc000194300)({ + authType: (*main.supportedAuth)(0xc000157e80)({ + id: (string) (len=3) "app", + name: (string) (len=3) "App", + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040bc0)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=21) "/api/app/internal/pay", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) false, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002af360)({ + in: (main.MethodMessage) { + name: (string) (len=34) "SendAppUserToAppUserPaymentRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=27) "SendAppUserToAppUserPayment", + out: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + opts: (*main.methodOptions)(0xc000194180)({ + authType: (*main.supportedAuth)(0xc000157dc0)({ + id: (string) (len=3) "app", + name: (string) (len=3) "App", + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040bc0)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=26) "/api/app/user/internal/pay", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) false, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002af4f0)({ + in: (main.MethodMessage) { + name: (string) (len=24) "SetMockAppBalanceRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=17) "SetMockAppBalance", + out: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + opts: (*main.methodOptions)(0xc0001947e0)({ + authType: (*main.supportedAuth)(0xc0001960c0)({ + id: (string) (len=3) "app", + name: (string) (len=3) "App", + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040bc0)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=24) "/api/app/mock/blance/set", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) false, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002af4a0)({ + in: (main.MethodMessage) { + name: (string) (len=28) "SetMockAppUserBalanceRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=21) "SetMockAppUserBalance", + out: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + opts: (*main.methodOptions)(0xc000194600)({ + authType: (*main.supportedAuth)(0xc000196000)({ + id: (string) (len=3) "app", + name: (string) (len=3) "App", + context: ([]*main.authContext) (len=1 cap=1) { + (*main.authContext)(0xc000040bc0)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=29) "/api/app/mock/user/blance/set", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) false, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002aebe0)({ + in: (main.MethodMessage) { + name: (string) (len=27) "SetMockInvoiceAsPaidRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=20) "SetMockInvoiceAsPaid", + out: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + opts: (*main.methodOptions)(0xc0001660c0)({ + authType: (*main.supportedAuth)(0xc000157080)({ + id: (string) (len=5) "guest", + name: (string) (len=5) "Guest", + context: ([]*main.authContext) + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=26) "/api/lnd/mock/invoice/paid", + params: ([]string) + }, + query: ([]string) , + nostr: (bool) false, + batch: (bool) false + }), + serverStream: (bool) false + }), + (*main.Method)(0xc0002aeff0)({ + in: (main.MethodMessage) { + name: (string) (len=20) "UseInviteLinkRequest", + hasZeroFields: (bool) false + }, + name: (string) (len=13) "UseInviteLink", + out: (main.MethodMessage) { + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true + }, + opts: (*main.methodOptions)(0xc000167620)({ + authType: (*main.supportedAuth)(0xc000157800)({ + id: (string) (len=8) "guestPub", + name: (string) (len=12) "GuestWithPub", + context: ([]*main.authContext) (len=2 cap=2) { + (*main.authContext)(0xc000040ca0)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040c80)({ + itemName: (string) (len=3) "pub", + itemType: (string) (len=6) "string" + }) + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=17) "/api/guest/invite", params: ([]string) }, query: ([]string) , @@ -1491,140 +1831,52 @@ }), serverStream: (bool) false }), - (*main.Method)(0xc00007b950)({ + (*main.Method)(0xc0002af5e0)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - name: (string) (len=21) "GetLiveUserOperations", + name: (string) (len=10) "UserHealth", out: (main.MethodMessage) { - name: (string) (len=17) "LiveUserOperation", - hasZeroFields: (bool) false + name: (string) (len=5) "Empty", + hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc0005f2ba0)({ - authType: (*main.supportedAuth)(0xc0005e91d0)({ + opts: (*main.methodOptions)(0xc000194d20)({ + authType: (*main.supportedAuth)(0xc000196300)({ id: (string) (len=4) "user", name: (string) (len=4) "User", - 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" + context: ([]*main.authContext) (len=3 cap=4) { + (*main.authContext)(0xc000040960)({ + itemName: (string) (len=6) "app_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc0000409e0)({ + itemName: (string) (len=11) "app_user_id", + itemType: (string) (len=6) "string" + }), + (*main.authContext)(0xc000040940)({ + itemName: (string) (len=7) "user_id", + itemType: (string) (len=6) "string" + }) } }), method: (string) (len=4) "post", route: (main.decodedRoute) { - route: (string) (len=24) "/api/user/operations/sub", + route: (string) (len=16) "/api/user/health", params: ([]string) }, query: ([]string) , nostr: (bool) true, batch: (bool) false }), - serverStream: (bool) true - }), - (*main.Method)(0xc00007b9f0)({ - in: (main.MethodMessage) { - name: (string) (len=5) "Empty", - hasZeroFields: (bool) true - }, - name: (string) (len=18) "GetMigrationUpdate", - out: (main.MethodMessage) { - name: (string) (len=15) "MigrationUpdate", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0005f2d80)({ - authType: (*main.supportedAuth)(0xc0005e9260)({ - 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=24) "/api/user/migrations/sub", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) true, - batch: (bool) false - }), - serverStream: (bool) true - }), - (*main.Method)(0xc00007ba40)({ - in: (main.MethodMessage) { - name: (string) (len=5) "Empty", - hasZeroFields: (bool) true - }, - name: (string) (len=12) "GetHttpCreds", - out: (main.MethodMessage) { - name: (string) (len=9) "HttpCreds", - hasZeroFields: (bool) false - }, - opts: (*main.methodOptions)(0xc0005f2f60)({ - authType: (*main.supportedAuth)(0xc0005e92f0)({ - 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=20) "/api/user/http_creds", - params: ([]string) - }, - query: ([]string) , - nostr: (bool) true, - batch: (bool) false - }), - serverStream: (bool) true - }), - (*main.Method)(0xc00007ba90)({ - 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)(0xc0005f31a0)({ - authType: (*main.supportedAuth)(0xc0005e93b0)({ - id: (string) (len=4) "user", - name: (string) (len=4) "User", - 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" - } - }), - 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)(0xc00049cbd0)({ + (*main.Enum)(0xc000513ce0)({ name: (string) (len=11) "AddressType", values: ([]main.EnumValue) (len=3 cap=4) { - (main.EnumValue) { - number: (int64) 0, - name: (string) (len=19) "WITNESS_PUBKEY_HASH" - }, (main.EnumValue) { number: (int64) 1, name: (string) (len=18) "NESTED_PUBKEY_HASH" @@ -1632,47 +1884,51 @@ (main.EnumValue) { number: (int64) 2, name: (string) (len=14) "TAPROOT_PUBKEY" + }, + (main.EnumValue) { + number: (int64) 0, + name: (string) (len=19) "WITNESS_PUBKEY_HASH" } } }), - (*main.Enum)(0xc00049cc30)({ + (*main.Enum)(0xc000513d40)({ name: (string) (len=17) "UserOperationType", values: ([]main.EnumValue) (len=6 cap=8) { + (main.EnumValue) { + number: (int64) 2, + name: (string) (len=16) "INCOMING_INVOICE" + }, (main.EnumValue) { number: (int64) 0, name: (string) (len=11) "INCOMING_TX" }, (main.EnumValue) { - number: (int64) 1, - name: (string) (len=11) "OUTGOING_TX" - }, - (main.EnumValue) { - number: (int64) 2, - name: (string) (len=16) "INCOMING_INVOICE" + number: (int64) 5, + name: (string) (len=21) "INCOMING_USER_TO_USER" }, (main.EnumValue) { number: (int64) 3, name: (string) (len=16) "OUTGOING_INVOICE" }, (main.EnumValue) { - number: (int64) 4, - name: (string) (len=21) "OUTGOING_USER_TO_USER" + number: (int64) 1, + name: (string) (len=11) "OUTGOING_TX" }, (main.EnumValue) { - number: (int64) 5, - name: (string) (len=21) "INCOMING_USER_TO_USER" + number: (int64) 4, + name: (string) (len=21) "OUTGOING_USER_TO_USER" } } }) } -(map[string]*main.Message) (len=78) { - (string) (len=13) "BannedAppUser": (*main.Message)(0xc000470bd0)({ - fullName: (string) (len=13) "BannedAppUser", - name: (string) (len=13) "BannedAppUser", - fields: (map[string]*main.Field) (len=4) { - (string) (len=6) "app_id": (*main.Field)(0xc00031f080)({ - name: (string) (len=6) "app_id", +([]*main.SortableMessage) (len=78 cap=128) { + (*main.SortableMessage)(0xc00019c500)({ + fullName: (string) (len=20) "AddAppInvoiceRequest", + name: (string) (len=20) "AddAppInvoiceRequest", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc000106100)({ + name: (string) (len=17) "http_callback_url", kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, @@ -1681,28 +1937,18 @@ isOptional: (bool) false, oneOfName: (string) "" }), - (string) (len=15) "user_identifier": (*main.Field)(0xc00031f0c0)({ - name: (string) (len=15) "user_identifier", - kind: (string) (len=6) "string", + (*main.Field)(0xc000106140)({ + name: (string) (len=11) "invoice_req", + kind: (string) (len=17) "NewInvoiceRequest", isMap: (bool) false, isArray: (bool) false, isEnum: (bool) false, - isMessage: (bool) false, + isMessage: (bool) true, isOptional: (bool) false, oneOfName: (string) "" }), - (string) (len=9) "nostr_pub": (*main.Field)(0xc00031f100)({ - name: (string) (len=9) "nostr_pub", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=8) "app_name": (*main.Field)(0xc00031f040)({ - name: (string) (len=8) "app_name", + (*main.Field)(0xc0001060c0)({ + name: (string) (len=16) "payer_identifier", kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, @@ -1713,72 +1959,12 @@ }) } }), - (string) (len=20) "LnurlPayInfoResponse": (*main.Message)(0xc000471830)({ - fullName: (string) (len=20) "LnurlPayInfoResponse", - name: (string) (len=20) "LnurlPayInfoResponse", - fields: (map[string]*main.Field) (len=7) { - (string) (len=11) "nostrPubkey": (*main.Field)(0xc0005e6240)({ - 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, - oneOfName: (string) "" - }), - (string) (len=3) "tag": (*main.Field)(0xc0005e60c0)({ - 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, - oneOfName: (string) "" - }), - (string) (len=8) "callback": (*main.Field)(0xc0005e6100)({ - 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, - oneOfName: (string) "" - }), - (string) (len=11) "maxSendable": (*main.Field)(0xc0005e6140)({ - 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, - oneOfName: (string) "" - }), - (string) (len=11) "minSendable": (*main.Field)(0xc0005e6180)({ - 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, - oneOfName: (string) "" - }), - (string) (len=8) "metadata": (*main.Field)(0xc0005e61c0)({ - 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, - oneOfName: (string) "" - }), - (string) (len=11) "allowsNostr": (*main.Field)(0xc0005e6200)({ - name: (string) (len=11) "allowsNostr", + (*main.SortableMessage)(0xc0001978c0)({ + fullName: (string) (len=13) "AddAppRequest", + name: (string) (len=13) "AddAppRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc00010f140)({ + name: (string) (len=19) "allow_user_creation", kind: (string) (len=4) "bool", isMap: (bool) false, isArray: (bool) false, @@ -1786,25 +1972,71 @@ isMessage: (bool) false, isOptional: (bool) false, oneOfName: (string) "" + }), + (*main.Field)(0xc00010f100)({ + 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, + oneOfName: (string) "" }) } }), - (string) (len=13) "UserOperation": (*main.Message)(0xc0004719b0)({ - fullName: (string) (len=13) "UserOperation", - name: (string) (len=13) "UserOperation", - fields: (map[string]*main.Field) (len=11) { - (string) (len=4) "type": (*main.Field)(0xc0005e66c0)({ - name: (string) (len=4) "type", - kind: (string) (len=17) "UserOperationType", + (*main.SortableMessage)(0xc00019c780)({ + fullName: (string) (len=24) "AddAppUserInvoiceRequest", + name: (string) (len=24) "AddAppUserInvoiceRequest", + fields: ([]*main.Field) (len=4 cap=4) { + (*main.Field)(0xc000106200)({ + name: (string) (len=17) "http_callback_url", + kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, - isEnum: (bool) true, + isEnum: (bool) false, isMessage: (bool) false, isOptional: (bool) false, oneOfName: (string) "" }), - (string) (len=6) "amount": (*main.Field)(0xc0005e6740)({ - name: (string) (len=6) "amount", + (*main.Field)(0xc000106240)({ + name: (string) (len=11) "invoice_req", + kind: (string) (len=17) "NewInvoiceRequest", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc0001061c0)({ + name: (string) (len=16) "payer_identifier", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106180)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c4c0)({ + fullName: (string) (len=17) "AddAppUserRequest", + name: (string) (len=17) "AddAppUserRequest", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc00010fc80)({ + name: (string) (len=7) "balance", kind: (string) (len=5) "int64", isMap: (bool) false, isArray: (bool) false, @@ -1813,7 +2045,17 @@ isOptional: (bool) false, oneOfName: (string) "" }), - (string) (len=10) "identifier": (*main.Field)(0xc0005e6780)({ + (*main.Field)(0xc00010fc40)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010fac0)({ name: (string) (len=10) "identifier", kind: (string) (len=6) "string", isMap: (bool) false, @@ -1822,9 +2064,15 @@ isMessage: (bool) false, isOptional: (bool) false, oneOfName: (string) "" - }), - (string) (len=7) "tx_hash": (*main.Field)(0xc0005e68c0)({ - name: (string) (len=7) "tx_hash", + }) + } + }), + (*main.SortableMessage)(0xc000197980)({ + fullName: (string) (len=17) "AddProductRequest", + name: (string) (len=17) "AddProductRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc000107b00)({ + name: (string) (len=4) "name", kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, @@ -1833,68 +2081,8 @@ isOptional: (bool) false, oneOfName: (string) "" }), - (string) (len=11) "network_fee": (*main.Field)(0xc0005e6840)({ - 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, - oneOfName: (string) "" - }), - (string) (len=9) "confirmed": (*main.Field)(0xc0005e6880)({ - 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, - oneOfName: (string) "" - }), - (string) (len=8) "internal": (*main.Field)(0xc0005e6900)({ - name: (string) (len=8) "internal", - kind: (string) (len=4) "bool", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=10) "paidAtUnix": (*main.Field)(0xc0005e6680)({ - 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, - oneOfName: (string) "" - }), - (string) (len=7) "inbound": (*main.Field)(0xc0005e6700)({ - 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, - oneOfName: (string) "" - }), - (string) (len=11) "operationId": (*main.Field)(0xc0005e67c0)({ - 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, - oneOfName: (string) "" - }), - (string) (len=11) "service_fee": (*main.Field)(0xc0005e6800)({ - name: (string) (len=11) "service_fee", + (*main.Field)(0xc000107b40)({ + name: (string) (len=10) "price_sats", kind: (string) (len=5) "int64", isMap: (bool) false, isArray: (bool) false, @@ -1905,14 +2093,94 @@ }) } }), - (string) (len=17) "LiveUserOperation": (*main.Message)(0xc000471bf0)({ - fullName: (string) (len=17) "LiveUserOperation", - name: (string) (len=17) "LiveUserOperation", - fields: (map[string]*main.Field) (len=1) { - (string) (len=9) "operation": (*main.Field)(0xc0005e6d00)({ - name: (string) (len=9) "operation", + (*main.SortableMessage)(0xc000197700)({ + fullName: (string) (len=10) "AppMetrics", + name: (string) (len=10) "AppMetrics", + fields: ([]*main.Field) (len=9 cap=16) { + (*main.Field)(0xc00023fa40)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023fb40)({ + name: (string) (len=9) "available", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023fb80)({ + name: (string) (len=4) "fees", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023fbc0)({ + name: (string) (len=8) "invoices", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023fc40)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023fac0)({ + name: (string) (len=8) "received", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023fb00)({ + name: (string) (len=5) "spent", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023fc00)({ + name: (string) (len=10) "total_fees", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023fa80)({ + name: (string) (len=5) "users", + kind: (string) (len=9) "UsersInfo", + isMap: (bool) false, isArray: (bool) false, isEnum: (bool) false, isMessage: (bool) true, @@ -1921,15 +2189,35 @@ }) } }), - (string) (len=15) "RelaysMigration": (*main.Message)(0xc000471d10)({ - fullName: (string) (len=15) "RelaysMigration", - name: (string) (len=15) "RelaysMigration", - fields: (map[string]*main.Field) (len=1) { - (string) (len=6) "relays": (*main.Field)(0xc0005e6e00)({ - name: (string) (len=6) "relays", + (*main.SortableMessage)(0xc00019c3c0)({ + fullName: (string) (len=7) "AppUser", + name: (string) (len=7) "AppUser", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc000106000)({ + name: (string) (len=10) "identifier", kind: (string) (len=6) "string", isMap: (bool) false, - isArray: (bool) true, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106040)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106080)({ + 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, @@ -1937,12 +2225,42 @@ }) } }), - (string) (len=26) "GetInviteTokenStateRequest": (*main.Message)(0xc00049cb10)({ - fullName: (string) (len=26) "GetInviteTokenStateRequest", - name: (string) (len=26) "GetInviteTokenStateRequest", - fields: (map[string]*main.Field) (len=1) { - (string) (len=12) "invite_token": (*main.Field)(0xc0005e7080)({ - name: (string) (len=12) "invite_token", + (*main.SortableMessage)(0xc000197d00)({ + fullName: (string) (len=11) "Application", + name: (string) (len=11) "Application", + fields: ([]*main.Field) (len=4 cap=4) { + (*main.Field)(0xc00010f4c0)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010f340)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010f300)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010f900)({ + name: (string) (len=4) "npub", kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, @@ -1953,11 +2271,11 @@ }) } }), - (string) (len=11) "AppsMetrics": (*main.Message)(0xc0004706f0)({ + (*main.SortableMessage)(0xc000197740)({ fullName: (string) (len=11) "AppsMetrics", name: (string) (len=11) "AppsMetrics", - fields: (map[string]*main.Field) (len=1) { - (string) (len=4) "apps": (*main.Field)(0xc0000b1100)({ + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc00023fc80)({ name: (string) (len=4) "apps", kind: (string) (len=10) "AppMetrics", isMap: (bool) false, @@ -1969,54 +2287,32 @@ }) } }), - (string) (len=28) "SetMockAppUserBalanceRequest": (*main.Message)(0xc000471170)({ - fullName: (string) (len=28) "SetMockAppUserBalanceRequest", - name: (string) (len=28) "SetMockAppUserBalanceRequest", - fields: (map[string]*main.Field) (len=2) { - (string) (len=15) "user_identifier": (*main.Field)(0xc00031fa40)({ - 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, - oneOfName: (string) "" - }), - (string) (len=6) "amount": (*main.Field)(0xc00031fa80)({ - name: (string) (len=6) "amount", + (*main.SortableMessage)(0xc00019c380)({ + fullName: (string) (len=18) "AppsMetricsRequest", + name: (string) (len=18) "AppsMetricsRequest", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc00023f800)({ + name: (string) (len=9) "from_unix", kind: (string) (len=5) "int64", isMap: (bool) false, isArray: (bool) false, isEnum: (bool) false, isMessage: (bool) false, - isOptional: (bool) false, + isOptional: (bool) true, oneOfName: (string) "" - }) - } - }), - (string) (len=17) "NewAddressRequest": (*main.Message)(0xc000471230)({ - fullName: (string) (len=17) "NewAddressRequest", - name: (string) (len=17) "NewAddressRequest", - fields: (map[string]*main.Field) (len=1) { - (string) (len=11) "addressType": (*main.Field)(0xc00031fb00)({ - name: (string) (len=11) "addressType", - kind: (string) (len=11) "AddressType", + }), + (*main.Field)(0xc00023f880)({ + name: (string) (len=18) "include_operations", + kind: (string) (len=4) "bool", isMap: (bool) false, isArray: (bool) false, - isEnum: (bool) true, + isEnum: (bool) false, isMessage: (bool) false, - isOptional: (bool) false, + isOptional: (bool) true, oneOfName: (string) "" - }) - } - }), - (string) (len=30) "CreateOneTimeInviteLinkRequest": (*main.Message)(0xc000471f50)({ - fullName: (string) (len=30) "CreateOneTimeInviteLinkRequest", - name: (string) (len=30) "CreateOneTimeInviteLinkRequest", - fields: (map[string]*main.Field) (len=1) { - (string) (len=4) "sats": (*main.Field)(0xc0005e6fc0)({ - name: (string) (len=4) "sats", + }), + (*main.Field)(0xc00023f840)({ + name: (string) (len=7) "to_unix", kind: (string) (len=5) "int64", isMap: (bool) false, isArray: (bool) false, @@ -2027,73 +2323,11 @@ }) } }), - (string) (len=20) "UseInviteLinkRequest": (*main.Message)(0xc00049cab0)({ - fullName: (string) (len=20) "UseInviteLinkRequest", - name: (string) (len=20) "UseInviteLinkRequest", - fields: (map[string]*main.Field) (len=1) { - (string) (len=12) "invite_token": (*main.Field)(0xc0005e7040)({ - name: (string) (len=12) "invite_token", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=11) "Application": (*main.Message)(0xc000470d50)({ - fullName: (string) (len=11) "Application", - name: (string) (len=11) "Application", - fields: (map[string]*main.Field) (len=4) { - (string) (len=2) "id": (*main.Field)(0xc00031f300)({ - 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, - oneOfName: (string) "" - }), - (string) (len=7) "balance": (*main.Field)(0xc00031f340)({ - 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, - oneOfName: (string) "" - }), - (string) (len=4) "npub": (*main.Field)(0xc00031f380)({ - name: (string) (len=4) "npub", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=4) "name": (*main.Field)(0xc00031f2c0)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=7) "AuthApp": (*main.Message)(0xc000470db0)({ + (*main.SortableMessage)(0xc00019c180)({ fullName: (string) (len=7) "AuthApp", name: (string) (len=7) "AuthApp", - fields: (map[string]*main.Field) (len=2) { - (string) (len=3) "app": (*main.Field)(0xc00031f3c0)({ + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc00010f9c0)({ name: (string) (len=3) "app", kind: (string) (len=11) "Application", isMap: (bool) false, @@ -2103,7 +2337,7 @@ isOptional: (bool) false, oneOfName: (string) "" }), - (string) (len=10) "auth_token": (*main.Field)(0xc00031f400)({ + (*main.Field)(0xc00010fa40)({ name: (string) (len=10) "auth_token", kind: (string) (len=6) "string", isMap: (bool) false, @@ -2115,561 +2349,11 @@ }) } }), - (string) (len=18) "NewInvoiceResponse": (*main.Message)(0xc000471410)({ - fullName: (string) (len=18) "NewInvoiceResponse", - name: (string) (len=18) "NewInvoiceResponse", - fields: (map[string]*main.Field) (len=1) { - (string) (len=7) "invoice": (*main.Field)(0xc00031fdc0)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=18) "PayInvoiceResponse": (*main.Message)(0xc000471590)({ - fullName: (string) (len=18) "PayInvoiceResponse", - name: (string) (len=18) "PayInvoiceResponse", - fields: (map[string]*main.Field) (len=5) { - (string) (len=8) "preimage": (*main.Field)(0xc00031ff00)({ - 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, - oneOfName: (string) "" - }), - (string) (len=11) "amount_paid": (*main.Field)(0xc00031ff40)({ - 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, - oneOfName: (string) "" - }), - (string) (len=12) "operation_id": (*main.Field)(0xc00031ff80)({ - 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, - oneOfName: (string) "" - }), - (string) (len=11) "service_fee": (*main.Field)(0xc00031ffc0)({ - 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, - oneOfName: (string) "" - }), - (string) (len=11) "network_fee": (*main.Field)(0xc000268000)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=22) "GetPaymentStateRequest": (*main.Message)(0xc0004715f0)({ - fullName: (string) (len=22) "GetPaymentStateRequest", - name: (string) (len=22) "GetPaymentStateRequest", - fields: (map[string]*main.Field) (len=1) { - (string) (len=7) "invoice": (*main.Field)(0xc0002683c0)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=10) "AppMetrics": (*main.Message)(0xc000470690)({ - fullName: (string) (len=10) "AppMetrics", - name: (string) (len=10) "AppMetrics", - fields: (map[string]*main.Field) (len=9) { - (string) (len=8) "received": (*main.Field)(0xc0000b0e40)({ - name: (string) (len=8) "received", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=5) "spent": (*main.Field)(0xc0000b0e80)({ - name: (string) (len=5) "spent", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=9) "available": (*main.Field)(0xc0000b0ec0)({ - name: (string) (len=9) "available", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=4) "fees": (*main.Field)(0xc0000b0f00)({ - name: (string) (len=4) "fees", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=10) "total_fees": (*main.Field)(0xc0000b0fc0)({ - name: (string) (len=10) "total_fees", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=10) "operations": (*main.Field)(0xc0000b10c0)({ - 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, - oneOfName: (string) "" - }), - (string) (len=3) "app": (*main.Field)(0xc0000b0dc0)({ - 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, - oneOfName: (string) "" - }), - (string) (len=5) "users": (*main.Field)(0xc0000b0e00)({ - name: (string) (len=5) "users", - kind: (string) (len=9) "UsersInfo", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=8) "invoices": (*main.Field)(0xc0000b0f40)({ - name: (string) (len=8) "invoices", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=8) "UserInfo": (*main.Message)(0xc0004718f0)({ - fullName: (string) (len=8) "UserInfo", - name: (string) (len=8) "UserInfo", - fields: (map[string]*main.Field) (len=7) { - (string) (len=6) "userId": (*main.Field)(0xc0005e6300)({ - 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, - oneOfName: (string) "" - }), - (string) (len=7) "balance": (*main.Field)(0xc0005e6340)({ - 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, - oneOfName: (string) "" - }), - (string) (len=16) "max_withdrawable": (*main.Field)(0xc0005e6380)({ - 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, - oneOfName: (string) "" - }), - (string) (len=15) "user_identifier": (*main.Field)(0xc0005e63c0)({ - 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, - oneOfName: (string) "" - }), - (string) (len=15) "service_fee_bps": (*main.Field)(0xc0005e6400)({ - name: (string) (len=15) "service_fee_bps", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=19) "network_max_fee_bps": (*main.Field)(0xc0005e6440)({ - name: (string) (len=19) "network_max_fee_bps", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=21) "network_max_fee_fixed": (*main.Field)(0xc0005e6480)({ - name: (string) (len=21) "network_max_fee_fixed", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=17) "AddProductRequest": (*main.Message)(0xc000471ad0)({ - fullName: (string) (len=17) "AddProductRequest", - name: (string) (len=17) "AddProductRequest", - fields: (map[string]*main.Field) (len=2) { - (string) (len=4) "name": (*main.Field)(0xc0005e6b80)({ - 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, - oneOfName: (string) "" - }), - (string) (len=10) "price_sats": (*main.Field)(0xc0005e6bc0)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=16) "ClosureMigration": (*main.Message)(0xc000471cb0)({ - fullName: (string) (len=16) "ClosureMigration", - name: (string) (len=16) "ClosureMigration", - fields: (map[string]*main.Field) (len=1) { - (string) (len=14) "closes_at_unix": (*main.Field)(0xc0005e6dc0)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=30) "SendAppUserToAppPaymentRequest": (*main.Message)(0xc0004710b0)({ - fullName: (string) (len=30) "SendAppUserToAppPaymentRequest", - name: (string) (len=30) "SendAppUserToAppPaymentRequest", - fields: (map[string]*main.Field) (len=2) { - (string) (len=20) "from_user_identifier": (*main.Field)(0xc00031f940)({ - 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, - oneOfName: (string) "" - }), - (string) (len=6) "amount": (*main.Field)(0xc00031f980)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=25) "EncryptionExchangeRequest": (*main.Message)(0xc0004704b0)({ - fullName: (string) (len=25) "EncryptionExchangeRequest", - name: (string) (len=25) "EncryptionExchangeRequest", - fields: (map[string]*main.Field) (len=2) { - (string) (len=9) "publicKey": (*main.Field)(0xc0000b0640)({ - name: (string) (len=9) "publicKey", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=8) "deviceId": (*main.Field)(0xc0000b0680)({ - name: (string) (len=8) "deviceId", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=13) "ClosedChannel": (*main.Message)(0xc000470870)({ - fullName: (string) (len=13) "ClosedChannel", - name: (string) (len=13) "ClosedChannel", - fields: (map[string]*main.Field) (len=3) { - (string) (len=10) "channel_id": (*main.Field)(0xc00031e680)({ - name: (string) (len=10) "channel_id", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=8) "capacity": (*main.Field)(0xc00031e6c0)({ - name: (string) (len=8) "capacity", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=13) "closed_height": (*main.Field)(0xc00031e900)({ - name: (string) (len=13) "closed_height", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=15) "BanUserResponse": (*main.Message)(0xc000470c30)({ - fullName: (string) (len=15) "BanUserResponse", - name: (string) (len=15) "BanUserResponse", - fields: (map[string]*main.Field) (len=2) { - (string) (len=16) "banned_app_users": (*main.Field)(0xc00031f180)({ - name: (string) (len=16) "banned_app_users", - kind: (string) (len=13) "BannedAppUser", - isMap: (bool) false, - isArray: (bool) true, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=12) "balance_sats": (*main.Field)(0xc00031f140)({ - name: (string) (len=12) "balance_sats", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=15) "MigrationUpdate": (*main.Message)(0xc000471c50)({ - fullName: (string) (len=15) "MigrationUpdate", - name: (string) (len=15) "MigrationUpdate", - fields: (map[string]*main.Field) (len=2) { - (string) (len=7) "closure": (*main.Field)(0xc0005e6d40)({ - 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, - oneOfName: (string) "" - }), - (string) (len=6) "relays": (*main.Field)(0xc0005e6d80)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=5) "Empty": (*main.Message)(0xc0004703f0)({ - fullName: (string) (len=5) "Empty", - name: (string) (len=5) "Empty", - fields: (map[string]*main.Field) { - } - }), - (string) (len=26) "GetAppUserLNURLInfoRequest": (*main.Message)(0xc000471110)({ - fullName: (string) (len=26) "GetAppUserLNURLInfoRequest", - name: (string) (len=26) "GetAppUserLNURLInfoRequest", - fields: (map[string]*main.Field) (len=2) { - (string) (len=15) "user_identifier": (*main.Field)(0xc00031f9c0)({ - 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, - oneOfName: (string) "" - }), - (string) (len=17) "base_url_override": (*main.Field)(0xc00031fa00)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=25) "GetUserOperationsResponse": (*main.Message)(0xc000471a70)({ - fullName: (string) (len=25) "GetUserOperationsResponse", - name: (string) (len=25) "GetUserOperationsResponse", - fields: (map[string]*main.Field) (len=6) { - (string) (len=31) "latestOutgoingInvoiceOperations": (*main.Field)(0xc0005e6a00)({ - 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, - oneOfName: (string) "" - }), - (string) (len=31) "latestIncomingInvoiceOperations": (*main.Field)(0xc0005e6a40)({ - 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, - oneOfName: (string) "" - }), - (string) (len=26) "latestOutgoingTxOperations": (*main.Field)(0xc0005e6a80)({ - 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, - oneOfName: (string) "" - }), - (string) (len=26) "latestIncomingTxOperations": (*main.Field)(0xc0005e6ac0)({ - 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, - oneOfName: (string) "" - }), - (string) (len=32) "latestOutgoingUserToUserPayemnts": (*main.Field)(0xc0005e6b00)({ - 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, - oneOfName: (string) "" - }), - (string) (len=32) "latestIncomingUserToUserPayemnts": (*main.Field)(0xc0005e6b40)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=14) "AuthAppRequest": (*main.Message)(0xc000470cf0)({ + (*main.SortableMessage)(0xc00019c580)({ fullName: (string) (len=14) "AuthAppRequest", name: (string) (len=14) "AuthAppRequest", - fields: (map[string]*main.Field) (len=2) { - (string) (len=4) "name": (*main.Field)(0xc00031f240)({ - 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, - oneOfName: (string) "" - }), - (string) (len=19) "allow_user_creation": (*main.Field)(0xc00031f280)({ + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc00010f2c0)({ name: (string) (len=19) "allow_user_creation", kind: (string) (len=4) "bool", isMap: (bool) false, @@ -2678,102 +2362,8 @@ isMessage: (bool) false, isOptional: (bool) true, oneOfName: (string) "" - }) - } - }), - (string) (len=17) "LndGetInfoRequest": (*main.Message)(0xc000470a50)({ - fullName: (string) (len=17) "LndGetInfoRequest", - name: (string) (len=17) "LndGetInfoRequest", - fields: (map[string]*main.Field) (len=1) { - (string) (len=6) "nodeId": (*main.Field)(0xc00031ef00)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=24) "AddAppUserInvoiceRequest": (*main.Message)(0xc000470f30)({ - fullName: (string) (len=24) "AddAppUserInvoiceRequest", - name: (string) (len=24) "AddAppUserInvoiceRequest", - fields: (map[string]*main.Field) (len=4) { - (string) (len=19) "receiver_identifier": (*main.Field)(0xc00031f680)({ - 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, - oneOfName: (string) "" }), - (string) (len=16) "payer_identifier": (*main.Field)(0xc00031f6c0)({ - name: (string) (len=16) "payer_identifier", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=17) "http_callback_url": (*main.Field)(0xc00031f700)({ - name: (string) (len=17) "http_callback_url", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=11) "invoice_req": (*main.Field)(0xc00031f740)({ - name: (string) (len=11) "invoice_req", - kind: (string) (len=17) "NewInvoiceRequest", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=18) "NewAddressResponse": (*main.Message)(0xc000471290)({ - fullName: (string) (len=18) "NewAddressResponse", - name: (string) (len=18) "NewAddressResponse", - fields: (map[string]*main.Field) (len=1) { - (string) (len=7) "address": (*main.Field)(0xc00031fb40)({ - name: (string) (len=7) "address", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=7) "Product": (*main.Message)(0xc000471b30)({ - fullName: (string) (len=7) "Product", - name: (string) (len=7) "Product", - fields: (map[string]*main.Field) (len=3) { - (string) (len=2) "id": (*main.Field)(0xc0005e6c00)({ - 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, - oneOfName: (string) "" - }), - (string) (len=4) "name": (*main.Field)(0xc0005e6c40)({ + (*main.Field)(0xc00010f200)({ name: (string) (len=4) "name", kind: (string) (len=6) "string", isMap: (bool) false, @@ -2782,810 +2372,14 @@ isMessage: (bool) false, isOptional: (bool) false, oneOfName: (string) "" - }), - (string) (len=10) "price_sats": (*main.Field)(0xc0005e6c80)({ - 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, - oneOfName: (string) "" }) } }), - (string) (len=31) "CreateOneTimeInviteLinkResponse": (*main.Message)(0xc000471fb0)({ - fullName: (string) (len=31) "CreateOneTimeInviteLinkResponse", - name: (string) (len=31) "CreateOneTimeInviteLinkResponse", - fields: (map[string]*main.Field) (len=1) { - (string) (len=15) "invitation_link": (*main.Field)(0xc0005e7000)({ - name: (string) (len=15) "invitation_link", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=18) "AppsMetricsRequest": (*main.Message)(0xc0004705d0)({ - fullName: (string) (len=18) "AppsMetricsRequest", - name: (string) (len=18) "AppsMetricsRequest", - fields: (map[string]*main.Field) (len=3) { - (string) (len=9) "from_unix": (*main.Field)(0xc0000b0ac0)({ - name: (string) (len=9) "from_unix", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) true, - oneOfName: (string) "" - }), - (string) (len=7) "to_unix": (*main.Field)(0xc0000b0b00)({ - name: (string) (len=7) "to_unix", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) true, - oneOfName: (string) "" - }), - (string) (len=18) "include_operations": (*main.Field)(0xc0000b0b40)({ - name: (string) (len=18) "include_operations", - kind: (string) (len=4) "bool", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) true, - oneOfName: (string) "" - }) - } - }), - (string) (len=20) "AddAppInvoiceRequest": (*main.Message)(0xc000470ed0)({ - fullName: (string) (len=20) "AddAppInvoiceRequest", - name: (string) (len=20) "AddAppInvoiceRequest", - fields: (map[string]*main.Field) (len=3) { - (string) (len=16) "payer_identifier": (*main.Field)(0xc00031f5c0)({ - name: (string) (len=16) "payer_identifier", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=17) "http_callback_url": (*main.Field)(0xc00031f600)({ - name: (string) (len=17) "http_callback_url", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=11) "invoice_req": (*main.Field)(0xc00031f640)({ - name: (string) (len=11) "invoice_req", - kind: (string) (len=17) "NewInvoiceRequest", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=24) "SetMockAppBalanceRequest": (*main.Message)(0xc0004711d0)({ - fullName: (string) (len=24) "SetMockAppBalanceRequest", - name: (string) (len=24) "SetMockAppBalanceRequest", - fields: (map[string]*main.Field) (len=1) { - (string) (len=6) "amount": (*main.Field)(0xc00031fac0)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=17) "LnurlLinkResponse": (*main.Message)(0xc000471770)({ - fullName: (string) (len=17) "LnurlLinkResponse", - name: (string) (len=17) "LnurlLinkResponse", - fields: (map[string]*main.Field) (len=2) { - (string) (len=5) "lnurl": (*main.Field)(0xc000269780)({ - name: (string) (len=5) "lnurl", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=2) "k1": (*main.Field)(0xc000269800)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=25) "LnurlWithdrawInfoResponse": (*main.Message)(0xc0004717d0)({ - fullName: (string) (len=25) "LnurlWithdrawInfoResponse", - name: (string) (len=25) "LnurlWithdrawInfoResponse", - fields: (map[string]*main.Field) (len=8) { - (string) (len=15) "maxWithdrawable": (*main.Field)(0xc0005e6000)({ - 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, - oneOfName: (string) "" - }), - (string) (len=12) "balanceCheck": (*main.Field)(0xc0005e6040)({ - 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, - oneOfName: (string) "" - }), - (string) (len=7) "payLink": (*main.Field)(0xc0005e6080)({ - 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, - oneOfName: (string) "" - }), - (string) (len=3) "tag": (*main.Field)(0xc000269840)({ - 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, - oneOfName: (string) "" - }), - (string) (len=8) "callback": (*main.Field)(0xc000269940)({ - 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, - oneOfName: (string) "" - }), - (string) (len=2) "k1": (*main.Field)(0xc000269a00)({ - 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, - oneOfName: (string) "" - }), - (string) (len=18) "defaultDescription": (*main.Field)(0xc000269a80)({ - 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, - oneOfName: (string) "" - }), - (string) (len=15) "minWithdrawable": (*main.Field)(0xc000269c40)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=17) "AddAppUserRequest": (*main.Message)(0xc000470e10)({ - fullName: (string) (len=17) "AddAppUserRequest", - name: (string) (len=17) "AddAppUserRequest", - fields: (map[string]*main.Field) (len=3) { - (string) (len=10) "identifier": (*main.Field)(0xc00031f440)({ - 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, - oneOfName: (string) "" - }), - (string) (len=14) "fail_if_exists": (*main.Field)(0xc00031f480)({ - 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, - oneOfName: (string) "" - }), - (string) (len=7) "balance": (*main.Field)(0xc00031f4c0)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=27) "SetMockInvoiceAsPaidRequest": (*main.Message)(0xc000470ab0)({ - fullName: (string) (len=27) "SetMockInvoiceAsPaidRequest", - name: (string) (len=27) "SetMockInvoiceAsPaidRequest", - fields: (map[string]*main.Field) (len=2) { - (string) (len=6) "amount": (*main.Field)(0xc00031ef80)({ - 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, - oneOfName: (string) "" - }), - (string) (len=7) "invoice": (*main.Field)(0xc00031ef40)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=13) "AddAppRequest": (*main.Message)(0xc000470c90)({ - fullName: (string) (len=13) "AddAppRequest", - name: (string) (len=13) "AddAppRequest", - fields: (map[string]*main.Field) (len=2) { - (string) (len=4) "name": (*main.Field)(0xc00031f1c0)({ - 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, - oneOfName: (string) "" - }), - (string) (len=19) "allow_user_creation": (*main.Field)(0xc00031f200)({ - 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) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=18) "PayAddressResponse": (*main.Message)(0xc000471350)({ - fullName: (string) (len=18) "PayAddressResponse", - name: (string) (len=18) "PayAddressResponse", - fields: (map[string]*main.Field) (len=4) { - (string) (len=11) "network_fee": (*main.Field)(0xc00031fd00)({ - 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, - oneOfName: (string) "" - }), - (string) (len=4) "txId": (*main.Field)(0xc00031fc40)({ - 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, - oneOfName: (string) "" - }), - (string) (len=12) "operation_id": (*main.Field)(0xc00031fc80)({ - 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, - oneOfName: (string) "" - }), - (string) (len=11) "service_fee": (*main.Field)(0xc00031fcc0)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=31) "RequestNPubLinkingTokenResponse": (*main.Message)(0xc000471dd0)({ - fullName: (string) (len=31) "RequestNPubLinkingTokenResponse", - name: (string) (len=31) "RequestNPubLinkingTokenResponse", - fields: (map[string]*main.Field) (len=1) { - (string) (len=5) "token": (*main.Field)(0xc0005e6e80)({ - name: (string) (len=5) "token", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=11) "UsageMetric": (*main.Message)(0xc000470510)({ - fullName: (string) (len=11) "UsageMetric", - name: (string) (len=11) "UsageMetric", - fields: (map[string]*main.Field) (len=9) { - (string) (len=15) "processed_at_ms": (*main.Field)(0xc0000b06c0)({ - name: (string) (len=15) "processed_at_ms", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=12) "auth_in_nano": (*main.Field)(0xc0000b07c0)({ - name: (string) (len=12) "auth_in_nano", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=16) "validate_in_nano": (*main.Field)(0xc0000b0800)({ - name: (string) (len=16) "validate_in_nano", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=14) "handle_in_nano": (*main.Field)(0xc0000b0840)({ - name: (string) (len=14) "handle_in_nano", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=5) "batch": (*main.Field)(0xc0000b08c0)({ - name: (string) (len=5) "batch", - kind: (string) (len=4) "bool", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=5) "nostr": (*main.Field)(0xc0000b0900)({ - name: (string) (len=5) "nostr", - kind: (string) (len=4) "bool", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=14) "parsed_in_nano": (*main.Field)(0xc0000b0700)({ - name: (string) (len=14) "parsed_in_nano", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=8) "rpc_name": (*main.Field)(0xc0000b0880)({ - name: (string) (len=8) "rpc_name", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=10) "batch_size": (*main.Field)(0xc0000b0940)({ - name: (string) (len=10) "batch_size", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=14) "LndNodeMetrics": (*main.Message)(0xc000470930)({ - fullName: (string) (len=14) "LndNodeMetrics", - name: (string) (len=14) "LndNodeMetrics", - fields: (map[string]*main.Field) (len=11) { - (string) (len=15) "online_channels": (*main.Field)(0xc00031ecc0)({ - name: (string) (len=15) "online_channels", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=13) "open_channels": (*main.Field)(0xc00031ed80)({ - name: (string) (len=13) "open_channels", - kind: (string) (len=11) "OpenChannel", - isMap: (bool) false, - isArray: (bool) true, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=15) "closed_channels": (*main.Field)(0xc00031edc0)({ - name: (string) (len=15) "closed_channels", - kind: (string) (len=13) "ClosedChannel", - isMap: (bool) false, - isArray: (bool) true, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=17) "forwarding_events": (*main.Field)(0xc00031ee00)({ - name: (string) (len=17) "forwarding_events", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=15) "forwarding_fees": (*main.Field)(0xc00031ee40)({ - name: (string) (len=15) "forwarding_fees", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=13) "chain_balance": (*main.Field)(0xc00031ea00)({ - name: (string) (len=13) "chain_balance", - kind: (string) (len=10) "GraphPoint", - isMap: (bool) false, - isArray: (bool) true, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=15) "channel_balance": (*main.Field)(0xc00031ea80)({ - name: (string) (len=15) "channel_balance", - kind: (string) (len=10) "GraphPoint", - isMap: (bool) false, - isArray: (bool) true, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=16) "external_balance": (*main.Field)(0xc00031ec00)({ - name: (string) (len=16) "external_balance", - kind: (string) (len=10) "GraphPoint", - isMap: (bool) false, - isArray: (bool) true, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=16) "offline_channels": (*main.Field)(0xc00031ec80)({ - name: (string) (len=16) "offline_channels", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=16) "pending_channels": (*main.Field)(0xc00031ed00)({ - name: (string) (len=16) "pending_channels", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=16) "closing_channels": (*main.Field)(0xc00031ed40)({ - name: (string) (len=16) "closing_channels", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=18) "LndGetInfoResponse": (*main.Message)(0xc000470b10)({ - fullName: (string) (len=18) "LndGetInfoResponse", - name: (string) (len=18) "LndGetInfoResponse", - fields: (map[string]*main.Field) (len=1) { - (string) (len=5) "alias": (*main.Field)(0xc00031efc0)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=9) "HttpCreds": (*main.Message)(0xc000471e90)({ - fullName: (string) (len=9) "HttpCreds", - name: (string) (len=9) "HttpCreds", - fields: (map[string]*main.Field) (len=2) { - (string) (len=3) "url": (*main.Field)(0xc0005e6f00)({ - name: (string) (len=3) "url", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=5) "token": (*main.Field)(0xc0005e6f40)({ - name: (string) (len=5) "token", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=11) "OpenChannel": (*main.Message)(0xc000470810)({ - fullName: (string) (len=11) "OpenChannel", - name: (string) (len=11) "OpenChannel", - fields: (map[string]*main.Field) (len=7) { - (string) (len=14) "remote_balance": (*main.Field)(0xc00031e300)({ - name: (string) (len=14) "remote_balance", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=5) "label": (*main.Field)(0xc00031e600)({ - name: (string) (len=5) "label", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=10) "channel_id": (*main.Field)(0xc00031e080)({ - name: (string) (len=10) "channel_id", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=8) "capacity": (*main.Field)(0xc00031e140)({ - name: (string) (len=8) "capacity", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=6) "active": (*main.Field)(0xc00031e180)({ - name: (string) (len=6) "active", - kind: (string) (len=4) "bool", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=8) "lifetime": (*main.Field)(0xc00031e280)({ - name: (string) (len=8) "lifetime", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=13) "local_balance": (*main.Field)(0xc00031e2c0)({ - name: (string) (len=13) "local_balance", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=21) "DecodeInvoiceResponse": (*main.Message)(0xc0004714d0)({ - fullName: (string) (len=21) "DecodeInvoiceResponse", - name: (string) (len=21) "DecodeInvoiceResponse", - fields: (map[string]*main.Field) (len=1) { - (string) (len=6) "amount": (*main.Field)(0xc00031fe40)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=19) "OpenChannelResponse": (*main.Message)(0xc000471710)({ - fullName: (string) (len=19) "OpenChannelResponse", - name: (string) (len=19) "OpenChannelResponse", - fields: (map[string]*main.Field) (len=1) { - (string) (len=9) "channelId": (*main.Field)(0xc000269740)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=27) "LinkNPubThroughTokenRequest": (*main.Message)(0xc000471e30)({ - fullName: (string) (len=27) "LinkNPubThroughTokenRequest", - name: (string) (len=27) "LinkNPubThroughTokenRequest", - fields: (map[string]*main.Field) (len=1) { - (string) (len=5) "token": (*main.Field)(0xc0005e6ec0)({ - name: (string) (len=5) "token", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=17) "LndMetricsRequest": (*main.Message)(0xc000470750)({ - fullName: (string) (len=17) "LndMetricsRequest", - name: (string) (len=17) "LndMetricsRequest", - fields: (map[string]*main.Field) (len=2) { - (string) (len=9) "from_unix": (*main.Field)(0xc0000b1140)({ - name: (string) (len=9) "from_unix", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) true, - oneOfName: (string) "" - }), - (string) (len=7) "to_unix": (*main.Field)(0xc0000b1180)({ - name: (string) (len=7) "to_unix", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) true, - oneOfName: (string) "" - }) - } - }), - (string) (len=10) "LndMetrics": (*main.Message)(0xc000470990)({ - fullName: (string) (len=10) "LndMetrics", - name: (string) (len=10) "LndMetrics", - fields: (map[string]*main.Field) (len=1) { - (string) (len=5) "nodes": (*main.Field)(0xc00031ee80)({ - name: (string) (len=5) "nodes", - kind: (string) (len=14) "LndNodeMetrics", - isMap: (bool) false, - isArray: (bool) true, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=14) "BanUserRequest": (*main.Message)(0xc000470b70)({ + (*main.SortableMessage)(0xc000197f80)({ fullName: (string) (len=14) "BanUserRequest", name: (string) (len=14) "BanUserRequest", - fields: (map[string]*main.Field) (len=1) { - (string) (len=7) "user_id": (*main.Field)(0xc00031f000)({ + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc00010eec0)({ name: (string) (len=7) "user_id", kind: (string) (len=6) "string", isMap: (bool) false, @@ -3597,12 +2391,12 @@ }) } }), - (string) (len=7) "AppUser": (*main.Message)(0xc000470e70)({ - fullName: (string) (len=7) "AppUser", - name: (string) (len=7) "AppUser", - fields: (map[string]*main.Field) (len=3) { - (string) (len=16) "max_withdrawable": (*main.Field)(0xc00031f580)({ - name: (string) (len=16) "max_withdrawable", + (*main.SortableMessage)(0xc00019c740)({ + fullName: (string) (len=15) "BanUserResponse", + name: (string) (len=15) "BanUserResponse", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc00010f080)({ + name: (string) (len=12) "balance_sats", kind: (string) (len=5) "int64", isMap: (bool) false, isArray: (bool) false, @@ -3611,21 +2405,11 @@ isOptional: (bool) false, oneOfName: (string) "" }), - (string) (len=10) "identifier": (*main.Field)(0xc00031f500)({ - name: (string) (len=10) "identifier", - kind: (string) (len=6) "string", + (*main.Field)(0xc00010f0c0)({ + name: (string) (len=16) "banned_app_users", + kind: (string) (len=13) "BannedAppUser", isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=4) "info": (*main.Field)(0xc00031f540)({ - name: (string) (len=4) "info", - kind: (string) (len=8) "UserInfo", - isMap: (bool) false, - isArray: (bool) false, + isArray: (bool) true, isEnum: (bool) false, isMessage: (bool) true, isOptional: (bool) false, @@ -3633,13 +2417,13 @@ }) } }), - (string) (len=17) "NewInvoiceRequest": (*main.Message)(0xc0004713b0)({ - fullName: (string) (len=17) "NewInvoiceRequest", - name: (string) (len=17) "NewInvoiceRequest", - fields: (map[string]*main.Field) (len=2) { - (string) (len=10) "amountSats": (*main.Field)(0xc00031fd40)({ - name: (string) (len=10) "amountSats", - kind: (string) (len=5) "int64", + (*main.SortableMessage)(0xc000197a40)({ + fullName: (string) (len=13) "BannedAppUser", + name: (string) (len=13) "BannedAppUser", + fields: ([]*main.Field) (len=4 cap=4) { + (*main.Field)(0xc00010ef80)({ + name: (string) (len=6) "app_id", + kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, isEnum: (bool) false, @@ -3647,8 +2431,28 @@ isOptional: (bool) false, oneOfName: (string) "" }), - (string) (len=4) "memo": (*main.Field)(0xc00031fd80)({ - name: (string) (len=4) "memo", + (*main.Field)(0xc00010ef00)({ + name: (string) (len=8) "app_name", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010f000)({ + name: (string) (len=9) "nostr_pub", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010efc0)({ + name: (string) (len=15) "user_identifier", kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, @@ -3659,11 +2463,95 @@ }) } }), - (string) (len=20) "DecodeInvoiceRequest": (*main.Message)(0xc000471470)({ + (*main.SortableMessage)(0xc000197f00)({ + fullName: (string) (len=13) "ClosedChannel", + name: (string) (len=13) "ClosedChannel", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc00010e7c0)({ + name: (string) (len=8) "capacity", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010e700)({ + name: (string) (len=10) "channel_id", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010e800)({ + name: (string) (len=13) "closed_height", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c080)({ + fullName: (string) (len=16) "ClosureMigration", + name: (string) (len=16) "ClosureMigration", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000107d40)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc0001972c0)({ + fullName: (string) (len=30) "CreateOneTimeInviteLinkRequest", + name: (string) (len=30) "CreateOneTimeInviteLinkRequest", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000107f40)({ + name: (string) (len=4) "sats", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) true, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197840)({ + fullName: (string) (len=31) "CreateOneTimeInviteLinkResponse", + name: (string) (len=31) "CreateOneTimeInviteLinkResponse", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000107f80)({ + name: (string) (len=15) "invitation_link", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c7c0)({ fullName: (string) (len=20) "DecodeInvoiceRequest", name: (string) (len=20) "DecodeInvoiceRequest", - fields: (map[string]*main.Field) (len=1) { - (string) (len=7) "invoice": (*main.Field)(0xc00031fe00)({ + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000106900)({ name: (string) (len=7) "invoice", kind: (string) (len=6) "string", isMap: (bool) false, @@ -3675,139 +2563,11 @@ }) } }), - (string) (len=9) "UsersInfo": (*main.Message)(0xc000470630)({ - fullName: (string) (len=9) "UsersInfo", - name: (string) (len=9) "UsersInfo", - fields: (map[string]*main.Field) (len=6) { - (string) (len=10) "no_balance": (*main.Field)(0xc0000b0bc0)({ - name: (string) (len=10) "no_balance", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=16) "negative_balance": (*main.Field)(0xc0000b0cc0)({ - name: (string) (len=16) "negative_balance", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=20) "always_been_inactive": (*main.Field)(0xc0000b0d00)({ - name: (string) (len=20) "always_been_inactive", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=11) "balance_avg": (*main.Field)(0xc0000b0d40)({ - name: (string) (len=11) "balance_avg", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=14) "balance_median": (*main.Field)(0xc0000b0d80)({ - name: (string) (len=14) "balance_median", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=5) "total": (*main.Field)(0xc0000b0b80)({ - name: (string) (len=5) "total", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=11) "LndChannels": (*main.Message)(0xc0004709f0)({ - fullName: (string) (len=11) "LndChannels", - name: (string) (len=11) "LndChannels", - fields: (map[string]*main.Field) (len=1) { - (string) (len=13) "open_channels": (*main.Field)(0xc00031eec0)({ - name: (string) (len=13) "open_channels", - kind: (string) (len=11) "OpenChannel", - isMap: (bool) false, - isArray: (bool) true, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=17) "PayAddressRequest": (*main.Message)(0xc0004712f0)({ - fullName: (string) (len=17) "PayAddressRequest", - name: (string) (len=17) "PayAddressRequest", - fields: (map[string]*main.Field) (len=3) { - (string) (len=7) "address": (*main.Field)(0xc00031fb80)({ - name: (string) (len=7) "address", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=9) "amoutSats": (*main.Field)(0xc00031fbc0)({ - name: (string) (len=9) "amoutSats", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=12) "satsPerVByte": (*main.Field)(0xc00031fc00)({ - name: (string) (len=12) "satsPerVByte", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=12) "PaymentState": (*main.Message)(0xc000471650)({ - fullName: (string) (len=12) "PaymentState", - name: (string) (len=12) "PaymentState", - fields: (map[string]*main.Field) (len=4) { - (string) (len=12) "paid_at_unix": (*main.Field)(0xc000268cc0)({ - name: (string) (len=12) "paid_at_unix", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=6) "amount": (*main.Field)(0xc000268d00)({ + (*main.SortableMessage)(0xc000197900)({ + fullName: (string) (len=21) "DecodeInvoiceResponse", + name: (string) (len=21) "DecodeInvoiceResponse", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000106940)({ name: (string) (len=6) "amount", kind: (string) (len=5) "int64", isMap: (bool) false, @@ -3816,88 +2576,21 @@ isMessage: (bool) false, isOptional: (bool) false, oneOfName: (string) "" - }), - (string) (len=11) "service_fee": (*main.Field)(0xc000269300)({ - 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, - oneOfName: (string) "" - }), - (string) (len=11) "network_fee": (*main.Field)(0xc000269500)({ - 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, - oneOfName: (string) "" }) } }), - (string) (len=14) "UserOperations": (*main.Message)(0xc000471a10)({ - fullName: (string) (len=14) "UserOperations", - name: (string) (len=14) "UserOperations", - fields: (map[string]*main.Field) (len=3) { - (string) (len=9) "fromIndex": (*main.Field)(0xc0005e6940)({ - 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, - oneOfName: (string) "" - }), - (string) (len=7) "toIndex": (*main.Field)(0xc0005e6980)({ - 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, - oneOfName: (string) "" - }), - (string) (len=10) "operations": (*main.Field)(0xc0005e69c0)({ - 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, - oneOfName: (string) "" - }) - } + (*main.SortableMessage)(0xc00019c100)({ + fullName: (string) (len=5) "Empty", + name: (string) (len=5) "Empty", + fields: ([]*main.Field) }), - (string) (len=12) "UsageMetrics": (*main.Message)(0xc000470570)({ - fullName: (string) (len=12) "UsageMetrics", - name: (string) (len=12) "UsageMetrics", - fields: (map[string]*main.Field) (len=1) { - (string) (len=7) "metrics": (*main.Field)(0xc0000b0a80)({ - name: (string) (len=7) "metrics", - kind: (string) (len=11) "UsageMetric", - isMap: (bool) false, - isArray: (bool) true, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=24) "GetUserOperationsRequest": (*main.Message)(0xc000471950)({ - fullName: (string) (len=24) "GetUserOperationsRequest", - name: (string) (len=24) "GetUserOperationsRequest", - fields: (map[string]*main.Field) (len=7) { - (string) (len=16) "latestOutgoingTx": (*main.Field)(0xc0005e6580)({ - name: (string) (len=16) "latestOutgoingTx", - kind: (string) (len=5) "int64", + (*main.SortableMessage)(0xc0001974c0)({ + fullName: (string) (len=25) "EncryptionExchangeRequest", + name: (string) (len=25) "EncryptionExchangeRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc00023f2c0)({ + name: (string) (len=8) "deviceId", + kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, isEnum: (bool) false, @@ -3905,74 +2598,8 @@ isOptional: (bool) false, oneOfName: (string) "" }), - (string) (len=31) "latestIncomingUserToUserPayment": (*main.Field)(0xc0005e65c0)({ - 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, - oneOfName: (string) "" - }), - (string) (len=31) "latestOutgoingUserToUserPayment": (*main.Field)(0xc0005e6600)({ - 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, - oneOfName: (string) "" - }), - (string) (len=8) "max_size": (*main.Field)(0xc0005e6640)({ - name: (string) (len=8) "max_size", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=21) "latestIncomingInvoice": (*main.Field)(0xc0005e64c0)({ - 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, - oneOfName: (string) "" - }), - (string) (len=21) "latestOutgoingInvoice": (*main.Field)(0xc0005e6500)({ - 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, - oneOfName: (string) "" - }), - (string) (len=16) "latestIncomingTx": (*main.Field)(0xc0005e6540)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=30) "RequestNPubLinkingTokenRequest": (*main.Message)(0xc000471d70)({ - fullName: (string) (len=30) "RequestNPubLinkingTokenRequest", - name: (string) (len=30) "RequestNPubLinkingTokenRequest", - fields: (map[string]*main.Field) (len=1) { - (string) (len=15) "user_identifier": (*main.Field)(0xc0005e6e40)({ - name: (string) (len=15) "user_identifier", + (*main.Field)(0xc00023f1c0)({ + name: (string) (len=9) "publicKey", kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, @@ -3983,261 +2610,11 @@ }) } }), - (string) (len=34) "SendAppUserToAppUserPaymentRequest": (*main.Message)(0xc000471050)({ - fullName: (string) (len=34) "SendAppUserToAppUserPaymentRequest", - name: (string) (len=34) "SendAppUserToAppUserPaymentRequest", - fields: (map[string]*main.Field) (len=3) { - (string) (len=6) "amount": (*main.Field)(0xc00031f900)({ - 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, - oneOfName: (string) "" - }), - (string) (len=20) "from_user_identifier": (*main.Field)(0xc00031f880)({ - 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, - oneOfName: (string) "" - }), - (string) (len=18) "to_user_identifier": (*main.Field)(0xc00031f8c0)({ - name: (string) (len=18) "to_user_identifier", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=12) "RoutingEvent": (*main.Message)(0xc0004707b0)({ - fullName: (string) (len=12) "RoutingEvent", - name: (string) (len=12) "RoutingEvent", - fields: (map[string]*main.Field) (len=12) { - (string) (len=12) "timestamp_ns": (*main.Field)(0xc0000b13c0)({ - name: (string) (len=12) "timestamp_ns", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=14) "failure_string": (*main.Field)(0xc0000b15c0)({ - name: (string) (len=14) "failure_string", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=8) "offchain": (*main.Field)(0xc0000b1b80)({ - name: (string) (len=8) "offchain", - kind: (string) (len=4) "bool", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=19) "incoming_channel_id": (*main.Field)(0xc0000b11c0)({ - name: (string) (len=19) "incoming_channel_id", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=19) "outgoing_channel_id": (*main.Field)(0xc0000b1340)({ - name: (string) (len=19) "outgoing_channel_id", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=10) "event_type": (*main.Field)(0xc0000b14c0)({ - name: (string) (len=10) "event_type", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=17) "incoming_amt_msat": (*main.Field)(0xc0000b1500)({ - name: (string) (len=17) "incoming_amt_msat", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=17) "outgoing_amt_msat": (*main.Field)(0xc0000b1540)({ - name: (string) (len=17) "outgoing_amt_msat", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=7) "settled": (*main.Field)(0xc0000b1740)({ - name: (string) (len=7) "settled", - kind: (string) (len=4) "bool", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=18) "forward_fail_event": (*main.Field)(0xc0000b1c40)({ - name: (string) (len=18) "forward_fail_event", - kind: (string) (len=4) "bool", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=16) "incoming_htlc_id": (*main.Field)(0xc0000b1280)({ - name: (string) (len=16) "incoming_htlc_id", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=16) "outgoing_htlc_id": (*main.Field)(0xc0000b1380)({ - name: (string) (len=16) "outgoing_htlc_id", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=10) "GraphPoint": (*main.Message)(0xc0004708d0)({ - fullName: (string) (len=10) "GraphPoint", - name: (string) (len=10) "GraphPoint", - fields: (map[string]*main.Field) (len=2) { - (string) (len=1) "x": (*main.Field)(0xc00031e940)({ - name: (string) (len=1) "x", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }), - (string) (len=1) "y": (*main.Field)(0xc00031e9c0)({ - name: (string) (len=1) "y", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=17) "GetAppUserRequest": (*main.Message)(0xc000470f90)({ - fullName: (string) (len=17) "GetAppUserRequest", - name: (string) (len=17) "GetAppUserRequest", - fields: (map[string]*main.Field) (len=1) { - (string) (len=15) "user_identifier": (*main.Field)(0xc00031f780)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=18) "OpenChannelRequest": (*main.Message)(0xc0004716b0)({ - fullName: (string) (len=18) "OpenChannelRequest", - name: (string) (len=18) "OpenChannelRequest", - fields: (map[string]*main.Field) (len=4) { - (string) (len=11) "destination": (*main.Field)(0xc000269540)({ - 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, - oneOfName: (string) "" - }), - (string) (len=13) "fundingAmount": (*main.Field)(0xc0002695c0)({ - 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, - oneOfName: (string) "" - }), - (string) (len=10) "pushAmount": (*main.Field)(0xc000269640)({ - 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, - oneOfName: (string) "" - }), - (string) (len=12) "closeAddress": (*main.Field)(0xc000269700)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=23) "EnrollAdminTokenRequest": (*main.Message)(0xc000471ef0)({ + (*main.SortableMessage)(0xc000197480)({ fullName: (string) (len=23) "EnrollAdminTokenRequest", name: (string) (len=23) "EnrollAdminTokenRequest", - fields: (map[string]*main.Field) (len=1) { - (string) (len=11) "admin_token": (*main.Field)(0xc0005e6f80)({ + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000107f00)({ name: (string) (len=11) "admin_token", kind: (string) (len=6) "string", isMap: (bool) false, @@ -4249,54 +2626,12 @@ }) } }), - (string) (len=7) "LndSeed": (*main.Message)(0xc000470450)({ - fullName: (string) (len=7) "LndSeed", - name: (string) (len=7) "LndSeed", - fields: (map[string]*main.Field) (len=1) { - (string) (len=4) "seed": (*main.Field)(0xc0000b03c0)({ - name: (string) (len=4) "seed", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) true, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=17) "PayInvoiceRequest": (*main.Message)(0xc000471530)({ - fullName: (string) (len=17) "PayInvoiceRequest", - name: (string) (len=17) "PayInvoiceRequest", - fields: (map[string]*main.Field) (len=2) { - (string) (len=6) "amount": (*main.Field)(0xc00031fec0)({ - 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, - oneOfName: (string) "" - }), - (string) (len=7) "invoice": (*main.Field)(0xc00031fe80)({ - 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, - oneOfName: (string) "" - }) - } - }), - (string) (len=22) "HandleLnurlPayResponse": (*main.Message)(0xc000471890)({ - fullName: (string) (len=22) "HandleLnurlPayResponse", - name: (string) (len=22) "HandleLnurlPayResponse", - fields: (map[string]*main.Field) (len=2) { - (string) (len=2) "pr": (*main.Field)(0xc0005e6280)({ - name: (string) (len=2) "pr", + (*main.SortableMessage)(0xc00019c8c0)({ + fullName: (string) (len=26) "GetAppUserLNURLInfoRequest", + name: (string) (len=26) "GetAppUserLNURLInfoRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc000106500)({ + name: (string) (len=17) "base_url_override", kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, @@ -4305,24 +2640,8 @@ isOptional: (bool) false, oneOfName: (string) "" }), - (string) (len=6) "routes": (*main.Field)(0xc0005e62c0)({ - name: (string) (len=6) "routes", - kind: (string) (len=5) "Empty", - isMap: (bool) false, - isArray: (bool) true, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false, - oneOfName: (string) "" - }) - } - }), - (string) (len=25) "GetProductBuyLinkResponse": (*main.Message)(0xc000471b90)({ - fullName: (string) (len=25) "GetProductBuyLinkResponse", - name: (string) (len=25) "GetProductBuyLinkResponse", - fields: (map[string]*main.Field) (len=1) { - (string) (len=4) "link": (*main.Field)(0xc0005e6cc0)({ - name: (string) (len=4) "link", + (*main.Field)(0xc0001064c0)({ + name: (string) (len=15) "user_identifier", kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, @@ -4333,11 +2652,43 @@ }) } }), - (string) (len=27) "GetInviteTokenStateResponse": (*main.Message)(0xc00049cb70)({ + (*main.SortableMessage)(0xc00019c640)({ + fullName: (string) (len=17) "GetAppUserRequest", + name: (string) (len=17) "GetAppUserRequest", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000106280)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197880)({ + fullName: (string) (len=26) "GetInviteTokenStateRequest", + name: (string) (len=26) "GetInviteTokenStateRequest", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000156000)({ + name: (string) (len=12) "invite_token", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197300)({ fullName: (string) (len=27) "GetInviteTokenStateResponse", name: (string) (len=27) "GetInviteTokenStateResponse", - fields: (map[string]*main.Field) (len=1) { - (string) (len=4) "used": (*main.Field)(0xc0005e70c0)({ + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000156040)({ name: (string) (len=4) "used", kind: (string) (len=4) "bool", isMap: (bool) false, @@ -4349,12 +2700,212 @@ }) } }), - (string) (len=24) "PayAppUserInvoiceRequest": (*main.Message)(0xc000470ff0)({ - fullName: (string) (len=24) "PayAppUserInvoiceRequest", - name: (string) (len=24) "PayAppUserInvoiceRequest", - fields: (map[string]*main.Field) (len=3) { - (string) (len=15) "user_identifier": (*main.Field)(0xc00031f7c0)({ - name: (string) (len=15) "user_identifier", + (*main.SortableMessage)(0xc000197640)({ + fullName: (string) (len=22) "GetPaymentStateRequest", + name: (string) (len=22) "GetPaymentStateRequest", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000106b40)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c300)({ + fullName: (string) (len=25) "GetProductBuyLinkResponse", + name: (string) (len=25) "GetProductBuyLinkResponse", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000107c40)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197c00)({ + fullName: (string) (len=24) "GetUserOperationsRequest", + name: (string) (len=24) "GetUserOperationsRequest", + fields: ([]*main.Field) (len=7 cap=8) { + (*main.Field)(0xc000107440)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc0001074c0)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107540)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107480)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107500)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107580)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc0001075c0)({ + name: (string) (len=8) "max_size", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c040)({ + fullName: (string) (len=25) "GetUserOperationsResponse", + name: (string) (len=25) "GetUserOperationsResponse", + fields: ([]*main.Field) (len=6 cap=8) { + (*main.Field)(0xc0001079c0)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107a40)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107ac0)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107980)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107a00)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107a80)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c200)({ + fullName: (string) (len=10) "GraphPoint", + name: (string) (len=10) "GraphPoint", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc00010e840)({ + name: (string) (len=1) "x", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010e880)({ + name: (string) (len=1) "y", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c2c0)({ + fullName: (string) (len=22) "HandleLnurlPayResponse", + name: (string) (len=22) "HandleLnurlPayResponse", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc000107200)({ + name: (string) (len=2) "pr", kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, @@ -4363,7 +2914,821 @@ isOptional: (bool) false, oneOfName: (string) "" }), - (string) (len=7) "invoice": (*main.Field)(0xc00031f800)({ + (*main.Field)(0xc000107240)({ + name: (string) (len=6) "routes", + kind: (string) (len=5) "Empty", + isMap: (bool) false, + isArray: (bool) true, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197280)({ + fullName: (string) (len=9) "HttpCreds", + name: (string) (len=9) "HttpCreds", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc000107ec0)({ + name: (string) (len=5) "token", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107e80)({ + name: (string) (len=3) "url", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197e00)({ + fullName: (string) (len=27) "LinkNPubThroughTokenRequest", + name: (string) (len=27) "LinkNPubThroughTokenRequest", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000107e40)({ + name: (string) (len=5) "token", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c480)({ + fullName: (string) (len=17) "LiveUserOperation", + name: (string) (len=17) "LiveUserOperation", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000107c80)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c140)({ + fullName: (string) (len=11) "LndChannels", + name: (string) (len=11) "LndChannels", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc00010ed80)({ + name: (string) (len=13) "open_channels", + kind: (string) (len=11) "OpenChannel", + isMap: (bool) false, + isArray: (bool) true, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197cc0)({ + fullName: (string) (len=17) "LndGetInfoRequest", + name: (string) (len=17) "LndGetInfoRequest", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc00010edc0)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197f40)({ + fullName: (string) (len=18) "LndGetInfoResponse", + name: (string) (len=18) "LndGetInfoResponse", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc00010ee80)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc0001975c0)({ + fullName: (string) (len=10) "LndMetrics", + name: (string) (len=10) "LndMetrics", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc00010ed40)({ + name: (string) (len=5) "nodes", + kind: (string) (len=14) "LndNodeMetrics", + isMap: (bool) false, + isArray: (bool) true, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197780)({ + fullName: (string) (len=17) "LndMetricsRequest", + name: (string) (len=17) "LndMetricsRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc00023fcc0)({ + name: (string) (len=9) "from_unix", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) true, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023fd00)({ + name: (string) (len=7) "to_unix", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) true, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197dc0)({ + fullName: (string) (len=14) "LndNodeMetrics", + name: (string) (len=14) "LndNodeMetrics", + fields: ([]*main.Field) (len=11 cap=16) { + (*main.Field)(0xc00010e8c0)({ + name: (string) (len=13) "chain_balance", + kind: (string) (len=10) "GraphPoint", + isMap: (bool) false, + isArray: (bool) true, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010e900)({ + name: (string) (len=15) "channel_balance", + kind: (string) (len=10) "GraphPoint", + isMap: (bool) false, + isArray: (bool) true, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010ebc0)({ + name: (string) (len=15) "closed_channels", + kind: (string) (len=13) "ClosedChannel", + isMap: (bool) false, + isArray: (bool) true, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010eb40)({ + name: (string) (len=16) "closing_channels", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010e940)({ + name: (string) (len=16) "external_balance", + kind: (string) (len=10) "GraphPoint", + isMap: (bool) false, + isArray: (bool) true, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010ecc0)({ + name: (string) (len=17) "forwarding_events", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010ed00)({ + name: (string) (len=15) "forwarding_fees", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010ea80)({ + name: (string) (len=16) "offline_channels", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010eac0)({ + name: (string) (len=15) "online_channels", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010eb80)({ + name: (string) (len=13) "open_channels", + kind: (string) (len=11) "OpenChannel", + isMap: (bool) false, + isArray: (bool) true, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010eb00)({ + name: (string) (len=16) "pending_channels", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c340)({ + fullName: (string) (len=7) "LndSeed", + name: (string) (len=7) "LndSeed", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc00023f180)({ + name: (string) (len=4) "seed", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) true, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197440)({ + fullName: (string) (len=17) "LnurlLinkResponse", + name: (string) (len=17) "LnurlLinkResponse", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc000106e00)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106dc0)({ + name: (string) (len=5) "lnurl", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c280)({ + fullName: (string) (len=20) "LnurlPayInfoResponse", + name: (string) (len=20) "LnurlPayInfoResponse", + fields: ([]*main.Field) (len=7 cap=8) { + (*main.Field)(0xc000107180)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107080)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc0001070c0)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107140)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107100)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc0001071c0)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107040)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197b80)({ + fullName: (string) (len=25) "LnurlWithdrawInfoResponse", + name: (string) (len=25) "LnurlWithdrawInfoResponse", + fields: ([]*main.Field) (len=8 cap=8) { + (*main.Field)(0xc000106fc0)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106e80)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106f00)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106ec0)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106f80)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106f40)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107000)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106e40)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c1c0)({ + fullName: (string) (len=15) "MigrationUpdate", + name: (string) (len=15) "MigrationUpdate", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc000107cc0)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107d00)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197ac0)({ + fullName: (string) (len=17) "NewAddressRequest", + name: (string) (len=17) "NewAddressRequest", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000106600)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c900)({ + fullName: (string) (len=18) "NewAddressResponse", + name: (string) (len=18) "NewAddressResponse", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000106640)({ + name: (string) (len=7) "address", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197b00)({ + fullName: (string) (len=17) "NewInvoiceRequest", + name: (string) (len=17) "NewInvoiceRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc000106840)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106880)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c540)({ + fullName: (string) (len=18) "NewInvoiceResponse", + name: (string) (len=18) "NewInvoiceResponse", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc0001068c0)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197540)({ + fullName: (string) (len=11) "OpenChannel", + name: (string) (len=11) "OpenChannel", + fields: ([]*main.Field) (len=7 cap=8) { + (*main.Field)(0xc00010e180)({ + name: (string) (len=6) "active", + kind: (string) (len=4) "bool", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010e080)({ + name: (string) (len=8) "capacity", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010e040)({ + name: (string) (len=10) "channel_id", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010e6c0)({ + name: (string) (len=5) "label", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010e3c0)({ + name: (string) (len=8) "lifetime", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010e640)({ + name: (string) (len=13) "local_balance", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010e680)({ + name: (string) (len=14) "remote_balance", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197400)({ + fullName: (string) (len=18) "OpenChannelRequest", + name: (string) (len=18) "OpenChannelRequest", + fields: ([]*main.Field) (len=4 cap=4) { + (*main.Field)(0xc000106d40)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106c80)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106cc0)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106d00)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197a80)({ + fullName: (string) (len=19) "OpenChannelResponse", + name: (string) (len=19) "OpenChannelResponse", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000106d80)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c940)({ + fullName: (string) (len=17) "PayAddressRequest", + name: (string) (len=17) "PayAddressRequest", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc000106680)({ + name: (string) (len=7) "address", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc0001066c0)({ + name: (string) (len=9) "amoutSats", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106700)({ + name: (string) (len=12) "satsPerVByte", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197380)({ + fullName: (string) (len=18) "PayAddressResponse", + name: (string) (len=18) "PayAddressResponse", + fields: ([]*main.Field) (len=4 cap=4) { + (*main.Field)(0xc000106800)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106780)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc0001067c0)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106740)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197600)({ + fullName: (string) (len=24) "PayAppUserInvoiceRequest", + name: (string) (len=24) "PayAppUserInvoiceRequest", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc000106340)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106300)({ name: (string) (len=7) "invoice", kind: (string) (len=6) "string", isMap: (bool) false, @@ -4373,7 +3738,23 @@ isOptional: (bool) false, oneOfName: (string) "" }), - (string) (len=6) "amount": (*main.Field)(0xc00031f840)({ + (*main.Field)(0xc0001062c0)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c800)({ + fullName: (string) (len=17) "PayInvoiceRequest", + name: (string) (len=17) "PayInvoiceRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc0001069c0)({ name: (string) (len=6) "amount", kind: (string) (len=5) "int64", isMap: (bool) false, @@ -4382,17 +3763,890 @@ isMessage: (bool) false, isOptional: (bool) false, oneOfName: (string) "" + }), + (*main.Field)(0xc000106980)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197ec0)({ + fullName: (string) (len=18) "PayInvoiceResponse", + name: (string) (len=18) "PayInvoiceResponse", + fields: ([]*main.Field) (len=5 cap=8) { + (*main.Field)(0xc000106a40)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106b00)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106a80)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106a00)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106ac0)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197940)({ + fullName: (string) (len=12) "PaymentState", + name: (string) (len=12) "PaymentState", + fields: ([]*main.Field) (len=4 cap=4) { + (*main.Field)(0xc000106bc0)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106c40)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106b80)({ + name: (string) (len=12) "paid_at_unix", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106c00)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c880)({ + fullName: (string) (len=7) "Product", + name: (string) (len=7) "Product", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc000107b80)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107bc0)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107c00)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197680)({ + fullName: (string) (len=15) "RelaysMigration", + name: (string) (len=15) "RelaysMigration", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000107d80)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c0c0)({ + fullName: (string) (len=30) "RequestNPubLinkingTokenRequest", + name: (string) (len=30) "RequestNPubLinkingTokenRequest", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000107dc0)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc0001979c0)({ + fullName: (string) (len=31) "RequestNPubLinkingTokenResponse", + name: (string) (len=31) "RequestNPubLinkingTokenResponse", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000107e00)({ + name: (string) (len=5) "token", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c600)({ + fullName: (string) (len=12) "RoutingEvent", + name: (string) (len=12) "RoutingEvent", + fields: ([]*main.Field) (len=12 cap=16) { + (*main.Field)(0xc00023fe80)({ + name: (string) (len=10) "event_type", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023ff40)({ + name: (string) (len=14) "failure_string", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010e000)({ + name: (string) (len=18) "forward_fail_event", + kind: (string) (len=4) "bool", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023fec0)({ + name: (string) (len=17) "incoming_amt_msat", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023fd40)({ + name: (string) (len=19) "incoming_channel_id", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023fd80)({ + name: (string) (len=16) "incoming_htlc_id", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023ffc0)({ + name: (string) (len=8) "offchain", + kind: (string) (len=4) "bool", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023ff00)({ + name: (string) (len=17) "outgoing_amt_msat", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023fdc0)({ + name: (string) (len=19) "outgoing_channel_id", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023fe00)({ + name: (string) (len=16) "outgoing_htlc_id", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023ff80)({ + name: (string) (len=7) "settled", + kind: (string) (len=4) "bool", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023fe40)({ + name: (string) (len=12) "timestamp_ns", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197e40)({ + fullName: (string) (len=30) "SendAppUserToAppPaymentRequest", + name: (string) (len=30) "SendAppUserToAppPaymentRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc000106480)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106440)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197fc0)({ + fullName: (string) (len=34) "SendAppUserToAppUserPaymentRequest", + name: (string) (len=34) "SendAppUserToAppUserPaymentRequest", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc000106400)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106380)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc0001063c0)({ + name: (string) (len=18) "to_user_identifier", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197340)({ + fullName: (string) (len=24) "SetMockAppBalanceRequest", + name: (string) (len=24) "SetMockAppBalanceRequest", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc0001065c0)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197580)({ + fullName: (string) (len=28) "SetMockAppUserBalanceRequest", + name: (string) (len=28) "SetMockAppUserBalanceRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc000106580)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000106540)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197a00)({ + fullName: (string) (len=27) "SetMockInvoiceAsPaidRequest", + name: (string) (len=27) "SetMockInvoiceAsPaidRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc00010ee40)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc00010ee00)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197c80)({ + fullName: (string) (len=11) "UsageMetric", + name: (string) (len=11) "UsageMetric", + fields: ([]*main.Field) (len=9 cap=16) { + (*main.Field)(0xc00023f480)({ + name: (string) (len=12) "auth_in_nano", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023f600)({ + name: (string) (len=5) "batch", + kind: (string) (len=4) "bool", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023f780)({ + name: (string) (len=10) "batch_size", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023f500)({ + name: (string) (len=14) "handle_in_nano", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023f740)({ + name: (string) (len=5) "nostr", + kind: (string) (len=4) "bool", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023f440)({ + name: (string) (len=14) "parsed_in_nano", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023f380)({ + name: (string) (len=15) "processed_at_ms", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023f540)({ + name: (string) (len=8) "rpc_name", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023f4c0)({ + name: (string) (len=16) "validate_in_nano", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197d40)({ + fullName: (string) (len=12) "UsageMetrics", + name: (string) (len=12) "UsageMetrics", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc00023f7c0)({ + name: (string) (len=7) "metrics", + kind: (string) (len=11) "UsageMetric", + isMap: (bool) false, + isArray: (bool) true, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c680)({ + fullName: (string) (len=20) "UseInviteLinkRequest", + name: (string) (len=20) "UseInviteLinkRequest", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000107fc0)({ + name: (string) (len=12) "invite_token", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc000197800)({ + fullName: (string) (len=8) "UserInfo", + name: (string) (len=8) "UserInfo", + fields: ([]*main.Field) (len=7 cap=8) { + (*main.Field)(0xc0001072c0)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107300)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc0001073c0)({ + name: (string) (len=19) "network_max_fee_bps", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107400)({ + name: (string) (len=21) "network_max_fee_fixed", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107380)({ + name: (string) (len=15) "service_fee_bps", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107280)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107340)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c440)({ + fullName: (string) (len=13) "UserOperation", + name: (string) (len=13) "UserOperation", + fields: ([]*main.Field) (len=11 cap=16) { + (*main.Field)(0xc0001076c0)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107800)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107700)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107680)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107880)({ + name: (string) (len=8) "internal", + kind: (string) (len=4) "bool", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc0001077c0)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107740)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107600)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107780)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107840)({ + name: (string) (len=7) "tx_hash", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107640)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c840)({ + fullName: (string) (len=14) "UserOperations", + name: (string) (len=14) "UserOperations", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc0001078c0)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107940)({ + 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, + oneOfName: (string) "" + }), + (*main.Field)(0xc000107900)({ + 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, + oneOfName: (string) "" + }) + } + }), + (*main.SortableMessage)(0xc00019c700)({ + fullName: (string) (len=9) "UsersInfo", + name: (string) (len=9) "UsersInfo", + fields: ([]*main.Field) (len=6 cap=8) { + (*main.Field)(0xc00023f980)({ + name: (string) (len=20) "always_been_inactive", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023f9c0)({ + name: (string) (len=11) "balance_avg", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023fa00)({ + name: (string) (len=14) "balance_median", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023f940)({ + name: (string) (len=16) "negative_balance", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023f900)({ + name: (string) (len=10) "no_balance", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" + }), + (*main.Field)(0xc00023f8c0)({ + name: (string) (len=5) "total", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false, + oneOfName: (string) "" }) } }) } -(map[string][]*main.Field) { -} +([]*main.OneOf) parsing file: structs 78 parsing file: methods 2 --> [{guest Guest map[]} {user User map[app_id:string app_user_id:string user_id:string]} {admin Admin map[admin_id:string]} {metrics Metrics map[operator_id:string]} {app App map[app_id:string]} {guestPub GuestWithPub map[app_id:string pub:string]}] +-> [{guest Guest []} {user User [0xc000040960 0xc0000409e0 0xc000040940]} {admin Admin [0xc000040b00]} {metrics Metrics [0xc000040b80]} {app App [0xc000040bc0]} {guestPub GuestWithPub [0xc000040ca0 0xc000040c80]}] ([]interface {}) diff --git a/proto/autogenerated/ts/express_server.ts b/proto/autogenerated/ts/express_server.ts index 769de65c..32c0cc62 100644 --- a/proto/autogenerated/ts/express_server.ts +++ b/proto/autogenerated/ts/express_server.ts @@ -13,12 +13,12 @@ export type ServerOptions = { logMethod?: true logBody?: true metricsCallback: (metrics: Types.RequestMetric[]) => void - GuestAuthGuard: (authorizationHeader?: string) => Promise - UserAuthGuard: (authorizationHeader?: string) => Promise AdminAuthGuard: (authorizationHeader?: string) => Promise - MetricsAuthGuard: (authorizationHeader?: string) => Promise AppAuthGuard: (authorizationHeader?: string) => Promise + GuestAuthGuard: (authorizationHeader?: string) => Promise GuestWithPubAuthGuard: (authorizationHeader?: string) => Promise + MetricsAuthGuard: (authorizationHeader?: string) => Promise + UserAuthGuard: (authorizationHeader?: string) => Promise } declare module 'express-serve-static-core' { interface Request { startTime?: bigint, bodySize?: number, startTimeMs: number } } const logErrorAndReturnResponse = (error: Error, response: string, res: Response, logger: Logger, metric: Types.RequestMetric, metricsCallback: (metrics: Types.RequestMetric[]) => void) => { @@ -34,28 +34,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() }) - if (!opts.allowNotImplementedMethods && !methods.LndGetInfo) throw new Error('method: LndGetInfo is not implemented') - app.post('/api/admin/lnd/getinfo', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'LndGetInfo', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.LndGetInfo) throw new Error('method: LndGetInfo is not implemented') - const authContext = await opts.AdminAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.LndGetInfoRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - const response = await methods.LndGetInfo({rpcName:'LndGetInfo', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) if (!opts.allowNotImplementedMethods && !methods.AddApp) throw new Error('method: AddApp is not implemented') app.post('/api/admin/app/add', async (req, res) => { const info: Types.RequestInfo = { rpcName: 'AddApp', batch: false, nostr: false, batchSize: 0} @@ -78,6 +56,94 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { opts.metricsCallback([{ ...info, ...stats, ...authContext }]) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } }) + if (!opts.allowNotImplementedMethods && !methods.AddAppInvoice) throw new Error('method: AddAppInvoice is not implemented') + app.post('/api/app/add/invoice', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'AddAppInvoice', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.AddAppInvoice) throw new Error('method: AddAppInvoice is not implemented') + const authContext = await opts.AppAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.AddAppInvoiceRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + const response = await methods.AddAppInvoice({rpcName:'AddAppInvoice', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.AddAppUser) throw new Error('method: AddAppUser is not implemented') + app.post('/api/app/user/add', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'AddAppUser', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.AddAppUser) throw new Error('method: AddAppUser is not implemented') + const authContext = await opts.AppAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.AddAppUserRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + const response = await methods.AddAppUser({rpcName:'AddAppUser', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.AddAppUserInvoice) throw new Error('method: AddAppUserInvoice is not implemented') + app.post('/api/app/user/add/invoice', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'AddAppUserInvoice', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.AddAppUserInvoice) throw new Error('method: AddAppUserInvoice is not implemented') + const authContext = await opts.AppAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.AddAppUserInvoiceRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + const response = await methods.AddAppUserInvoice({rpcName:'AddAppUserInvoice', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.AddProduct) throw new Error('method: AddProduct is not implemented') + app.post('/api/user/product/add', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'AddProduct', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.AddProduct) throw new Error('method: AddProduct is not implemented') + const authContext = await opts.UserAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.AddProductRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + const response = await methods.AddProduct({rpcName:'AddProduct', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) if (!opts.allowNotImplementedMethods && !methods.AuthApp) throw new Error('method: AuthApp is not implemented') app.post('/api/admin/app/auth', async (req, res) => { const info: Types.RequestInfo = { rpcName: 'AuthApp', batch: false, nostr: false, batchSize: 0} @@ -122,105 +188,215 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { opts.metricsCallback([{ ...info, ...stats, ...authContext }]) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } }) - if (!opts.allowNotImplementedMethods && !methods.GetSeed) throw new Error('method: GetSeed is not implemented') - app.get('/api/admin/seed', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'GetSeed', batch: false, nostr: false, batchSize: 0} + app.post('/api/user/batch', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'BatchUser', batch: true, nostr: false, batchSize: 1 } const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } let authCtx: Types.AuthContext = {} try { - if (!methods.GetSeed) throw new Error('method: GetSeed is not implemented') - const authContext = await opts.AdminAuthGuard(req.headers['authorization']) - authCtx = authContext + const requests = req.body.requests as Types.UserMethodInputs[] + if (!Array.isArray(requests))throw new Error('invalid body, is not an array') + info.batchSize = requests.length + if (requests.length > 10) throw new Error('too many requests in the batch') + const ctx = await opts.UserAuthGuard(req.headers['authorization']) stats.guard = process.hrtime.bigint() stats.validate = stats.guard - const query = req.query - const params = req.params - const response = await methods.GetSeed({rpcName:'GetSeed', ctx:authContext }) + authCtx = ctx + const responses = [] + const callsMetrics: Types.RequestMetric[] = [] + for (let i = 0; i < requests.length; i++) { + const operation = requests[i] + const opInfo: Types.RequestInfo = { rpcName: operation.rpcName, batch: true, nostr: false, batchSize: 0 } + const opStats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: stats.parse, guard: stats.guard, validate: 0n, handle: 0n } + try { + switch(operation.rpcName) { + case 'AddProduct': + if (!methods.AddProduct) { + throw new Error('method AddProduct not found' ) + } else { + const error = Types.AddProductRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + const res = await methods.AddProduct({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'DecodeInvoice': + if (!methods.DecodeInvoice) { + throw new Error('method DecodeInvoice not found' ) + } else { + const error = Types.DecodeInvoiceRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + const res = await methods.DecodeInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'EnrollAdminToken': + if (!methods.EnrollAdminToken) { + throw new Error('method EnrollAdminToken not found' ) + } else { + const error = Types.EnrollAdminTokenRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + await methods.EnrollAdminToken({...operation, ctx}); responses.push({ status: 'OK' }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'GetLNURLChannelLink': + if (!methods.GetLNURLChannelLink) { + throw new Error('method GetLNURLChannelLink not found' ) + } else { + opStats.validate = opStats.guard + const res = await methods.GetLNURLChannelLink({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'GetLnurlPayLink': + if (!methods.GetLnurlPayLink) { + throw new Error('method GetLnurlPayLink not found' ) + } else { + opStats.validate = opStats.guard + const res = await methods.GetLnurlPayLink({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'GetLnurlWithdrawLink': + if (!methods.GetLnurlWithdrawLink) { + throw new Error('method GetLnurlWithdrawLink not found' ) + } else { + opStats.validate = opStats.guard + const res = await methods.GetLnurlWithdrawLink({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'GetPaymentState': + if (!methods.GetPaymentState) { + throw new Error('method GetPaymentState not found' ) + } else { + const error = Types.GetPaymentStateRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + const res = await methods.GetPaymentState({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'GetUserInfo': + if (!methods.GetUserInfo) { + throw new Error('method GetUserInfo not found' ) + } else { + opStats.validate = opStats.guard + const res = await methods.GetUserInfo({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'GetUserOperations': + if (!methods.GetUserOperations) { + throw new Error('method GetUserOperations not found' ) + } else { + const error = Types.GetUserOperationsRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + const res = await methods.GetUserOperations({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'NewAddress': + if (!methods.NewAddress) { + throw new Error('method NewAddress not found' ) + } else { + const error = Types.NewAddressRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + const res = await methods.NewAddress({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'NewInvoice': + if (!methods.NewInvoice) { + throw new Error('method NewInvoice not found' ) + } else { + const error = Types.NewInvoiceRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + const res = await methods.NewInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'NewProductInvoice': + if (!methods.NewProductInvoice) { + throw new Error('method NewProductInvoice not found' ) + } else { + opStats.validate = opStats.guard + const res = await methods.NewProductInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'OpenChannel': + if (!methods.OpenChannel) { + throw new Error('method OpenChannel not found' ) + } else { + const error = Types.OpenChannelRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + const res = await methods.OpenChannel({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'PayAddress': + if (!methods.PayAddress) { + throw new Error('method PayAddress not found' ) + } else { + const error = Types.PayAddressRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + const res = await methods.PayAddress({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'PayInvoice': + if (!methods.PayInvoice) { + throw new Error('method PayInvoice not found' ) + } else { + const error = Types.PayInvoiceRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + const res = await methods.PayInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'UserHealth': + if (!methods.UserHealth) { + throw new Error('method UserHealth not found' ) + } else { + opStats.validate = opStats.guard + await methods.UserHealth({...operation, ctx}); responses.push({ status: 'OK' }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + default: + throw new Error('unkown rpcName') + } + } catch(ex) {const e = ex as any; logger.error(e.message || e); callsMetrics.push({ ...opInfo, ...opStats, ...ctx, error: e.message }); responses.push({ status: 'ERROR', reason: e.message || e })} + } stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.ListChannels) throw new Error('method: ListChannels is not implemented') - app.get('/api/admin/channels', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'ListChannels', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.ListChannels) throw new Error('method: ListChannels is not implemented') - const authContext = await opts.AdminAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - stats.validate = stats.guard - const query = req.query - const params = req.params - const response = await methods.ListChannels({rpcName:'ListChannels', ctx:authContext }) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.GetUsageMetrics) throw new Error('method: GetUsageMetrics is not implemented') - app.post('/api/reports/usage', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'GetUsageMetrics', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.GetUsageMetrics) throw new Error('method: GetUsageMetrics is not implemented') - const authContext = await opts.MetricsAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - stats.validate = stats.guard - const query = req.query - const params = req.params - const response = await methods.GetUsageMetrics({rpcName:'GetUsageMetrics', ctx:authContext }) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.GetAppsMetrics) throw new Error('method: GetAppsMetrics is not implemented') - app.post('/api/reports/apps', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'GetAppsMetrics', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.GetAppsMetrics) throw new Error('method: GetAppsMetrics is not implemented') - const authContext = await opts.MetricsAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.AppsMetricsRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - const response = await methods.GetAppsMetrics({rpcName:'GetAppsMetrics', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.GetLndMetrics) throw new Error('method: GetLndMetrics is not implemented') - app.post('/api/reports/lnd', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'GetLndMetrics', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.GetLndMetrics) throw new Error('method: GetLndMetrics is not implemented') - const authContext = await opts.MetricsAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.LndMetricsRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - const response = await methods.GetLndMetrics({rpcName:'GetLndMetrics', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + res.json({ status: 'OK', responses }) + opts.metricsCallback([{ ...info, ...stats, ...ctx }, ...callsMetrics]) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.CreateOneTimeInviteLink) throw new Error('method: CreateOneTimeInviteLink is not implemented') @@ -245,47 +421,28 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { opts.metricsCallback([{ ...info, ...stats, ...authContext }]) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } }) - if (!opts.allowNotImplementedMethods && !methods.GetInviteLinkState) throw new Error('method: GetInviteLinkState is not implemented') - app.post('/api/admin/app/invite/get', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'GetInviteLinkState', batch: false, nostr: false, batchSize: 0} + if (!opts.allowNotImplementedMethods && !methods.DecodeInvoice) throw new Error('method: DecodeInvoice is not implemented') + app.post('/api/user/invoice/decode', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'DecodeInvoice', batch: false, nostr: false, batchSize: 0} const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } let authCtx: Types.AuthContext = {} try { - if (!methods.GetInviteLinkState) throw new Error('method: GetInviteLinkState is not implemented') - const authContext = await opts.AdminAuthGuard(req.headers['authorization']) + if (!methods.DecodeInvoice) throw new Error('method: DecodeInvoice is not implemented') + const authContext = await opts.UserAuthGuard(req.headers['authorization']) authCtx = authContext stats.guard = process.hrtime.bigint() const request = req.body - const error = Types.GetInviteTokenStateRequestValidate(request) + const error = Types.DecodeInvoiceRequestValidate(request) stats.validate = process.hrtime.bigint() if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) const query = req.query const params = req.params - const response = await methods.GetInviteLinkState({rpcName:'GetInviteLinkState', ctx:authContext , req: request}) + const response = await methods.DecodeInvoice({rpcName:'DecodeInvoice', ctx:authContext , req: request}) stats.handle = process.hrtime.bigint() res.json({status: 'OK', ...response}) opts.metricsCallback([{ ...info, ...stats, ...authContext }]) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } }) - if (!opts.allowNotImplementedMethods && !methods.Health) throw new Error('method: Health is not implemented') - app.get('/api/health', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'Health', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.Health) throw new Error('method: Health is not implemented') - const authContext = await opts.GuestAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - stats.validate = stats.guard - const query = req.query - const params = req.params - await methods.Health({rpcName:'Health', ctx:authContext }) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK'}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) if (!opts.allowNotImplementedMethods && !methods.EncryptionExchange) throw new Error('method: EncryptionExchange is not implemented') app.post('/api/encryption/exchange', async (req, res) => { const info: Types.RequestInfo = { rpcName: 'EncryptionExchange', batch: false, nostr: false, batchSize: 0} @@ -308,123 +465,6 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { opts.metricsCallback([{ ...info, ...stats, ...authContext }]) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } }) - if (!opts.allowNotImplementedMethods && !methods.SetMockInvoiceAsPaid) throw new Error('method: SetMockInvoiceAsPaid is not implemented') - app.post('/api/lnd/mock/invoice/paid', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'SetMockInvoiceAsPaid', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.SetMockInvoiceAsPaid) throw new Error('method: SetMockInvoiceAsPaid is not implemented') - const authContext = await opts.GuestAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.SetMockInvoiceAsPaidRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - await methods.SetMockInvoiceAsPaid({rpcName:'SetMockInvoiceAsPaid', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK'}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.GetLnurlWithdrawInfo) throw new Error('method: GetLnurlWithdrawInfo is not implemented') - app.get('/api/guest/lnurl_withdraw/info', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'GetLnurlWithdrawInfo', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.GetLnurlWithdrawInfo) throw new Error('method: GetLnurlWithdrawInfo is not implemented') - const authContext = await opts.GuestAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - stats.validate = stats.guard - const query = req.query - const params = req.params - const response = await methods.GetLnurlWithdrawInfo({rpcName:'GetLnurlWithdrawInfo', ctx:authContext ,query: req.query}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.HandleLnurlWithdraw) throw new Error('method: HandleLnurlWithdraw is not implemented') - app.get('/api/guest/lnurl_withdraw/handle', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'HandleLnurlWithdraw', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.HandleLnurlWithdraw) throw new Error('method: HandleLnurlWithdraw is not implemented') - const authContext = await opts.GuestAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - stats.validate = stats.guard - const query = req.query - const params = req.params - await methods.HandleLnurlWithdraw({rpcName:'HandleLnurlWithdraw', ctx:authContext ,query: req.query}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK'}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.GetLnurlPayInfo) throw new Error('method: GetLnurlPayInfo is not implemented') - app.get('/api/guest/lnurl_pay/info', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'GetLnurlPayInfo', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.GetLnurlPayInfo) throw new Error('method: GetLnurlPayInfo is not implemented') - const authContext = await opts.GuestAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - stats.validate = stats.guard - const query = req.query - const params = req.params - const response = await methods.GetLnurlPayInfo({rpcName:'GetLnurlPayInfo', ctx:authContext ,query: req.query}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.HandleLnurlPay) throw new Error('method: HandleLnurlPay is not implemented') - app.get('/api/guest/lnurl_pay/handle', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'HandleLnurlPay', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.HandleLnurlPay) throw new Error('method: HandleLnurlPay is not implemented') - const authContext = await opts.GuestAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - stats.validate = stats.guard - const query = req.query - const params = req.params - const response = await methods.HandleLnurlPay({rpcName:'HandleLnurlPay', ctx:authContext ,query: req.query}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.HandleLnurlAddress) throw new Error('method: HandleLnurlAddress is not implemented') - app.get('/.well-known/lnurlp/:address_name', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'HandleLnurlAddress', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.HandleLnurlAddress) throw new Error('method: HandleLnurlAddress is not implemented') - const authContext = await opts.GuestAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - stats.validate = stats.guard - const query = req.query - const params = req.params - const response = await methods.HandleLnurlAddress({rpcName:'HandleLnurlAddress', ctx:authContext ,params: req.params}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) if (!opts.allowNotImplementedMethods && !methods.EnrollAdminToken) throw new Error('method: EnrollAdminToken is not implemented') app.post('/api/guest/npub/enroll/admin', async (req, res) => { const info: Types.RequestInfo = { rpcName: 'EnrollAdminToken', batch: false, nostr: false, batchSize: 0} @@ -447,50 +487,6 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { opts.metricsCallback([{ ...info, ...stats, ...authContext }]) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } }) - if (!opts.allowNotImplementedMethods && !methods.LinkNPubThroughToken) throw new Error('method: LinkNPubThroughToken is not implemented') - app.post('/api/guest/npub/link', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'LinkNPubThroughToken', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.LinkNPubThroughToken) throw new Error('method: LinkNPubThroughToken is not implemented') - const authContext = await opts.GuestWithPubAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.LinkNPubThroughTokenRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - await methods.LinkNPubThroughToken({rpcName:'LinkNPubThroughToken', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK'}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.UseInviteLink) throw new Error('method: UseInviteLink is not implemented') - app.post('/api/guest/invite', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'UseInviteLink', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.UseInviteLink) throw new Error('method: UseInviteLink is not implemented') - const authContext = await opts.GuestWithPubAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.UseInviteLinkRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - await methods.UseInviteLink({rpcName:'UseInviteLink', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK'}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) if (!opts.allowNotImplementedMethods && !methods.GetApp) throw new Error('method: GetApp is not implemented') app.post('/api/app/get', async (req, res) => { const info: Types.RequestInfo = { rpcName: 'GetApp', batch: false, nostr: false, batchSize: 0} @@ -510,72 +506,6 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { opts.metricsCallback([{ ...info, ...stats, ...authContext }]) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } }) - if (!opts.allowNotImplementedMethods && !methods.AddAppUser) throw new Error('method: AddAppUser is not implemented') - app.post('/api/app/user/add', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'AddAppUser', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.AddAppUser) throw new Error('method: AddAppUser is not implemented') - const authContext = await opts.AppAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.AddAppUserRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - const response = await methods.AddAppUser({rpcName:'AddAppUser', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.AddAppInvoice) throw new Error('method: AddAppInvoice is not implemented') - app.post('/api/app/add/invoice', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'AddAppInvoice', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.AddAppInvoice) throw new Error('method: AddAppInvoice is not implemented') - const authContext = await opts.AppAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.AddAppInvoiceRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - const response = await methods.AddAppInvoice({rpcName:'AddAppInvoice', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.AddAppUserInvoice) throw new Error('method: AddAppUserInvoice is not implemented') - app.post('/api/app/user/add/invoice', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'AddAppUserInvoice', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.AddAppUserInvoice) throw new Error('method: AddAppUserInvoice is not implemented') - const authContext = await opts.AppAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.AddAppUserInvoiceRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - const response = await methods.AddAppUserInvoice({rpcName:'AddAppUserInvoice', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) if (!opts.allowNotImplementedMethods && !methods.GetAppUser) throw new Error('method: GetAppUser is not implemented') app.post('/api/app/user/get', async (req, res) => { const info: Types.RequestInfo = { rpcName: 'GetAppUser', batch: false, nostr: false, batchSize: 0} @@ -598,72 +528,6 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { opts.metricsCallback([{ ...info, ...stats, ...authContext }]) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } }) - if (!opts.allowNotImplementedMethods && !methods.PayAppUserInvoice) throw new Error('method: PayAppUserInvoice is not implemented') - app.post('/api/app/invoice/pay', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'PayAppUserInvoice', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.PayAppUserInvoice) throw new Error('method: PayAppUserInvoice is not implemented') - const authContext = await opts.AppAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.PayAppUserInvoiceRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - const response = await methods.PayAppUserInvoice({rpcName:'PayAppUserInvoice', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.SendAppUserToAppUserPayment) throw new Error('method: SendAppUserToAppUserPayment is not implemented') - app.post('/api/app/user/internal/pay', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'SendAppUserToAppUserPayment', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.SendAppUserToAppUserPayment) throw new Error('method: SendAppUserToAppUserPayment is not implemented') - const authContext = await opts.AppAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.SendAppUserToAppUserPaymentRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - await methods.SendAppUserToAppUserPayment({rpcName:'SendAppUserToAppUserPayment', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK'}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.SendAppUserToAppPayment) throw new Error('method: SendAppUserToAppPayment is not implemented') - app.post('/api/app/internal/pay', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'SendAppUserToAppPayment', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.SendAppUserToAppPayment) throw new Error('method: SendAppUserToAppPayment is not implemented') - const authContext = await opts.AppAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.SendAppUserToAppPaymentRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - await methods.SendAppUserToAppPayment({rpcName:'SendAppUserToAppPayment', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK'}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) if (!opts.allowNotImplementedMethods && !methods.GetAppUserLNURLInfo) throw new Error('method: GetAppUserLNURLInfo is not implemented') app.post('/api/app/user/lnurl/pay/info', async (req, res) => { const info: Types.RequestInfo = { rpcName: 'GetAppUserLNURLInfo', batch: false, nostr: false, batchSize: 0} @@ -686,50 +550,558 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { opts.metricsCallback([{ ...info, ...stats, ...authContext }]) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } }) - if (!opts.allowNotImplementedMethods && !methods.SetMockAppUserBalance) throw new Error('method: SetMockAppUserBalance is not implemented') - app.post('/api/app/mock/user/blance/set', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'SetMockAppUserBalance', batch: false, nostr: false, batchSize: 0} + if (!opts.allowNotImplementedMethods && !methods.GetAppsMetrics) throw new Error('method: GetAppsMetrics is not implemented') + app.post('/api/reports/apps', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'GetAppsMetrics', batch: false, nostr: false, batchSize: 0} const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } let authCtx: Types.AuthContext = {} try { - if (!methods.SetMockAppUserBalance) throw new Error('method: SetMockAppUserBalance is not implemented') - const authContext = await opts.AppAuthGuard(req.headers['authorization']) + if (!methods.GetAppsMetrics) throw new Error('method: GetAppsMetrics is not implemented') + const authContext = await opts.MetricsAuthGuard(req.headers['authorization']) authCtx = authContext stats.guard = process.hrtime.bigint() const request = req.body - const error = Types.SetMockAppUserBalanceRequestValidate(request) + const error = Types.AppsMetricsRequestValidate(request) stats.validate = process.hrtime.bigint() if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) const query = req.query const params = req.params - await methods.SetMockAppUserBalance({rpcName:'SetMockAppUserBalance', ctx:authContext , req: request}) + const response = await methods.GetAppsMetrics({rpcName:'GetAppsMetrics', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.GetInviteLinkState) throw new Error('method: GetInviteLinkState is not implemented') + app.post('/api/admin/app/invite/get', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'GetInviteLinkState', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.GetInviteLinkState) throw new Error('method: GetInviteLinkState is not implemented') + const authContext = await opts.AdminAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.GetInviteTokenStateRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + const response = await methods.GetInviteLinkState({rpcName:'GetInviteLinkState', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.GetLNURLChannelLink) throw new Error('method: GetLNURLChannelLink is not implemented') + app.post('/api/user/lnurl_channel/url', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'GetLNURLChannelLink', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.GetLNURLChannelLink) throw new Error('method: GetLNURLChannelLink is not implemented') + const authContext = await opts.UserAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + stats.validate = stats.guard + const query = req.query + const params = req.params + const response = await methods.GetLNURLChannelLink({rpcName:'GetLNURLChannelLink', ctx:authContext }) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.GetLndMetrics) throw new Error('method: GetLndMetrics is not implemented') + app.post('/api/reports/lnd', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'GetLndMetrics', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.GetLndMetrics) throw new Error('method: GetLndMetrics is not implemented') + const authContext = await opts.MetricsAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.LndMetricsRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + const response = await methods.GetLndMetrics({rpcName:'GetLndMetrics', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.GetLnurlPayInfo) throw new Error('method: GetLnurlPayInfo is not implemented') + app.get('/api/guest/lnurl_pay/info', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'GetLnurlPayInfo', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.GetLnurlPayInfo) throw new Error('method: GetLnurlPayInfo is not implemented') + const authContext = await opts.GuestAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + stats.validate = stats.guard + const query = req.query + const params = req.params + const response = await methods.GetLnurlPayInfo({rpcName:'GetLnurlPayInfo', ctx:authContext ,query: req.query}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.GetLnurlPayLink) throw new Error('method: GetLnurlPayLink is not implemented') + app.get('/api/user/lnurl_pay/link', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'GetLnurlPayLink', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.GetLnurlPayLink) throw new Error('method: GetLnurlPayLink is not implemented') + const authContext = await opts.UserAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + stats.validate = stats.guard + const query = req.query + const params = req.params + const response = await methods.GetLnurlPayLink({rpcName:'GetLnurlPayLink', ctx:authContext }) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.GetLnurlWithdrawInfo) throw new Error('method: GetLnurlWithdrawInfo is not implemented') + app.get('/api/guest/lnurl_withdraw/info', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'GetLnurlWithdrawInfo', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.GetLnurlWithdrawInfo) throw new Error('method: GetLnurlWithdrawInfo is not implemented') + const authContext = await opts.GuestAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + stats.validate = stats.guard + const query = req.query + const params = req.params + const response = await methods.GetLnurlWithdrawInfo({rpcName:'GetLnurlWithdrawInfo', ctx:authContext ,query: req.query}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.GetLnurlWithdrawLink) throw new Error('method: GetLnurlWithdrawLink is not implemented') + app.get('/api/user/lnurl_withdraw/link', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'GetLnurlWithdrawLink', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.GetLnurlWithdrawLink) throw new Error('method: GetLnurlWithdrawLink is not implemented') + const authContext = await opts.UserAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + stats.validate = stats.guard + const query = req.query + const params = req.params + const response = await methods.GetLnurlWithdrawLink({rpcName:'GetLnurlWithdrawLink', ctx:authContext }) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.GetPaymentState) throw new Error('method: GetPaymentState is not implemented') + app.post('/api/user/payment/state', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'GetPaymentState', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.GetPaymentState) throw new Error('method: GetPaymentState is not implemented') + const authContext = await opts.UserAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.GetPaymentStateRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + const response = await methods.GetPaymentState({rpcName:'GetPaymentState', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.GetSeed) throw new Error('method: GetSeed is not implemented') + app.get('/api/admin/seed', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'GetSeed', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.GetSeed) throw new Error('method: GetSeed is not implemented') + const authContext = await opts.AdminAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + stats.validate = stats.guard + const query = req.query + const params = req.params + const response = await methods.GetSeed({rpcName:'GetSeed', ctx:authContext }) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.GetUsageMetrics) throw new Error('method: GetUsageMetrics is not implemented') + app.post('/api/reports/usage', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'GetUsageMetrics', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.GetUsageMetrics) throw new Error('method: GetUsageMetrics is not implemented') + const authContext = await opts.MetricsAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + stats.validate = stats.guard + const query = req.query + const params = req.params + const response = await methods.GetUsageMetrics({rpcName:'GetUsageMetrics', ctx:authContext }) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.GetUserInfo) throw new Error('method: GetUserInfo is not implemented') + app.post('/api/user/info', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'GetUserInfo', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.GetUserInfo) throw new Error('method: GetUserInfo is not implemented') + const authContext = await opts.UserAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + stats.validate = stats.guard + const query = req.query + const params = req.params + const response = await methods.GetUserInfo({rpcName:'GetUserInfo', ctx:authContext }) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.GetUserOperations) throw new Error('method: GetUserOperations is not implemented') + app.post('/api/user/operations', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'GetUserOperations', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.GetUserOperations) throw new Error('method: GetUserOperations is not implemented') + const authContext = await opts.UserAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.GetUserOperationsRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + const response = await methods.GetUserOperations({rpcName:'GetUserOperations', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.HandleLnurlAddress) throw new Error('method: HandleLnurlAddress is not implemented') + app.get('/.well-known/lnurlp/:address_name', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'HandleLnurlAddress', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.HandleLnurlAddress) throw new Error('method: HandleLnurlAddress is not implemented') + const authContext = await opts.GuestAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + stats.validate = stats.guard + const query = req.query + const params = req.params + const response = await methods.HandleLnurlAddress({rpcName:'HandleLnurlAddress', ctx:authContext ,params: req.params}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.HandleLnurlPay) throw new Error('method: HandleLnurlPay is not implemented') + app.get('/api/guest/lnurl_pay/handle', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'HandleLnurlPay', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.HandleLnurlPay) throw new Error('method: HandleLnurlPay is not implemented') + const authContext = await opts.GuestAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + stats.validate = stats.guard + const query = req.query + const params = req.params + const response = await methods.HandleLnurlPay({rpcName:'HandleLnurlPay', ctx:authContext ,query: req.query}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.HandleLnurlWithdraw) throw new Error('method: HandleLnurlWithdraw is not implemented') + app.get('/api/guest/lnurl_withdraw/handle', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'HandleLnurlWithdraw', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.HandleLnurlWithdraw) throw new Error('method: HandleLnurlWithdraw is not implemented') + const authContext = await opts.GuestAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + stats.validate = stats.guard + const query = req.query + const params = req.params + await methods.HandleLnurlWithdraw({rpcName:'HandleLnurlWithdraw', ctx:authContext ,query: req.query}) stats.handle = process.hrtime.bigint() res.json({status: 'OK'}) opts.metricsCallback([{ ...info, ...stats, ...authContext }]) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } }) - if (!opts.allowNotImplementedMethods && !methods.SetMockAppBalance) throw new Error('method: SetMockAppBalance is not implemented') - app.post('/api/app/mock/blance/set', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'SetMockAppBalance', batch: false, nostr: false, batchSize: 0} + if (!opts.allowNotImplementedMethods && !methods.Health) throw new Error('method: Health is not implemented') + app.get('/api/health', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'Health', batch: false, nostr: false, batchSize: 0} const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } let authCtx: Types.AuthContext = {} try { - if (!methods.SetMockAppBalance) throw new Error('method: SetMockAppBalance is not implemented') - const authContext = await opts.AppAuthGuard(req.headers['authorization']) + if (!methods.Health) throw new Error('method: Health is not implemented') + const authContext = await opts.GuestAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + stats.validate = stats.guard + const query = req.query + const params = req.params + await methods.Health({rpcName:'Health', ctx:authContext }) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK'}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.LinkNPubThroughToken) throw new Error('method: LinkNPubThroughToken is not implemented') + app.post('/api/guest/npub/link', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'LinkNPubThroughToken', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.LinkNPubThroughToken) throw new Error('method: LinkNPubThroughToken is not implemented') + const authContext = await opts.GuestWithPubAuthGuard(req.headers['authorization']) authCtx = authContext stats.guard = process.hrtime.bigint() const request = req.body - const error = Types.SetMockAppBalanceRequestValidate(request) + const error = Types.LinkNPubThroughTokenRequestValidate(request) stats.validate = process.hrtime.bigint() if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) const query = req.query const params = req.params - await methods.SetMockAppBalance({rpcName:'SetMockAppBalance', ctx:authContext , req: request}) + await methods.LinkNPubThroughToken({rpcName:'LinkNPubThroughToken', ctx:authContext , req: request}) stats.handle = process.hrtime.bigint() res.json({status: 'OK'}) opts.metricsCallback([{ ...info, ...stats, ...authContext }]) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } }) + if (!opts.allowNotImplementedMethods && !methods.ListChannels) throw new Error('method: ListChannels is not implemented') + app.get('/api/admin/channels', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'ListChannels', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.ListChannels) throw new Error('method: ListChannels is not implemented') + const authContext = await opts.AdminAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + stats.validate = stats.guard + const query = req.query + const params = req.params + const response = await methods.ListChannels({rpcName:'ListChannels', ctx:authContext }) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.LndGetInfo) throw new Error('method: LndGetInfo is not implemented') + app.post('/api/admin/lnd/getinfo', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'LndGetInfo', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.LndGetInfo) throw new Error('method: LndGetInfo is not implemented') + const authContext = await opts.AdminAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.LndGetInfoRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + const response = await methods.LndGetInfo({rpcName:'LndGetInfo', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.NewAddress) throw new Error('method: NewAddress is not implemented') + app.post('/api/user/chain/new', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'NewAddress', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.NewAddress) throw new Error('method: NewAddress is not implemented') + const authContext = await opts.UserAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.NewAddressRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + const response = await methods.NewAddress({rpcName:'NewAddress', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.NewInvoice) throw new Error('method: NewInvoice is not implemented') + app.post('/api/user/invoice/new', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'NewInvoice', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.NewInvoice) throw new Error('method: NewInvoice is not implemented') + const authContext = await opts.UserAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.NewInvoiceRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + const response = await methods.NewInvoice({rpcName:'NewInvoice', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.NewProductInvoice) throw new Error('method: NewProductInvoice is not implemented') + app.get('/api/user/product/get/invoice', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'NewProductInvoice', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.NewProductInvoice) throw new Error('method: NewProductInvoice is not implemented') + const authContext = await opts.UserAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + stats.validate = stats.guard + const query = req.query + const params = req.params + const response = await methods.NewProductInvoice({rpcName:'NewProductInvoice', ctx:authContext ,query: req.query}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.OpenChannel) throw new Error('method: OpenChannel is not implemented') + app.post('/api/user/open/channel', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'OpenChannel', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.OpenChannel) throw new Error('method: OpenChannel is not implemented') + const authContext = await opts.UserAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.OpenChannelRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + const response = await methods.OpenChannel({rpcName:'OpenChannel', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.PayAddress) throw new Error('method: PayAddress is not implemented') + app.post('/api/user/chain/pay', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'PayAddress', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.PayAddress) throw new Error('method: PayAddress is not implemented') + const authContext = await opts.UserAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.PayAddressRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + const response = await methods.PayAddress({rpcName:'PayAddress', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.PayAppUserInvoice) throw new Error('method: PayAppUserInvoice is not implemented') + app.post('/api/app/invoice/pay', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'PayAppUserInvoice', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.PayAppUserInvoice) throw new Error('method: PayAppUserInvoice is not implemented') + const authContext = await opts.AppAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.PayAppUserInvoiceRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + const response = await methods.PayAppUserInvoice({rpcName:'PayAppUserInvoice', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.PayInvoice) throw new Error('method: PayInvoice is not implemented') + app.post('/api/user/invoice/pay', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'PayInvoice', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.PayInvoice) throw new Error('method: PayInvoice is not implemented') + const authContext = await opts.UserAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.PayInvoiceRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + const response = await methods.PayInvoice({rpcName:'PayInvoice', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) if (!opts.allowNotImplementedMethods && !methods.RequestNPubLinkingToken) throw new Error('method: RequestNPubLinkingToken is not implemented') app.post('/api/app/user/npub/token', async (req, res) => { const info: Types.RequestInfo = { rpcName: 'RequestNPubLinkingToken', batch: false, nostr: false, batchSize: 0} @@ -774,6 +1146,138 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { opts.metricsCallback([{ ...info, ...stats, ...authContext }]) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } }) + if (!opts.allowNotImplementedMethods && !methods.SendAppUserToAppPayment) throw new Error('method: SendAppUserToAppPayment is not implemented') + app.post('/api/app/internal/pay', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'SendAppUserToAppPayment', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.SendAppUserToAppPayment) throw new Error('method: SendAppUserToAppPayment is not implemented') + const authContext = await opts.AppAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.SendAppUserToAppPaymentRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + await methods.SendAppUserToAppPayment({rpcName:'SendAppUserToAppPayment', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK'}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.SendAppUserToAppUserPayment) throw new Error('method: SendAppUserToAppUserPayment is not implemented') + app.post('/api/app/user/internal/pay', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'SendAppUserToAppUserPayment', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.SendAppUserToAppUserPayment) throw new Error('method: SendAppUserToAppUserPayment is not implemented') + const authContext = await opts.AppAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.SendAppUserToAppUserPaymentRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + await methods.SendAppUserToAppUserPayment({rpcName:'SendAppUserToAppUserPayment', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK'}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.SetMockAppBalance) throw new Error('method: SetMockAppBalance is not implemented') + app.post('/api/app/mock/blance/set', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'SetMockAppBalance', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.SetMockAppBalance) throw new Error('method: SetMockAppBalance is not implemented') + const authContext = await opts.AppAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.SetMockAppBalanceRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + await methods.SetMockAppBalance({rpcName:'SetMockAppBalance', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK'}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.SetMockAppUserBalance) throw new Error('method: SetMockAppUserBalance is not implemented') + app.post('/api/app/mock/user/blance/set', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'SetMockAppUserBalance', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.SetMockAppUserBalance) throw new Error('method: SetMockAppUserBalance is not implemented') + const authContext = await opts.AppAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.SetMockAppUserBalanceRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + await methods.SetMockAppUserBalance({rpcName:'SetMockAppUserBalance', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK'}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.SetMockInvoiceAsPaid) throw new Error('method: SetMockInvoiceAsPaid is not implemented') + app.post('/api/lnd/mock/invoice/paid', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'SetMockInvoiceAsPaid', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.SetMockInvoiceAsPaid) throw new Error('method: SetMockInvoiceAsPaid is not implemented') + const authContext = await opts.GuestAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.SetMockInvoiceAsPaidRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + await methods.SetMockInvoiceAsPaid({rpcName:'SetMockInvoiceAsPaid', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK'}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.UseInviteLink) throw new Error('method: UseInviteLink is not implemented') + app.post('/api/guest/invite', async (req, res) => { + const info: Types.RequestInfo = { rpcName: 'UseInviteLink', batch: false, nostr: false, batchSize: 0} + const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } + let authCtx: Types.AuthContext = {} + try { + if (!methods.UseInviteLink) throw new Error('method: UseInviteLink is not implemented') + const authContext = await opts.GuestWithPubAuthGuard(req.headers['authorization']) + authCtx = authContext + stats.guard = process.hrtime.bigint() + const request = req.body + const error = Types.UseInviteLinkRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) + const query = req.query + const params = req.params + await methods.UseInviteLink({rpcName:'UseInviteLink', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res.json({status: 'OK'}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + }) if (!opts.allowNotImplementedMethods && !methods.UserHealth) throw new Error('method: UserHealth is not implemented') app.post('/api/user/health', async (req, res) => { const info: Types.RequestInfo = { rpcName: 'UserHealth', batch: false, nostr: false, batchSize: 0} @@ -793,510 +1297,6 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { opts.metricsCallback([{ ...info, ...stats, ...authContext }]) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } }) - if (!opts.allowNotImplementedMethods && !methods.GetUserInfo) throw new Error('method: GetUserInfo is not implemented') - app.post('/api/user/info', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'GetUserInfo', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.GetUserInfo) throw new Error('method: GetUserInfo is not implemented') - const authContext = await opts.UserAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - stats.validate = stats.guard - const query = req.query - const params = req.params - const response = await methods.GetUserInfo({rpcName:'GetUserInfo', ctx:authContext }) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.AddProduct) throw new Error('method: AddProduct is not implemented') - app.post('/api/user/product/add', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'AddProduct', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.AddProduct) throw new Error('method: AddProduct is not implemented') - const authContext = await opts.UserAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.AddProductRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - const response = await methods.AddProduct({rpcName:'AddProduct', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.NewProductInvoice) throw new Error('method: NewProductInvoice is not implemented') - app.get('/api/user/product/get/invoice', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'NewProductInvoice', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.NewProductInvoice) throw new Error('method: NewProductInvoice is not implemented') - const authContext = await opts.UserAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - stats.validate = stats.guard - const query = req.query - const params = req.params - const response = await methods.NewProductInvoice({rpcName:'NewProductInvoice', ctx:authContext ,query: req.query}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.GetUserOperations) throw new Error('method: GetUserOperations is not implemented') - app.post('/api/user/operations', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'GetUserOperations', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.GetUserOperations) throw new Error('method: GetUserOperations is not implemented') - const authContext = await opts.UserAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.GetUserOperationsRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - const response = await methods.GetUserOperations({rpcName:'GetUserOperations', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.NewAddress) throw new Error('method: NewAddress is not implemented') - app.post('/api/user/chain/new', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'NewAddress', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.NewAddress) throw new Error('method: NewAddress is not implemented') - const authContext = await opts.UserAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.NewAddressRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - const response = await methods.NewAddress({rpcName:'NewAddress', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.PayAddress) throw new Error('method: PayAddress is not implemented') - app.post('/api/user/chain/pay', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'PayAddress', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.PayAddress) throw new Error('method: PayAddress is not implemented') - const authContext = await opts.UserAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.PayAddressRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - const response = await methods.PayAddress({rpcName:'PayAddress', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.NewInvoice) throw new Error('method: NewInvoice is not implemented') - app.post('/api/user/invoice/new', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'NewInvoice', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.NewInvoice) throw new Error('method: NewInvoice is not implemented') - const authContext = await opts.UserAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.NewInvoiceRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - const response = await methods.NewInvoice({rpcName:'NewInvoice', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.DecodeInvoice) throw new Error('method: DecodeInvoice is not implemented') - app.post('/api/user/invoice/decode', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'DecodeInvoice', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.DecodeInvoice) throw new Error('method: DecodeInvoice is not implemented') - const authContext = await opts.UserAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.DecodeInvoiceRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - const response = await methods.DecodeInvoice({rpcName:'DecodeInvoice', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.PayInvoice) throw new Error('method: PayInvoice is not implemented') - app.post('/api/user/invoice/pay', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'PayInvoice', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.PayInvoice) throw new Error('method: PayInvoice is not implemented') - const authContext = await opts.UserAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.PayInvoiceRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - const response = await methods.PayInvoice({rpcName:'PayInvoice', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.GetPaymentState) throw new Error('method: GetPaymentState is not implemented') - app.post('/api/user/payment/state', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'GetPaymentState', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.GetPaymentState) throw new Error('method: GetPaymentState is not implemented') - const authContext = await opts.UserAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.GetPaymentStateRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - const response = await methods.GetPaymentState({rpcName:'GetPaymentState', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.OpenChannel) throw new Error('method: OpenChannel is not implemented') - app.post('/api/user/open/channel', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'OpenChannel', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.OpenChannel) throw new Error('method: OpenChannel is not implemented') - const authContext = await opts.UserAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - const request = req.body - const error = Types.OpenChannelRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback) - const query = req.query - const params = req.params - const response = await methods.OpenChannel({rpcName:'OpenChannel', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.GetLnurlWithdrawLink) throw new Error('method: GetLnurlWithdrawLink is not implemented') - app.get('/api/user/lnurl_withdraw/link', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'GetLnurlWithdrawLink', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.GetLnurlWithdrawLink) throw new Error('method: GetLnurlWithdrawLink is not implemented') - const authContext = await opts.UserAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - stats.validate = stats.guard - const query = req.query - const params = req.params - const response = await methods.GetLnurlWithdrawLink({rpcName:'GetLnurlWithdrawLink', ctx:authContext }) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.GetLnurlPayLink) throw new Error('method: GetLnurlPayLink is not implemented') - app.get('/api/user/lnurl_pay/link', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'GetLnurlPayLink', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.GetLnurlPayLink) throw new Error('method: GetLnurlPayLink is not implemented') - const authContext = await opts.UserAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - stats.validate = stats.guard - const query = req.query - const params = req.params - const response = await methods.GetLnurlPayLink({rpcName:'GetLnurlPayLink', ctx:authContext }) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - if (!opts.allowNotImplementedMethods && !methods.GetLNURLChannelLink) throw new Error('method: GetLNURLChannelLink is not implemented') - app.post('/api/user/lnurl_channel/url', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'GetLNURLChannelLink', batch: false, nostr: false, batchSize: 0} - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - if (!methods.GetLNURLChannelLink) throw new Error('method: GetLNURLChannelLink is not implemented') - const authContext = await opts.UserAuthGuard(req.headers['authorization']) - authCtx = authContext - stats.guard = process.hrtime.bigint() - stats.validate = stats.guard - const query = req.query - const params = req.params - const response = await methods.GetLNURLChannelLink({rpcName:'GetLNURLChannelLink', ctx:authContext }) - stats.handle = process.hrtime.bigint() - res.json({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) - app.post('/api/user/batch', async (req, res) => { - const info: Types.RequestInfo = { rpcName: 'BatchUser', batch: true, nostr: false, batchSize: 1 } - const stats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } - let authCtx: Types.AuthContext = {} - try { - const requests = req.body.requests as Types.UserMethodInputs[] - if (!Array.isArray(requests))throw new Error('invalid body, is not an array') - info.batchSize = requests.length - if (requests.length > 10) throw new Error('too many requests in the batch') - const ctx = await opts.UserAuthGuard(req.headers['authorization']) - stats.guard = process.hrtime.bigint() - stats.validate = stats.guard - authCtx = ctx - const responses = [] - const callsMetrics: Types.RequestMetric[] = [] - for (let i = 0; i < requests.length; i++) { - const operation = requests[i] - const opInfo: Types.RequestInfo = { rpcName: operation.rpcName, batch: true, nostr: false, batchSize: 0 } - const opStats: Types.RequestStats = { startMs:req.startTimeMs || 0, start:req.startTime || 0n, parse: stats.parse, guard: stats.guard, validate: 0n, handle: 0n } - try { - switch(operation.rpcName) { - case 'EnrollAdminToken': - if (!methods.EnrollAdminToken) { - throw new Error('method EnrollAdminToken not found' ) - } else { - const error = Types.EnrollAdminTokenRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - await methods.EnrollAdminToken({...operation, ctx}); responses.push({ status: 'OK' }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'UserHealth': - if (!methods.UserHealth) { - throw new Error('method UserHealth not found' ) - } else { - opStats.validate = opStats.guard - await methods.UserHealth({...operation, ctx}); responses.push({ status: 'OK' }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'GetUserInfo': - if (!methods.GetUserInfo) { - throw new Error('method GetUserInfo not found' ) - } else { - opStats.validate = opStats.guard - const res = await methods.GetUserInfo({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'AddProduct': - if (!methods.AddProduct) { - throw new Error('method AddProduct not found' ) - } else { - const error = Types.AddProductRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - const res = await methods.AddProduct({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'NewProductInvoice': - if (!methods.NewProductInvoice) { - throw new Error('method NewProductInvoice not found' ) - } else { - opStats.validate = opStats.guard - const res = await methods.NewProductInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'GetUserOperations': - if (!methods.GetUserOperations) { - throw new Error('method GetUserOperations not found' ) - } else { - const error = Types.GetUserOperationsRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - const res = await methods.GetUserOperations({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'NewAddress': - if (!methods.NewAddress) { - throw new Error('method NewAddress not found' ) - } else { - const error = Types.NewAddressRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - const res = await methods.NewAddress({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'PayAddress': - if (!methods.PayAddress) { - throw new Error('method PayAddress not found' ) - } else { - const error = Types.PayAddressRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - const res = await methods.PayAddress({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'NewInvoice': - if (!methods.NewInvoice) { - throw new Error('method NewInvoice not found' ) - } else { - const error = Types.NewInvoiceRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - const res = await methods.NewInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'DecodeInvoice': - if (!methods.DecodeInvoice) { - throw new Error('method DecodeInvoice not found' ) - } else { - const error = Types.DecodeInvoiceRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - const res = await methods.DecodeInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'PayInvoice': - if (!methods.PayInvoice) { - throw new Error('method PayInvoice not found' ) - } else { - const error = Types.PayInvoiceRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - const res = await methods.PayInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'GetPaymentState': - if (!methods.GetPaymentState) { - throw new Error('method GetPaymentState not found' ) - } else { - const error = Types.GetPaymentStateRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - const res = await methods.GetPaymentState({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'OpenChannel': - if (!methods.OpenChannel) { - throw new Error('method OpenChannel not found' ) - } else { - const error = Types.OpenChannelRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - const res = await methods.OpenChannel({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'GetLnurlWithdrawLink': - if (!methods.GetLnurlWithdrawLink) { - throw new Error('method GetLnurlWithdrawLink not found' ) - } else { - opStats.validate = opStats.guard - const res = await methods.GetLnurlWithdrawLink({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'GetLnurlPayLink': - if (!methods.GetLnurlPayLink) { - throw new Error('method GetLnurlPayLink not found' ) - } else { - opStats.validate = opStats.guard - const res = await methods.GetLnurlPayLink({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'GetLNURLChannelLink': - if (!methods.GetLNURLChannelLink) { - throw new Error('method GetLNURLChannelLink not found' ) - } else { - opStats.validate = opStats.guard - const res = await methods.GetLNURLChannelLink({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - default: - throw new Error('unkown rpcName') - } - } catch(ex) {const e = ex as any; logger.error(e.message || e); callsMetrics.push({ ...opInfo, ...opStats, ...ctx, error: e.message }); responses.push({ status: 'ERROR', reason: e.message || e })} - } - stats.handle = process.hrtime.bigint() - res.json({ status: 'OK', responses }) - opts.metricsCallback([{ ...info, ...stats, ...ctx }, ...callsMetrics]) - } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - }) if (opts.staticFiles) { app.use(express.static(opts.staticFiles)) app.get('*', function (_, res) { res.sendFile('index.html', { root: opts.staticFiles })}) diff --git a/proto/autogenerated/ts/http_client.ts b/proto/autogenerated/ts/http_client.ts index cad2b106..86aeac62 100644 --- a/proto/autogenerated/ts/http_client.ts +++ b/proto/autogenerated/ts/http_client.ts @@ -5,32 +5,18 @@ export type ResultError = { status: 'ERROR', reason: string } export type ClientParams = { baseUrl: string - retrieveGuestAuth: () => Promise - retrieveUserAuth: () => Promise retrieveAdminAuth: () => Promise - retrieveMetricsAuth: () => Promise retrieveAppAuth: () => Promise + retrieveGuestAuth: () => Promise retrieveGuestWithPubAuth: () => Promise + retrieveMetricsAuth: () => Promise + retrieveUserAuth: () => Promise encryptCallback: (plain: any) => Promise decryptCallback: (encrypted: any) => Promise deviceId: string checkResult?: true } export default (params: ClientParams) => ({ - LndGetInfo: async (request: Types.LndGetInfoRequest): Promise => { - const auth = await params.retrieveAdminAuth() - if (auth === null) throw new Error('retrieveAdminAuth() returned null') - let finalRoute = '/api/admin/lnd/getinfo' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.LndGetInfoResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, AddApp: async (request: Types.AddAppRequest): Promise => { const auth = await params.retrieveAdminAuth() if (auth === null) throw new Error('retrieveAdminAuth() returned null') @@ -45,6 +31,62 @@ export default (params: ClientParams) => ({ } return { status: 'ERROR', reason: 'invalid response' } }, + AddAppInvoice: async (request: Types.AddAppInvoiceRequest): Promise => { + const auth = await params.retrieveAppAuth() + if (auth === null) throw new Error('retrieveAppAuth() returned null') + let finalRoute = '/api/app/add/invoice' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.NewInvoiceResponseValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + AddAppUser: async (request: Types.AddAppUserRequest): Promise => { + const auth = await params.retrieveAppAuth() + if (auth === null) throw new Error('retrieveAppAuth() returned null') + let finalRoute = '/api/app/user/add' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.AppUserValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + AddAppUserInvoice: async (request: Types.AddAppUserInvoiceRequest): Promise => { + const auth = await params.retrieveAppAuth() + if (auth === null) throw new Error('retrieveAppAuth() returned null') + let finalRoute = '/api/app/user/add/invoice' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.NewInvoiceResponseValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + AddProduct: async (request: Types.AddProductRequest): Promise => { + const auth = await params.retrieveUserAuth() + if (auth === null) throw new Error('retrieveUserAuth() returned null') + let finalRoute = '/api/user/product/add' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.ProductValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, AuthApp: async (request: Types.AuthAppRequest): Promise => { const auth = await params.retrieveAdminAuth() if (auth === null) throw new Error('retrieveAdminAuth() returned null') @@ -73,44 +115,105 @@ export default (params: ClientParams) => ({ } return { status: 'ERROR', reason: 'invalid response' } }, - GetSeed: async (): Promise => { + 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' } + }, + CreateOneTimeInviteLink: async (request: Types.CreateOneTimeInviteLinkRequest): Promise => { const auth = await params.retrieveAdminAuth() if (auth === null) throw new Error('retrieveAdminAuth() returned null') - let finalRoute = '/api/admin/seed' - const { data } = await axios.get(params.baseUrl + finalRoute, { headers: { 'authorization': auth } }) + let finalRoute = '/api/admin/app/invite/create' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) if (data.status === 'ERROR' && typeof data.reason === 'string') return data if (data.status === 'OK') { const result = data if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.LndSeedValidate(result) + const error = Types.CreateOneTimeInviteLinkResponseValidate(result) if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } } return { status: 'ERROR', reason: 'invalid response' } }, - ListChannels: async (): Promise => { - const auth = await params.retrieveAdminAuth() - if (auth === null) throw new Error('retrieveAdminAuth() returned null') - let finalRoute = '/api/admin/channels' - const { data } = await axios.get(params.baseUrl + finalRoute, { headers: { 'authorization': auth } }) + DecodeInvoice: async (request: Types.DecodeInvoiceRequest): Promise => { + const auth = await params.retrieveUserAuth() + if (auth === null) throw new Error('retrieveUserAuth() returned null') + let finalRoute = '/api/user/invoice/decode' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) if (data.status === 'ERROR' && typeof data.reason === 'string') return data if (data.status === 'OK') { const result = data if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.LndChannelsValidate(result) + const error = Types.DecodeInvoiceResponseValidate(result) if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } } return { status: 'ERROR', reason: 'invalid response' } }, - GetUsageMetrics: async (): Promise => { - const auth = await params.retrieveMetricsAuth() - if (auth === null) throw new Error('retrieveMetricsAuth() returned null') - let finalRoute = '/api/reports/usage' + EncryptionExchange: async (request: Types.EncryptionExchangeRequest): Promise => { + const auth = await params.retrieveGuestAuth() + if (auth === null) throw new Error('retrieveGuestAuth() returned null') + let finalRoute = '/api/encryption/exchange' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + return data + } + return { status: 'ERROR', reason: 'invalid response' } + }, + EnrollAdminToken: async (request: Types.EnrollAdminTokenRequest): Promise => { + const auth = await params.retrieveUserAuth() + if (auth === null) throw new Error('retrieveUserAuth() returned null') + let finalRoute = '/api/guest/npub/enroll/admin' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + return data + } + return { status: 'ERROR', reason: 'invalid response' } + }, + GetApp: async (): Promise => { + const auth = await params.retrieveAppAuth() + if (auth === null) throw new Error('retrieveAppAuth() returned null') + let finalRoute = '/api/app/get' const { data } = await axios.post(params.baseUrl + finalRoute, {}, { headers: { 'authorization': auth } }) if (data.status === 'ERROR' && typeof data.reason === 'string') return data if (data.status === 'OK') { const result = data if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.UsageMetricsValidate(result) + const error = Types.ApplicationValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + GetAppUser: async (request: Types.GetAppUserRequest): Promise => { + const auth = await params.retrieveAppAuth() + if (auth === null) throw new Error('retrieveAppAuth() returned null') + let finalRoute = '/api/app/user/get' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.AppUserValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + GetAppUserLNURLInfo: async (request: Types.GetAppUserLNURLInfoRequest): Promise => { + const auth = await params.retrieveAppAuth() + if (auth === null) throw new Error('retrieveAppAuth() returned null') + let finalRoute = '/api/app/user/lnurl/pay/info' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.LnurlPayInfoResponseValidate(result) if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } } return { status: 'ERROR', reason: 'invalid response' } @@ -129,34 +232,7 @@ export default (params: ClientParams) => ({ } return { status: 'ERROR', reason: 'invalid response' } }, - GetLndMetrics: async (request: Types.LndMetricsRequest): Promise => { - const auth = await params.retrieveMetricsAuth() - if (auth === null) throw new Error('retrieveMetricsAuth() returned null') - let finalRoute = '/api/reports/lnd' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.LndMetricsValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - CreateOneTimeInviteLink: async (request: Types.CreateOneTimeInviteLinkRequest): Promise => { - const auth = await params.retrieveAdminAuth() - if (auth === null) throw new Error('retrieveAdminAuth() returned null') - let finalRoute = '/api/admin/app/invite/create' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.CreateOneTimeInviteLinkResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, + GetHttpCreds: async (cb: (v:ResultError | ({ status: 'OK' }& Types.HttpCreds)) => void): Promise => { throw new Error('http streams are not supported')}, GetInviteLinkState: async (request: Types.GetInviteTokenStateRequest): Promise => { const auth = await params.retrieveAdminAuth() if (auth === null) throw new Error('retrieveAdminAuth() returned null') @@ -171,36 +247,62 @@ export default (params: ClientParams) => ({ } return { status: 'ERROR', reason: 'invalid response' } }, - Health: async (): Promise => { + GetLNURLChannelLink: async (): Promise => { + const auth = await params.retrieveUserAuth() + if (auth === null) throw new Error('retrieveUserAuth() returned null') + let finalRoute = '/api/user/lnurl_channel/url' + const { data } = await axios.post(params.baseUrl + finalRoute, {}, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.LnurlLinkResponseValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + GetLiveUserOperations: async (cb: (v:ResultError | ({ status: 'OK' }& Types.LiveUserOperation)) => void): Promise => { throw new Error('http streams are not supported')}, + GetLndMetrics: async (request: Types.LndMetricsRequest): Promise => { + const auth = await params.retrieveMetricsAuth() + if (auth === null) throw new Error('retrieveMetricsAuth() returned null') + let finalRoute = '/api/reports/lnd' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.LndMetricsValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + GetLnurlPayInfo: async (query: Types.GetLnurlPayInfo_Query): Promise => { const auth = await params.retrieveGuestAuth() if (auth === null) throw new Error('retrieveGuestAuth() returned null') - let finalRoute = '/api/health' + let finalRoute = '/api/guest/lnurl_pay/info' + const q = (new URLSearchParams(query)).toString() + finalRoute = finalRoute + (q === '' ? '' : '?' + q) const { data } = await axios.get(params.baseUrl + finalRoute, { headers: { 'authorization': auth } }) if (data.status === 'ERROR' && typeof data.reason === 'string') return data if (data.status === 'OK') { - return data + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.LnurlPayInfoResponseValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } } return { status: 'ERROR', reason: 'invalid response' } }, - EncryptionExchange: async (request: Types.EncryptionExchangeRequest): Promise => { - const auth = await params.retrieveGuestAuth() - if (auth === null) throw new Error('retrieveGuestAuth() returned null') - let finalRoute = '/api/encryption/exchange' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + GetLnurlPayLink: async (): Promise => { + const auth = await params.retrieveUserAuth() + if (auth === null) throw new Error('retrieveUserAuth() returned null') + let finalRoute = '/api/user/lnurl_pay/link' + const { data } = await axios.get(params.baseUrl + finalRoute, { headers: { 'authorization': auth } }) if (data.status === 'ERROR' && typeof data.reason === 'string') return data if (data.status === 'OK') { - return data - } - return { status: 'ERROR', reason: 'invalid response' } - }, - SetMockInvoiceAsPaid: async (request: Types.SetMockInvoiceAsPaidRequest): Promise => { - const auth = await params.retrieveGuestAuth() - if (auth === null) throw new Error('retrieveGuestAuth() returned null') - let finalRoute = '/api/lnd/mock/invoice/paid' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - return data + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.LnurlLinkResponseValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } } return { status: 'ERROR', reason: 'invalid response' } }, @@ -220,25 +322,96 @@ export default (params: ClientParams) => ({ } return { status: 'ERROR', reason: 'invalid response' } }, - HandleLnurlWithdraw: async (query: Types.HandleLnurlWithdraw_Query): Promise => { - const auth = await params.retrieveGuestAuth() - if (auth === null) throw new Error('retrieveGuestAuth() returned null') - let finalRoute = '/api/guest/lnurl_withdraw/handle' - const q = (new URLSearchParams(query)).toString() - finalRoute = finalRoute + (q === '' ? '' : '?' + q) + GetLnurlWithdrawLink: async (): Promise => { + const auth = await params.retrieveUserAuth() + if (auth === null) throw new Error('retrieveUserAuth() returned null') + let finalRoute = '/api/user/lnurl_withdraw/link' const { data } = await axios.get(params.baseUrl + finalRoute, { headers: { 'authorization': auth } }) if (data.status === 'ERROR' && typeof data.reason === 'string') return data if (data.status === 'OK') { - return data + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.LnurlLinkResponseValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } } return { status: 'ERROR', reason: 'invalid response' } }, - GetLnurlPayInfo: async (query: Types.GetLnurlPayInfo_Query): Promise => { + GetMigrationUpdate: async (cb: (v:ResultError | ({ status: 'OK' }& Types.MigrationUpdate)) => void): Promise => { throw new Error('http streams are not supported')}, + GetPaymentState: async (request: Types.GetPaymentStateRequest): Promise => { + const auth = await params.retrieveUserAuth() + if (auth === null) throw new Error('retrieveUserAuth() returned null') + let finalRoute = '/api/user/payment/state' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.PaymentStateValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + GetSeed: async (): Promise => { + const auth = await params.retrieveAdminAuth() + if (auth === null) throw new Error('retrieveAdminAuth() returned null') + let finalRoute = '/api/admin/seed' + const { data } = await axios.get(params.baseUrl + finalRoute, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.LndSeedValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + GetUsageMetrics: async (): Promise => { + const auth = await params.retrieveMetricsAuth() + if (auth === null) throw new Error('retrieveMetricsAuth() returned null') + let finalRoute = '/api/reports/usage' + const { data } = await axios.post(params.baseUrl + finalRoute, {}, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.UsageMetricsValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + GetUserInfo: async (): Promise => { + const auth = await params.retrieveUserAuth() + if (auth === null) throw new Error('retrieveUserAuth() returned null') + let finalRoute = '/api/user/info' + const { data } = await axios.post(params.baseUrl + finalRoute, {}, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.UserInfoValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + GetUserOperations: async (request: Types.GetUserOperationsRequest): Promise => { + const auth = await params.retrieveUserAuth() + if (auth === null) throw new Error('retrieveUserAuth() returned null') + let finalRoute = '/api/user/operations' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.GetUserOperationsResponseValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + HandleLnurlAddress: async (routeParams: Types.HandleLnurlAddress_RouteParams): Promise => { const auth = await params.retrieveGuestAuth() if (auth === null) throw new Error('retrieveGuestAuth() returned null') - let finalRoute = '/api/guest/lnurl_pay/info' - const q = (new URLSearchParams(query)).toString() - finalRoute = finalRoute + (q === '' ? '' : '?' + q) + let finalRoute = '/.well-known/lnurlp/:address_name' + finalRoute = finalRoute.replace(':address_name', routeParams['address_name']) const { data } = await axios.get(params.baseUrl + finalRoute, { headers: { 'authorization': auth } }) if (data.status === 'ERROR' && typeof data.reason === 'string') return data if (data.status === 'OK') { @@ -265,26 +438,24 @@ export default (params: ClientParams) => ({ } return { status: 'ERROR', reason: 'invalid response' } }, - HandleLnurlAddress: async (routeParams: Types.HandleLnurlAddress_RouteParams): Promise => { + HandleLnurlWithdraw: async (query: Types.HandleLnurlWithdraw_Query): Promise => { const auth = await params.retrieveGuestAuth() if (auth === null) throw new Error('retrieveGuestAuth() returned null') - let finalRoute = '/.well-known/lnurlp/:address_name' - finalRoute = finalRoute.replace(':address_name', routeParams['address_name']) + let finalRoute = '/api/guest/lnurl_withdraw/handle' + const q = (new URLSearchParams(query)).toString() + finalRoute = finalRoute + (q === '' ? '' : '?' + q) const { data } = await axios.get(params.baseUrl + finalRoute, { headers: { 'authorization': auth } }) if (data.status === 'ERROR' && typeof data.reason === 'string') return data if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.LnurlPayInfoResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + return data } return { status: 'ERROR', reason: 'invalid response' } }, - EnrollAdminToken: async (request: Types.EnrollAdminTokenRequest): Promise => { - const auth = await params.retrieveUserAuth() - if (auth === null) throw new Error('retrieveUserAuth() returned null') - let finalRoute = '/api/guest/npub/enroll/admin' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + Health: async (): Promise => { + const auth = await params.retrieveGuestAuth() + if (auth === null) throw new Error('retrieveGuestAuth() returned null') + let finalRoute = '/api/health' + const { data } = await axios.get(params.baseUrl + finalRoute, { headers: { 'authorization': auth } }) if (data.status === 'ERROR' && typeof data.reason === 'string') return data if (data.status === 'OK') { return data @@ -302,49 +473,52 @@ export default (params: ClientParams) => ({ } return { status: 'ERROR', reason: 'invalid response' } }, - UseInviteLink: async (request: Types.UseInviteLinkRequest): Promise => { - const auth = await params.retrieveGuestWithPubAuth() - if (auth === null) throw new Error('retrieveGuestWithPubAuth() returned null') - let finalRoute = '/api/guest/invite' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - return data - } - return { status: 'ERROR', reason: 'invalid response' } - }, - GetApp: async (): Promise => { - const auth = await params.retrieveAppAuth() - if (auth === null) throw new Error('retrieveAppAuth() returned null') - let finalRoute = '/api/app/get' - const { data } = await axios.post(params.baseUrl + finalRoute, {}, { headers: { 'authorization': auth } }) + ListChannels: async (): Promise => { + const auth = await params.retrieveAdminAuth() + if (auth === null) throw new Error('retrieveAdminAuth() returned null') + let finalRoute = '/api/admin/channels' + const { data } = await axios.get(params.baseUrl + finalRoute, { headers: { 'authorization': auth } }) if (data.status === 'ERROR' && typeof data.reason === 'string') return data if (data.status === 'OK') { const result = data if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.ApplicationValidate(result) + const error = Types.LndChannelsValidate(result) if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } } return { status: 'ERROR', reason: 'invalid response' } }, - AddAppUser: async (request: Types.AddAppUserRequest): Promise => { - const auth = await params.retrieveAppAuth() - if (auth === null) throw new Error('retrieveAppAuth() returned null') - let finalRoute = '/api/app/user/add' + LndGetInfo: async (request: Types.LndGetInfoRequest): Promise => { + const auth = await params.retrieveAdminAuth() + if (auth === null) throw new Error('retrieveAdminAuth() returned null') + let finalRoute = '/api/admin/lnd/getinfo' const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) if (data.status === 'ERROR' && typeof data.reason === 'string') return data if (data.status === 'OK') { const result = data if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.AppUserValidate(result) + const error = Types.LndGetInfoResponseValidate(result) if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } } return { status: 'ERROR', reason: 'invalid response' } }, - AddAppInvoice: async (request: Types.AddAppInvoiceRequest): Promise => { - const auth = await params.retrieveAppAuth() - if (auth === null) throw new Error('retrieveAppAuth() returned null') - let finalRoute = '/api/app/add/invoice' + NewAddress: async (request: Types.NewAddressRequest): Promise => { + const auth = await params.retrieveUserAuth() + if (auth === null) throw new Error('retrieveUserAuth() returned null') + let finalRoute = '/api/user/chain/new' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.NewAddressResponseValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + NewInvoice: async (request: Types.NewInvoiceRequest): Promise => { + const auth = await params.retrieveUserAuth() + if (auth === null) throw new Error('retrieveUserAuth() returned null') + let finalRoute = '/api/user/invoice/new' const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) if (data.status === 'ERROR' && typeof data.reason === 'string') return data if (data.status === 'OK') { @@ -355,11 +529,13 @@ export default (params: ClientParams) => ({ } return { status: 'ERROR', reason: 'invalid response' } }, - AddAppUserInvoice: async (request: Types.AddAppUserInvoiceRequest): Promise => { - const auth = await params.retrieveAppAuth() - if (auth === null) throw new Error('retrieveAppAuth() returned null') - let finalRoute = '/api/app/user/add/invoice' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + NewProductInvoice: async (query: Types.NewProductInvoice_Query): Promise => { + const auth = await params.retrieveUserAuth() + if (auth === null) throw new Error('retrieveUserAuth() returned null') + let finalRoute = '/api/user/product/get/invoice' + const q = (new URLSearchParams(query)).toString() + finalRoute = finalRoute + (q === '' ? '' : '?' + q) + const { data } = await axios.get(params.baseUrl + finalRoute, { headers: { 'authorization': auth } }) if (data.status === 'ERROR' && typeof data.reason === 'string') return data if (data.status === 'OK') { const result = data @@ -369,16 +545,30 @@ export default (params: ClientParams) => ({ } return { status: 'ERROR', reason: 'invalid response' } }, - GetAppUser: async (request: Types.GetAppUserRequest): Promise => { - const auth = await params.retrieveAppAuth() - if (auth === null) throw new Error('retrieveAppAuth() returned null') - let finalRoute = '/api/app/user/get' + OpenChannel: async (request: Types.OpenChannelRequest): Promise => { + const auth = await params.retrieveUserAuth() + if (auth === null) throw new Error('retrieveUserAuth() returned null') + let finalRoute = '/api/user/open/channel' const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) if (data.status === 'ERROR' && typeof data.reason === 'string') return data if (data.status === 'OK') { const result = data if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.AppUserValidate(result) + const error = Types.OpenChannelResponseValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + PayAddress: async (request: Types.PayAddressRequest): Promise => { + const auth = await params.retrieveUserAuth() + if (auth === null) throw new Error('retrieveUserAuth() returned null') + let finalRoute = '/api/user/chain/pay' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.PayAddressResponseValidate(result) if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } } return { status: 'ERROR', reason: 'invalid response' } @@ -397,64 +587,20 @@ export default (params: ClientParams) => ({ } return { status: 'ERROR', reason: 'invalid response' } }, - SendAppUserToAppUserPayment: async (request: Types.SendAppUserToAppUserPaymentRequest): Promise => { - const auth = await params.retrieveAppAuth() - if (auth === null) throw new Error('retrieveAppAuth() returned null') - let finalRoute = '/api/app/user/internal/pay' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - return data - } - return { status: 'ERROR', reason: 'invalid response' } - }, - SendAppUserToAppPayment: async (request: Types.SendAppUserToAppPaymentRequest): Promise => { - const auth = await params.retrieveAppAuth() - if (auth === null) throw new Error('retrieveAppAuth() returned null') - let finalRoute = '/api/app/internal/pay' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - return data - } - return { status: 'ERROR', reason: 'invalid response' } - }, - GetAppUserLNURLInfo: async (request: Types.GetAppUserLNURLInfoRequest): Promise => { - const auth = await params.retrieveAppAuth() - if (auth === null) throw new Error('retrieveAppAuth() returned null') - let finalRoute = '/api/app/user/lnurl/pay/info' + PayInvoice: async (request: Types.PayInvoiceRequest): Promise => { + const auth = await params.retrieveUserAuth() + if (auth === null) throw new Error('retrieveUserAuth() returned null') + let finalRoute = '/api/user/invoice/pay' const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) if (data.status === 'ERROR' && typeof data.reason === 'string') return data if (data.status === 'OK') { const result = data if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.LnurlPayInfoResponseValidate(result) + const error = Types.PayInvoiceResponseValidate(result) if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } } return { status: 'ERROR', reason: 'invalid response' } }, - SetMockAppUserBalance: async (request: Types.SetMockAppUserBalanceRequest): Promise => { - const auth = await params.retrieveAppAuth() - if (auth === null) throw new Error('retrieveAppAuth() returned null') - let finalRoute = '/api/app/mock/user/blance/set' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - return data - } - return { status: 'ERROR', reason: 'invalid response' } - }, - SetMockAppBalance: async (request: Types.SetMockAppBalanceRequest): Promise => { - const auth = await params.retrieveAppAuth() - if (auth === null) throw new Error('retrieveAppAuth() returned null') - let finalRoute = '/api/app/mock/blance/set' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - return data - } - return { status: 'ERROR', reason: 'invalid response' } - }, RequestNPubLinkingToken: async (request: Types.RequestNPubLinkingTokenRequest): Promise => { const auth = await params.retrieveAppAuth() if (auth === null) throw new Error('retrieveAppAuth() returned null') @@ -483,6 +629,72 @@ export default (params: ClientParams) => ({ } return { status: 'ERROR', reason: 'invalid response' } }, + SendAppUserToAppPayment: async (request: Types.SendAppUserToAppPaymentRequest): Promise => { + const auth = await params.retrieveAppAuth() + if (auth === null) throw new Error('retrieveAppAuth() returned null') + let finalRoute = '/api/app/internal/pay' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + return data + } + return { status: 'ERROR', reason: 'invalid response' } + }, + SendAppUserToAppUserPayment: async (request: Types.SendAppUserToAppUserPaymentRequest): Promise => { + const auth = await params.retrieveAppAuth() + if (auth === null) throw new Error('retrieveAppAuth() returned null') + let finalRoute = '/api/app/user/internal/pay' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + return data + } + return { status: 'ERROR', reason: 'invalid response' } + }, + SetMockAppBalance: async (request: Types.SetMockAppBalanceRequest): Promise => { + const auth = await params.retrieveAppAuth() + if (auth === null) throw new Error('retrieveAppAuth() returned null') + let finalRoute = '/api/app/mock/blance/set' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + return data + } + return { status: 'ERROR', reason: 'invalid response' } + }, + SetMockAppUserBalance: async (request: Types.SetMockAppUserBalanceRequest): Promise => { + const auth = await params.retrieveAppAuth() + if (auth === null) throw new Error('retrieveAppAuth() returned null') + let finalRoute = '/api/app/mock/user/blance/set' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + return data + } + return { status: 'ERROR', reason: 'invalid response' } + }, + SetMockInvoiceAsPaid: async (request: Types.SetMockInvoiceAsPaidRequest): Promise => { + const auth = await params.retrieveGuestAuth() + if (auth === null) throw new Error('retrieveGuestAuth() returned null') + let finalRoute = '/api/lnd/mock/invoice/paid' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + return data + } + return { status: 'ERROR', reason: 'invalid response' } + }, + UseInviteLink: async (request: Types.UseInviteLinkRequest): Promise => { + const auth = await params.retrieveGuestWithPubAuth() + if (auth === null) throw new Error('retrieveGuestWithPubAuth() returned null') + let finalRoute = '/api/guest/invite' + const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + return data + } + return { status: 'ERROR', reason: 'invalid response' } + }, UserHealth: async (): Promise => { const auth = await params.retrieveUserAuth() if (auth === null) throw new Error('retrieveUserAuth() returned null') @@ -494,216 +706,4 @@ export default (params: ClientParams) => ({ } return { status: 'ERROR', reason: 'invalid response' } }, - GetUserInfo: async (): Promise => { - const auth = await params.retrieveUserAuth() - if (auth === null) throw new Error('retrieveUserAuth() returned null') - let finalRoute = '/api/user/info' - const { data } = await axios.post(params.baseUrl + finalRoute, {}, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.UserInfoValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - AddProduct: async (request: Types.AddProductRequest): Promise => { - const auth = await params.retrieveUserAuth() - if (auth === null) throw new Error('retrieveUserAuth() returned null') - let finalRoute = '/api/user/product/add' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.ProductValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - NewProductInvoice: async (query: Types.NewProductInvoice_Query): Promise => { - const auth = await params.retrieveUserAuth() - if (auth === null) throw new Error('retrieveUserAuth() returned null') - let finalRoute = '/api/user/product/get/invoice' - const q = (new URLSearchParams(query)).toString() - finalRoute = finalRoute + (q === '' ? '' : '?' + q) - const { data } = await axios.get(params.baseUrl + finalRoute, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.NewInvoiceResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - GetUserOperations: async (request: Types.GetUserOperationsRequest): Promise => { - const auth = await params.retrieveUserAuth() - if (auth === null) throw new Error('retrieveUserAuth() returned null') - let finalRoute = '/api/user/operations' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.GetUserOperationsResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - NewAddress: async (request: Types.NewAddressRequest): Promise => { - const auth = await params.retrieveUserAuth() - if (auth === null) throw new Error('retrieveUserAuth() returned null') - let finalRoute = '/api/user/chain/new' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.NewAddressResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - PayAddress: async (request: Types.PayAddressRequest): Promise => { - const auth = await params.retrieveUserAuth() - if (auth === null) throw new Error('retrieveUserAuth() returned null') - let finalRoute = '/api/user/chain/pay' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.PayAddressResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - NewInvoice: async (request: Types.NewInvoiceRequest): Promise => { - const auth = await params.retrieveUserAuth() - if (auth === null) throw new Error('retrieveUserAuth() returned null') - let finalRoute = '/api/user/invoice/new' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.NewInvoiceResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - DecodeInvoice: async (request: Types.DecodeInvoiceRequest): Promise => { - const auth = await params.retrieveUserAuth() - if (auth === null) throw new Error('retrieveUserAuth() returned null') - let finalRoute = '/api/user/invoice/decode' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.DecodeInvoiceResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - PayInvoice: async (request: Types.PayInvoiceRequest): Promise => { - const auth = await params.retrieveUserAuth() - if (auth === null) throw new Error('retrieveUserAuth() returned null') - let finalRoute = '/api/user/invoice/pay' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.PayInvoiceResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - GetPaymentState: async (request: Types.GetPaymentStateRequest): Promise => { - const auth = await params.retrieveUserAuth() - if (auth === null) throw new Error('retrieveUserAuth() returned null') - let finalRoute = '/api/user/payment/state' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.PaymentStateValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - OpenChannel: async (request: Types.OpenChannelRequest): Promise => { - const auth = await params.retrieveUserAuth() - if (auth === null) throw new Error('retrieveUserAuth() returned null') - let finalRoute = '/api/user/open/channel' - const { data } = await axios.post(params.baseUrl + finalRoute, request, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.OpenChannelResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - GetLnurlWithdrawLink: async (): Promise => { - const auth = await params.retrieveUserAuth() - if (auth === null) throw new Error('retrieveUserAuth() returned null') - let finalRoute = '/api/user/lnurl_withdraw/link' - const { data } = await axios.get(params.baseUrl + finalRoute, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.LnurlLinkResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - GetLnurlPayLink: async (): Promise => { - const auth = await params.retrieveUserAuth() - if (auth === null) throw new Error('retrieveUserAuth() returned null') - let finalRoute = '/api/user/lnurl_pay/link' - const { data } = await axios.get(params.baseUrl + finalRoute, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.LnurlLinkResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - GetLNURLChannelLink: async (): Promise => { - const auth = await params.retrieveUserAuth() - if (auth === null) throw new Error('retrieveUserAuth() returned null') - let finalRoute = '/api/user/lnurl_channel/url' - const { data } = await axios.post(params.baseUrl + finalRoute, {}, { headers: { 'authorization': auth } }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.LnurlLinkResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - 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')}, - GetHttpCreds: async (cb: (v:ResultError | ({ status: 'OK' }& Types.HttpCreds)) => 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 e09636eb..6a6fb4c0 100644 --- a/proto/autogenerated/ts/nostr_client.ts +++ b/proto/autogenerated/ts/nostr_client.ts @@ -6,27 +6,12 @@ export type ResultError = { status: 'ERROR', reason: string } export type NostrClientParams = { pubDestination: string retrieveNostrAdminAuth: () => Promise + retrieveNostrGuestWithPubAuth: () => Promise retrieveNostrMetricsAuth: () => Promise retrieveNostrUserAuth: () => Promise - retrieveNostrGuestWithPubAuth: () => Promise checkResult?: true } export default (params: NostrClientParams, send: (to:string, message: NostrRequest) => Promise, subscribe: (to:string, message: NostrRequest, cb:(res:any)=> void) => void) => ({ - LndGetInfo: async (request: Types.LndGetInfoRequest): Promise => { - const auth = await params.retrieveNostrAdminAuth() - if (auth === null) throw new Error('retrieveNostrAdminAuth() returned null') - const nostrRequest: NostrRequest = {} - nostrRequest.body = request - const data = await send(params.pubDestination, {rpcName:'LndGetInfo',authIdentifier:auth, ...nostrRequest }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.LndGetInfoResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, AddApp: async (request: Types.AddAppRequest): Promise => { const auth = await params.retrieveNostrAdminAuth() if (auth === null) throw new Error('retrieveNostrAdminAuth() returned null') @@ -42,6 +27,21 @@ export default (params: NostrClientParams, send: (to:string, message: NostrRequ } return { status: 'ERROR', reason: 'invalid response' } }, + AddProduct: async (request: Types.AddProductRequest): Promise => { + const auth = await params.retrieveNostrUserAuth() + if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') + const nostrRequest: NostrRequest = {} + nostrRequest.body = request + const data = await send(params.pubDestination, {rpcName:'AddProduct',authIdentifier:auth, ...nostrRequest }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.ProductValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, AuthApp: async (request: Types.AuthAppRequest): Promise => { const auth = await params.retrieveNostrAdminAuth() if (auth === null) throw new Error('retrieveNostrAdminAuth() returned null') @@ -72,76 +72,15 @@ export default (params: NostrClientParams, send: (to:string, message: NostrRequ } return { status: 'ERROR', reason: 'invalid response' } }, - GetSeed: async (): Promise => { - const auth = await params.retrieveNostrAdminAuth() - if (auth === null) throw new Error('retrieveNostrAdminAuth() returned null') - const nostrRequest: NostrRequest = {} - const data = await send(params.pubDestination, {rpcName:'GetSeed',authIdentifier:auth, ...nostrRequest }) + 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') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.LndSeedValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - ListChannels: async (): Promise => { - const auth = await params.retrieveNostrAdminAuth() - if (auth === null) throw new Error('retrieveNostrAdminAuth() returned null') - const nostrRequest: NostrRequest = {} - const data = await send(params.pubDestination, {rpcName:'ListChannels',authIdentifier:auth, ...nostrRequest }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.LndChannelsValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - GetUsageMetrics: async (): Promise => { - const auth = await params.retrieveNostrMetricsAuth() - if (auth === null) throw new Error('retrieveNostrMetricsAuth() returned null') - const nostrRequest: NostrRequest = {} - const data = await send(params.pubDestination, {rpcName:'GetUsageMetrics',authIdentifier:auth, ...nostrRequest }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.UsageMetricsValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - GetAppsMetrics: async (request: Types.AppsMetricsRequest): Promise => { - const auth = await params.retrieveNostrMetricsAuth() - if (auth === null) throw new Error('retrieveNostrMetricsAuth() returned null') - const nostrRequest: NostrRequest = {} - nostrRequest.body = request - const data = await send(params.pubDestination, {rpcName:'GetAppsMetrics',authIdentifier:auth, ...nostrRequest }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.AppsMetricsValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - GetLndMetrics: async (request: Types.LndMetricsRequest): Promise => { - const auth = await params.retrieveNostrMetricsAuth() - if (auth === null) throw new Error('retrieveNostrMetricsAuth() returned null') - const nostrRequest: NostrRequest = {} - nostrRequest.body = request - const data = await send(params.pubDestination, {rpcName:'GetLndMetrics',authIdentifier:auth, ...nostrRequest }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.LndMetricsValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } + return data + } return { status: 'ERROR', reason: 'invalid response' } }, CreateOneTimeInviteLink: async (request: Types.CreateOneTimeInviteLinkRequest): Promise => { @@ -159,172 +98,6 @@ export default (params: NostrClientParams, send: (to:string, message: NostrRequ } return { status: 'ERROR', reason: 'invalid response' } }, - GetInviteLinkState: async (request: Types.GetInviteTokenStateRequest): Promise => { - const auth = await params.retrieveNostrAdminAuth() - if (auth === null) throw new Error('retrieveNostrAdminAuth() returned null') - const nostrRequest: NostrRequest = {} - nostrRequest.body = request - const data = await send(params.pubDestination, {rpcName:'GetInviteLinkState',authIdentifier:auth, ...nostrRequest }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.GetInviteTokenStateResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - EnrollAdminToken: async (request: Types.EnrollAdminTokenRequest): Promise => { - const auth = await params.retrieveNostrUserAuth() - if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') - const nostrRequest: NostrRequest = {} - nostrRequest.body = request - const data = await send(params.pubDestination, {rpcName:'EnrollAdminToken',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' } - }, - LinkNPubThroughToken: async (request: Types.LinkNPubThroughTokenRequest): Promise => { - const auth = await params.retrieveNostrGuestWithPubAuth() - if (auth === null) throw new Error('retrieveNostrGuestWithPubAuth() returned null') - const nostrRequest: NostrRequest = {} - nostrRequest.body = request - const data = await send(params.pubDestination, {rpcName:'LinkNPubThroughToken',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' } - }, - UseInviteLink: async (request: Types.UseInviteLinkRequest): Promise => { - const auth = await params.retrieveNostrGuestWithPubAuth() - if (auth === null) throw new Error('retrieveNostrGuestWithPubAuth() returned null') - const nostrRequest: NostrRequest = {} - nostrRequest.body = request - const data = await send(params.pubDestination, {rpcName:'UseInviteLink',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' } - }, - UserHealth: async (): Promise => { - const auth = await params.retrieveNostrUserAuth() - if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') - const nostrRequest: NostrRequest = {} - const data = await send(params.pubDestination, {rpcName:'UserHealth',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' } - }, - GetUserInfo: async (): Promise => { - const auth = await params.retrieveNostrUserAuth() - if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') - const nostrRequest: NostrRequest = {} - const data = await send(params.pubDestination, {rpcName:'GetUserInfo',authIdentifier:auth, ...nostrRequest }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.UserInfoValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - AddProduct: async (request: Types.AddProductRequest): Promise => { - const auth = await params.retrieveNostrUserAuth() - if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') - const nostrRequest: NostrRequest = {} - nostrRequest.body = request - const data = await send(params.pubDestination, {rpcName:'AddProduct',authIdentifier:auth, ...nostrRequest }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.ProductValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - NewProductInvoice: async (query: Types.NewProductInvoice_Query): Promise => { - const auth = await params.retrieveNostrUserAuth() - if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') - const nostrRequest: NostrRequest = {} - nostrRequest.query = query - const data = await send(params.pubDestination, {rpcName:'NewProductInvoice',authIdentifier:auth, ...nostrRequest }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.NewInvoiceResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - GetUserOperations: async (request: Types.GetUserOperationsRequest): Promise => { - const auth = await params.retrieveNostrUserAuth() - if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') - const nostrRequest: NostrRequest = {} - nostrRequest.body = request - const data = await send(params.pubDestination, {rpcName:'GetUserOperations',authIdentifier:auth, ...nostrRequest }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.GetUserOperationsResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - NewAddress: async (request: Types.NewAddressRequest): Promise => { - const auth = await params.retrieveNostrUserAuth() - if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') - const nostrRequest: NostrRequest = {} - nostrRequest.body = request - const data = await send(params.pubDestination, {rpcName:'NewAddress',authIdentifier:auth, ...nostrRequest }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.NewAddressResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - PayAddress: async (request: Types.PayAddressRequest): Promise => { - const auth = await params.retrieveNostrUserAuth() - if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') - const nostrRequest: NostrRequest = {} - nostrRequest.body = request - const data = await send(params.pubDestination, {rpcName:'PayAddress',authIdentifier:auth, ...nostrRequest }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.PayAddressResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - NewInvoice: async (request: Types.NewInvoiceRequest): Promise => { - const auth = await params.retrieveNostrUserAuth() - if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') - const nostrRequest: NostrRequest = {} - nostrRequest.body = request - const data = await send(params.pubDestination, {rpcName:'NewInvoice',authIdentifier:auth, ...nostrRequest }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.NewInvoiceResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, DecodeInvoice: async (request: Types.DecodeInvoiceRequest): Promise => { const auth = await params.retrieveNostrUserAuth() if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') @@ -340,75 +113,59 @@ export default (params: NostrClientParams, send: (to:string, message: NostrRequ } return { status: 'ERROR', reason: 'invalid response' } }, - PayInvoice: async (request: Types.PayInvoiceRequest): Promise => { + EnrollAdminToken: async (request: Types.EnrollAdminTokenRequest): Promise => { const auth = await params.retrieveNostrUserAuth() if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') const nostrRequest: NostrRequest = {} nostrRequest.body = request - const data = await send(params.pubDestination, {rpcName:'PayInvoice',authIdentifier:auth, ...nostrRequest }) + const data = await send(params.pubDestination, {rpcName:'EnrollAdminToken',authIdentifier:auth, ...nostrRequest }) if (data.status === 'ERROR' && typeof data.reason === 'string') return data if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.PayInvoiceResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + return data } return { status: 'ERROR', reason: 'invalid response' } }, - GetPaymentState: async (request: Types.GetPaymentStateRequest): Promise => { - const auth = await params.retrieveNostrUserAuth() - if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') + GetAppsMetrics: async (request: Types.AppsMetricsRequest): Promise => { + const auth = await params.retrieveNostrMetricsAuth() + if (auth === null) throw new Error('retrieveNostrMetricsAuth() returned null') const nostrRequest: NostrRequest = {} nostrRequest.body = request - const data = await send(params.pubDestination, {rpcName:'GetPaymentState',authIdentifier:auth, ...nostrRequest }) + const data = await send(params.pubDestination, {rpcName:'GetAppsMetrics',authIdentifier:auth, ...nostrRequest }) if (data.status === 'ERROR' && typeof data.reason === 'string') return data if (data.status === 'OK') { const result = data if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.PaymentStateValidate(result) + const error = Types.AppsMetricsValidate(result) if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } } return { status: 'ERROR', reason: 'invalid response' } }, - OpenChannel: async (request: Types.OpenChannelRequest): Promise => { + GetHttpCreds: async (cb: (res:ResultError | ({ status: 'OK' }& Types.HttpCreds)) => void): Promise => { const auth = await params.retrieveNostrUserAuth() if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') const nostrRequest: NostrRequest = {} + subscribe(params.pubDestination, {rpcName:'GetHttpCreds',authIdentifier:auth, ...nostrRequest }, (data) => { + if (data.status === 'ERROR' && typeof data.reason === 'string') return cb(data) + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return cb({ status: 'OK', ...result }) + const error = Types.HttpCredsValidate(result) + if (error === null) { return cb({ status: 'OK', ...result }) } else return cb({ status: 'ERROR', reason: error.message }) + } + return cb({ status: 'ERROR', reason: 'invalid response' }) + }) + }, + GetInviteLinkState: async (request: Types.GetInviteTokenStateRequest): Promise => { + const auth = await params.retrieveNostrAdminAuth() + if (auth === null) throw new Error('retrieveNostrAdminAuth() returned null') + const nostrRequest: NostrRequest = {} nostrRequest.body = request - const data = await send(params.pubDestination, {rpcName:'OpenChannel',authIdentifier:auth, ...nostrRequest }) + const data = await send(params.pubDestination, {rpcName:'GetInviteLinkState',authIdentifier:auth, ...nostrRequest }) if (data.status === 'ERROR' && typeof data.reason === 'string') return data if (data.status === 'OK') { const result = data if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.OpenChannelResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - GetLnurlWithdrawLink: async (): Promise => { - const auth = await params.retrieveNostrUserAuth() - if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') - const nostrRequest: NostrRequest = {} - const data = await send(params.pubDestination, {rpcName:'GetLnurlWithdrawLink',authIdentifier:auth, ...nostrRequest }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.LnurlLinkResponseValidate(result) - if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } - } - return { status: 'ERROR', reason: 'invalid response' } - }, - GetLnurlPayLink: async (): Promise => { - const auth = await params.retrieveNostrUserAuth() - if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') - const nostrRequest: NostrRequest = {} - const data = await send(params.pubDestination, {rpcName:'GetLnurlPayLink',authIdentifier:auth, ...nostrRequest }) - if (data.status === 'ERROR' && typeof data.reason === 'string') return data - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return { status: 'OK', ...result } - const error = Types.LnurlLinkResponseValidate(result) + const error = Types.GetInviteTokenStateResponseValidate(result) if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } } return { status: 'ERROR', reason: 'invalid response' } @@ -442,6 +199,49 @@ export default (params: NostrClientParams, send: (to:string, message: NostrRequ return cb({ status: 'ERROR', reason: 'invalid response' }) }) }, + GetLndMetrics: async (request: Types.LndMetricsRequest): Promise => { + const auth = await params.retrieveNostrMetricsAuth() + if (auth === null) throw new Error('retrieveNostrMetricsAuth() returned null') + const nostrRequest: NostrRequest = {} + nostrRequest.body = request + const data = await send(params.pubDestination, {rpcName:'GetLndMetrics',authIdentifier:auth, ...nostrRequest }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.LndMetricsValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + GetLnurlPayLink: async (): Promise => { + const auth = await params.retrieveNostrUserAuth() + if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') + const nostrRequest: NostrRequest = {} + const data = await send(params.pubDestination, {rpcName:'GetLnurlPayLink',authIdentifier:auth, ...nostrRequest }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.LnurlLinkResponseValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + GetLnurlWithdrawLink: async (): Promise => { + const auth = await params.retrieveNostrUserAuth() + if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') + const nostrRequest: NostrRequest = {} + const data = await send(params.pubDestination, {rpcName:'GetLnurlWithdrawLink',authIdentifier:auth, ...nostrRequest }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.LnurlLinkResponseValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, GetMigrationUpdate: async (cb: (res:ResultError | ({ status: 'OK' }& Types.MigrationUpdate)) => void): Promise => { const auth = await params.retrieveNostrUserAuth() if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') @@ -457,30 +257,230 @@ export default (params: NostrClientParams, send: (to:string, message: NostrRequ return cb({ status: 'ERROR', reason: 'invalid response' }) }) }, - GetHttpCreds: async (cb: (res:ResultError | ({ status: 'OK' }& Types.HttpCreds)) => void): Promise => { + GetPaymentState: async (request: Types.GetPaymentStateRequest): Promise => { const auth = await params.retrieveNostrUserAuth() if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') const nostrRequest: NostrRequest = {} - subscribe(params.pubDestination, {rpcName:'GetHttpCreds',authIdentifier:auth, ...nostrRequest }, (data) => { - if (data.status === 'ERROR' && typeof data.reason === 'string') return cb(data) - if (data.status === 'OK') { - const result = data - if(!params.checkResult) return cb({ status: 'OK', ...result }) - const error = Types.HttpCredsValidate(result) - if (error === null) { return cb({ status: 'OK', ...result }) } else return cb({ status: 'ERROR', reason: error.message }) - } - return cb({ status: 'ERROR', reason: 'invalid response' }) - }) + nostrRequest.body = request + const data = await send(params.pubDestination, {rpcName:'GetPaymentState',authIdentifier:auth, ...nostrRequest }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.PaymentStateValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } }, - BatchUser: async (requests:Types.UserMethodInputs[]): Promise => { + GetSeed: async (): Promise => { + const auth = await params.retrieveNostrAdminAuth() + if (auth === null) throw new Error('retrieveNostrAdminAuth() returned null') + const nostrRequest: NostrRequest = {} + const data = await send(params.pubDestination, {rpcName:'GetSeed',authIdentifier:auth, ...nostrRequest }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.LndSeedValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + GetUsageMetrics: async (): Promise => { + const auth = await params.retrieveNostrMetricsAuth() + if (auth === null) throw new Error('retrieveNostrMetricsAuth() returned null') + const nostrRequest: NostrRequest = {} + const data = await send(params.pubDestination, {rpcName:'GetUsageMetrics',authIdentifier:auth, ...nostrRequest }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.UsageMetricsValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + GetUserInfo: async (): 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 }) + const nostrRequest: NostrRequest = {} + const data = await send(params.pubDestination, {rpcName:'GetUserInfo',authIdentifier:auth, ...nostrRequest }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.UserInfoValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + GetUserOperations: async (request: Types.GetUserOperationsRequest): Promise => { + const auth = await params.retrieveNostrUserAuth() + if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') + const nostrRequest: NostrRequest = {} + nostrRequest.body = request + const data = await send(params.pubDestination, {rpcName:'GetUserOperations',authIdentifier:auth, ...nostrRequest }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.GetUserOperationsResponseValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + LinkNPubThroughToken: async (request: Types.LinkNPubThroughTokenRequest): Promise => { + const auth = await params.retrieveNostrGuestWithPubAuth() + if (auth === null) throw new Error('retrieveNostrGuestWithPubAuth() returned null') + const nostrRequest: NostrRequest = {} + nostrRequest.body = request + const data = await send(params.pubDestination, {rpcName:'LinkNPubThroughToken',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' } - } + }, + ListChannels: async (): Promise => { + const auth = await params.retrieveNostrAdminAuth() + if (auth === null) throw new Error('retrieveNostrAdminAuth() returned null') + const nostrRequest: NostrRequest = {} + const data = await send(params.pubDestination, {rpcName:'ListChannels',authIdentifier:auth, ...nostrRequest }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.LndChannelsValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + LndGetInfo: async (request: Types.LndGetInfoRequest): Promise => { + const auth = await params.retrieveNostrAdminAuth() + if (auth === null) throw new Error('retrieveNostrAdminAuth() returned null') + const nostrRequest: NostrRequest = {} + nostrRequest.body = request + const data = await send(params.pubDestination, {rpcName:'LndGetInfo',authIdentifier:auth, ...nostrRequest }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.LndGetInfoResponseValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + NewAddress: async (request: Types.NewAddressRequest): Promise => { + const auth = await params.retrieveNostrUserAuth() + if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') + const nostrRequest: NostrRequest = {} + nostrRequest.body = request + const data = await send(params.pubDestination, {rpcName:'NewAddress',authIdentifier:auth, ...nostrRequest }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.NewAddressResponseValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + NewInvoice: async (request: Types.NewInvoiceRequest): Promise => { + const auth = await params.retrieveNostrUserAuth() + if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') + const nostrRequest: NostrRequest = {} + nostrRequest.body = request + const data = await send(params.pubDestination, {rpcName:'NewInvoice',authIdentifier:auth, ...nostrRequest }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.NewInvoiceResponseValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + NewProductInvoice: async (query: Types.NewProductInvoice_Query): Promise => { + const auth = await params.retrieveNostrUserAuth() + if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') + const nostrRequest: NostrRequest = {} + nostrRequest.query = query + const data = await send(params.pubDestination, {rpcName:'NewProductInvoice',authIdentifier:auth, ...nostrRequest }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.NewInvoiceResponseValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + OpenChannel: async (request: Types.OpenChannelRequest): Promise => { + const auth = await params.retrieveNostrUserAuth() + if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') + const nostrRequest: NostrRequest = {} + nostrRequest.body = request + const data = await send(params.pubDestination, {rpcName:'OpenChannel',authIdentifier:auth, ...nostrRequest }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.OpenChannelResponseValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + PayAddress: async (request: Types.PayAddressRequest): Promise => { + const auth = await params.retrieveNostrUserAuth() + if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') + const nostrRequest: NostrRequest = {} + nostrRequest.body = request + const data = await send(params.pubDestination, {rpcName:'PayAddress',authIdentifier:auth, ...nostrRequest }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.PayAddressResponseValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + PayInvoice: async (request: Types.PayInvoiceRequest): Promise => { + const auth = await params.retrieveNostrUserAuth() + if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') + const nostrRequest: NostrRequest = {} + nostrRequest.body = request + const data = await send(params.pubDestination, {rpcName:'PayInvoice',authIdentifier:auth, ...nostrRequest }) + if (data.status === 'ERROR' && typeof data.reason === 'string') return data + if (data.status === 'OK') { + const result = data + if(!params.checkResult) return { status: 'OK', ...result } + const error = Types.PayInvoiceResponseValidate(result) + if (error === null) { return { status: 'OK', ...result } } else return { status: 'ERROR', reason: error.message } + } + return { status: 'ERROR', reason: 'invalid response' } + }, + UseInviteLink: async (request: Types.UseInviteLinkRequest): Promise => { + const auth = await params.retrieveNostrGuestWithPubAuth() + if (auth === null) throw new Error('retrieveNostrGuestWithPubAuth() returned null') + const nostrRequest: NostrRequest = {} + nostrRequest.body = request + const data = await send(params.pubDestination, {rpcName:'UseInviteLink',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' } + }, + UserHealth: async (): Promise => { + const auth = await params.retrieveNostrUserAuth() + if (auth === null) throw new Error('retrieveNostrUserAuth() returned null') + const nostrRequest: NostrRequest = {} + const data = await send(params.pubDestination, {rpcName:'UserHealth',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 2a30160a..288d3169 100644 --- a/proto/autogenerated/ts/nostr_transport.ts +++ b/proto/autogenerated/ts/nostr_transport.ts @@ -16,10 +16,10 @@ export type NostrOptions = { logger?: Logger throwErrors?: true metricsCallback: (metrics: Types.RequestMetric[]) => void + NostrAdminAuthGuard: (appId?:string, identifier?: string) => Promise + NostrGuestWithPubAuthGuard: (appId?:string, identifier?: string) => Promise NostrMetricsAuthGuard: (appId?:string, identifier?: string) => Promise NostrUserAuthGuard: (appId?:string, identifier?: string) => Promise - NostrGuestWithPubAuthGuard: (appId?:string, identifier?: string) => Promise - NostrAdminAuthGuard: (appId?:string, identifier?: string) => Promise } const logErrorAndReturnResponse = (error: Error, response: string, res: NostrResponse, logger: Logger, metric: Types.RequestMetric, metricsCallback: (metrics: Types.RequestMetric[]) => void) => { logger.error(error.message || error); metricsCallback([{ ...metric, error: response }]); res({ status: 'ERROR', reason: response }) @@ -32,22 +32,6 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { const stats: Types.RequestStats = { startMs, start: startTime, parse: process.hrtime.bigint(), guard: 0n, validate: 0n, handle: 0n } let authCtx: Types.AuthContext = {} switch (req.rpcName) { - case 'LndGetInfo': - try { - if (!methods.LndGetInfo) throw new Error('method: LndGetInfo is not implemented') - const authContext = await opts.NostrAdminAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - const request = req.body - const error = Types.LndGetInfoRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) - const response = await methods.LndGetInfo({rpcName:'LndGetInfo', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break case 'AddApp': try { if (!methods.AddApp) throw new Error('method: AddApp is not implemented') @@ -64,6 +48,22 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { opts.metricsCallback([{ ...info, ...stats, ...authContext }]) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } break + case 'AddProduct': + try { + if (!methods.AddProduct) throw new Error('method: AddProduct is not implemented') + const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + const request = req.body + const error = Types.AddProductRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) + const response = await methods.AddProduct({rpcName:'AddProduct', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break case 'AuthApp': try { if (!methods.AuthApp) throw new Error('method: AuthApp is not implemented') @@ -96,75 +96,213 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { opts.metricsCallback([{ ...info, ...stats, ...authContext }]) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } break - case 'GetSeed': + case 'BatchUser': try { - if (!methods.GetSeed) throw new Error('method: GetSeed is not implemented') - const authContext = await opts.NostrAdminAuthGuard(req.appId, req.authIdentifier) + info.batch = true + const requests = req.body.requests as Types.UserMethodInputs[] + if (!Array.isArray(requests))throw new Error('invalid body, is not an array') + info.batchSize = requests.length + if (requests.length > 10) throw new Error('too many requests in the batch') + const ctx = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) stats.guard = process.hrtime.bigint() - authCtx = authContext + authCtx = ctx stats.validate = stats.guard - const response = await methods.GetSeed({rpcName:'GetSeed', ctx:authContext }) + const responses = [] + const callsMetrics: Types.RequestMetric[] = [] + for (let i = 0; i < requests.length; i++) { + const operation = requests[i] + const opInfo: Types.RequestInfo = { rpcName: operation.rpcName, batch: true, nostr: true, batchSize: 0 } + const opStats: Types.RequestStats = { startMs, start: startTime, parse: stats.parse, guard: stats.guard, validate: 0n, handle: 0n } + try { + switch(operation.rpcName) { + case 'AddProduct': + if (!methods.AddProduct) { + throw new Error('method not defined: AddProduct') + } else { + const error = Types.AddProductRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + const res = await methods.AddProduct({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'DecodeInvoice': + if (!methods.DecodeInvoice) { + throw new Error('method not defined: DecodeInvoice') + } else { + const error = Types.DecodeInvoiceRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + const res = await methods.DecodeInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'EnrollAdminToken': + if (!methods.EnrollAdminToken) { + throw new Error('method not defined: EnrollAdminToken') + } else { + const error = Types.EnrollAdminTokenRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + await methods.EnrollAdminToken({...operation, ctx}); responses.push({ status: 'OK' }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'GetLNURLChannelLink': + if (!methods.GetLNURLChannelLink) { + throw new Error('method not defined: GetLNURLChannelLink') + } else { + opStats.validate = opStats.guard + const res = await methods.GetLNURLChannelLink({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'GetLnurlPayLink': + if (!methods.GetLnurlPayLink) { + throw new Error('method not defined: GetLnurlPayLink') + } else { + opStats.validate = opStats.guard + const res = await methods.GetLnurlPayLink({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'GetLnurlWithdrawLink': + if (!methods.GetLnurlWithdrawLink) { + throw new Error('method not defined: GetLnurlWithdrawLink') + } else { + opStats.validate = opStats.guard + const res = await methods.GetLnurlWithdrawLink({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'GetPaymentState': + if (!methods.GetPaymentState) { + throw new Error('method not defined: GetPaymentState') + } else { + const error = Types.GetPaymentStateRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + const res = await methods.GetPaymentState({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'GetUserInfo': + if (!methods.GetUserInfo) { + throw new Error('method not defined: GetUserInfo') + } else { + opStats.validate = opStats.guard + const res = await methods.GetUserInfo({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'GetUserOperations': + if (!methods.GetUserOperations) { + throw new Error('method not defined: GetUserOperations') + } else { + const error = Types.GetUserOperationsRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + const res = await methods.GetUserOperations({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'NewAddress': + if (!methods.NewAddress) { + throw new Error('method not defined: NewAddress') + } else { + const error = Types.NewAddressRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + const res = await methods.NewAddress({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'NewInvoice': + if (!methods.NewInvoice) { + throw new Error('method not defined: NewInvoice') + } else { + const error = Types.NewInvoiceRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + const res = await methods.NewInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'NewProductInvoice': + if (!methods.NewProductInvoice) { + throw new Error('method not defined: NewProductInvoice') + } else { + opStats.validate = opStats.guard + const res = await methods.NewProductInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'OpenChannel': + if (!methods.OpenChannel) { + throw new Error('method not defined: OpenChannel') + } else { + const error = Types.OpenChannelRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + const res = await methods.OpenChannel({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'PayAddress': + if (!methods.PayAddress) { + throw new Error('method not defined: PayAddress') + } else { + const error = Types.PayAddressRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + const res = await methods.PayAddress({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'PayInvoice': + if (!methods.PayInvoice) { + throw new Error('method not defined: PayInvoice') + } else { + const error = Types.PayInvoiceRequestValidate(operation.req) + opStats.validate = process.hrtime.bigint() + if (error !== null) throw error + const res = await methods.PayInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + case 'UserHealth': + if (!methods.UserHealth) { + throw new Error('method not defined: UserHealth') + } else { + opStats.validate = opStats.guard + await methods.UserHealth({...operation, ctx}); responses.push({ status: 'OK' }) + opStats.handle = process.hrtime.bigint() + callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) + } + break + default: + throw new Error('unkown rpcName') + } + } catch(ex) {const e = ex as any; logger.error(e.message || e); callsMetrics.push({ ...opInfo, ...opStats, ...ctx, error: e.message }); responses.push({ status: 'ERROR', reason: e.message || e })} + } stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'ListChannels': - try { - if (!methods.ListChannels) throw new Error('method: ListChannels is not implemented') - const authContext = await opts.NostrAdminAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - stats.validate = stats.guard - const response = await methods.ListChannels({rpcName:'ListChannels', ctx:authContext }) - stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'GetUsageMetrics': - try { - if (!methods.GetUsageMetrics) throw new Error('method: GetUsageMetrics is not implemented') - const authContext = await opts.NostrMetricsAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - stats.validate = stats.guard - const response = await methods.GetUsageMetrics({rpcName:'GetUsageMetrics', ctx:authContext }) - stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'GetAppsMetrics': - try { - if (!methods.GetAppsMetrics) throw new Error('method: GetAppsMetrics is not implemented') - const authContext = await opts.NostrMetricsAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - const request = req.body - const error = Types.AppsMetricsRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) - const response = await methods.GetAppsMetrics({rpcName:'GetAppsMetrics', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'GetLndMetrics': - try { - if (!methods.GetLndMetrics) throw new Error('method: GetLndMetrics is not implemented') - const authContext = await opts.NostrMetricsAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - const request = req.body - const error = Types.LndMetricsRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) - const response = await methods.GetLndMetrics({rpcName:'GetLndMetrics', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + res({ status: 'OK', responses }) + opts.metricsCallback([{ ...info, ...stats, ...ctx }, ...callsMetrics]) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } break case 'CreateOneTimeInviteLink': @@ -183,17 +321,17 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { opts.metricsCallback([{ ...info, ...stats, ...authContext }]) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } break - case 'GetInviteLinkState': + case 'DecodeInvoice': try { - if (!methods.GetInviteLinkState) throw new Error('method: GetInviteLinkState is not implemented') - const authContext = await opts.NostrAdminAuthGuard(req.appId, req.authIdentifier) + if (!methods.DecodeInvoice) throw new Error('method: DecodeInvoice is not implemented') + const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) stats.guard = process.hrtime.bigint() authCtx = authContext const request = req.body - const error = Types.GetInviteTokenStateRequestValidate(request) + const error = Types.DecodeInvoiceRequestValidate(request) stats.validate = process.hrtime.bigint() if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) - const response = await methods.GetInviteLinkState({rpcName:'GetInviteLinkState', ctx:authContext , req: request}) + const response = await methods.DecodeInvoice({rpcName:'DecodeInvoice', ctx:authContext , req: request}) stats.handle = process.hrtime.bigint() res({status: 'OK', ...response}) opts.metricsCallback([{ ...info, ...stats, ...authContext }]) @@ -215,6 +353,203 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { opts.metricsCallback([{ ...info, ...stats, ...authContext }]) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } break + case 'GetAppsMetrics': + try { + if (!methods.GetAppsMetrics) throw new Error('method: GetAppsMetrics is not implemented') + const authContext = await opts.NostrMetricsAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + const request = req.body + const error = Types.AppsMetricsRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) + const response = await methods.GetAppsMetrics({rpcName:'GetAppsMetrics', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break + case 'GetHttpCreds': + try { + if (!methods.GetHttpCreds) throw new Error('method: GetHttpCreds is not implemented') + const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + stats.validate = stats.guard + methods.GetHttpCreds({rpcName:'GetHttpCreds', ctx:authContext ,cb: (response, err) => { + stats.handle = process.hrtime.bigint() + if (err) { logErrorAndReturnResponse(err, err.message, res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback)} else { res({status: 'OK', ...response});opts.metricsCallback([{ ...info, ...stats, ...authContext }])} + }}) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break + case 'GetInviteLinkState': + try { + if (!methods.GetInviteLinkState) throw new Error('method: GetInviteLinkState is not implemented') + const authContext = await opts.NostrAdminAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + const request = req.body + const error = Types.GetInviteTokenStateRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) + const response = await methods.GetInviteLinkState({rpcName:'GetInviteLinkState', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break + case 'GetLNURLChannelLink': + try { + if (!methods.GetLNURLChannelLink) throw new Error('method: GetLNURLChannelLink is not implemented') + const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + stats.validate = stats.guard + const response = await methods.GetLNURLChannelLink({rpcName:'GetLNURLChannelLink', ctx:authContext }) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break + case 'GetLiveUserOperations': + try { + if (!methods.GetLiveUserOperations) throw new Error('method: GetLiveUserOperations is not implemented') + const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + stats.validate = stats.guard + methods.GetLiveUserOperations({rpcName:'GetLiveUserOperations', ctx:authContext ,cb: (response, err) => { + stats.handle = process.hrtime.bigint() + if (err) { logErrorAndReturnResponse(err, err.message, res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback)} else { res({status: 'OK', ...response});opts.metricsCallback([{ ...info, ...stats, ...authContext }])} + }}) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break + case 'GetLndMetrics': + try { + if (!methods.GetLndMetrics) throw new Error('method: GetLndMetrics is not implemented') + const authContext = await opts.NostrMetricsAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + const request = req.body + const error = Types.LndMetricsRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) + const response = await methods.GetLndMetrics({rpcName:'GetLndMetrics', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break + case 'GetLnurlPayLink': + try { + if (!methods.GetLnurlPayLink) throw new Error('method: GetLnurlPayLink is not implemented') + const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + stats.validate = stats.guard + const response = await methods.GetLnurlPayLink({rpcName:'GetLnurlPayLink', ctx:authContext }) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break + case 'GetLnurlWithdrawLink': + try { + if (!methods.GetLnurlWithdrawLink) throw new Error('method: GetLnurlWithdrawLink is not implemented') + const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + stats.validate = stats.guard + const response = await methods.GetLnurlWithdrawLink({rpcName:'GetLnurlWithdrawLink', ctx:authContext }) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); 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) + stats.guard = process.hrtime.bigint() + authCtx = authContext + stats.validate = stats.guard + methods.GetMigrationUpdate({rpcName:'GetMigrationUpdate', ctx:authContext ,cb: (response, err) => { + stats.handle = process.hrtime.bigint() + if (err) { logErrorAndReturnResponse(err, err.message, res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback)} else { res({status: 'OK', ...response});opts.metricsCallback([{ ...info, ...stats, ...authContext }])} + }}) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break + case 'GetPaymentState': + try { + if (!methods.GetPaymentState) throw new Error('method: GetPaymentState is not implemented') + const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + const request = req.body + const error = Types.GetPaymentStateRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) + const response = await methods.GetPaymentState({rpcName:'GetPaymentState', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break + case 'GetSeed': + try { + if (!methods.GetSeed) throw new Error('method: GetSeed is not implemented') + const authContext = await opts.NostrAdminAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + stats.validate = stats.guard + const response = await methods.GetSeed({rpcName:'GetSeed', ctx:authContext }) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break + case 'GetUsageMetrics': + try { + if (!methods.GetUsageMetrics) throw new Error('method: GetUsageMetrics is not implemented') + const authContext = await opts.NostrMetricsAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + stats.validate = stats.guard + const response = await methods.GetUsageMetrics({rpcName:'GetUsageMetrics', ctx:authContext }) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break + case 'GetUserInfo': + try { + if (!methods.GetUserInfo) throw new Error('method: GetUserInfo is not implemented') + const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + stats.validate = stats.guard + const response = await methods.GetUserInfo({rpcName:'GetUserInfo', ctx:authContext }) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break + case 'GetUserOperations': + try { + if (!methods.GetUserOperations) throw new Error('method: GetUserOperations is not implemented') + const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + const request = req.body + const error = Types.GetUserOperationsRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) + const response = await methods.GetUserOperations({rpcName:'GetUserOperations', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break case 'LinkNPubThroughToken': try { if (!methods.LinkNPubThroughToken) throw new Error('method: LinkNPubThroughToken is not implemented') @@ -231,6 +566,128 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { opts.metricsCallback([{ ...info, ...stats, ...authContext }]) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } break + case 'ListChannels': + try { + if (!methods.ListChannels) throw new Error('method: ListChannels is not implemented') + const authContext = await opts.NostrAdminAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + stats.validate = stats.guard + const response = await methods.ListChannels({rpcName:'ListChannels', ctx:authContext }) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break + case 'LndGetInfo': + try { + if (!methods.LndGetInfo) throw new Error('method: LndGetInfo is not implemented') + const authContext = await opts.NostrAdminAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + const request = req.body + const error = Types.LndGetInfoRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) + const response = await methods.LndGetInfo({rpcName:'LndGetInfo', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break + case 'NewAddress': + try { + if (!methods.NewAddress) throw new Error('method: NewAddress is not implemented') + const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + const request = req.body + const error = Types.NewAddressRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) + const response = await methods.NewAddress({rpcName:'NewAddress', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break + case 'NewInvoice': + try { + if (!methods.NewInvoice) throw new Error('method: NewInvoice is not implemented') + const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + const request = req.body + const error = Types.NewInvoiceRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) + const response = await methods.NewInvoice({rpcName:'NewInvoice', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break + case 'NewProductInvoice': + try { + if (!methods.NewProductInvoice) throw new Error('method: NewProductInvoice is not implemented') + const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + stats.validate = stats.guard + const response = await methods.NewProductInvoice({rpcName:'NewProductInvoice', ctx:authContext ,query: req.query||{}}) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break + case 'OpenChannel': + try { + if (!methods.OpenChannel) throw new Error('method: OpenChannel is not implemented') + const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + const request = req.body + const error = Types.OpenChannelRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) + const response = await methods.OpenChannel({rpcName:'OpenChannel', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break + case 'PayAddress': + try { + if (!methods.PayAddress) throw new Error('method: PayAddress is not implemented') + const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + const request = req.body + const error = Types.PayAddressRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) + const response = await methods.PayAddress({rpcName:'PayAddress', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break + case 'PayInvoice': + try { + if (!methods.PayInvoice) throw new Error('method: PayInvoice is not implemented') + const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) + stats.guard = process.hrtime.bigint() + authCtx = authContext + const request = req.body + const error = Types.PayInvoiceRequestValidate(request) + stats.validate = process.hrtime.bigint() + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) + const response = await methods.PayInvoice({rpcName:'PayInvoice', ctx:authContext , req: request}) + stats.handle = process.hrtime.bigint() + res({status: 'OK', ...response}) + opts.metricsCallback([{ ...info, ...stats, ...authContext }]) + }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } + break case 'UseInviteLink': try { if (!methods.UseInviteLink) throw new Error('method: UseInviteLink is not implemented') @@ -260,463 +717,6 @@ export default (methods: Types.ServerMethods, opts: NostrOptions) => { opts.metricsCallback([{ ...info, ...stats, ...authContext }]) }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } break - case 'GetUserInfo': - try { - if (!methods.GetUserInfo) throw new Error('method: GetUserInfo is not implemented') - const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - stats.validate = stats.guard - const response = await methods.GetUserInfo({rpcName:'GetUserInfo', ctx:authContext }) - stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'AddProduct': - try { - if (!methods.AddProduct) throw new Error('method: AddProduct is not implemented') - const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - const request = req.body - const error = Types.AddProductRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) - const response = await methods.AddProduct({rpcName:'AddProduct', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'NewProductInvoice': - try { - if (!methods.NewProductInvoice) throw new Error('method: NewProductInvoice is not implemented') - const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - stats.validate = stats.guard - const response = await methods.NewProductInvoice({rpcName:'NewProductInvoice', ctx:authContext ,query: req.query||{}}) - stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'GetUserOperations': - try { - if (!methods.GetUserOperations) throw new Error('method: GetUserOperations is not implemented') - const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - const request = req.body - const error = Types.GetUserOperationsRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) - const response = await methods.GetUserOperations({rpcName:'GetUserOperations', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'NewAddress': - try { - if (!methods.NewAddress) throw new Error('method: NewAddress is not implemented') - const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - const request = req.body - const error = Types.NewAddressRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) - const response = await methods.NewAddress({rpcName:'NewAddress', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'PayAddress': - try { - if (!methods.PayAddress) throw new Error('method: PayAddress is not implemented') - const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - const request = req.body - const error = Types.PayAddressRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) - const response = await methods.PayAddress({rpcName:'PayAddress', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'NewInvoice': - try { - if (!methods.NewInvoice) throw new Error('method: NewInvoice is not implemented') - const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - const request = req.body - const error = Types.NewInvoiceRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) - const response = await methods.NewInvoice({rpcName:'NewInvoice', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'DecodeInvoice': - try { - if (!methods.DecodeInvoice) throw new Error('method: DecodeInvoice is not implemented') - const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - const request = req.body - const error = Types.DecodeInvoiceRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) - const response = await methods.DecodeInvoice({rpcName:'DecodeInvoice', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'PayInvoice': - try { - if (!methods.PayInvoice) throw new Error('method: PayInvoice is not implemented') - const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - const request = req.body - const error = Types.PayInvoiceRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) - const response = await methods.PayInvoice({rpcName:'PayInvoice', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'GetPaymentState': - try { - if (!methods.GetPaymentState) throw new Error('method: GetPaymentState is not implemented') - const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - const request = req.body - const error = Types.GetPaymentStateRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) - const response = await methods.GetPaymentState({rpcName:'GetPaymentState', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'OpenChannel': - try { - if (!methods.OpenChannel) throw new Error('method: OpenChannel is not implemented') - const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - const request = req.body - const error = Types.OpenChannelRequestValidate(request) - stats.validate = process.hrtime.bigint() - if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback) - const response = await methods.OpenChannel({rpcName:'OpenChannel', ctx:authContext , req: request}) - stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'GetLnurlWithdrawLink': - try { - if (!methods.GetLnurlWithdrawLink) throw new Error('method: GetLnurlWithdrawLink is not implemented') - const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - stats.validate = stats.guard - const response = await methods.GetLnurlWithdrawLink({rpcName:'GetLnurlWithdrawLink', ctx:authContext }) - stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'GetLnurlPayLink': - try { - if (!methods.GetLnurlPayLink) throw new Error('method: GetLnurlPayLink is not implemented') - const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - stats.validate = stats.guard - const response = await methods.GetLnurlPayLink({rpcName:'GetLnurlPayLink', ctx:authContext }) - stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'GetLNURLChannelLink': - try { - if (!methods.GetLNURLChannelLink) throw new Error('method: GetLNURLChannelLink is not implemented') - const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - stats.validate = stats.guard - const response = await methods.GetLNURLChannelLink({rpcName:'GetLNURLChannelLink', ctx:authContext }) - stats.handle = process.hrtime.bigint() - res({status: 'OK', ...response}) - opts.metricsCallback([{ ...info, ...stats, ...authContext }]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'GetLiveUserOperations': - try { - if (!methods.GetLiveUserOperations) throw new Error('method: GetLiveUserOperations is not implemented') - const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - stats.validate = stats.guard - methods.GetLiveUserOperations({rpcName:'GetLiveUserOperations', ctx:authContext ,cb: (response, err) => { - stats.handle = process.hrtime.bigint() - if (err) { logErrorAndReturnResponse(err, err.message, res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback)} else { res({status: 'OK', ...response});opts.metricsCallback([{ ...info, ...stats, ...authContext }])} - }}) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); 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) - stats.guard = process.hrtime.bigint() - authCtx = authContext - stats.validate = stats.guard - methods.GetMigrationUpdate({rpcName:'GetMigrationUpdate', ctx:authContext ,cb: (response, err) => { - stats.handle = process.hrtime.bigint() - if (err) { logErrorAndReturnResponse(err, err.message, res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback)} else { res({status: 'OK', ...response});opts.metricsCallback([{ ...info, ...stats, ...authContext }])} - }}) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'GetHttpCreds': - try { - if (!methods.GetHttpCreds) throw new Error('method: GetHttpCreds is not implemented') - const authContext = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = authContext - stats.validate = stats.guard - methods.GetHttpCreds({rpcName:'GetHttpCreds', ctx:authContext ,cb: (response, err) => { - stats.handle = process.hrtime.bigint() - if (err) { logErrorAndReturnResponse(err, err.message, res, logger, { ...info, ...stats, ...authContext }, opts.metricsCallback)} else { res({status: 'OK', ...response});opts.metricsCallback([{ ...info, ...stats, ...authContext }])} - }}) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); if (opts.throwErrors) throw e } - break - case 'BatchUser': - try { - info.batch = true - const requests = req.body.requests as Types.UserMethodInputs[] - if (!Array.isArray(requests))throw new Error('invalid body, is not an array') - info.batchSize = requests.length - if (requests.length > 10) throw new Error('too many requests in the batch') - const ctx = await opts.NostrUserAuthGuard(req.appId, req.authIdentifier) - stats.guard = process.hrtime.bigint() - authCtx = ctx - stats.validate = stats.guard - const responses = [] - const callsMetrics: Types.RequestMetric[] = [] - for (let i = 0; i < requests.length; i++) { - const operation = requests[i] - const opInfo: Types.RequestInfo = { rpcName: operation.rpcName, batch: true, nostr: true, batchSize: 0 } - const opStats: Types.RequestStats = { startMs, start: startTime, parse: stats.parse, guard: stats.guard, validate: 0n, handle: 0n } - try { - switch(operation.rpcName) { - case 'EnrollAdminToken': - if (!methods.EnrollAdminToken) { - throw new Error('method not defined: EnrollAdminToken') - } else { - const error = Types.EnrollAdminTokenRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - await methods.EnrollAdminToken({...operation, ctx}); responses.push({ status: 'OK' }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'UserHealth': - if (!methods.UserHealth) { - throw new Error('method not defined: UserHealth') - } else { - opStats.validate = opStats.guard - await methods.UserHealth({...operation, ctx}); responses.push({ status: 'OK' }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'GetUserInfo': - if (!methods.GetUserInfo) { - throw new Error('method not defined: GetUserInfo') - } else { - opStats.validate = opStats.guard - const res = await methods.GetUserInfo({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'AddProduct': - if (!methods.AddProduct) { - throw new Error('method not defined: AddProduct') - } else { - const error = Types.AddProductRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - const res = await methods.AddProduct({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'NewProductInvoice': - if (!methods.NewProductInvoice) { - throw new Error('method not defined: NewProductInvoice') - } else { - opStats.validate = opStats.guard - const res = await methods.NewProductInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'GetUserOperations': - if (!methods.GetUserOperations) { - throw new Error('method not defined: GetUserOperations') - } else { - const error = Types.GetUserOperationsRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - const res = await methods.GetUserOperations({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'NewAddress': - if (!methods.NewAddress) { - throw new Error('method not defined: NewAddress') - } else { - const error = Types.NewAddressRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - const res = await methods.NewAddress({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'PayAddress': - if (!methods.PayAddress) { - throw new Error('method not defined: PayAddress') - } else { - const error = Types.PayAddressRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - const res = await methods.PayAddress({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'NewInvoice': - if (!methods.NewInvoice) { - throw new Error('method not defined: NewInvoice') - } else { - const error = Types.NewInvoiceRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - const res = await methods.NewInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'DecodeInvoice': - if (!methods.DecodeInvoice) { - throw new Error('method not defined: DecodeInvoice') - } else { - const error = Types.DecodeInvoiceRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - const res = await methods.DecodeInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'PayInvoice': - if (!methods.PayInvoice) { - throw new Error('method not defined: PayInvoice') - } else { - const error = Types.PayInvoiceRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - const res = await methods.PayInvoice({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'GetPaymentState': - if (!methods.GetPaymentState) { - throw new Error('method not defined: GetPaymentState') - } else { - const error = Types.GetPaymentStateRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - const res = await methods.GetPaymentState({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'OpenChannel': - if (!methods.OpenChannel) { - throw new Error('method not defined: OpenChannel') - } else { - const error = Types.OpenChannelRequestValidate(operation.req) - opStats.validate = process.hrtime.bigint() - if (error !== null) throw error - const res = await methods.OpenChannel({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'GetLnurlWithdrawLink': - if (!methods.GetLnurlWithdrawLink) { - throw new Error('method not defined: GetLnurlWithdrawLink') - } else { - opStats.validate = opStats.guard - const res = await methods.GetLnurlWithdrawLink({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'GetLnurlPayLink': - if (!methods.GetLnurlPayLink) { - throw new Error('method not defined: GetLnurlPayLink') - } else { - opStats.validate = opStats.guard - const res = await methods.GetLnurlPayLink({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - case 'GetLNURLChannelLink': - if (!methods.GetLNURLChannelLink) { - throw new Error('method not defined: GetLNURLChannelLink') - } else { - opStats.validate = opStats.guard - const res = await methods.GetLNURLChannelLink({...operation, ctx}); responses.push({ status: 'OK', ...res }) - opStats.handle = process.hrtime.bigint() - callsMetrics.push({ ...opInfo, ...opStats, ...ctx }) - } - break - default: - throw new Error('unkown rpcName') - } - } catch(ex) {const e = ex as any; logger.error(e.message || e); callsMetrics.push({ ...opInfo, ...opStats, ...ctx, error: e.message }); responses.push({ status: 'ERROR', reason: e.message || e })} - } - stats.handle = process.hrtime.bigint() - res({ status: 'OK', responses }) - opts.metricsCallback([{ ...info, ...stats, ...ctx }, ...callsMetrics]) - }catch(ex){ const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger, { ...info, ...stats, ...authCtx }, opts.metricsCallback); 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 b55dd09e..329d8c22 100644 --- a/proto/autogenerated/ts/types.ts +++ b/proto/autogenerated/ts/types.ts @@ -4,81 +4,111 @@ export type ResultError = { status: 'ERROR', reason: string } export type RequestInfo = { rpcName: string, batch: boolean, nostr: boolean, batchSize: number } export type RequestStats = { startMs:number, start:bigint, parse: bigint, guard: bigint, validate: bigint, handle: bigint } export type RequestMetric = AuthContext & RequestInfo & RequestStats & { error?: string } -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 -} -export type UserMethodInputs = EnrollAdminToken_Input | UserHealth_Input | GetUserInfo_Input | AddProduct_Input | NewProductInvoice_Input | GetUserOperations_Input | NewAddress_Input | PayAddress_Input | NewInvoice_Input | DecodeInvoice_Input | PayInvoice_Input | GetPaymentState_Input | OpenChannel_Input | GetLnurlWithdrawLink_Input | GetLnurlPayLink_Input | GetLNURLChannelLink_Input -export type UserMethodOutputs = EnrollAdminToken_Output | UserHealth_Output | GetUserInfo_Output | AddProduct_Output | NewProductInvoice_Output | GetUserOperations_Output | NewAddress_Output | PayAddress_Output | NewInvoice_Output | DecodeInvoice_Output | PayInvoice_Output | GetPaymentState_Output | OpenChannel_Output | GetLnurlWithdrawLink_Output | GetLnurlPayLink_Output | GetLNURLChannelLink_Output export type AdminContext = { admin_id: string } -export type AdminMethodInputs = LndGetInfo_Input | AddApp_Input | AuthApp_Input | BanUser_Input | GetSeed_Input | ListChannels_Input | CreateOneTimeInviteLink_Input | GetInviteLinkState_Input -export type AdminMethodOutputs = LndGetInfo_Output | AddApp_Output | AuthApp_Output | BanUser_Output | GetSeed_Output | ListChannels_Output | CreateOneTimeInviteLink_Output | GetInviteLinkState_Output -export type MetricsContext = { - operator_id: string -} -export type MetricsMethodInputs = GetUsageMetrics_Input | GetAppsMetrics_Input | GetLndMetrics_Input -export type MetricsMethodOutputs = GetUsageMetrics_Output | GetAppsMetrics_Output | GetLndMetrics_Output +export type AdminMethodInputs = AddApp_Input | AuthApp_Input | BanUser_Input | CreateOneTimeInviteLink_Input | GetInviteLinkState_Input | GetSeed_Input | ListChannels_Input | LndGetInfo_Input +export type AdminMethodOutputs = AddApp_Output | AuthApp_Output | BanUser_Output | CreateOneTimeInviteLink_Output | GetInviteLinkState_Output | GetSeed_Output | ListChannels_Output | LndGetInfo_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 | RequestNPubLinkingToken_Input | ResetNPubLinkingToken_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 | RequestNPubLinkingToken_Output | ResetNPubLinkingToken_Output +export type AppMethodInputs = AddAppInvoice_Input | AddAppUser_Input | AddAppUserInvoice_Input | GetApp_Input | GetAppUser_Input | GetAppUserLNURLInfo_Input | PayAppUserInvoice_Input | RequestNPubLinkingToken_Input | ResetNPubLinkingToken_Input | SendAppUserToAppPayment_Input | SendAppUserToAppUserPayment_Input | SetMockAppBalance_Input | SetMockAppUserBalance_Input +export type AppMethodOutputs = AddAppInvoice_Output | AddAppUser_Output | AddAppUserInvoice_Output | GetApp_Output | GetAppUser_Output | GetAppUserLNURLInfo_Output | PayAppUserInvoice_Output | RequestNPubLinkingToken_Output | ResetNPubLinkingToken_Output | SendAppUserToAppPayment_Output | SendAppUserToAppUserPayment_Output | SetMockAppBalance_Output | SetMockAppUserBalance_Output +export type GuestContext = { +} +export type GuestMethodInputs = EncryptionExchange_Input | GetLnurlPayInfo_Input | GetLnurlWithdrawInfo_Input | HandleLnurlAddress_Input | HandleLnurlPay_Input | HandleLnurlWithdraw_Input | Health_Input | SetMockInvoiceAsPaid_Input +export type GuestMethodOutputs = EncryptionExchange_Output | GetLnurlPayInfo_Output | GetLnurlWithdrawInfo_Output | HandleLnurlAddress_Output | HandleLnurlPay_Output | HandleLnurlWithdraw_Output | Health_Output | SetMockInvoiceAsPaid_Output export type GuestWithPubContext = { app_id: string pub: string } export type GuestWithPubMethodInputs = LinkNPubThroughToken_Input | UseInviteLink_Input export type GuestWithPubMethodOutputs = LinkNPubThroughToken_Output | UseInviteLink_Output -export type AuthContext = GuestContext | UserContext | AdminContext | MetricsContext | AppContext | GuestWithPubContext - -export type LndGetInfo_Input = {rpcName:'LndGetInfo', req: LndGetInfoRequest} -export type LndGetInfo_Output = ResultError | ({ status: 'OK' } & LndGetInfoResponse) +export type MetricsContext = { + operator_id: string +} +export type MetricsMethodInputs = GetAppsMetrics_Input | GetLndMetrics_Input | GetUsageMetrics_Input +export type MetricsMethodOutputs = GetAppsMetrics_Output | GetLndMetrics_Output | GetUsageMetrics_Output +export type UserContext = { + app_id: string + app_user_id: string + user_id: string +} +export type UserMethodInputs = AddProduct_Input | DecodeInvoice_Input | EnrollAdminToken_Input | GetLNURLChannelLink_Input | GetLnurlPayLink_Input | GetLnurlWithdrawLink_Input | GetPaymentState_Input | GetUserInfo_Input | GetUserOperations_Input | NewAddress_Input | NewInvoice_Input | NewProductInvoice_Input | OpenChannel_Input | PayAddress_Input | PayInvoice_Input | UserHealth_Input +export type UserMethodOutputs = AddProduct_Output | DecodeInvoice_Output | EnrollAdminToken_Output | GetLNURLChannelLink_Output | GetLnurlPayLink_Output | GetLnurlWithdrawLink_Output | GetPaymentState_Output | GetUserInfo_Output | GetUserOperations_Output | NewAddress_Output | NewInvoice_Output | NewProductInvoice_Output | OpenChannel_Output | PayAddress_Output | PayInvoice_Output | UserHealth_Output +export type AuthContext = AdminContext | AppContext | GuestContext | GuestWithPubContext | MetricsContext | UserContext export type AddApp_Input = {rpcName:'AddApp', req: AddAppRequest} export type AddApp_Output = ResultError | ({ status: 'OK' } & AuthApp) +export type AddAppInvoice_Input = {rpcName:'AddAppInvoice', req: AddAppInvoiceRequest} +export type AddAppInvoice_Output = ResultError | ({ status: 'OK' } & NewInvoiceResponse) + +export type AddAppUser_Input = {rpcName:'AddAppUser', req: AddAppUserRequest} +export type AddAppUser_Output = ResultError | ({ status: 'OK' } & AppUser) + +export type AddAppUserInvoice_Input = {rpcName:'AddAppUserInvoice', req: AddAppUserInvoiceRequest} +export type AddAppUserInvoice_Output = ResultError | ({ status: 'OK' } & NewInvoiceResponse) + +export type AddProduct_Input = {rpcName:'AddProduct', req: AddProductRequest} +export type AddProduct_Output = ResultError | ({ status: 'OK' } & Product) + export type AuthApp_Input = {rpcName:'AuthApp', req: AuthAppRequest} export type AuthApp_Output = ResultError | ({ status: 'OK' } & AuthApp) export type BanUser_Input = {rpcName:'BanUser', req: BanUserRequest} export type BanUser_Output = ResultError | ({ status: 'OK' } & BanUserResponse) -export type GetSeed_Input = {rpcName:'GetSeed'} -export type GetSeed_Output = ResultError | ({ status: 'OK' } & LndSeed) - -export type ListChannels_Input = {rpcName:'ListChannels'} -export type ListChannels_Output = ResultError | ({ status: 'OK' } & LndChannels) - -export type GetUsageMetrics_Input = {rpcName:'GetUsageMetrics'} -export type GetUsageMetrics_Output = ResultError | ({ status: 'OK' } & UsageMetrics) - -export type GetAppsMetrics_Input = {rpcName:'GetAppsMetrics', req: AppsMetricsRequest} -export type GetAppsMetrics_Output = ResultError | ({ status: 'OK' } & AppsMetrics) - -export type GetLndMetrics_Input = {rpcName:'GetLndMetrics', req: LndMetricsRequest} -export type GetLndMetrics_Output = ResultError | ({ status: 'OK' } & LndMetrics) +export type BatchUser_Input = UserMethodInputs +export type BatchUser_Output = UserMethodOutputs export type CreateOneTimeInviteLink_Input = {rpcName:'CreateOneTimeInviteLink', req: CreateOneTimeInviteLinkRequest} export type CreateOneTimeInviteLink_Output = ResultError | ({ status: 'OK' } & CreateOneTimeInviteLinkResponse) -export type GetInviteLinkState_Input = {rpcName:'GetInviteLinkState', req: GetInviteTokenStateRequest} -export type GetInviteLinkState_Output = ResultError | ({ status: 'OK' } & GetInviteTokenStateResponse) - -export type Health_Input = {rpcName:'Health'} -export type Health_Output = ResultError | { status: 'OK' } +export type DecodeInvoice_Input = {rpcName:'DecodeInvoice', req: DecodeInvoiceRequest} +export type DecodeInvoice_Output = ResultError | ({ status: 'OK' } & DecodeInvoiceResponse) export type EncryptionExchange_Input = {rpcName:'EncryptionExchange', req: EncryptionExchangeRequest} export type EncryptionExchange_Output = ResultError | { status: 'OK' } -export type SetMockInvoiceAsPaid_Input = {rpcName:'SetMockInvoiceAsPaid', req: SetMockInvoiceAsPaidRequest} -export type SetMockInvoiceAsPaid_Output = ResultError | { status: 'OK' } +export type EnrollAdminToken_Input = {rpcName:'EnrollAdminToken', req: EnrollAdminTokenRequest} +export type EnrollAdminToken_Output = ResultError | { status: 'OK' } + +export type GetApp_Input = {rpcName:'GetApp'} +export type GetApp_Output = ResultError | ({ status: 'OK' } & Application) + +export type GetAppUser_Input = {rpcName:'GetAppUser', req: GetAppUserRequest} +export type GetAppUser_Output = ResultError | ({ status: 'OK' } & AppUser) + +export type GetAppUserLNURLInfo_Input = {rpcName:'GetAppUserLNURLInfo', req: GetAppUserLNURLInfoRequest} +export type GetAppUserLNURLInfo_Output = ResultError | ({ status: 'OK' } & LnurlPayInfoResponse) + +export type GetAppsMetrics_Input = {rpcName:'GetAppsMetrics', req: AppsMetricsRequest} +export type GetAppsMetrics_Output = ResultError | ({ status: 'OK' } & AppsMetrics) + +export type GetHttpCreds_Input = {rpcName:'GetHttpCreds', cb:(res: HttpCreds, err:Error|null)=> void} +export type GetHttpCreds_Output = ResultError | { status: 'OK' } + +export type GetInviteLinkState_Input = {rpcName:'GetInviteLinkState', req: GetInviteTokenStateRequest} +export type GetInviteLinkState_Output = ResultError | ({ status: 'OK' } & GetInviteTokenStateResponse) + +export type GetLNURLChannelLink_Input = {rpcName:'GetLNURLChannelLink'} +export type GetLNURLChannelLink_Output = ResultError | ({ status: 'OK' } & LnurlLinkResponse) + +export type GetLiveUserOperations_Input = {rpcName:'GetLiveUserOperations', cb:(res: LiveUserOperation, err:Error|null)=> void} +export type GetLiveUserOperations_Output = ResultError | { status: 'OK' } + +export type GetLndMetrics_Input = {rpcName:'GetLndMetrics', req: LndMetricsRequest} +export type GetLndMetrics_Output = ResultError | ({ status: 'OK' } & LndMetrics) + +export type GetLnurlPayInfo_Query = { + k1?: string +} +export type GetLnurlPayInfo_Input = {rpcName:'GetLnurlPayInfo', query: GetLnurlPayInfo_Query} +export type GetLnurlPayInfo_Output = ResultError | ({ status: 'OK' } & LnurlPayInfoResponse) + +export type GetLnurlPayLink_Input = {rpcName:'GetLnurlPayLink'} +export type GetLnurlPayLink_Output = ResultError | ({ status: 'OK' } & LnurlLinkResponse) export type GetLnurlWithdrawInfo_Query = { k1?: string @@ -86,6 +116,42 @@ export type GetLnurlWithdrawInfo_Query = { export type GetLnurlWithdrawInfo_Input = {rpcName:'GetLnurlWithdrawInfo', query: GetLnurlWithdrawInfo_Query} export type GetLnurlWithdrawInfo_Output = ResultError | ({ status: 'OK' } & LnurlWithdrawInfoResponse) +export type GetLnurlWithdrawLink_Input = {rpcName:'GetLnurlWithdrawLink'} +export type GetLnurlWithdrawLink_Output = ResultError | ({ status: 'OK' } & LnurlLinkResponse) + +export type GetMigrationUpdate_Input = {rpcName:'GetMigrationUpdate', cb:(res: MigrationUpdate, err:Error|null)=> void} +export type GetMigrationUpdate_Output = ResultError | { status: 'OK' } + +export type GetPaymentState_Input = {rpcName:'GetPaymentState', req: GetPaymentStateRequest} +export type GetPaymentState_Output = ResultError | ({ status: 'OK' } & PaymentState) + +export type GetSeed_Input = {rpcName:'GetSeed'} +export type GetSeed_Output = ResultError | ({ status: 'OK' } & LndSeed) + +export type GetUsageMetrics_Input = {rpcName:'GetUsageMetrics'} +export type GetUsageMetrics_Output = ResultError | ({ status: 'OK' } & UsageMetrics) + +export type GetUserInfo_Input = {rpcName:'GetUserInfo'} +export type GetUserInfo_Output = ResultError | ({ status: 'OK' } & UserInfo) + +export type GetUserOperations_Input = {rpcName:'GetUserOperations', req: GetUserOperationsRequest} +export type GetUserOperations_Output = ResultError | ({ status: 'OK' } & GetUserOperationsResponse) + +export type HandleLnurlAddress_RouteParams = { + address_name: string +} +export type HandleLnurlAddress_Input = {rpcName:'HandleLnurlAddress', params: HandleLnurlAddress_RouteParams} +export type HandleLnurlAddress_Output = ResultError | ({ status: 'OK' } & LnurlPayInfoResponse) + +export type HandleLnurlPay_Query = { + amount?: string + k1?: string + lnurl?: string + nostr?: string +} +export type HandleLnurlPay_Input = {rpcName:'HandleLnurlPay', query: HandleLnurlPay_Query} +export type HandleLnurlPay_Output = ResultError | ({ status: 'OK' } & HandleLnurlPayResponse) + export type HandleLnurlWithdraw_Query = { k1?: string pr?: string @@ -93,83 +159,23 @@ export type HandleLnurlWithdraw_Query = { export type HandleLnurlWithdraw_Input = {rpcName:'HandleLnurlWithdraw', query: HandleLnurlWithdraw_Query} export type HandleLnurlWithdraw_Output = ResultError | { status: 'OK' } -export type GetLnurlPayInfo_Query = { - k1?: string -} -export type GetLnurlPayInfo_Input = {rpcName:'GetLnurlPayInfo', query: GetLnurlPayInfo_Query} -export type GetLnurlPayInfo_Output = ResultError | ({ status: 'OK' } & LnurlPayInfoResponse) - -export type HandleLnurlPay_Query = { - k1?: string - amount?: string - nostr?: string - lnurl?: string -} -export type HandleLnurlPay_Input = {rpcName:'HandleLnurlPay', query: HandleLnurlPay_Query} -export type HandleLnurlPay_Output = ResultError | ({ status: 'OK' } & HandleLnurlPayResponse) - -export type HandleLnurlAddress_RouteParams = { - address_name: string -} -export type HandleLnurlAddress_Input = {rpcName:'HandleLnurlAddress', params: HandleLnurlAddress_RouteParams} -export type HandleLnurlAddress_Output = ResultError | ({ status: 'OK' } & LnurlPayInfoResponse) - -export type EnrollAdminToken_Input = {rpcName:'EnrollAdminToken', req: EnrollAdminTokenRequest} -export type EnrollAdminToken_Output = ResultError | { status: 'OK' } +export type Health_Input = {rpcName:'Health'} +export type Health_Output = ResultError | { status: 'OK' } export type LinkNPubThroughToken_Input = {rpcName:'LinkNPubThroughToken', req: LinkNPubThroughTokenRequest} export type LinkNPubThroughToken_Output = ResultError | { status: 'OK' } -export type UseInviteLink_Input = {rpcName:'UseInviteLink', req: UseInviteLinkRequest} -export type UseInviteLink_Output = ResultError | { status: 'OK' } +export type ListChannels_Input = {rpcName:'ListChannels'} +export type ListChannels_Output = ResultError | ({ status: 'OK' } & LndChannels) -export type GetApp_Input = {rpcName:'GetApp'} -export type GetApp_Output = ResultError | ({ status: 'OK' } & Application) +export type LndGetInfo_Input = {rpcName:'LndGetInfo', req: LndGetInfoRequest} +export type LndGetInfo_Output = ResultError | ({ status: 'OK' } & LndGetInfoResponse) -export type AddAppUser_Input = {rpcName:'AddAppUser', req: AddAppUserRequest} -export type AddAppUser_Output = ResultError | ({ status: 'OK' } & AppUser) +export type NewAddress_Input = {rpcName:'NewAddress', req: NewAddressRequest} +export type NewAddress_Output = ResultError | ({ status: 'OK' } & NewAddressResponse) -export type AddAppInvoice_Input = {rpcName:'AddAppInvoice', req: AddAppInvoiceRequest} -export type AddAppInvoice_Output = ResultError | ({ status: 'OK' } & NewInvoiceResponse) - -export type AddAppUserInvoice_Input = {rpcName:'AddAppUserInvoice', req: AddAppUserInvoiceRequest} -export type AddAppUserInvoice_Output = ResultError | ({ status: 'OK' } & NewInvoiceResponse) - -export type GetAppUser_Input = {rpcName:'GetAppUser', req: GetAppUserRequest} -export type GetAppUser_Output = ResultError | ({ status: 'OK' } & AppUser) - -export type PayAppUserInvoice_Input = {rpcName:'PayAppUserInvoice', req: PayAppUserInvoiceRequest} -export type PayAppUserInvoice_Output = ResultError | ({ status: 'OK' } & PayInvoiceResponse) - -export type SendAppUserToAppUserPayment_Input = {rpcName:'SendAppUserToAppUserPayment', req: SendAppUserToAppUserPaymentRequest} -export type SendAppUserToAppUserPayment_Output = ResultError | { status: 'OK' } - -export type SendAppUserToAppPayment_Input = {rpcName:'SendAppUserToAppPayment', req: SendAppUserToAppPaymentRequest} -export type SendAppUserToAppPayment_Output = ResultError | { status: 'OK' } - -export type GetAppUserLNURLInfo_Input = {rpcName:'GetAppUserLNURLInfo', req: GetAppUserLNURLInfoRequest} -export type GetAppUserLNURLInfo_Output = ResultError | ({ status: 'OK' } & LnurlPayInfoResponse) - -export type SetMockAppUserBalance_Input = {rpcName:'SetMockAppUserBalance', req: SetMockAppUserBalanceRequest} -export type SetMockAppUserBalance_Output = ResultError | { status: 'OK' } - -export type SetMockAppBalance_Input = {rpcName:'SetMockAppBalance', req: SetMockAppBalanceRequest} -export type SetMockAppBalance_Output = ResultError | { status: 'OK' } - -export type RequestNPubLinkingToken_Input = {rpcName:'RequestNPubLinkingToken', req: RequestNPubLinkingTokenRequest} -export type RequestNPubLinkingToken_Output = ResultError | ({ status: 'OK' } & RequestNPubLinkingTokenResponse) - -export type ResetNPubLinkingToken_Input = {rpcName:'ResetNPubLinkingToken', req: RequestNPubLinkingTokenRequest} -export type ResetNPubLinkingToken_Output = ResultError | ({ status: 'OK' } & RequestNPubLinkingTokenResponse) - -export type UserHealth_Input = {rpcName:'UserHealth'} -export type UserHealth_Output = ResultError | { status: 'OK' } - -export type GetUserInfo_Input = {rpcName:'GetUserInfo'} -export type GetUserInfo_Output = ResultError | ({ status: 'OK' } & UserInfo) - -export type AddProduct_Input = {rpcName:'AddProduct', req: AddProductRequest} -export type AddProduct_Output = ResultError | ({ status: 'OK' } & Product) +export type NewInvoice_Input = {rpcName:'NewInvoice', req: NewInvoiceRequest} +export type NewInvoice_Output = ResultError | ({ status: 'OK' } & NewInvoiceResponse) export type NewProductInvoice_Query = { id?: string @@ -177,123 +183,117 @@ export type NewProductInvoice_Query = { export type NewProductInvoice_Input = {rpcName:'NewProductInvoice', query: NewProductInvoice_Query} export type NewProductInvoice_Output = ResultError | ({ status: 'OK' } & NewInvoiceResponse) -export type GetUserOperations_Input = {rpcName:'GetUserOperations', req: GetUserOperationsRequest} -export type GetUserOperations_Output = ResultError | ({ status: 'OK' } & GetUserOperationsResponse) - -export type NewAddress_Input = {rpcName:'NewAddress', req: NewAddressRequest} -export type NewAddress_Output = ResultError | ({ status: 'OK' } & NewAddressResponse) +export type OpenChannel_Input = {rpcName:'OpenChannel', req: OpenChannelRequest} +export type OpenChannel_Output = ResultError | ({ status: 'OK' } & OpenChannelResponse) export type PayAddress_Input = {rpcName:'PayAddress', req: PayAddressRequest} export type PayAddress_Output = ResultError | ({ status: 'OK' } & PayAddressResponse) -export type NewInvoice_Input = {rpcName:'NewInvoice', req: NewInvoiceRequest} -export type NewInvoice_Output = ResultError | ({ status: 'OK' } & NewInvoiceResponse) - -export type DecodeInvoice_Input = {rpcName:'DecodeInvoice', req: DecodeInvoiceRequest} -export type DecodeInvoice_Output = ResultError | ({ status: 'OK' } & DecodeInvoiceResponse) +export type PayAppUserInvoice_Input = {rpcName:'PayAppUserInvoice', req: PayAppUserInvoiceRequest} +export type PayAppUserInvoice_Output = ResultError | ({ status: 'OK' } & PayInvoiceResponse) export type PayInvoice_Input = {rpcName:'PayInvoice', req: PayInvoiceRequest} export type PayInvoice_Output = ResultError | ({ status: 'OK' } & PayInvoiceResponse) -export type GetPaymentState_Input = {rpcName:'GetPaymentState', req: GetPaymentStateRequest} -export type GetPaymentState_Output = ResultError | ({ status: 'OK' } & PaymentState) +export type RequestNPubLinkingToken_Input = {rpcName:'RequestNPubLinkingToken', req: RequestNPubLinkingTokenRequest} +export type RequestNPubLinkingToken_Output = ResultError | ({ status: 'OK' } & RequestNPubLinkingTokenResponse) -export type OpenChannel_Input = {rpcName:'OpenChannel', req: OpenChannelRequest} -export type OpenChannel_Output = ResultError | ({ status: 'OK' } & OpenChannelResponse) +export type ResetNPubLinkingToken_Input = {rpcName:'ResetNPubLinkingToken', req: RequestNPubLinkingTokenRequest} +export type ResetNPubLinkingToken_Output = ResultError | ({ status: 'OK' } & RequestNPubLinkingTokenResponse) -export type GetLnurlWithdrawLink_Input = {rpcName:'GetLnurlWithdrawLink'} -export type GetLnurlWithdrawLink_Output = ResultError | ({ status: 'OK' } & LnurlLinkResponse) +export type SendAppUserToAppPayment_Input = {rpcName:'SendAppUserToAppPayment', req: SendAppUserToAppPaymentRequest} +export type SendAppUserToAppPayment_Output = ResultError | { status: 'OK' } -export type GetLnurlPayLink_Input = {rpcName:'GetLnurlPayLink'} -export type GetLnurlPayLink_Output = ResultError | ({ status: 'OK' } & LnurlLinkResponse) +export type SendAppUserToAppUserPayment_Input = {rpcName:'SendAppUserToAppUserPayment', req: SendAppUserToAppUserPaymentRequest} +export type SendAppUserToAppUserPayment_Output = ResultError | { status: 'OK' } -export type GetLNURLChannelLink_Input = {rpcName:'GetLNURLChannelLink'} -export type GetLNURLChannelLink_Output = ResultError | ({ status: 'OK' } & LnurlLinkResponse) +export type SetMockAppBalance_Input = {rpcName:'SetMockAppBalance', req: SetMockAppBalanceRequest} +export type SetMockAppBalance_Output = ResultError | { status: 'OK' } -export type GetLiveUserOperations_Input = {rpcName:'GetLiveUserOperations', cb:(res: LiveUserOperation, err:Error|null)=> void} -export type GetLiveUserOperations_Output = ResultError | { status: 'OK' } +export type SetMockAppUserBalance_Input = {rpcName:'SetMockAppUserBalance', req: SetMockAppUserBalanceRequest} +export type SetMockAppUserBalance_Output = ResultError | { status: 'OK' } -export type GetMigrationUpdate_Input = {rpcName:'GetMigrationUpdate', cb:(res: MigrationUpdate, err:Error|null)=> void} -export type GetMigrationUpdate_Output = ResultError | { status: 'OK' } +export type SetMockInvoiceAsPaid_Input = {rpcName:'SetMockInvoiceAsPaid', req: SetMockInvoiceAsPaidRequest} +export type SetMockInvoiceAsPaid_Output = ResultError | { status: 'OK' } -export type GetHttpCreds_Input = {rpcName:'GetHttpCreds', cb:(res: HttpCreds, err:Error|null)=> void} -export type GetHttpCreds_Output = ResultError | { status: 'OK' } +export type UseInviteLink_Input = {rpcName:'UseInviteLink', req: UseInviteLinkRequest} +export type UseInviteLink_Output = ResultError | { status: 'OK' } -export type BatchUser_Input = UserMethodInputs -export type BatchUser_Output = UserMethodOutputs +export type UserHealth_Input = {rpcName:'UserHealth'} +export type UserHealth_Output = ResultError | { status: 'OK' } export type ServerMethods = { - LndGetInfo?: (req: LndGetInfo_Input & {ctx: AdminContext }) => Promise AddApp?: (req: AddApp_Input & {ctx: AdminContext }) => Promise + AddAppInvoice?: (req: AddAppInvoice_Input & {ctx: AppContext }) => Promise + AddAppUser?: (req: AddAppUser_Input & {ctx: AppContext }) => Promise + AddAppUserInvoice?: (req: AddAppUserInvoice_Input & {ctx: AppContext }) => Promise + AddProduct?: (req: AddProduct_Input & {ctx: UserContext }) => Promise AuthApp?: (req: AuthApp_Input & {ctx: AdminContext }) => Promise BanUser?: (req: BanUser_Input & {ctx: AdminContext }) => Promise - GetSeed?: (req: GetSeed_Input & {ctx: AdminContext }) => Promise - ListChannels?: (req: ListChannels_Input & {ctx: AdminContext }) => Promise - GetUsageMetrics?: (req: GetUsageMetrics_Input & {ctx: MetricsContext }) => Promise - GetAppsMetrics?: (req: GetAppsMetrics_Input & {ctx: MetricsContext }) => Promise - GetLndMetrics?: (req: GetLndMetrics_Input & {ctx: MetricsContext }) => Promise CreateOneTimeInviteLink?: (req: CreateOneTimeInviteLink_Input & {ctx: AdminContext }) => Promise - GetInviteLinkState?: (req: GetInviteLinkState_Input & {ctx: AdminContext }) => Promise - Health?: (req: Health_Input & {ctx: GuestContext }) => Promise - EncryptionExchange?: (req: EncryptionExchange_Input & {ctx: GuestContext }) => Promise - SetMockInvoiceAsPaid?: (req: SetMockInvoiceAsPaid_Input & {ctx: GuestContext }) => Promise - GetLnurlWithdrawInfo?: (req: GetLnurlWithdrawInfo_Input & {ctx: GuestContext }) => Promise - HandleLnurlWithdraw?: (req: HandleLnurlWithdraw_Input & {ctx: GuestContext }) => Promise - GetLnurlPayInfo?: (req: GetLnurlPayInfo_Input & {ctx: GuestContext }) => Promise - HandleLnurlPay?: (req: HandleLnurlPay_Input & {ctx: GuestContext }) => Promise - HandleLnurlAddress?: (req: HandleLnurlAddress_Input & {ctx: GuestContext }) => Promise - EnrollAdminToken?: (req: EnrollAdminToken_Input & {ctx: UserContext }) => Promise - LinkNPubThroughToken?: (req: LinkNPubThroughToken_Input & {ctx: GuestWithPubContext }) => Promise - UseInviteLink?: (req: UseInviteLink_Input & {ctx: GuestWithPubContext }) => Promise - GetApp?: (req: GetApp_Input & {ctx: AppContext }) => Promise - AddAppUser?: (req: AddAppUser_Input & {ctx: AppContext }) => Promise - AddAppInvoice?: (req: AddAppInvoice_Input & {ctx: AppContext }) => Promise - AddAppUserInvoice?: (req: AddAppUserInvoice_Input & {ctx: AppContext }) => Promise - GetAppUser?: (req: GetAppUser_Input & {ctx: AppContext }) => Promise - PayAppUserInvoice?: (req: PayAppUserInvoice_Input & {ctx: AppContext }) => Promise - SendAppUserToAppUserPayment?: (req: SendAppUserToAppUserPayment_Input & {ctx: AppContext }) => Promise - SendAppUserToAppPayment?: (req: SendAppUserToAppPayment_Input & {ctx: AppContext }) => Promise - GetAppUserLNURLInfo?: (req: GetAppUserLNURLInfo_Input & {ctx: AppContext }) => Promise - SetMockAppUserBalance?: (req: SetMockAppUserBalance_Input & {ctx: AppContext }) => Promise - SetMockAppBalance?: (req: SetMockAppBalance_Input & {ctx: AppContext }) => Promise - RequestNPubLinkingToken?: (req: RequestNPubLinkingToken_Input & {ctx: AppContext }) => Promise - ResetNPubLinkingToken?: (req: ResetNPubLinkingToken_Input & {ctx: AppContext }) => Promise - UserHealth?: (req: UserHealth_Input & {ctx: UserContext }) => Promise - GetUserInfo?: (req: GetUserInfo_Input & {ctx: UserContext }) => Promise - AddProduct?: (req: AddProduct_Input & {ctx: UserContext }) => Promise - NewProductInvoice?: (req: NewProductInvoice_Input & {ctx: UserContext }) => Promise - GetUserOperations?: (req: GetUserOperations_Input & {ctx: UserContext }) => Promise - NewAddress?: (req: NewAddress_Input & {ctx: UserContext }) => Promise - PayAddress?: (req: PayAddress_Input & {ctx: UserContext }) => Promise - NewInvoice?: (req: NewInvoice_Input & {ctx: UserContext }) => Promise DecodeInvoice?: (req: DecodeInvoice_Input & {ctx: UserContext }) => Promise - PayInvoice?: (req: PayInvoice_Input & {ctx: UserContext }) => Promise - GetPaymentState?: (req: GetPaymentState_Input & {ctx: UserContext }) => Promise - OpenChannel?: (req: OpenChannel_Input & {ctx: UserContext }) => Promise - GetLnurlWithdrawLink?: (req: GetLnurlWithdrawLink_Input & {ctx: UserContext }) => Promise - GetLnurlPayLink?: (req: GetLnurlPayLink_Input & {ctx: UserContext }) => Promise + EncryptionExchange?: (req: EncryptionExchange_Input & {ctx: GuestContext }) => Promise + EnrollAdminToken?: (req: EnrollAdminToken_Input & {ctx: UserContext }) => Promise + GetApp?: (req: GetApp_Input & {ctx: AppContext }) => Promise + GetAppUser?: (req: GetAppUser_Input & {ctx: AppContext }) => Promise + GetAppUserLNURLInfo?: (req: GetAppUserLNURLInfo_Input & {ctx: AppContext }) => Promise + GetAppsMetrics?: (req: GetAppsMetrics_Input & {ctx: MetricsContext }) => Promise + GetHttpCreds?: (req: GetHttpCreds_Input & {ctx: UserContext }) => Promise + GetInviteLinkState?: (req: GetInviteLinkState_Input & {ctx: AdminContext }) => Promise GetLNURLChannelLink?: (req: GetLNURLChannelLink_Input & {ctx: UserContext }) => Promise GetLiveUserOperations?: (req: GetLiveUserOperations_Input & {ctx: UserContext }) => Promise + GetLndMetrics?: (req: GetLndMetrics_Input & {ctx: MetricsContext }) => Promise + GetLnurlPayInfo?: (req: GetLnurlPayInfo_Input & {ctx: GuestContext }) => Promise + GetLnurlPayLink?: (req: GetLnurlPayLink_Input & {ctx: UserContext }) => Promise + GetLnurlWithdrawInfo?: (req: GetLnurlWithdrawInfo_Input & {ctx: GuestContext }) => Promise + GetLnurlWithdrawLink?: (req: GetLnurlWithdrawLink_Input & {ctx: UserContext }) => Promise GetMigrationUpdate?: (req: GetMigrationUpdate_Input & {ctx: UserContext }) => Promise - GetHttpCreds?: (req: GetHttpCreds_Input & {ctx: UserContext }) => Promise + GetPaymentState?: (req: GetPaymentState_Input & {ctx: UserContext }) => Promise + GetSeed?: (req: GetSeed_Input & {ctx: AdminContext }) => Promise + GetUsageMetrics?: (req: GetUsageMetrics_Input & {ctx: MetricsContext }) => Promise + GetUserInfo?: (req: GetUserInfo_Input & {ctx: UserContext }) => Promise + GetUserOperations?: (req: GetUserOperations_Input & {ctx: UserContext }) => Promise + HandleLnurlAddress?: (req: HandleLnurlAddress_Input & {ctx: GuestContext }) => Promise + HandleLnurlPay?: (req: HandleLnurlPay_Input & {ctx: GuestContext }) => Promise + HandleLnurlWithdraw?: (req: HandleLnurlWithdraw_Input & {ctx: GuestContext }) => Promise + Health?: (req: Health_Input & {ctx: GuestContext }) => Promise + LinkNPubThroughToken?: (req: LinkNPubThroughToken_Input & {ctx: GuestWithPubContext }) => Promise + ListChannels?: (req: ListChannels_Input & {ctx: AdminContext }) => Promise + LndGetInfo?: (req: LndGetInfo_Input & {ctx: AdminContext }) => Promise + NewAddress?: (req: NewAddress_Input & {ctx: UserContext }) => Promise + NewInvoice?: (req: NewInvoice_Input & {ctx: UserContext }) => Promise + NewProductInvoice?: (req: NewProductInvoice_Input & {ctx: UserContext }) => Promise + OpenChannel?: (req: OpenChannel_Input & {ctx: UserContext }) => Promise + PayAddress?: (req: PayAddress_Input & {ctx: UserContext }) => Promise + PayAppUserInvoice?: (req: PayAppUserInvoice_Input & {ctx: AppContext }) => Promise + PayInvoice?: (req: PayInvoice_Input & {ctx: UserContext }) => Promise + RequestNPubLinkingToken?: (req: RequestNPubLinkingToken_Input & {ctx: AppContext }) => Promise + ResetNPubLinkingToken?: (req: ResetNPubLinkingToken_Input & {ctx: AppContext }) => Promise + SendAppUserToAppPayment?: (req: SendAppUserToAppPayment_Input & {ctx: AppContext }) => Promise + SendAppUserToAppUserPayment?: (req: SendAppUserToAppUserPayment_Input & {ctx: AppContext }) => Promise + SetMockAppBalance?: (req: SetMockAppBalance_Input & {ctx: AppContext }) => Promise + SetMockAppUserBalance?: (req: SetMockAppUserBalance_Input & {ctx: AppContext }) => Promise + SetMockInvoiceAsPaid?: (req: SetMockInvoiceAsPaid_Input & {ctx: GuestContext }) => Promise + UseInviteLink?: (req: UseInviteLink_Input & {ctx: GuestWithPubContext }) => Promise + UserHealth?: (req: UserHealth_Input & {ctx: UserContext }) => Promise } export enum AddressType { - WITNESS_PUBKEY_HASH = 'WITNESS_PUBKEY_HASH', NESTED_PUBKEY_HASH = 'NESTED_PUBKEY_HASH', TAPROOT_PUBKEY = 'TAPROOT_PUBKEY', + WITNESS_PUBKEY_HASH = 'WITNESS_PUBKEY_HASH', } export const enumCheckAddressType = (e?: AddressType): boolean => { for (const v in AddressType) if (e === v) return true return false } export enum UserOperationType { - INCOMING_TX = 'INCOMING_TX', - OUTGOING_TX = 'OUTGOING_TX', INCOMING_INVOICE = 'INCOMING_INVOICE', - OUTGOING_INVOICE = 'OUTGOING_INVOICE', - OUTGOING_USER_TO_USER = 'OUTGOING_USER_TO_USER', + INCOMING_TX = 'INCOMING_TX', INCOMING_USER_TO_USER = 'INCOMING_USER_TO_USER', + OUTGOING_INVOICE = 'OUTGOING_INVOICE', + OUTGOING_TX = 'OUTGOING_TX', + OUTGOING_USER_TO_USER = 'OUTGOING_USER_TO_USER', } export const enumCheckUserOperationType = (e?: UserOperationType): boolean => { for (const v in UserOperationType) if (e === v) return true @@ -304,58 +304,184 @@ export type OptionsBaseMessage = { allOptionalsAreSet?: true } -export type GetPaymentStateRequest = { - invoice: string +export type AddAppInvoiceRequest = { + http_callback_url: string + invoice_req: NewInvoiceRequest + payer_identifier: string } -export const GetPaymentStateRequestOptionalFields: [] = [] -export type GetPaymentStateRequestOptions = OptionsBaseMessage & { +export const AddAppInvoiceRequestOptionalFields: [] = [] +export type AddAppInvoiceRequestOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - invoice_CustomCheck?: (v: string) => boolean + http_callback_url_CustomCheck?: (v: string) => boolean + invoice_req_Options?: NewInvoiceRequestOptions + payer_identifier_CustomCheck?: (v: string) => boolean } -export const GetPaymentStateRequestValidate = (o?: GetPaymentStateRequest, opts: GetPaymentStateRequestOptions = {}, path: string = 'GetPaymentStateRequest::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.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.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 + + + 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`) + + return null +} + +export type AddAppRequest = { + allow_user_creation: boolean + name: string +} +export const AddAppRequestOptionalFields: [] = [] +export type AddAppRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + allow_user_creation_CustomCheck?: (v: boolean) => boolean + name_CustomCheck?: (v: string) => boolean +} +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.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`) + + 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`) + + return null +} + +export type AddAppUserInvoiceRequest = { + http_callback_url: string + invoice_req: NewInvoiceRequest + payer_identifier: string + receiver_identifier: string +} +export const AddAppUserInvoiceRequestOptionalFields: [] = [] +export type AddAppUserInvoiceRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + http_callback_url_CustomCheck?: (v: string) => boolean + invoice_req_Options?: NewInvoiceRequestOptions + payer_identifier_CustomCheck?: (v: string) => boolean + receiver_identifier_CustomCheck?: (v: string) => boolean +} +export const AddAppUserInvoiceRequestValidate = (o?: AddAppUserInvoiceRequest, opts: AddAppUserInvoiceRequestOptions = {}, path: string = 'AddAppUserInvoiceRequest::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.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 + + + 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.receiver_identifier !== 'string') return new Error(`${path}.receiver_identifier: is not a string`) + if (opts.receiver_identifier_CustomCheck && !opts.receiver_identifier_CustomCheck(o.receiver_identifier)) return new Error(`${path}.receiver_identifier: custom check failed`) + + return null +} + +export type AddAppUserRequest = { + balance: number + fail_if_exists: boolean + identifier: string +} +export const AddAppUserRequestOptionalFields: [] = [] +export type AddAppUserRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + balance_CustomCheck?: (v: number) => boolean + fail_if_exists_CustomCheck?: (v: boolean) => boolean + identifier_CustomCheck?: (v: string) => 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.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.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.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`) + + 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 AppMetrics = { - users: UsersInfo - invoices: number app: Application - spent: number available: number fees: number - total_fees: number + invoices: number operations: UserOperation[] received: number + spent: number + total_fees: number + users: UsersInfo } export const AppMetricsOptionalFields: [] = [] export type AppMetricsOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] app_Options?: ApplicationOptions - users_Options?: UsersInfoOptions + available_CustomCheck?: (v: number) => boolean + fees_CustomCheck?: (v: number) => boolean invoices_CustomCheck?: (v: number) => boolean - total_fees_CustomCheck?: (v: number) => boolean operations_ItemOptions?: UserOperationOptions operations_CustomCheck?: (v: UserOperation[]) => boolean received_CustomCheck?: (v: number) => boolean spent_CustomCheck?: (v: number) => boolean - available_CustomCheck?: (v: number) => boolean - fees_CustomCheck?: (v: number) => boolean + total_fees_CustomCheck?: (v: number) => boolean + users_Options?: UsersInfoOptions } export const AppMetricsValidate = (o?: AppMetrics, opts: AppMetricsOptions = {}, path: string = 'AppMetrics::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.available !== 'number') return new Error(`${path}.available: is not a number`) + if (opts.available_CustomCheck && !opts.available_CustomCheck(o.available)) return new Error(`${path}.available: custom check failed`) + if (typeof o.fees !== 'number') return new Error(`${path}.fees: is not a number`) if (opts.fees_CustomCheck && !opts.fees_CustomCheck(o.fees)) return new Error(`${path}.fees: custom check failed`) - if (typeof o.total_fees !== 'number') return new Error(`${path}.total_fees: is not a number`) - if (opts.total_fees_CustomCheck && !opts.total_fees_CustomCheck(o.total_fees)) return new Error(`${path}.total_fees: custom check failed`) + if (typeof o.invoices !== 'number') return new Error(`${path}.invoices: is not a number`) + if (opts.invoices_CustomCheck && !opts.invoices_CustomCheck(o.invoices)) return new Error(`${path}.invoices: 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++) { @@ -370,19 +496,126 @@ export const AppMetricsValidate = (o?: AppMetrics, opts: AppMetricsOptions = {}, if (typeof o.spent !== 'number') return new Error(`${path}.spent: is not a number`) if (opts.spent_CustomCheck && !opts.spent_CustomCheck(o.spent)) return new Error(`${path}.spent: custom check failed`) - if (typeof o.available !== 'number') return new Error(`${path}.available: is not a number`) - if (opts.available_CustomCheck && !opts.available_CustomCheck(o.available)) return new Error(`${path}.available: custom check failed`) - - const appErr = ApplicationValidate(o.app, opts.app_Options, `${path}.app`) - if (appErr !== null) return appErr - + if (typeof o.total_fees !== 'number') return new Error(`${path}.total_fees: is not a number`) + if (opts.total_fees_CustomCheck && !opts.total_fees_CustomCheck(o.total_fees)) return new Error(`${path}.total_fees: custom check failed`) const usersErr = UsersInfoValidate(o.users, opts.users_Options, `${path}.users`) if (usersErr !== null) return usersErr - if (typeof o.invoices !== 'number') return new Error(`${path}.invoices: is not a number`) - if (opts.invoices_CustomCheck && !opts.invoices_CustomCheck(o.invoices)) return new Error(`${path}.invoices: custom check failed`) + return null +} + +export type AppUser = { + identifier: string + info: UserInfo + max_withdrawable: number +} +export const AppUserOptionalFields: [] = [] +export type AppUserOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + identifier_CustomCheck?: (v: string) => boolean + info_Options?: UserInfoOptions + max_withdrawable_CustomCheck?: (v: number) => boolean +} +export const AppUserValidate = (o?: AppUser, opts: AppUserOptions = {}, path: string = 'AppUser::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`) + + const infoErr = UserInfoValidate(o.info, opts.info_Options, `${path}.info`) + if (infoErr !== null) return infoErr + + + if (typeof o.max_withdrawable !== 'number') return new Error(`${path}.max_withdrawable: is not a number`) + if (opts.max_withdrawable_CustomCheck && !opts.max_withdrawable_CustomCheck(o.max_withdrawable)) return new Error(`${path}.max_withdrawable: custom check failed`) + + return null +} + +export type Application = { + balance: number + id: string + name: string + npub: string +} +export const ApplicationOptionalFields: [] = [] +export type ApplicationOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + balance_CustomCheck?: (v: number) => boolean + id_CustomCheck?: (v: string) => boolean + name_CustomCheck?: (v: string) => 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.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.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.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 AppsMetrics = { + apps: AppMetrics[] +} +export const AppsMetricsOptionalFields: [] = [] +export type AppsMetricsOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + apps_ItemOptions?: AppMetricsOptions + apps_CustomCheck?: (v: AppMetrics[]) => boolean +} +export const AppsMetricsValidate = (o?: AppsMetrics, opts: AppsMetricsOptions = {}, path: string = 'AppsMetrics::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.apps)) return new Error(`${path}.apps: is not an array`) + for (let index = 0; index < o.apps.length; index++) { + const appsErr = AppMetricsValidate(o.apps[index], opts.apps_ItemOptions, `${path}.apps[${index}]`) + if (appsErr !== null) return appsErr + } + if (opts.apps_CustomCheck && !opts.apps_CustomCheck(o.apps)) return new Error(`${path}.apps: custom check failed`) + + return null +} + +export type AppsMetricsRequest = { + from_unix?: number + include_operations?: boolean + to_unix?: number +} +export type AppsMetricsRequestOptionalField = 'from_unix' | 'include_operations' | 'to_unix' +export const AppsMetricsRequestOptionalFields: AppsMetricsRequestOptionalField[] = ['from_unix', 'include_operations', 'to_unix'] +export type AppsMetricsRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: AppsMetricsRequestOptionalField[] + from_unix_CustomCheck?: (v?: number) => boolean + include_operations_CustomCheck?: (v?: boolean) => boolean + to_unix_CustomCheck?: (v?: number) => boolean +} +export const AppsMetricsRequestValidate = (o?: AppsMetricsRequest, opts: AppsMetricsRequestOptions = {}, path: string = 'AppsMetricsRequest::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 ((o.from_unix || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('from_unix')) && typeof o.from_unix !== 'number') return new Error(`${path}.from_unix: is not a number`) + if (opts.from_unix_CustomCheck && !opts.from_unix_CustomCheck(o.from_unix)) return new Error(`${path}.from_unix: custom check failed`) + + if ((o.include_operations || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('include_operations')) && typeof o.include_operations !== 'boolean') return new Error(`${path}.include_operations: is not a boolean`) + if (opts.include_operations_CustomCheck && !opts.include_operations_CustomCheck(o.include_operations)) return new Error(`${path}.include_operations: custom check failed`) + + if ((o.to_unix || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('to_unix')) && typeof o.to_unix !== 'number') return new Error(`${path}.to_unix: is not a number`) + if (opts.to_unix_CustomCheck && !opts.to_unix_CustomCheck(o.to_unix)) return new Error(`${path}.to_unix: custom check failed`) return null } @@ -411,152 +644,133 @@ export const AuthAppValidate = (o?: AuthApp, opts: AuthAppOptions = {}, path: st return null } -export type NewInvoiceResponse = { - invoice: string -} -export const NewInvoiceResponseOptionalFields: [] = [] -export type NewInvoiceResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - invoice_CustomCheck?: (v: string) => boolean -} -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') - - 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 PayInvoiceResponse = { - network_fee: number - preimage: string - amount_paid: number - operation_id: string - service_fee: number -} -export const PayInvoiceResponseOptionalFields: [] = [] -export type PayInvoiceResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - service_fee_CustomCheck?: (v: number) => boolean - network_fee_CustomCheck?: (v: number) => boolean - preimage_CustomCheck?: (v: string) => boolean - amount_paid_CustomCheck?: (v: number) => boolean - operation_id_CustomCheck?: (v: string) => 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.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`) - - 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`) - - 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 UserInfo = { - user_identifier: string - service_fee_bps: number - network_max_fee_bps: number - network_max_fee_fixed: number - userId: string - balance: number - max_withdrawable: number -} -export const UserInfoOptionalFields: [] = [] -export type UserInfoOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - service_fee_bps_CustomCheck?: (v: number) => boolean - network_max_fee_bps_CustomCheck?: (v: number) => boolean - network_max_fee_fixed_CustomCheck?: (v: number) => boolean - userId_CustomCheck?: (v: string) => boolean - balance_CustomCheck?: (v: number) => boolean - max_withdrawable_CustomCheck?: (v: number) => boolean - user_identifier_CustomCheck?: (v: string) => boolean -} -export const UserInfoValidate = (o?: UserInfo, opts: UserInfoOptions = {}, path: string = 'UserInfo::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.max_withdrawable !== 'number') return new Error(`${path}.max_withdrawable: is not a number`) - if (opts.max_withdrawable_CustomCheck && !opts.max_withdrawable_CustomCheck(o.max_withdrawable)) return new Error(`${path}.max_withdrawable: 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.service_fee_bps !== 'number') return new Error(`${path}.service_fee_bps: is not a number`) - if (opts.service_fee_bps_CustomCheck && !opts.service_fee_bps_CustomCheck(o.service_fee_bps)) return new Error(`${path}.service_fee_bps: custom check failed`) - - if (typeof o.network_max_fee_bps !== 'number') return new Error(`${path}.network_max_fee_bps: is not a number`) - if (opts.network_max_fee_bps_CustomCheck && !opts.network_max_fee_bps_CustomCheck(o.network_max_fee_bps)) return new Error(`${path}.network_max_fee_bps: custom check failed`) - - if (typeof o.network_max_fee_fixed !== 'number') return new Error(`${path}.network_max_fee_fixed: is not a number`) - if (opts.network_max_fee_fixed_CustomCheck && !opts.network_max_fee_fixed_CustomCheck(o.network_max_fee_fixed)) return new Error(`${path}.network_max_fee_fixed: custom check failed`) - - if (typeof o.userId !== 'string') return new Error(`${path}.userId: is not a string`) - if (opts.userId_CustomCheck && !opts.userId_CustomCheck(o.userId)) return new Error(`${path}.userId: 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 AddProductRequest = { +export type AuthAppRequest = { + allow_user_creation?: boolean name: string - price_sats: number } -export const AddProductRequestOptionalFields: [] = [] -export type AddProductRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] +export type AuthAppRequestOptionalField = 'allow_user_creation' +export const AuthAppRequestOptionalFields: AuthAppRequestOptionalField[] = ['allow_user_creation'] +export type AuthAppRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: AuthAppRequestOptionalField[] + allow_user_creation_CustomCheck?: (v?: boolean) => boolean name_CustomCheck?: (v: string) => boolean - price_sats_CustomCheck?: (v: number) => boolean } -export const AddProductRequestValidate = (o?: AddProductRequest, opts: AddProductRequestOptions = {}, path: string = 'AddProductRequest::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 ((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`) + 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 BanUserRequest = { + user_id: string +} +export const BanUserRequestOptionalFields: [] = [] +export type BanUserRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + user_id_CustomCheck?: (v: string) => boolean +} +export const BanUserRequestValidate = (o?: BanUserRequest, opts: BanUserRequestOptions = {}, path: string = 'BanUserRequest::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_id !== 'string') return new Error(`${path}.user_id: is not a string`) + if (opts.user_id_CustomCheck && !opts.user_id_CustomCheck(o.user_id)) return new Error(`${path}.user_id: custom check failed`) + + return null +} + +export type BanUserResponse = { + balance_sats: number + banned_app_users: BannedAppUser[] +} +export const BanUserResponseOptionalFields: [] = [] +export type BanUserResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + balance_sats_CustomCheck?: (v: number) => boolean + banned_app_users_ItemOptions?: BannedAppUserOptions + banned_app_users_CustomCheck?: (v: BannedAppUser[]) => boolean +} +export const BanUserResponseValidate = (o?: BanUserResponse, opts: BanUserResponseOptions = {}, path: string = 'BanUserResponse::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.balance_sats !== 'number') return new Error(`${path}.balance_sats: is not a number`) + if (opts.balance_sats_CustomCheck && !opts.balance_sats_CustomCheck(o.balance_sats)) return new Error(`${path}.balance_sats: custom check failed`) + + if (!Array.isArray(o.banned_app_users)) return new Error(`${path}.banned_app_users: is not an array`) + for (let index = 0; index < o.banned_app_users.length; index++) { + const banned_app_usersErr = BannedAppUserValidate(o.banned_app_users[index], opts.banned_app_users_ItemOptions, `${path}.banned_app_users[${index}]`) + if (banned_app_usersErr !== null) return banned_app_usersErr + } + if (opts.banned_app_users_CustomCheck && !opts.banned_app_users_CustomCheck(o.banned_app_users)) return new Error(`${path}.banned_app_users: custom check failed`) + + return null +} + +export type BannedAppUser = { + app_id: string + app_name: string + nostr_pub: string + user_identifier: string +} +export const BannedAppUserOptionalFields: [] = [] +export type BannedAppUserOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + app_id_CustomCheck?: (v: string) => boolean + app_name_CustomCheck?: (v: string) => boolean + nostr_pub_CustomCheck?: (v: string) => boolean + user_identifier_CustomCheck?: (v: string) => boolean +} +export const BannedAppUserValidate = (o?: BannedAppUser, opts: BannedAppUserOptions = {}, path: string = 'BannedAppUser::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.app_id !== 'string') return new Error(`${path}.app_id: is not a string`) + if (opts.app_id_CustomCheck && !opts.app_id_CustomCheck(o.app_id)) return new Error(`${path}.app_id: custom check failed`) + + if (typeof o.app_name !== 'string') return new Error(`${path}.app_name: is not a string`) + if (opts.app_name_CustomCheck && !opts.app_name_CustomCheck(o.app_name)) return new Error(`${path}.app_name: custom check failed`) + + if (typeof o.nostr_pub !== 'string') return new Error(`${path}.nostr_pub: is not a string`) + if (opts.nostr_pub_CustomCheck && !opts.nostr_pub_CustomCheck(o.nostr_pub)) return new Error(`${path}.nostr_pub: 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 ClosedChannel = { + capacity: number + channel_id: string + closed_height: number +} +export const ClosedChannelOptionalFields: [] = [] +export type ClosedChannelOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + capacity_CustomCheck?: (v: number) => boolean + channel_id_CustomCheck?: (v: string) => boolean + closed_height_CustomCheck?: (v: number) => boolean +} +export const ClosedChannelValidate = (o?: ClosedChannel, opts: ClosedChannelOptions = {}, path: string = 'ClosedChannel::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.capacity !== 'number') return new Error(`${path}.capacity: is not a number`) + if (opts.capacity_CustomCheck && !opts.capacity_CustomCheck(o.capacity)) return new Error(`${path}.capacity: custom check failed`) + + if (typeof o.channel_id !== 'string') return new Error(`${path}.channel_id: is not a string`) + if (opts.channel_id_CustomCheck && !opts.channel_id_CustomCheck(o.channel_id)) return new Error(`${path}.channel_id: custom check failed`) + + if (typeof o.closed_height !== 'number') return new Error(`${path}.closed_height: is not a number`) + if (opts.closed_height_CustomCheck && !opts.closed_height_CustomCheck(o.closed_height)) return new Error(`${path}.closed_height: custom check failed`) return null } @@ -579,6 +793,798 @@ export const ClosureMigrationValidate = (o?: ClosureMigration, opts: ClosureMigr return null } +export type CreateOneTimeInviteLinkRequest = { + sats?: number +} +export type CreateOneTimeInviteLinkRequestOptionalField = 'sats' +export const CreateOneTimeInviteLinkRequestOptionalFields: CreateOneTimeInviteLinkRequestOptionalField[] = ['sats'] +export type CreateOneTimeInviteLinkRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: CreateOneTimeInviteLinkRequestOptionalField[] + sats_CustomCheck?: (v?: number) => boolean +} +export const CreateOneTimeInviteLinkRequestValidate = (o?: CreateOneTimeInviteLinkRequest, opts: CreateOneTimeInviteLinkRequestOptions = {}, path: string = 'CreateOneTimeInviteLinkRequest::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 ((o.sats || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('sats')) && typeof o.sats !== 'number') return new Error(`${path}.sats: is not a number`) + if (opts.sats_CustomCheck && !opts.sats_CustomCheck(o.sats)) return new Error(`${path}.sats: custom check failed`) + + return null +} + +export type CreateOneTimeInviteLinkResponse = { + invitation_link: string +} +export const CreateOneTimeInviteLinkResponseOptionalFields: [] = [] +export type CreateOneTimeInviteLinkResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + invitation_link_CustomCheck?: (v: string) => boolean +} +export const CreateOneTimeInviteLinkResponseValidate = (o?: CreateOneTimeInviteLinkResponse, opts: CreateOneTimeInviteLinkResponseOptions = {}, path: string = 'CreateOneTimeInviteLinkResponse::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.invitation_link !== 'string') return new Error(`${path}.invitation_link: is not a string`) + if (opts.invitation_link_CustomCheck && !opts.invitation_link_CustomCheck(o.invitation_link)) return new Error(`${path}.invitation_link: 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 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 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 EncryptionExchangeRequest = { + deviceId: string + publicKey: string +} +export const EncryptionExchangeRequestOptionalFields: [] = [] +export type EncryptionExchangeRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + deviceId_CustomCheck?: (v: string) => boolean + publicKey_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.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`) + + 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`) + + return null +} + +export type EnrollAdminTokenRequest = { + admin_token: string +} +export const EnrollAdminTokenRequestOptionalFields: [] = [] +export type EnrollAdminTokenRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + admin_token_CustomCheck?: (v: string) => boolean +} +export const EnrollAdminTokenRequestValidate = (o?: EnrollAdminTokenRequest, opts: EnrollAdminTokenRequestOptions = {}, path: string = 'EnrollAdminTokenRequest::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.admin_token !== 'string') return new Error(`${path}.admin_token: is not a string`) + if (opts.admin_token_CustomCheck && !opts.admin_token_CustomCheck(o.admin_token)) return new Error(`${path}.admin_token: custom check failed`) + + return null +} + +export type GetAppUserLNURLInfoRequest = { + base_url_override: string + user_identifier: string +} +export const GetAppUserLNURLInfoRequestOptionalFields: [] = [] +export type GetAppUserLNURLInfoRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + base_url_override_CustomCheck?: (v: string) => boolean + user_identifier_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.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`) + + 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 GetAppUserRequest = { + user_identifier: string +} +export const GetAppUserRequestOptionalFields: [] = [] +export type GetAppUserRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + user_identifier_CustomCheck?: (v: string) => boolean +} +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.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 GetInviteTokenStateRequest = { + invite_token: string +} +export const GetInviteTokenStateRequestOptionalFields: [] = [] +export type GetInviteTokenStateRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + invite_token_CustomCheck?: (v: string) => boolean +} +export const GetInviteTokenStateRequestValidate = (o?: GetInviteTokenStateRequest, opts: GetInviteTokenStateRequestOptions = {}, path: string = 'GetInviteTokenStateRequest::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.invite_token !== 'string') return new Error(`${path}.invite_token: is not a string`) + if (opts.invite_token_CustomCheck && !opts.invite_token_CustomCheck(o.invite_token)) return new Error(`${path}.invite_token: custom check failed`) + + return null +} + +export type GetInviteTokenStateResponse = { + used: boolean +} +export const GetInviteTokenStateResponseOptionalFields: [] = [] +export type GetInviteTokenStateResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + used_CustomCheck?: (v: boolean) => boolean +} +export const GetInviteTokenStateResponseValidate = (o?: GetInviteTokenStateResponse, opts: GetInviteTokenStateResponseOptions = {}, path: string = 'GetInviteTokenStateResponse::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.used !== 'boolean') return new Error(`${path}.used: is not a boolean`) + if (opts.used_CustomCheck && !opts.used_CustomCheck(o.used)) return new Error(`${path}.used: custom check failed`) + + return null +} + +export type GetPaymentStateRequest = { + invoice: string +} +export const GetPaymentStateRequestOptionalFields: [] = [] +export type GetPaymentStateRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + invoice_CustomCheck?: (v: string) => boolean +} +export const GetPaymentStateRequestValidate = (o?: GetPaymentStateRequest, opts: GetPaymentStateRequestOptions = {}, path: string = 'GetPaymentStateRequest::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 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 GetUserOperationsRequest = { + latestIncomingInvoice: number + latestIncomingTx: number + latestIncomingUserToUserPayment: number + latestOutgoingInvoice: number + latestOutgoingTx: number + latestOutgoingUserToUserPayment: number + max_size: number +} +export const GetUserOperationsRequestOptionalFields: [] = [] +export type GetUserOperationsRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + latestIncomingInvoice_CustomCheck?: (v: number) => boolean + latestIncomingTx_CustomCheck?: (v: number) => boolean + latestIncomingUserToUserPayment_CustomCheck?: (v: number) => boolean + latestOutgoingInvoice_CustomCheck?: (v: number) => boolean + latestOutgoingTx_CustomCheck?: (v: number) => boolean + latestOutgoingUserToUserPayment_CustomCheck?: (v: number) => boolean + max_size_CustomCheck?: (v: number) => boolean +} +export const GetUserOperationsRequestValidate = (o?: GetUserOperationsRequest, opts: GetUserOperationsRequestOptions = {}, path: string = 'GetUserOperationsRequest::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.latestIncomingInvoice !== 'number') return new Error(`${path}.latestIncomingInvoice: is not a number`) + if (opts.latestIncomingInvoice_CustomCheck && !opts.latestIncomingInvoice_CustomCheck(o.latestIncomingInvoice)) return new Error(`${path}.latestIncomingInvoice: custom check failed`) + + if (typeof o.latestIncomingTx !== 'number') return new Error(`${path}.latestIncomingTx: is not a number`) + if (opts.latestIncomingTx_CustomCheck && !opts.latestIncomingTx_CustomCheck(o.latestIncomingTx)) return new Error(`${path}.latestIncomingTx: custom check failed`) + + if (typeof o.latestIncomingUserToUserPayment !== 'number') return new Error(`${path}.latestIncomingUserToUserPayment: is not a number`) + if (opts.latestIncomingUserToUserPayment_CustomCheck && !opts.latestIncomingUserToUserPayment_CustomCheck(o.latestIncomingUserToUserPayment)) return new Error(`${path}.latestIncomingUserToUserPayment: custom check failed`) + + if (typeof o.latestOutgoingInvoice !== 'number') return new Error(`${path}.latestOutgoingInvoice: is not a number`) + if (opts.latestOutgoingInvoice_CustomCheck && !opts.latestOutgoingInvoice_CustomCheck(o.latestOutgoingInvoice)) return new Error(`${path}.latestOutgoingInvoice: custom check failed`) + + if (typeof o.latestOutgoingTx !== 'number') return new Error(`${path}.latestOutgoingTx: is not a number`) + if (opts.latestOutgoingTx_CustomCheck && !opts.latestOutgoingTx_CustomCheck(o.latestOutgoingTx)) return new Error(`${path}.latestOutgoingTx: custom check failed`) + + if (typeof o.latestOutgoingUserToUserPayment !== 'number') return new Error(`${path}.latestOutgoingUserToUserPayment: is not a number`) + if (opts.latestOutgoingUserToUserPayment_CustomCheck && !opts.latestOutgoingUserToUserPayment_CustomCheck(o.latestOutgoingUserToUserPayment)) return new Error(`${path}.latestOutgoingUserToUserPayment: custom check failed`) + + if (typeof o.max_size !== 'number') return new Error(`${path}.max_size: is not a number`) + if (opts.max_size_CustomCheck && !opts.max_size_CustomCheck(o.max_size)) return new Error(`${path}.max_size: custom check failed`) + + return null +} + +export type GetUserOperationsResponse = { + latestIncomingInvoiceOperations: UserOperations + latestIncomingTxOperations: UserOperations + latestIncomingUserToUserPayemnts: UserOperations + latestOutgoingInvoiceOperations: UserOperations + latestOutgoingTxOperations: UserOperations + latestOutgoingUserToUserPayemnts: UserOperations +} +export const GetUserOperationsResponseOptionalFields: [] = [] +export type GetUserOperationsResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + latestIncomingInvoiceOperations_Options?: UserOperationsOptions + latestIncomingTxOperations_Options?: UserOperationsOptions + latestIncomingUserToUserPayemnts_Options?: UserOperationsOptions + latestOutgoingInvoiceOperations_Options?: UserOperationsOptions + latestOutgoingTxOperations_Options?: UserOperationsOptions + latestOutgoingUserToUserPayemnts_Options?: UserOperationsOptions +} +export const GetUserOperationsResponseValidate = (o?: GetUserOperationsResponse, opts: GetUserOperationsResponseOptions = {}, path: string = 'GetUserOperationsResponse::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 latestIncomingInvoiceOperationsErr = UserOperationsValidate(o.latestIncomingInvoiceOperations, opts.latestIncomingInvoiceOperations_Options, `${path}.latestIncomingInvoiceOperations`) + if (latestIncomingInvoiceOperationsErr !== null) return latestIncomingInvoiceOperationsErr + + + const latestIncomingTxOperationsErr = UserOperationsValidate(o.latestIncomingTxOperations, opts.latestIncomingTxOperations_Options, `${path}.latestIncomingTxOperations`) + if (latestIncomingTxOperationsErr !== null) return latestIncomingTxOperationsErr + + + const latestIncomingUserToUserPayemntsErr = UserOperationsValidate(o.latestIncomingUserToUserPayemnts, opts.latestIncomingUserToUserPayemnts_Options, `${path}.latestIncomingUserToUserPayemnts`) + if (latestIncomingUserToUserPayemntsErr !== null) return latestIncomingUserToUserPayemntsErr + + + const latestOutgoingInvoiceOperationsErr = UserOperationsValidate(o.latestOutgoingInvoiceOperations, opts.latestOutgoingInvoiceOperations_Options, `${path}.latestOutgoingInvoiceOperations`) + if (latestOutgoingInvoiceOperationsErr !== null) return latestOutgoingInvoiceOperationsErr + + + const latestOutgoingTxOperationsErr = UserOperationsValidate(o.latestOutgoingTxOperations, opts.latestOutgoingTxOperations_Options, `${path}.latestOutgoingTxOperations`) + if (latestOutgoingTxOperationsErr !== null) return latestOutgoingTxOperationsErr + + + const latestOutgoingUserToUserPayemntsErr = UserOperationsValidate(o.latestOutgoingUserToUserPayemnts, opts.latestOutgoingUserToUserPayemnts_Options, `${path}.latestOutgoingUserToUserPayemnts`) + if (latestOutgoingUserToUserPayemntsErr !== null) return latestOutgoingUserToUserPayemntsErr + + + return null +} + +export type GraphPoint = { + x: number + y: number +} +export const GraphPointOptionalFields: [] = [] +export type GraphPointOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + x_CustomCheck?: (v: number) => boolean + y_CustomCheck?: (v: number) => boolean +} +export const GraphPointValidate = (o?: GraphPoint, opts: GraphPointOptions = {}, path: string = 'GraphPoint::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.x !== 'number') return new Error(`${path}.x: is not a number`) + if (opts.x_CustomCheck && !opts.x_CustomCheck(o.x)) return new Error(`${path}.x: custom check failed`) + + if (typeof o.y !== 'number') return new Error(`${path}.y: is not a number`) + if (opts.y_CustomCheck && !opts.y_CustomCheck(o.y)) return new Error(`${path}.y: custom check failed`) + + return null +} + +export type HandleLnurlPayResponse = { + pr: string + routes: Empty[] +} +export const HandleLnurlPayResponseOptionalFields: [] = [] +export type HandleLnurlPayResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + pr_CustomCheck?: (v: string) => boolean + routes_ItemOptions?: EmptyOptions + routes_CustomCheck?: (v: Empty[]) => boolean +} +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.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 (!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 HttpCreds = { + token: string + url: string +} +export const HttpCredsOptionalFields: [] = [] +export type HttpCredsOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + token_CustomCheck?: (v: string) => boolean + url_CustomCheck?: (v: string) => boolean +} +export const HttpCredsValidate = (o?: HttpCreds, opts: HttpCredsOptions = {}, path: string = 'HttpCreds::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.token !== 'string') return new Error(`${path}.token: is not a string`) + if (opts.token_CustomCheck && !opts.token_CustomCheck(o.token)) return new Error(`${path}.token: custom check failed`) + + if (typeof o.url !== 'string') return new Error(`${path}.url: is not a string`) + if (opts.url_CustomCheck && !opts.url_CustomCheck(o.url)) return new Error(`${path}.url: custom check failed`) + + return null +} + +export type LinkNPubThroughTokenRequest = { + token: string +} +export const LinkNPubThroughTokenRequestOptionalFields: [] = [] +export type LinkNPubThroughTokenRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + token_CustomCheck?: (v: string) => boolean +} +export const LinkNPubThroughTokenRequestValidate = (o?: LinkNPubThroughTokenRequest, opts: LinkNPubThroughTokenRequestOptions = {}, path: string = 'LinkNPubThroughTokenRequest::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.token !== 'string') return new Error(`${path}.token: is not a string`) + if (opts.token_CustomCheck && !opts.token_CustomCheck(o.token)) return new Error(`${path}.token: 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 LndChannels = { + open_channels: OpenChannel[] +} +export const LndChannelsOptionalFields: [] = [] +export type LndChannelsOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + open_channels_ItemOptions?: OpenChannelOptions + open_channels_CustomCheck?: (v: OpenChannel[]) => boolean +} +export const LndChannelsValidate = (o?: LndChannels, opts: LndChannelsOptions = {}, path: string = 'LndChannels::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.open_channels)) return new Error(`${path}.open_channels: is not an array`) + for (let index = 0; index < o.open_channels.length; index++) { + const open_channelsErr = OpenChannelValidate(o.open_channels[index], opts.open_channels_ItemOptions, `${path}.open_channels[${index}]`) + if (open_channelsErr !== null) return open_channelsErr + } + if (opts.open_channels_CustomCheck && !opts.open_channels_CustomCheck(o.open_channels)) return new Error(`${path}.open_channels: 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 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`) + + return null +} + +export type LndMetrics = { + nodes: LndNodeMetrics[] +} +export const LndMetricsOptionalFields: [] = [] +export type LndMetricsOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + nodes_ItemOptions?: LndNodeMetricsOptions + nodes_CustomCheck?: (v: LndNodeMetrics[]) => boolean +} +export const LndMetricsValidate = (o?: LndMetrics, opts: LndMetricsOptions = {}, path: string = 'LndMetrics::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.nodes)) return new Error(`${path}.nodes: is not an array`) + for (let index = 0; index < o.nodes.length; index++) { + const nodesErr = LndNodeMetricsValidate(o.nodes[index], opts.nodes_ItemOptions, `${path}.nodes[${index}]`) + if (nodesErr !== null) return nodesErr + } + if (opts.nodes_CustomCheck && !opts.nodes_CustomCheck(o.nodes)) return new Error(`${path}.nodes: custom check failed`) + + return null +} + +export type LndMetricsRequest = { + from_unix?: number + to_unix?: number +} +export type LndMetricsRequestOptionalField = 'from_unix' | 'to_unix' +export const LndMetricsRequestOptionalFields: LndMetricsRequestOptionalField[] = ['from_unix', 'to_unix'] +export type LndMetricsRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: LndMetricsRequestOptionalField[] + from_unix_CustomCheck?: (v?: number) => boolean + to_unix_CustomCheck?: (v?: number) => boolean +} +export const LndMetricsRequestValidate = (o?: LndMetricsRequest, opts: LndMetricsRequestOptions = {}, path: string = 'LndMetricsRequest::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 ((o.from_unix || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('from_unix')) && typeof o.from_unix !== 'number') return new Error(`${path}.from_unix: is not a number`) + if (opts.from_unix_CustomCheck && !opts.from_unix_CustomCheck(o.from_unix)) return new Error(`${path}.from_unix: custom check failed`) + + if ((o.to_unix || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('to_unix')) && typeof o.to_unix !== 'number') return new Error(`${path}.to_unix: is not a number`) + if (opts.to_unix_CustomCheck && !opts.to_unix_CustomCheck(o.to_unix)) return new Error(`${path}.to_unix: custom check failed`) + + return null +} + +export type LndNodeMetrics = { + chain_balance: GraphPoint[] + channel_balance: GraphPoint[] + closed_channels: ClosedChannel[] + closing_channels: number + external_balance: GraphPoint[] + forwarding_events: number + forwarding_fees: number + offline_channels: number + online_channels: number + open_channels: OpenChannel[] + pending_channels: number +} +export const LndNodeMetricsOptionalFields: [] = [] +export type LndNodeMetricsOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + chain_balance_ItemOptions?: GraphPointOptions + chain_balance_CustomCheck?: (v: GraphPoint[]) => boolean + channel_balance_ItemOptions?: GraphPointOptions + channel_balance_CustomCheck?: (v: GraphPoint[]) => boolean + closed_channels_ItemOptions?: ClosedChannelOptions + closed_channels_CustomCheck?: (v: ClosedChannel[]) => boolean + closing_channels_CustomCheck?: (v: number) => boolean + external_balance_ItemOptions?: GraphPointOptions + external_balance_CustomCheck?: (v: GraphPoint[]) => boolean + forwarding_events_CustomCheck?: (v: number) => boolean + forwarding_fees_CustomCheck?: (v: number) => boolean + offline_channels_CustomCheck?: (v: number) => boolean + online_channels_CustomCheck?: (v: number) => boolean + open_channels_ItemOptions?: OpenChannelOptions + open_channels_CustomCheck?: (v: OpenChannel[]) => boolean + pending_channels_CustomCheck?: (v: number) => boolean +} +export const LndNodeMetricsValidate = (o?: LndNodeMetrics, opts: LndNodeMetricsOptions = {}, path: string = 'LndNodeMetrics::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.chain_balance)) return new Error(`${path}.chain_balance: is not an array`) + for (let index = 0; index < o.chain_balance.length; index++) { + const chain_balanceErr = GraphPointValidate(o.chain_balance[index], opts.chain_balance_ItemOptions, `${path}.chain_balance[${index}]`) + if (chain_balanceErr !== null) return chain_balanceErr + } + if (opts.chain_balance_CustomCheck && !opts.chain_balance_CustomCheck(o.chain_balance)) return new Error(`${path}.chain_balance: custom check failed`) + + if (!Array.isArray(o.channel_balance)) return new Error(`${path}.channel_balance: is not an array`) + for (let index = 0; index < o.channel_balance.length; index++) { + const channel_balanceErr = GraphPointValidate(o.channel_balance[index], opts.channel_balance_ItemOptions, `${path}.channel_balance[${index}]`) + if (channel_balanceErr !== null) return channel_balanceErr + } + if (opts.channel_balance_CustomCheck && !opts.channel_balance_CustomCheck(o.channel_balance)) return new Error(`${path}.channel_balance: custom check failed`) + + if (!Array.isArray(o.closed_channels)) return new Error(`${path}.closed_channels: is not an array`) + for (let index = 0; index < o.closed_channels.length; index++) { + const closed_channelsErr = ClosedChannelValidate(o.closed_channels[index], opts.closed_channels_ItemOptions, `${path}.closed_channels[${index}]`) + if (closed_channelsErr !== null) return closed_channelsErr + } + if (opts.closed_channels_CustomCheck && !opts.closed_channels_CustomCheck(o.closed_channels)) return new Error(`${path}.closed_channels: custom check failed`) + + if (typeof o.closing_channels !== 'number') return new Error(`${path}.closing_channels: is not a number`) + if (opts.closing_channels_CustomCheck && !opts.closing_channels_CustomCheck(o.closing_channels)) return new Error(`${path}.closing_channels: custom check failed`) + + if (!Array.isArray(o.external_balance)) return new Error(`${path}.external_balance: is not an array`) + for (let index = 0; index < o.external_balance.length; index++) { + const external_balanceErr = GraphPointValidate(o.external_balance[index], opts.external_balance_ItemOptions, `${path}.external_balance[${index}]`) + if (external_balanceErr !== null) return external_balanceErr + } + if (opts.external_balance_CustomCheck && !opts.external_balance_CustomCheck(o.external_balance)) return new Error(`${path}.external_balance: custom check failed`) + + if (typeof o.forwarding_events !== 'number') return new Error(`${path}.forwarding_events: is not a number`) + if (opts.forwarding_events_CustomCheck && !opts.forwarding_events_CustomCheck(o.forwarding_events)) return new Error(`${path}.forwarding_events: custom check failed`) + + if (typeof o.forwarding_fees !== 'number') return new Error(`${path}.forwarding_fees: is not a number`) + if (opts.forwarding_fees_CustomCheck && !opts.forwarding_fees_CustomCheck(o.forwarding_fees)) return new Error(`${path}.forwarding_fees: custom check failed`) + + if (typeof o.offline_channels !== 'number') return new Error(`${path}.offline_channels: is not a number`) + if (opts.offline_channels_CustomCheck && !opts.offline_channels_CustomCheck(o.offline_channels)) return new Error(`${path}.offline_channels: custom check failed`) + + if (typeof o.online_channels !== 'number') return new Error(`${path}.online_channels: is not a number`) + if (opts.online_channels_CustomCheck && !opts.online_channels_CustomCheck(o.online_channels)) return new Error(`${path}.online_channels: custom check failed`) + + if (!Array.isArray(o.open_channels)) return new Error(`${path}.open_channels: is not an array`) + for (let index = 0; index < o.open_channels.length; index++) { + const open_channelsErr = OpenChannelValidate(o.open_channels[index], opts.open_channels_ItemOptions, `${path}.open_channels[${index}]`) + if (open_channelsErr !== null) return open_channelsErr + } + if (opts.open_channels_CustomCheck && !opts.open_channels_CustomCheck(o.open_channels)) return new Error(`${path}.open_channels: custom check failed`) + + if (typeof o.pending_channels !== 'number') return new Error(`${path}.pending_channels: is not a number`) + if (opts.pending_channels_CustomCheck && !opts.pending_channels_CustomCheck(o.pending_channels)) return new Error(`${path}.pending_channels: custom check failed`) + + return null +} + +export type LndSeed = { + seed: string[] +} +export const LndSeedOptionalFields: [] = [] +export type LndSeedOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + seed_CustomCheck?: (v: string[]) => boolean +} +export const LndSeedValidate = (o?: LndSeed, opts: LndSeedOptions = {}, path: string = 'LndSeed::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.seed)) return new Error(`${path}.seed: is not an array`) + for (let index = 0; index < o.seed.length; index++) { + if (typeof o.seed[index] !== 'string') return new Error(`${path}.seed[${index}]: is not a string`) + } + if (opts.seed_CustomCheck && !opts.seed_CustomCheck(o.seed)) return new Error(`${path}.seed: custom check failed`) + + return null +} + +export type LnurlLinkResponse = { + k1: string + lnurl: string +} +export const LnurlLinkResponseOptionalFields: [] = [] +export type LnurlLinkResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + k1_CustomCheck?: (v: string) => boolean + lnurl_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.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`) + + 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`) + + return null +} + +export type LnurlPayInfoResponse = { + allowsNostr: boolean + callback: string + maxSendable: number + metadata: string + minSendable: number + nostrPubkey: string + tag: string +} +export const LnurlPayInfoResponseOptionalFields: [] = [] +export type LnurlPayInfoResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + allowsNostr_CustomCheck?: (v: boolean) => boolean + callback_CustomCheck?: (v: string) => boolean + maxSendable_CustomCheck?: (v: number) => boolean + metadata_CustomCheck?: (v: string) => boolean + minSendable_CustomCheck?: (v: number) => boolean + nostrPubkey_CustomCheck?: (v: string) => boolean + tag_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.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.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.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.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.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`) + + 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`) + + return null +} + +export type LnurlWithdrawInfoResponse = { + balanceCheck: string + callback: string + defaultDescription: string + k1: string + maxWithdrawable: number + minWithdrawable: number + payLink: string + tag: string +} +export const LnurlWithdrawInfoResponseOptionalFields: [] = [] +export type LnurlWithdrawInfoResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + balanceCheck_CustomCheck?: (v: string) => boolean + callback_CustomCheck?: (v: string) => boolean + defaultDescription_CustomCheck?: (v: string) => boolean + k1_CustomCheck?: (v: string) => boolean + maxWithdrawable_CustomCheck?: (v: number) => boolean + minWithdrawable_CustomCheck?: (v: number) => boolean + payLink_CustomCheck?: (v: string) => boolean + tag_CustomCheck?: (v: string) => boolean +} +export const LnurlWithdrawInfoResponseValidate = (o?: LnurlWithdrawInfoResponse, opts: LnurlWithdrawInfoResponseOptions = {}, path: string = 'LnurlWithdrawInfoResponse::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.balanceCheck !== 'string') return new Error(`${path}.balanceCheck: is not a string`) + if (opts.balanceCheck_CustomCheck && !opts.balanceCheck_CustomCheck(o.balanceCheck)) return new Error(`${path}.balanceCheck: 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.defaultDescription !== 'string') return new Error(`${path}.defaultDescription: is not a string`) + if (opts.defaultDescription_CustomCheck && !opts.defaultDescription_CustomCheck(o.defaultDescription)) return new Error(`${path}.defaultDescription: 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`) + + if (typeof o.maxWithdrawable !== 'number') return new Error(`${path}.maxWithdrawable: is not a number`) + if (opts.maxWithdrawable_CustomCheck && !opts.maxWithdrawable_CustomCheck(o.maxWithdrawable)) return new Error(`${path}.maxWithdrawable: custom check failed`) + + if (typeof o.minWithdrawable !== 'number') return new Error(`${path}.minWithdrawable: is not a number`) + if (opts.minWithdrawable_CustomCheck && !opts.minWithdrawable_CustomCheck(o.minWithdrawable)) return new Error(`${path}.minWithdrawable: custom check failed`) + + if (typeof o.payLink !== 'string') return new Error(`${path}.payLink: is not a string`) + if (opts.payLink_CustomCheck && !opts.payLink_CustomCheck(o.payLink)) return new Error(`${path}.payLink: custom check failed`) + + 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`) + + return null +} + export type MigrationUpdate = { closure?: ClosureMigration relays?: RelaysMigration @@ -609,190 +1615,361 @@ export const MigrationUpdateValidate = (o?: MigrationUpdate, opts: MigrationUpda return null } -export type Empty = { +export type NewAddressRequest = { + addressType: AddressType } -export const EmptyOptionalFields: [] = [] -export type EmptyOptions = OptionsBaseMessage & { +export const NewAddressRequestOptionalFields: [] = [] +export type NewAddressRequestOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] + addressType_CustomCheck?: (v: AddressType) => boolean } -export const EmptyValidate = (o?: Empty, opts: EmptyOptions = {}, path: string = 'Empty::root.'): Error | null => { +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 EncryptionExchangeRequest = { - publicKey: string - deviceId: string +export type NewAddressResponse = { + address: string } -export const EncryptionExchangeRequestOptionalFields: [] = [] -export type EncryptionExchangeRequestOptions = OptionsBaseMessage & { +export const NewAddressResponseOptionalFields: [] = [] +export type NewAddressResponseOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - publicKey_CustomCheck?: (v: string) => boolean - deviceId_CustomCheck?: (v: string) => boolean + address_CustomCheck?: (v: string) => boolean } -export const EncryptionExchangeRequestValidate = (o?: EncryptionExchangeRequest, opts: EncryptionExchangeRequestOptions = {}, path: string = 'EncryptionExchangeRequest::root.'): Error | null => { +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.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`) + 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 ClosedChannel = { - channel_id: string +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 NewInvoiceResponse = { + invoice: string +} +export const NewInvoiceResponseOptionalFields: [] = [] +export type NewInvoiceResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + invoice_CustomCheck?: (v: string) => boolean +} +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') + + 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 OpenChannel = { + active: boolean capacity: number - closed_height: number + channel_id: string + label: string + lifetime: number + local_balance: number + remote_balance: number } -export const ClosedChannelOptionalFields: [] = [] -export type ClosedChannelOptions = OptionsBaseMessage & { +export const OpenChannelOptionalFields: [] = [] +export type OpenChannelOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - channel_id_CustomCheck?: (v: string) => boolean + active_CustomCheck?: (v: boolean) => boolean capacity_CustomCheck?: (v: number) => boolean - closed_height_CustomCheck?: (v: number) => boolean + channel_id_CustomCheck?: (v: string) => boolean + label_CustomCheck?: (v: string) => boolean + lifetime_CustomCheck?: (v: number) => boolean + local_balance_CustomCheck?: (v: number) => boolean + remote_balance_CustomCheck?: (v: number) => boolean } -export const ClosedChannelValidate = (o?: ClosedChannel, opts: ClosedChannelOptions = {}, path: string = 'ClosedChannel::root.'): Error | null => { +export const OpenChannelValidate = (o?: OpenChannel, opts: OpenChannelOptions = {}, path: string = 'OpenChannel::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.channel_id !== 'string') return new Error(`${path}.channel_id: is not a string`) - if (opts.channel_id_CustomCheck && !opts.channel_id_CustomCheck(o.channel_id)) return new Error(`${path}.channel_id: custom check failed`) + if (typeof o.active !== 'boolean') return new Error(`${path}.active: is not a boolean`) + if (opts.active_CustomCheck && !opts.active_CustomCheck(o.active)) return new Error(`${path}.active: custom check failed`) if (typeof o.capacity !== 'number') return new Error(`${path}.capacity: is not a number`) if (opts.capacity_CustomCheck && !opts.capacity_CustomCheck(o.capacity)) return new Error(`${path}.capacity: custom check failed`) - if (typeof o.closed_height !== 'number') return new Error(`${path}.closed_height: is not a number`) - if (opts.closed_height_CustomCheck && !opts.closed_height_CustomCheck(o.closed_height)) return new Error(`${path}.closed_height: custom check failed`) + if (typeof o.channel_id !== 'string') return new Error(`${path}.channel_id: is not a string`) + if (opts.channel_id_CustomCheck && !opts.channel_id_CustomCheck(o.channel_id)) return new Error(`${path}.channel_id: custom check failed`) + + if (typeof o.label !== 'string') return new Error(`${path}.label: is not a string`) + if (opts.label_CustomCheck && !opts.label_CustomCheck(o.label)) return new Error(`${path}.label: custom check failed`) + + if (typeof o.lifetime !== 'number') return new Error(`${path}.lifetime: is not a number`) + if (opts.lifetime_CustomCheck && !opts.lifetime_CustomCheck(o.lifetime)) return new Error(`${path}.lifetime: custom check failed`) + + if (typeof o.local_balance !== 'number') return new Error(`${path}.local_balance: is not a number`) + if (opts.local_balance_CustomCheck && !opts.local_balance_CustomCheck(o.local_balance)) return new Error(`${path}.local_balance: custom check failed`) + + if (typeof o.remote_balance !== 'number') return new Error(`${path}.remote_balance: is not a number`) + if (opts.remote_balance_CustomCheck && !opts.remote_balance_CustomCheck(o.remote_balance)) return new Error(`${path}.remote_balance: custom check failed`) return null } -export type BanUserResponse = { - balance_sats: number - banned_app_users: BannedAppUser[] +export type OpenChannelRequest = { + closeAddress: string + destination: string + fundingAmount: number + pushAmount: number } -export const BanUserResponseOptionalFields: [] = [] -export type BanUserResponseOptions = OptionsBaseMessage & { +export const OpenChannelRequestOptionalFields: [] = [] +export type OpenChannelRequestOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - balance_sats_CustomCheck?: (v: number) => boolean - banned_app_users_ItemOptions?: BannedAppUserOptions - banned_app_users_CustomCheck?: (v: BannedAppUser[]) => boolean + closeAddress_CustomCheck?: (v: string) => boolean + destination_CustomCheck?: (v: string) => boolean + fundingAmount_CustomCheck?: (v: number) => boolean + pushAmount_CustomCheck?: (v: number) => boolean } -export const BanUserResponseValidate = (o?: BanUserResponse, opts: BanUserResponseOptions = {}, path: string = 'BanUserResponse::root.'): Error | null => { +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.balance_sats !== 'number') return new Error(`${path}.balance_sats: is not a number`) - if (opts.balance_sats_CustomCheck && !opts.balance_sats_CustomCheck(o.balance_sats)) return new Error(`${path}.balance_sats: 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`) - if (!Array.isArray(o.banned_app_users)) return new Error(`${path}.banned_app_users: is not an array`) - for (let index = 0; index < o.banned_app_users.length; index++) { - const banned_app_usersErr = BannedAppUserValidate(o.banned_app_users[index], opts.banned_app_users_ItemOptions, `${path}.banned_app_users[${index}]`) - if (banned_app_usersErr !== null) return banned_app_usersErr - } - if (opts.banned_app_users_CustomCheck && !opts.banned_app_users_CustomCheck(o.banned_app_users)) return new Error(`${path}.banned_app_users: custom check failed`) + 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`) return null } -export type AuthAppRequest = { - name: string - allow_user_creation?: boolean +export type OpenChannelResponse = { + channelId: string } -export type AuthAppRequestOptionalField = 'allow_user_creation' -export const AuthAppRequestOptionalFields: AuthAppRequestOptionalField[] = ['allow_user_creation'] -export type AuthAppRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: AuthAppRequestOptionalField[] - allow_user_creation_CustomCheck?: (v?: boolean) => boolean - name_CustomCheck?: (v: string) => boolean +export const OpenChannelResponseOptionalFields: [] = [] +export type OpenChannelResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + channelId_CustomCheck?: (v: string) => boolean } -export const AuthAppRequestValidate = (o?: AuthAppRequest, opts: AuthAppRequestOptions = {}, path: string = 'AuthAppRequest::root.'): Error | null => { +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 ((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`) - - 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.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 GetAppUserLNURLInfoRequest = { +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 PayAddressResponse = { + network_fee: number + operation_id: string + service_fee: number + txId: string +} +export const PayAddressResponseOptionalFields: [] = [] +export type PayAddressResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + network_fee_CustomCheck?: (v: number) => boolean + operation_id_CustomCheck?: (v: string) => boolean + service_fee_CustomCheck?: (v: number) => boolean + txId_CustomCheck?: (v: string) => 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.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`) + + 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.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`) + + return null +} + +export type PayAppUserInvoiceRequest = { + amount: number + invoice: string user_identifier: string - base_url_override: string } -export const GetAppUserLNURLInfoRequestOptionalFields: [] = [] -export type GetAppUserLNURLInfoRequestOptions = OptionsBaseMessage & { +export const PayAppUserInvoiceRequestOptionalFields: [] = [] +export type PayAppUserInvoiceRequestOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] + amount_CustomCheck?: (v: number) => boolean + invoice_CustomCheck?: (v: string) => boolean 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 => { +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.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.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.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 = { + amount: number + invoice: string +} +export const PayInvoiceRequestOptionalFields: [] = [] +export type PayInvoiceRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + amount_CustomCheck?: (v: number) => boolean + invoice_CustomCheck?: (v: string) => 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.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.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 GetUserOperationsResponse = { - latestOutgoingTxOperations: UserOperations - latestIncomingTxOperations: UserOperations - latestOutgoingUserToUserPayemnts: UserOperations - latestIncomingUserToUserPayemnts: UserOperations - latestOutgoingInvoiceOperations: UserOperations - latestIncomingInvoiceOperations: UserOperations +export type PayInvoiceResponse = { + amount_paid: number + network_fee: number + operation_id: string + preimage: string + service_fee: number } -export const GetUserOperationsResponseOptionalFields: [] = [] -export type GetUserOperationsResponseOptions = OptionsBaseMessage & { +export const PayInvoiceResponseOptionalFields: [] = [] +export type PayInvoiceResponseOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - latestOutgoingUserToUserPayemnts_Options?: UserOperationsOptions - latestIncomingUserToUserPayemnts_Options?: UserOperationsOptions - latestOutgoingInvoiceOperations_Options?: UserOperationsOptions - latestIncomingInvoiceOperations_Options?: UserOperationsOptions - latestOutgoingTxOperations_Options?: UserOperationsOptions - latestIncomingTxOperations_Options?: UserOperationsOptions + amount_paid_CustomCheck?: (v: number) => boolean + network_fee_CustomCheck?: (v: number) => boolean + operation_id_CustomCheck?: (v: string) => boolean + preimage_CustomCheck?: (v: string) => boolean + service_fee_CustomCheck?: (v: number) => boolean } -export const GetUserOperationsResponseValidate = (o?: GetUserOperationsResponse, opts: GetUserOperationsResponseOptions = {}, path: string = 'GetUserOperationsResponse::root.'): Error | null => { +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') - const latestOutgoingTxOperationsErr = UserOperationsValidate(o.latestOutgoingTxOperations, opts.latestOutgoingTxOperations_Options, `${path}.latestOutgoingTxOperations`) - if (latestOutgoingTxOperationsErr !== null) return latestOutgoingTxOperationsErr - + 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`) - const latestIncomingTxOperationsErr = UserOperationsValidate(o.latestIncomingTxOperations, opts.latestIncomingTxOperations_Options, `${path}.latestIncomingTxOperations`) - if (latestIncomingTxOperationsErr !== null) return latestIncomingTxOperationsErr - + 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`) - const latestOutgoingUserToUserPayemntsErr = UserOperationsValidate(o.latestOutgoingUserToUserPayemnts, opts.latestOutgoingUserToUserPayemnts_Options, `${path}.latestOutgoingUserToUserPayemnts`) - if (latestOutgoingUserToUserPayemntsErr !== null) return latestOutgoingUserToUserPayemntsErr - + 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`) - const latestIncomingUserToUserPayemntsErr = UserOperationsValidate(o.latestIncomingUserToUserPayemnts, opts.latestIncomingUserToUserPayemnts_Options, `${path}.latestIncomingUserToUserPayemnts`) - if (latestIncomingUserToUserPayemntsErr !== null) return latestIncomingUserToUserPayemntsErr - + 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`) - const latestOutgoingInvoiceOperationsErr = UserOperationsValidate(o.latestOutgoingInvoiceOperations, opts.latestOutgoingInvoiceOperations_Options, `${path}.latestOutgoingInvoiceOperations`) - if (latestOutgoingInvoiceOperationsErr !== null) return latestOutgoingInvoiceOperationsErr - + 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`) - const latestIncomingInvoiceOperationsErr = UserOperationsValidate(o.latestIncomingInvoiceOperations, opts.latestIncomingInvoiceOperations_Options, `${path}.latestIncomingInvoiceOperations`) - if (latestIncomingInvoiceOperationsErr !== null) return latestIncomingInvoiceOperationsErr - + return null +} + +export type PaymentState = { + amount: number + network_fee: number + paid_at_unix: number + service_fee: number +} +export const PaymentStateOptionalFields: [] = [] +export type PaymentStateOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + amount_CustomCheck?: (v: number) => boolean + network_fee_CustomCheck?: (v: number) => boolean + paid_at_unix_CustomCheck?: (v: number) => boolean + service_fee_CustomCheck?: (v: number) => boolean +} +export const PaymentStateValidate = (o?: PaymentState, opts: PaymentStateOptions = {}, path: string = 'PaymentState::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`) + + 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`) + + if (typeof o.paid_at_unix !== 'number') return new Error(`${path}.paid_at_unix: is not a number`) + if (opts.paid_at_unix_CustomCheck && !opts.paid_at_unix_CustomCheck(o.paid_at_unix)) return new Error(`${path}.paid_at_unix: 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`) return null } @@ -825,270 +2002,41 @@ export const ProductValidate = (o?: Product, opts: ProductOptions = {}, path: st return null } -export type CreateOneTimeInviteLinkResponse = { - invitation_link: string +export type RelaysMigration = { + relays: string[] } -export const CreateOneTimeInviteLinkResponseOptionalFields: [] = [] -export type CreateOneTimeInviteLinkResponseOptions = OptionsBaseMessage & { +export const RelaysMigrationOptionalFields: [] = [] +export type RelaysMigrationOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - invitation_link_CustomCheck?: (v: string) => boolean + relays_CustomCheck?: (v: string[]) => boolean } -export const CreateOneTimeInviteLinkResponseValidate = (o?: CreateOneTimeInviteLinkResponse, opts: CreateOneTimeInviteLinkResponseOptions = {}, path: string = 'CreateOneTimeInviteLinkResponse::root.'): Error | null => { +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 (typeof o.invitation_link !== 'string') return new Error(`${path}.invitation_link: is not a string`) - if (opts.invitation_link_CustomCheck && !opts.invitation_link_CustomCheck(o.invitation_link)) return new Error(`${path}.invitation_link: custom check failed`) + 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 AppsMetricsRequest = { - include_operations?: boolean - from_unix?: number - to_unix?: number +export type RequestNPubLinkingTokenRequest = { + user_identifier: string } -export type AppsMetricsRequestOptionalField = 'include_operations' | 'from_unix' | 'to_unix' -export const AppsMetricsRequestOptionalFields: AppsMetricsRequestOptionalField[] = ['include_operations', 'from_unix', 'to_unix'] -export type AppsMetricsRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: AppsMetricsRequestOptionalField[] - include_operations_CustomCheck?: (v?: boolean) => boolean - from_unix_CustomCheck?: (v?: number) => boolean - to_unix_CustomCheck?: (v?: number) => boolean -} -export const AppsMetricsRequestValidate = (o?: AppsMetricsRequest, opts: AppsMetricsRequestOptions = {}, path: string = 'AppsMetricsRequest::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 ((o.from_unix || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('from_unix')) && typeof o.from_unix !== 'number') return new Error(`${path}.from_unix: is not a number`) - if (opts.from_unix_CustomCheck && !opts.from_unix_CustomCheck(o.from_unix)) return new Error(`${path}.from_unix: custom check failed`) - - if ((o.to_unix || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('to_unix')) && typeof o.to_unix !== 'number') return new Error(`${path}.to_unix: is not a number`) - if (opts.to_unix_CustomCheck && !opts.to_unix_CustomCheck(o.to_unix)) return new Error(`${path}.to_unix: custom check failed`) - - if ((o.include_operations || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('include_operations')) && typeof o.include_operations !== 'boolean') return new Error(`${path}.include_operations: is not a boolean`) - if (opts.include_operations_CustomCheck && !opts.include_operations_CustomCheck(o.include_operations)) return new Error(`${path}.include_operations: custom check failed`) - - return null -} - -export type LndGetInfoRequest = { - nodeId: number -} -export const LndGetInfoRequestOptionalFields: [] = [] -export type LndGetInfoRequestOptions = OptionsBaseMessage & { +export const RequestNPubLinkingTokenRequestOptionalFields: [] = [] +export type RequestNPubLinkingTokenRequestOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - nodeId_CustomCheck?: (v: number) => boolean + user_identifier_CustomCheck?: (v: string) => boolean } -export const LndGetInfoRequestValidate = (o?: LndGetInfoRequest, opts: LndGetInfoRequestOptions = {}, path: string = 'LndGetInfoRequest::root.'): Error | null => { +export const RequestNPubLinkingTokenRequestValidate = (o?: RequestNPubLinkingTokenRequest, opts: RequestNPubLinkingTokenRequestOptions = {}, path: string = 'RequestNPubLinkingTokenRequest::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 AddAppUserInvoiceRequest = { - receiver_identifier: string - payer_identifier: string - http_callback_url: string - invoice_req: NewInvoiceRequest -} -export const AddAppUserInvoiceRequestOptionalFields: [] = [] -export type AddAppUserInvoiceRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - payer_identifier_CustomCheck?: (v: string) => boolean - http_callback_url_CustomCheck?: (v: string) => boolean - invoice_req_Options?: NewInvoiceRequestOptions - receiver_identifier_CustomCheck?: (v: string) => boolean -} -export const AddAppUserInvoiceRequestValidate = (o?: AddAppUserInvoiceRequest, opts: AddAppUserInvoiceRequestOptions = {}, path: string = 'AddAppUserInvoiceRequest::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.receiver_identifier !== 'string') return new Error(`${path}.receiver_identifier: is not a string`) - if (opts.receiver_identifier_CustomCheck && !opts.receiver_identifier_CustomCheck(o.receiver_identifier)) return new Error(`${path}.receiver_identifier: 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.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 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 LnurlWithdrawInfoResponse = { - k1: string - defaultDescription: string - minWithdrawable: number - maxWithdrawable: number - balanceCheck: string - payLink: string - tag: string - callback: string -} -export const LnurlWithdrawInfoResponseOptionalFields: [] = [] -export type LnurlWithdrawInfoResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - minWithdrawable_CustomCheck?: (v: number) => boolean - maxWithdrawable_CustomCheck?: (v: number) => boolean - balanceCheck_CustomCheck?: (v: string) => boolean - payLink_CustomCheck?: (v: string) => boolean - tag_CustomCheck?: (v: string) => boolean - callback_CustomCheck?: (v: string) => boolean - k1_CustomCheck?: (v: string) => boolean - defaultDescription_CustomCheck?: (v: string) => boolean -} -export const LnurlWithdrawInfoResponseValidate = (o?: LnurlWithdrawInfoResponse, opts: LnurlWithdrawInfoResponseOptions = {}, path: string = 'LnurlWithdrawInfoResponse::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.balanceCheck !== 'string') return new Error(`${path}.balanceCheck: is not a string`) - if (opts.balanceCheck_CustomCheck && !opts.balanceCheck_CustomCheck(o.balanceCheck)) return new Error(`${path}.balanceCheck: custom check failed`) - - if (typeof o.payLink !== 'string') return new Error(`${path}.payLink: is not a string`) - if (opts.payLink_CustomCheck && !opts.payLink_CustomCheck(o.payLink)) return new Error(`${path}.payLink: custom check failed`) - - 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.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`) - - if (typeof o.defaultDescription !== 'string') return new Error(`${path}.defaultDescription: is not a string`) - if (opts.defaultDescription_CustomCheck && !opts.defaultDescription_CustomCheck(o.defaultDescription)) return new Error(`${path}.defaultDescription: custom check failed`) - - if (typeof o.minWithdrawable !== 'number') return new Error(`${path}.minWithdrawable: is not a number`) - if (opts.minWithdrawable_CustomCheck && !opts.minWithdrawable_CustomCheck(o.minWithdrawable)) return new Error(`${path}.minWithdrawable: custom check failed`) - - if (typeof o.maxWithdrawable !== 'number') return new Error(`${path}.maxWithdrawable: is not a number`) - if (opts.maxWithdrawable_CustomCheck && !opts.maxWithdrawable_CustomCheck(o.maxWithdrawable)) return new Error(`${path}.maxWithdrawable: 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 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 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 LnurlLinkResponse = { - lnurl: string - k1: string -} -export const LnurlLinkResponseOptionalFields: [] = [] -export type LnurlLinkResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - k1_CustomCheck?: (v: string) => boolean - lnurl_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`) + 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 } @@ -1111,73 +2059,180 @@ export const RequestNPubLinkingTokenResponseValidate = (o?: RequestNPubLinkingTo return null } -export type UsageMetric = { - batch_size: number - parsed_in_nano: number - rpc_name: string - validate_in_nano: number - handle_in_nano: number - batch: boolean - nostr: boolean - processed_at_ms: number - auth_in_nano: number +export type RoutingEvent = { + event_type: string + failure_string: string + forward_fail_event: boolean + incoming_amt_msat: number + incoming_channel_id: number + incoming_htlc_id: number + offchain: boolean + outgoing_amt_msat: number + outgoing_channel_id: number + outgoing_htlc_id: number + settled: boolean + timestamp_ns: number } -export const UsageMetricOptionalFields: [] = [] -export type UsageMetricOptions = OptionsBaseMessage & { +export const RoutingEventOptionalFields: [] = [] +export type RoutingEventOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - validate_in_nano_CustomCheck?: (v: number) => boolean - handle_in_nano_CustomCheck?: (v: number) => boolean - batch_CustomCheck?: (v: boolean) => boolean - nostr_CustomCheck?: (v: boolean) => boolean - processed_at_ms_CustomCheck?: (v: number) => boolean - auth_in_nano_CustomCheck?: (v: number) => boolean - batch_size_CustomCheck?: (v: number) => boolean - parsed_in_nano_CustomCheck?: (v: number) => boolean - rpc_name_CustomCheck?: (v: string) => boolean + event_type_CustomCheck?: (v: string) => boolean + failure_string_CustomCheck?: (v: string) => boolean + forward_fail_event_CustomCheck?: (v: boolean) => boolean + incoming_amt_msat_CustomCheck?: (v: number) => boolean + incoming_channel_id_CustomCheck?: (v: number) => boolean + incoming_htlc_id_CustomCheck?: (v: number) => boolean + offchain_CustomCheck?: (v: boolean) => boolean + outgoing_amt_msat_CustomCheck?: (v: number) => boolean + outgoing_channel_id_CustomCheck?: (v: number) => boolean + outgoing_htlc_id_CustomCheck?: (v: number) => boolean + settled_CustomCheck?: (v: boolean) => boolean + timestamp_ns_CustomCheck?: (v: number) => boolean } -export const UsageMetricValidate = (o?: UsageMetric, opts: UsageMetricOptions = {}, path: string = 'UsageMetric::root.'): Error | null => { +export const RoutingEventValidate = (o?: RoutingEvent, opts: RoutingEventOptions = {}, path: string = 'RoutingEvent::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.parsed_in_nano !== 'number') return new Error(`${path}.parsed_in_nano: is not a number`) - if (opts.parsed_in_nano_CustomCheck && !opts.parsed_in_nano_CustomCheck(o.parsed_in_nano)) return new Error(`${path}.parsed_in_nano: custom check failed`) + if (typeof o.event_type !== 'string') return new Error(`${path}.event_type: is not a string`) + if (opts.event_type_CustomCheck && !opts.event_type_CustomCheck(o.event_type)) return new Error(`${path}.event_type: custom check failed`) - if (typeof o.rpc_name !== 'string') return new Error(`${path}.rpc_name: is not a string`) - if (opts.rpc_name_CustomCheck && !opts.rpc_name_CustomCheck(o.rpc_name)) return new Error(`${path}.rpc_name: custom check failed`) + if (typeof o.failure_string !== 'string') return new Error(`${path}.failure_string: is not a string`) + if (opts.failure_string_CustomCheck && !opts.failure_string_CustomCheck(o.failure_string)) return new Error(`${path}.failure_string: custom check failed`) - if (typeof o.batch_size !== 'number') return new Error(`${path}.batch_size: is not a number`) - if (opts.batch_size_CustomCheck && !opts.batch_size_CustomCheck(o.batch_size)) return new Error(`${path}.batch_size: custom check failed`) + if (typeof o.forward_fail_event !== 'boolean') return new Error(`${path}.forward_fail_event: is not a boolean`) + if (opts.forward_fail_event_CustomCheck && !opts.forward_fail_event_CustomCheck(o.forward_fail_event)) return new Error(`${path}.forward_fail_event: custom check failed`) - if (typeof o.processed_at_ms !== 'number') return new Error(`${path}.processed_at_ms: is not a number`) - if (opts.processed_at_ms_CustomCheck && !opts.processed_at_ms_CustomCheck(o.processed_at_ms)) return new Error(`${path}.processed_at_ms: custom check failed`) + if (typeof o.incoming_amt_msat !== 'number') return new Error(`${path}.incoming_amt_msat: is not a number`) + if (opts.incoming_amt_msat_CustomCheck && !opts.incoming_amt_msat_CustomCheck(o.incoming_amt_msat)) return new Error(`${path}.incoming_amt_msat: custom check failed`) - if (typeof o.auth_in_nano !== 'number') return new Error(`${path}.auth_in_nano: is not a number`) - if (opts.auth_in_nano_CustomCheck && !opts.auth_in_nano_CustomCheck(o.auth_in_nano)) return new Error(`${path}.auth_in_nano: custom check failed`) + if (typeof o.incoming_channel_id !== 'number') return new Error(`${path}.incoming_channel_id: is not a number`) + if (opts.incoming_channel_id_CustomCheck && !opts.incoming_channel_id_CustomCheck(o.incoming_channel_id)) return new Error(`${path}.incoming_channel_id: custom check failed`) - if (typeof o.validate_in_nano !== 'number') return new Error(`${path}.validate_in_nano: is not a number`) - if (opts.validate_in_nano_CustomCheck && !opts.validate_in_nano_CustomCheck(o.validate_in_nano)) return new Error(`${path}.validate_in_nano: custom check failed`) + if (typeof o.incoming_htlc_id !== 'number') return new Error(`${path}.incoming_htlc_id: is not a number`) + if (opts.incoming_htlc_id_CustomCheck && !opts.incoming_htlc_id_CustomCheck(o.incoming_htlc_id)) return new Error(`${path}.incoming_htlc_id: custom check failed`) - if (typeof o.handle_in_nano !== 'number') return new Error(`${path}.handle_in_nano: is not a number`) - if (opts.handle_in_nano_CustomCheck && !opts.handle_in_nano_CustomCheck(o.handle_in_nano)) return new Error(`${path}.handle_in_nano: custom check failed`) + if (typeof o.offchain !== 'boolean') return new Error(`${path}.offchain: is not a boolean`) + if (opts.offchain_CustomCheck && !opts.offchain_CustomCheck(o.offchain)) return new Error(`${path}.offchain: custom check failed`) - if (typeof o.batch !== 'boolean') return new Error(`${path}.batch: is not a boolean`) - if (opts.batch_CustomCheck && !opts.batch_CustomCheck(o.batch)) return new Error(`${path}.batch: custom check failed`) + if (typeof o.outgoing_amt_msat !== 'number') return new Error(`${path}.outgoing_amt_msat: is not a number`) + if (opts.outgoing_amt_msat_CustomCheck && !opts.outgoing_amt_msat_CustomCheck(o.outgoing_amt_msat)) return new Error(`${path}.outgoing_amt_msat: custom check failed`) - if (typeof o.nostr !== 'boolean') return new Error(`${path}.nostr: is not a boolean`) - if (opts.nostr_CustomCheck && !opts.nostr_CustomCheck(o.nostr)) return new Error(`${path}.nostr: custom check failed`) + if (typeof o.outgoing_channel_id !== 'number') return new Error(`${path}.outgoing_channel_id: is not a number`) + if (opts.outgoing_channel_id_CustomCheck && !opts.outgoing_channel_id_CustomCheck(o.outgoing_channel_id)) return new Error(`${path}.outgoing_channel_id: custom check failed`) + + if (typeof o.outgoing_htlc_id !== 'number') return new Error(`${path}.outgoing_htlc_id: is not a number`) + if (opts.outgoing_htlc_id_CustomCheck && !opts.outgoing_htlc_id_CustomCheck(o.outgoing_htlc_id)) return new Error(`${path}.outgoing_htlc_id: custom check failed`) + + if (typeof o.settled !== 'boolean') return new Error(`${path}.settled: is not a boolean`) + if (opts.settled_CustomCheck && !opts.settled_CustomCheck(o.settled)) return new Error(`${path}.settled: custom check failed`) + + if (typeof o.timestamp_ns !== 'number') return new Error(`${path}.timestamp_ns: is not a number`) + if (opts.timestamp_ns_CustomCheck && !opts.timestamp_ns_CustomCheck(o.timestamp_ns)) return new Error(`${path}.timestamp_ns: custom check failed`) + + return null +} + +export type SendAppUserToAppPaymentRequest = { + amount: number + from_user_identifier: string +} +export const SendAppUserToAppPaymentRequestOptionalFields: [] = [] +export type SendAppUserToAppPaymentRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + amount_CustomCheck?: (v: number) => boolean + from_user_identifier_CustomCheck?: (v: string) => 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.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.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`) + + return null +} + +export type SendAppUserToAppUserPaymentRequest = { + amount: number + from_user_identifier: string + to_user_identifier: string +} +export const SendAppUserToAppUserPaymentRequestOptionalFields: [] = [] +export type SendAppUserToAppUserPaymentRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + amount_CustomCheck?: (v: number) => boolean + from_user_identifier_CustomCheck?: (v: string) => boolean + to_user_identifier_CustomCheck?: (v: string) => 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.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.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`) + + 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 SetMockAppUserBalanceRequest = { + amount: number + user_identifier: string +} +export const SetMockAppUserBalanceRequestOptionalFields: [] = [] +export type SetMockAppUserBalanceRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + amount_CustomCheck?: (v: number) => boolean + user_identifier_CustomCheck?: (v: string) => 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.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 SetMockInvoiceAsPaidRequest = { - invoice: string amount: number + invoice: string } export const SetMockInvoiceAsPaidRequestOptionalFields: [] = [] export type SetMockInvoiceAsPaidRequestOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - invoice_CustomCheck?: (v: string) => boolean amount_CustomCheck?: (v: number) => boolean + invoice_CustomCheck?: (v: string) => boolean } 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') @@ -1192,505 +2247,60 @@ export const SetMockInvoiceAsPaidRequestValidate = (o?: SetMockInvoiceAsPaidRequ return null } -export type AddAppRequest = { - name: string - allow_user_creation: boolean +export type UsageMetric = { + auth_in_nano: number + batch: boolean + batch_size: number + handle_in_nano: number + nostr: boolean + parsed_in_nano: number + processed_at_ms: number + rpc_name: string + validate_in_nano: number } -export const AddAppRequestOptionalFields: [] = [] -export type AddAppRequestOptions = OptionsBaseMessage & { +export const UsageMetricOptionalFields: [] = [] +export type UsageMetricOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - allow_user_creation_CustomCheck?: (v: boolean) => boolean - name_CustomCheck?: (v: string) => boolean + auth_in_nano_CustomCheck?: (v: number) => boolean + batch_CustomCheck?: (v: boolean) => boolean + batch_size_CustomCheck?: (v: number) => boolean + handle_in_nano_CustomCheck?: (v: number) => boolean + nostr_CustomCheck?: (v: boolean) => boolean + parsed_in_nano_CustomCheck?: (v: number) => boolean + processed_at_ms_CustomCheck?: (v: number) => boolean + rpc_name_CustomCheck?: (v: string) => boolean + validate_in_nano_CustomCheck?: (v: number) => boolean } -export const AddAppRequestValidate = (o?: AddAppRequest, opts: AddAppRequestOptions = {}, path: string = 'AddAppRequest::root.'): Error | null => { +export const UsageMetricValidate = (o?: UsageMetric, opts: UsageMetricOptions = {}, path: string = 'UsageMetric::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.auth_in_nano !== 'number') return new Error(`${path}.auth_in_nano: is not a number`) + if (opts.auth_in_nano_CustomCheck && !opts.auth_in_nano_CustomCheck(o.auth_in_nano)) return new Error(`${path}.auth_in_nano: 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`) + if (typeof o.batch !== 'boolean') return new Error(`${path}.batch: is not a boolean`) + if (opts.batch_CustomCheck && !opts.batch_CustomCheck(o.batch)) return new Error(`${path}.batch: custom check failed`) - return null -} + if (typeof o.batch_size !== 'number') return new Error(`${path}.batch_size: is not a number`) + if (opts.batch_size_CustomCheck && !opts.batch_size_CustomCheck(o.batch_size)) return new Error(`${path}.batch_size: custom check failed`) -export type PayAddressResponse = { - operation_id: string - service_fee: number - network_fee: number - txId: string -} -export const PayAddressResponseOptionalFields: [] = [] -export type PayAddressResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - operation_id_CustomCheck?: (v: string) => boolean - service_fee_CustomCheck?: (v: number) => boolean - network_fee_CustomCheck?: (v: number) => boolean - txId_CustomCheck?: (v: string) => 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.handle_in_nano !== 'number') return new Error(`${path}.handle_in_nano: is not a number`) + if (opts.handle_in_nano_CustomCheck && !opts.handle_in_nano_CustomCheck(o.handle_in_nano)) return new Error(`${path}.handle_in_nano: custom check failed`) - 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.nostr !== 'boolean') return new Error(`${path}.nostr: is not a boolean`) + if (opts.nostr_CustomCheck && !opts.nostr_CustomCheck(o.nostr)) return new Error(`${path}.nostr: 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.parsed_in_nano !== 'number') return new Error(`${path}.parsed_in_nano: is not a number`) + if (opts.parsed_in_nano_CustomCheck && !opts.parsed_in_nano_CustomCheck(o.parsed_in_nano)) return new Error(`${path}.parsed_in_nano: 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.processed_at_ms !== 'number') return new Error(`${path}.processed_at_ms: is not a number`) + if (opts.processed_at_ms_CustomCheck && !opts.processed_at_ms_CustomCheck(o.processed_at_ms)) return new Error(`${path}.processed_at_ms: 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`) + if (typeof o.rpc_name !== 'string') return new Error(`${path}.rpc_name: is not a string`) + if (opts.rpc_name_CustomCheck && !opts.rpc_name_CustomCheck(o.rpc_name)) return new Error(`${path}.rpc_name: custom check failed`) - return null -} - -export type OpenChannel = { - remote_balance: number - label: string - channel_id: string - capacity: number - active: boolean - lifetime: number - local_balance: number -} -export const OpenChannelOptionalFields: [] = [] -export type OpenChannelOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - lifetime_CustomCheck?: (v: number) => boolean - local_balance_CustomCheck?: (v: number) => boolean - remote_balance_CustomCheck?: (v: number) => boolean - label_CustomCheck?: (v: string) => boolean - channel_id_CustomCheck?: (v: string) => boolean - capacity_CustomCheck?: (v: number) => boolean - active_CustomCheck?: (v: boolean) => boolean -} -export const OpenChannelValidate = (o?: OpenChannel, opts: OpenChannelOptions = {}, path: string = 'OpenChannel::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.channel_id !== 'string') return new Error(`${path}.channel_id: is not a string`) - if (opts.channel_id_CustomCheck && !opts.channel_id_CustomCheck(o.channel_id)) return new Error(`${path}.channel_id: custom check failed`) - - if (typeof o.capacity !== 'number') return new Error(`${path}.capacity: is not a number`) - if (opts.capacity_CustomCheck && !opts.capacity_CustomCheck(o.capacity)) return new Error(`${path}.capacity: custom check failed`) - - if (typeof o.active !== 'boolean') return new Error(`${path}.active: is not a boolean`) - if (opts.active_CustomCheck && !opts.active_CustomCheck(o.active)) return new Error(`${path}.active: custom check failed`) - - if (typeof o.lifetime !== 'number') return new Error(`${path}.lifetime: is not a number`) - if (opts.lifetime_CustomCheck && !opts.lifetime_CustomCheck(o.lifetime)) return new Error(`${path}.lifetime: custom check failed`) - - if (typeof o.local_balance !== 'number') return new Error(`${path}.local_balance: is not a number`) - if (opts.local_balance_CustomCheck && !opts.local_balance_CustomCheck(o.local_balance)) return new Error(`${path}.local_balance: custom check failed`) - - if (typeof o.remote_balance !== 'number') return new Error(`${path}.remote_balance: is not a number`) - if (opts.remote_balance_CustomCheck && !opts.remote_balance_CustomCheck(o.remote_balance)) return new Error(`${path}.remote_balance: custom check failed`) - - if (typeof o.label !== 'string') return new Error(`${path}.label: is not a string`) - if (opts.label_CustomCheck && !opts.label_CustomCheck(o.label)) return new Error(`${path}.label: custom check failed`) - - return null -} - -export type LndNodeMetrics = { - online_channels: number - open_channels: OpenChannel[] - closed_channels: ClosedChannel[] - closing_channels: number - forwarding_events: number - forwarding_fees: number - chain_balance: GraphPoint[] - channel_balance: GraphPoint[] - external_balance: GraphPoint[] - offline_channels: number - pending_channels: number -} -export const LndNodeMetricsOptionalFields: [] = [] -export type LndNodeMetricsOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - closed_channels_ItemOptions?: ClosedChannelOptions - closed_channels_CustomCheck?: (v: ClosedChannel[]) => boolean - online_channels_CustomCheck?: (v: number) => boolean - open_channels_ItemOptions?: OpenChannelOptions - open_channels_CustomCheck?: (v: OpenChannel[]) => boolean - external_balance_ItemOptions?: GraphPointOptions - external_balance_CustomCheck?: (v: GraphPoint[]) => boolean - offline_channels_CustomCheck?: (v: number) => boolean - pending_channels_CustomCheck?: (v: number) => boolean - closing_channels_CustomCheck?: (v: number) => boolean - forwarding_events_CustomCheck?: (v: number) => boolean - forwarding_fees_CustomCheck?: (v: number) => boolean - chain_balance_ItemOptions?: GraphPointOptions - chain_balance_CustomCheck?: (v: GraphPoint[]) => boolean - channel_balance_ItemOptions?: GraphPointOptions - channel_balance_CustomCheck?: (v: GraphPoint[]) => boolean -} -export const LndNodeMetricsValidate = (o?: LndNodeMetrics, opts: LndNodeMetricsOptions = {}, path: string = 'LndNodeMetrics::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.channel_balance)) return new Error(`${path}.channel_balance: is not an array`) - for (let index = 0; index < o.channel_balance.length; index++) { - const channel_balanceErr = GraphPointValidate(o.channel_balance[index], opts.channel_balance_ItemOptions, `${path}.channel_balance[${index}]`) - if (channel_balanceErr !== null) return channel_balanceErr - } - if (opts.channel_balance_CustomCheck && !opts.channel_balance_CustomCheck(o.channel_balance)) return new Error(`${path}.channel_balance: custom check failed`) - - if (!Array.isArray(o.external_balance)) return new Error(`${path}.external_balance: is not an array`) - for (let index = 0; index < o.external_balance.length; index++) { - const external_balanceErr = GraphPointValidate(o.external_balance[index], opts.external_balance_ItemOptions, `${path}.external_balance[${index}]`) - if (external_balanceErr !== null) return external_balanceErr - } - if (opts.external_balance_CustomCheck && !opts.external_balance_CustomCheck(o.external_balance)) return new Error(`${path}.external_balance: custom check failed`) - - if (typeof o.offline_channels !== 'number') return new Error(`${path}.offline_channels: is not a number`) - if (opts.offline_channels_CustomCheck && !opts.offline_channels_CustomCheck(o.offline_channels)) return new Error(`${path}.offline_channels: custom check failed`) - - if (typeof o.pending_channels !== 'number') return new Error(`${path}.pending_channels: is not a number`) - if (opts.pending_channels_CustomCheck && !opts.pending_channels_CustomCheck(o.pending_channels)) return new Error(`${path}.pending_channels: custom check failed`) - - if (typeof o.closing_channels !== 'number') return new Error(`${path}.closing_channels: is not a number`) - if (opts.closing_channels_CustomCheck && !opts.closing_channels_CustomCheck(o.closing_channels)) return new Error(`${path}.closing_channels: custom check failed`) - - if (typeof o.forwarding_events !== 'number') return new Error(`${path}.forwarding_events: is not a number`) - if (opts.forwarding_events_CustomCheck && !opts.forwarding_events_CustomCheck(o.forwarding_events)) return new Error(`${path}.forwarding_events: custom check failed`) - - if (typeof o.forwarding_fees !== 'number') return new Error(`${path}.forwarding_fees: is not a number`) - if (opts.forwarding_fees_CustomCheck && !opts.forwarding_fees_CustomCheck(o.forwarding_fees)) return new Error(`${path}.forwarding_fees: custom check failed`) - - if (!Array.isArray(o.chain_balance)) return new Error(`${path}.chain_balance: is not an array`) - for (let index = 0; index < o.chain_balance.length; index++) { - const chain_balanceErr = GraphPointValidate(o.chain_balance[index], opts.chain_balance_ItemOptions, `${path}.chain_balance[${index}]`) - if (chain_balanceErr !== null) return chain_balanceErr - } - if (opts.chain_balance_CustomCheck && !opts.chain_balance_CustomCheck(o.chain_balance)) return new Error(`${path}.chain_balance: custom check failed`) - - if (!Array.isArray(o.open_channels)) return new Error(`${path}.open_channels: is not an array`) - for (let index = 0; index < o.open_channels.length; index++) { - const open_channelsErr = OpenChannelValidate(o.open_channels[index], opts.open_channels_ItemOptions, `${path}.open_channels[${index}]`) - if (open_channelsErr !== null) return open_channelsErr - } - if (opts.open_channels_CustomCheck && !opts.open_channels_CustomCheck(o.open_channels)) return new Error(`${path}.open_channels: custom check failed`) - - if (!Array.isArray(o.closed_channels)) return new Error(`${path}.closed_channels: is not an array`) - for (let index = 0; index < o.closed_channels.length; index++) { - const closed_channelsErr = ClosedChannelValidate(o.closed_channels[index], opts.closed_channels_ItemOptions, `${path}.closed_channels[${index}]`) - if (closed_channelsErr !== null) return closed_channelsErr - } - if (opts.closed_channels_CustomCheck && !opts.closed_channels_CustomCheck(o.closed_channels)) return new Error(`${path}.closed_channels: custom check failed`) - - if (typeof o.online_channels !== 'number') return new Error(`${path}.online_channels: is not a number`) - if (opts.online_channels_CustomCheck && !opts.online_channels_CustomCheck(o.online_channels)) return new Error(`${path}.online_channels: 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`) - - return null -} - -export type HttpCreds = { - url: string - token: string -} -export const HttpCredsOptionalFields: [] = [] -export type HttpCredsOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - url_CustomCheck?: (v: string) => boolean - token_CustomCheck?: (v: string) => boolean -} -export const HttpCredsValidate = (o?: HttpCreds, opts: HttpCredsOptions = {}, path: string = 'HttpCreds::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.token !== 'string') return new Error(`${path}.token: is not a string`) - if (opts.token_CustomCheck && !opts.token_CustomCheck(o.token)) return new Error(`${path}.token: custom check failed`) - - if (typeof o.url !== 'string') return new Error(`${path}.url: is not a string`) - if (opts.url_CustomCheck && !opts.url_CustomCheck(o.url)) return new Error(`${path}.url: custom check failed`) - - return null -} - -export type LndMetricsRequest = { - from_unix?: number - to_unix?: number -} -export type LndMetricsRequestOptionalField = 'from_unix' | 'to_unix' -export const LndMetricsRequestOptionalFields: LndMetricsRequestOptionalField[] = ['from_unix', 'to_unix'] -export type LndMetricsRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: LndMetricsRequestOptionalField[] - from_unix_CustomCheck?: (v?: number) => boolean - to_unix_CustomCheck?: (v?: number) => boolean -} -export const LndMetricsRequestValidate = (o?: LndMetricsRequest, opts: LndMetricsRequestOptions = {}, path: string = 'LndMetricsRequest::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 ((o.from_unix || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('from_unix')) && typeof o.from_unix !== 'number') return new Error(`${path}.from_unix: is not a number`) - if (opts.from_unix_CustomCheck && !opts.from_unix_CustomCheck(o.from_unix)) return new Error(`${path}.from_unix: custom check failed`) - - if ((o.to_unix || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('to_unix')) && typeof o.to_unix !== 'number') return new Error(`${path}.to_unix: is not a number`) - if (opts.to_unix_CustomCheck && !opts.to_unix_CustomCheck(o.to_unix)) return new Error(`${path}.to_unix: 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 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 LinkNPubThroughTokenRequest = { - token: string -} -export const LinkNPubThroughTokenRequestOptionalFields: [] = [] -export type LinkNPubThroughTokenRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - token_CustomCheck?: (v: string) => boolean -} -export const LinkNPubThroughTokenRequestValidate = (o?: LinkNPubThroughTokenRequest, opts: LinkNPubThroughTokenRequestOptions = {}, path: string = 'LinkNPubThroughTokenRequest::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.token !== 'string') return new Error(`${path}.token: is not a string`) - if (opts.token_CustomCheck && !opts.token_CustomCheck(o.token)) return new Error(`${path}.token: custom check failed`) - - return null -} - -export type NewInvoiceRequest = { - amountSats: number - memo: string -} -export const NewInvoiceRequestOptionalFields: [] = [] -export type NewInvoiceRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - memo_CustomCheck?: (v: string) => boolean - amountSats_CustomCheck?: (v: number) => 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 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 UsersInfo = { - balance_avg: number - balance_median: number - total: number - no_balance: number - negative_balance: number - always_been_inactive: number -} -export const UsersInfoOptionalFields: [] = [] -export type UsersInfoOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - always_been_inactive_CustomCheck?: (v: number) => boolean - balance_avg_CustomCheck?: (v: number) => boolean - balance_median_CustomCheck?: (v: number) => boolean - total_CustomCheck?: (v: number) => boolean - no_balance_CustomCheck?: (v: number) => boolean - negative_balance_CustomCheck?: (v: number) => boolean -} -export const UsersInfoValidate = (o?: UsersInfo, opts: UsersInfoOptions = {}, path: string = 'UsersInfo::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.no_balance !== 'number') return new Error(`${path}.no_balance: is not a number`) - if (opts.no_balance_CustomCheck && !opts.no_balance_CustomCheck(o.no_balance)) return new Error(`${path}.no_balance: custom check failed`) - - if (typeof o.negative_balance !== 'number') return new Error(`${path}.negative_balance: is not a number`) - if (opts.negative_balance_CustomCheck && !opts.negative_balance_CustomCheck(o.negative_balance)) return new Error(`${path}.negative_balance: custom check failed`) - - if (typeof o.always_been_inactive !== 'number') return new Error(`${path}.always_been_inactive: is not a number`) - if (opts.always_been_inactive_CustomCheck && !opts.always_been_inactive_CustomCheck(o.always_been_inactive)) return new Error(`${path}.always_been_inactive: custom check failed`) - - if (typeof o.balance_avg !== 'number') return new Error(`${path}.balance_avg: is not a number`) - if (opts.balance_avg_CustomCheck && !opts.balance_avg_CustomCheck(o.balance_avg)) return new Error(`${path}.balance_avg: custom check failed`) - - if (typeof o.balance_median !== 'number') return new Error(`${path}.balance_median: is not a number`) - if (opts.balance_median_CustomCheck && !opts.balance_median_CustomCheck(o.balance_median)) return new Error(`${path}.balance_median: custom check failed`) - - if (typeof o.total !== 'number') return new Error(`${path}.total: is not a number`) - if (opts.total_CustomCheck && !opts.total_CustomCheck(o.total)) return new Error(`${path}.total: custom check failed`) - - return null -} - -export type LndMetrics = { - nodes: LndNodeMetrics[] -} -export const LndMetricsOptionalFields: [] = [] -export type LndMetricsOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - nodes_ItemOptions?: LndNodeMetricsOptions - nodes_CustomCheck?: (v: LndNodeMetrics[]) => boolean -} -export const LndMetricsValidate = (o?: LndMetrics, opts: LndMetricsOptions = {}, path: string = 'LndMetrics::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.nodes)) return new Error(`${path}.nodes: is not an array`) - for (let index = 0; index < o.nodes.length; index++) { - const nodesErr = LndNodeMetricsValidate(o.nodes[index], opts.nodes_ItemOptions, `${path}.nodes[${index}]`) - if (nodesErr !== null) return nodesErr - } - if (opts.nodes_CustomCheck && !opts.nodes_CustomCheck(o.nodes)) return new Error(`${path}.nodes: custom check failed`) - - return null -} - -export type BanUserRequest = { - user_id: string -} -export const BanUserRequestOptionalFields: [] = [] -export type BanUserRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - user_id_CustomCheck?: (v: string) => boolean -} -export const BanUserRequestValidate = (o?: BanUserRequest, opts: BanUserRequestOptions = {}, path: string = 'BanUserRequest::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_id !== 'string') return new Error(`${path}.user_id: is not a string`) - if (opts.user_id_CustomCheck && !opts.user_id_CustomCheck(o.user_id)) return new Error(`${path}.user_id: custom check failed`) - - return null -} - -export type AppUser = { - identifier: string - info: UserInfo - max_withdrawable: number -} -export const AppUserOptionalFields: [] = [] -export type AppUserOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - identifier_CustomCheck?: (v: string) => boolean - info_Options?: UserInfoOptions - max_withdrawable_CustomCheck?: (v: number) => boolean -} -export const AppUserValidate = (o?: AppUser, opts: AppUserOptions = {}, path: string = 'AppUser::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`) - - const infoErr = UserInfoValidate(o.info, opts.info_Options, `${path}.info`) - if (infoErr !== null) return infoErr - - - if (typeof o.max_withdrawable !== 'number') return new Error(`${path}.max_withdrawable: is not a number`) - if (opts.max_withdrawable_CustomCheck && !opts.max_withdrawable_CustomCheck(o.max_withdrawable)) return new Error(`${path}.max_withdrawable: custom check failed`) - - return null -} - -export type UserOperations = { - fromIndex: number - toIndex: number - operations: UserOperation[] -} -export const UserOperationsOptionalFields: [] = [] -export type UserOperationsOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - toIndex_CustomCheck?: (v: number) => boolean - operations_ItemOptions?: UserOperationOptions - operations_CustomCheck?: (v: UserOperation[]) => boolean - fromIndex_CustomCheck?: (v: number) => 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`) + if (typeof o.validate_in_nano !== 'number') return new Error(`${path}.validate_in_nano: is not a number`) + if (opts.validate_in_nano_CustomCheck && !opts.validate_in_nano_CustomCheck(o.validate_in_nano)) return new Error(`${path}.validate_in_nano: custom check failed`) return null } @@ -1718,715 +2328,6 @@ export const UsageMetricsValidate = (o?: UsageMetrics, opts: UsageMetricsOptions return null } -export type LndChannels = { - open_channels: OpenChannel[] -} -export const LndChannelsOptionalFields: [] = [] -export type LndChannelsOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - open_channels_ItemOptions?: OpenChannelOptions - open_channels_CustomCheck?: (v: OpenChannel[]) => boolean -} -export const LndChannelsValidate = (o?: LndChannels, opts: LndChannelsOptions = {}, path: string = 'LndChannels::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.open_channels)) return new Error(`${path}.open_channels: is not an array`) - for (let index = 0; index < o.open_channels.length; index++) { - const open_channelsErr = OpenChannelValidate(o.open_channels[index], opts.open_channels_ItemOptions, `${path}.open_channels[${index}]`) - if (open_channelsErr !== null) return open_channelsErr - } - if (opts.open_channels_CustomCheck && !opts.open_channels_CustomCheck(o.open_channels)) return new Error(`${path}.open_channels: custom check failed`) - - return null -} - -export type PayAddressRequest = { - satsPerVByte: number - address: string - amoutSats: number -} -export const PayAddressRequestOptionalFields: [] = [] -export type PayAddressRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - satsPerVByte_CustomCheck?: (v: number) => boolean - address_CustomCheck?: (v: string) => boolean - amoutSats_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.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`) - - 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`) - - return null -} - -export type PaymentState = { - paid_at_unix: number - amount: number - service_fee: number - network_fee: number -} -export const PaymentStateOptionalFields: [] = [] -export type PaymentStateOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - paid_at_unix_CustomCheck?: (v: number) => boolean - amount_CustomCheck?: (v: number) => boolean - service_fee_CustomCheck?: (v: number) => boolean - network_fee_CustomCheck?: (v: number) => boolean -} -export const PaymentStateValidate = (o?: PaymentState, opts: PaymentStateOptions = {}, path: string = 'PaymentState::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.paid_at_unix !== 'number') return new Error(`${path}.paid_at_unix: is not a number`) - if (opts.paid_at_unix_CustomCheck && !opts.paid_at_unix_CustomCheck(o.paid_at_unix)) return new Error(`${path}.paid_at_unix: 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.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 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 GetUserOperationsRequest = { - max_size: number - latestIncomingInvoice: number - latestOutgoingInvoice: number - latestIncomingTx: number - latestOutgoingTx: number - latestIncomingUserToUserPayment: number - latestOutgoingUserToUserPayment: number -} -export const GetUserOperationsRequestOptionalFields: [] = [] -export type GetUserOperationsRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - latestIncomingTx_CustomCheck?: (v: number) => boolean - latestOutgoingTx_CustomCheck?: (v: number) => boolean - latestIncomingUserToUserPayment_CustomCheck?: (v: number) => boolean - latestOutgoingUserToUserPayment_CustomCheck?: (v: number) => boolean - max_size_CustomCheck?: (v: number) => boolean - latestIncomingInvoice_CustomCheck?: (v: number) => boolean - latestOutgoingInvoice_CustomCheck?: (v: number) => boolean -} -export const GetUserOperationsRequestValidate = (o?: GetUserOperationsRequest, opts: GetUserOperationsRequestOptions = {}, path: string = 'GetUserOperationsRequest::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.latestOutgoingTx !== 'number') return new Error(`${path}.latestOutgoingTx: is not a number`) - if (opts.latestOutgoingTx_CustomCheck && !opts.latestOutgoingTx_CustomCheck(o.latestOutgoingTx)) return new Error(`${path}.latestOutgoingTx: custom check failed`) - - if (typeof o.latestIncomingUserToUserPayment !== 'number') return new Error(`${path}.latestIncomingUserToUserPayment: is not a number`) - if (opts.latestIncomingUserToUserPayment_CustomCheck && !opts.latestIncomingUserToUserPayment_CustomCheck(o.latestIncomingUserToUserPayment)) return new Error(`${path}.latestIncomingUserToUserPayment: custom check failed`) - - if (typeof o.latestOutgoingUserToUserPayment !== 'number') return new Error(`${path}.latestOutgoingUserToUserPayment: is not a number`) - if (opts.latestOutgoingUserToUserPayment_CustomCheck && !opts.latestOutgoingUserToUserPayment_CustomCheck(o.latestOutgoingUserToUserPayment)) return new Error(`${path}.latestOutgoingUserToUserPayment: custom check failed`) - - if (typeof o.max_size !== 'number') return new Error(`${path}.max_size: is not a number`) - if (opts.max_size_CustomCheck && !opts.max_size_CustomCheck(o.max_size)) return new Error(`${path}.max_size: custom check failed`) - - if (typeof o.latestIncomingInvoice !== 'number') return new Error(`${path}.latestIncomingInvoice: is not a number`) - if (opts.latestIncomingInvoice_CustomCheck && !opts.latestIncomingInvoice_CustomCheck(o.latestIncomingInvoice)) return new Error(`${path}.latestIncomingInvoice: custom check failed`) - - if (typeof o.latestOutgoingInvoice !== 'number') return new Error(`${path}.latestOutgoingInvoice: is not a number`) - if (opts.latestOutgoingInvoice_CustomCheck && !opts.latestOutgoingInvoice_CustomCheck(o.latestOutgoingInvoice)) return new Error(`${path}.latestOutgoingInvoice: custom check failed`) - - if (typeof o.latestIncomingTx !== 'number') return new Error(`${path}.latestIncomingTx: is not a number`) - if (opts.latestIncomingTx_CustomCheck && !opts.latestIncomingTx_CustomCheck(o.latestIncomingTx)) return new Error(`${path}.latestIncomingTx: custom check failed`) - - return null -} - -export type RequestNPubLinkingTokenRequest = { - user_identifier: string -} -export const RequestNPubLinkingTokenRequestOptionalFields: [] = [] -export type RequestNPubLinkingTokenRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - user_identifier_CustomCheck?: (v: string) => boolean -} -export const RequestNPubLinkingTokenRequestValidate = (o?: RequestNPubLinkingTokenRequest, opts: RequestNPubLinkingTokenRequestOptions = {}, path: string = 'RequestNPubLinkingTokenRequest::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`) - - return null -} - -export type OpenChannelRequest = { - closeAddress: string - destination: string - fundingAmount: number - pushAmount: number -} -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 EnrollAdminTokenRequest = { - admin_token: string -} -export const EnrollAdminTokenRequestOptionalFields: [] = [] -export type EnrollAdminTokenRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - admin_token_CustomCheck?: (v: string) => boolean -} -export const EnrollAdminTokenRequestValidate = (o?: EnrollAdminTokenRequest, opts: EnrollAdminTokenRequestOptions = {}, path: string = 'EnrollAdminTokenRequest::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.admin_token !== 'string') return new Error(`${path}.admin_token: is not a string`) - if (opts.admin_token_CustomCheck && !opts.admin_token_CustomCheck(o.admin_token)) return new Error(`${path}.admin_token: custom check failed`) - - return null -} - -export type LndSeed = { - seed: string[] -} -export const LndSeedOptionalFields: [] = [] -export type LndSeedOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - seed_CustomCheck?: (v: string[]) => boolean -} -export const LndSeedValidate = (o?: LndSeed, opts: LndSeedOptions = {}, path: string = 'LndSeed::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.seed)) return new Error(`${path}.seed: is not an array`) - for (let index = 0; index < o.seed.length; index++) { - if (typeof o.seed[index] !== 'string') return new Error(`${path}.seed[${index}]: is not a string`) - } - if (opts.seed_CustomCheck && !opts.seed_CustomCheck(o.seed)) return new Error(`${path}.seed: custom check failed`) - - return null -} - -export type RoutingEvent = { - incoming_htlc_id: number - outgoing_htlc_id: number - event_type: string - incoming_amt_msat: number - outgoing_amt_msat: number - settled: boolean - forward_fail_event: boolean - incoming_channel_id: number - outgoing_channel_id: number - timestamp_ns: number - failure_string: string - offchain: boolean -} -export const RoutingEventOptionalFields: [] = [] -export type RoutingEventOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - incoming_htlc_id_CustomCheck?: (v: number) => boolean - outgoing_htlc_id_CustomCheck?: (v: number) => boolean - event_type_CustomCheck?: (v: string) => boolean - incoming_amt_msat_CustomCheck?: (v: number) => boolean - outgoing_amt_msat_CustomCheck?: (v: number) => boolean - settled_CustomCheck?: (v: boolean) => boolean - forward_fail_event_CustomCheck?: (v: boolean) => boolean - incoming_channel_id_CustomCheck?: (v: number) => boolean - outgoing_channel_id_CustomCheck?: (v: number) => boolean - timestamp_ns_CustomCheck?: (v: number) => boolean - failure_string_CustomCheck?: (v: string) => boolean - offchain_CustomCheck?: (v: boolean) => boolean -} -export const RoutingEventValidate = (o?: RoutingEvent, opts: RoutingEventOptions = {}, path: string = 'RoutingEvent::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.outgoing_amt_msat !== 'number') return new Error(`${path}.outgoing_amt_msat: is not a number`) - if (opts.outgoing_amt_msat_CustomCheck && !opts.outgoing_amt_msat_CustomCheck(o.outgoing_amt_msat)) return new Error(`${path}.outgoing_amt_msat: custom check failed`) - - if (typeof o.settled !== 'boolean') return new Error(`${path}.settled: is not a boolean`) - if (opts.settled_CustomCheck && !opts.settled_CustomCheck(o.settled)) return new Error(`${path}.settled: custom check failed`) - - if (typeof o.forward_fail_event !== 'boolean') return new Error(`${path}.forward_fail_event: is not a boolean`) - if (opts.forward_fail_event_CustomCheck && !opts.forward_fail_event_CustomCheck(o.forward_fail_event)) return new Error(`${path}.forward_fail_event: custom check failed`) - - if (typeof o.incoming_htlc_id !== 'number') return new Error(`${path}.incoming_htlc_id: is not a number`) - if (opts.incoming_htlc_id_CustomCheck && !opts.incoming_htlc_id_CustomCheck(o.incoming_htlc_id)) return new Error(`${path}.incoming_htlc_id: custom check failed`) - - if (typeof o.outgoing_htlc_id !== 'number') return new Error(`${path}.outgoing_htlc_id: is not a number`) - if (opts.outgoing_htlc_id_CustomCheck && !opts.outgoing_htlc_id_CustomCheck(o.outgoing_htlc_id)) return new Error(`${path}.outgoing_htlc_id: custom check failed`) - - if (typeof o.event_type !== 'string') return new Error(`${path}.event_type: is not a string`) - if (opts.event_type_CustomCheck && !opts.event_type_CustomCheck(o.event_type)) return new Error(`${path}.event_type: custom check failed`) - - if (typeof o.incoming_amt_msat !== 'number') return new Error(`${path}.incoming_amt_msat: is not a number`) - if (opts.incoming_amt_msat_CustomCheck && !opts.incoming_amt_msat_CustomCheck(o.incoming_amt_msat)) return new Error(`${path}.incoming_amt_msat: custom check failed`) - - if (typeof o.offchain !== 'boolean') return new Error(`${path}.offchain: is not a boolean`) - if (opts.offchain_CustomCheck && !opts.offchain_CustomCheck(o.offchain)) return new Error(`${path}.offchain: custom check failed`) - - if (typeof o.incoming_channel_id !== 'number') return new Error(`${path}.incoming_channel_id: is not a number`) - if (opts.incoming_channel_id_CustomCheck && !opts.incoming_channel_id_CustomCheck(o.incoming_channel_id)) return new Error(`${path}.incoming_channel_id: custom check failed`) - - if (typeof o.outgoing_channel_id !== 'number') return new Error(`${path}.outgoing_channel_id: is not a number`) - if (opts.outgoing_channel_id_CustomCheck && !opts.outgoing_channel_id_CustomCheck(o.outgoing_channel_id)) return new Error(`${path}.outgoing_channel_id: custom check failed`) - - if (typeof o.timestamp_ns !== 'number') return new Error(`${path}.timestamp_ns: is not a number`) - if (opts.timestamp_ns_CustomCheck && !opts.timestamp_ns_CustomCheck(o.timestamp_ns)) return new Error(`${path}.timestamp_ns: custom check failed`) - - if (typeof o.failure_string !== 'string') return new Error(`${path}.failure_string: is not a string`) - if (opts.failure_string_CustomCheck && !opts.failure_string_CustomCheck(o.failure_string)) return new Error(`${path}.failure_string: custom check failed`) - - return null -} - -export type GraphPoint = { - x: number - y: number -} -export const GraphPointOptionalFields: [] = [] -export type GraphPointOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - x_CustomCheck?: (v: number) => boolean - y_CustomCheck?: (v: number) => boolean -} -export const GraphPointValidate = (o?: GraphPoint, opts: GraphPointOptions = {}, path: string = 'GraphPoint::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.x !== 'number') return new Error(`${path}.x: is not a number`) - if (opts.x_CustomCheck && !opts.x_CustomCheck(o.x)) return new Error(`${path}.x: custom check failed`) - - if (typeof o.y !== 'number') return new Error(`${path}.y: is not a number`) - if (opts.y_CustomCheck && !opts.y_CustomCheck(o.y)) return new Error(`${path}.y: custom check failed`) - - return null -} - -export type GetAppUserRequest = { - user_identifier: string -} -export const GetAppUserRequestOptionalFields: [] = [] -export type GetAppUserRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - user_identifier_CustomCheck?: (v: string) => boolean -} -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.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 GetInviteTokenStateResponse = { - used: boolean -} -export const GetInviteTokenStateResponseOptionalFields: [] = [] -export type GetInviteTokenStateResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - used_CustomCheck?: (v: boolean) => boolean -} -export const GetInviteTokenStateResponseValidate = (o?: GetInviteTokenStateResponse, opts: GetInviteTokenStateResponseOptions = {}, path: string = 'GetInviteTokenStateResponse::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.used !== 'boolean') return new Error(`${path}.used: is not a boolean`) - if (opts.used_CustomCheck && !opts.used_CustomCheck(o.used)) return new Error(`${path}.used: custom check failed`) - - 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.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`) - - 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 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 HandleLnurlPayResponse = { - pr: string - routes: Empty[] -} -export const HandleLnurlPayResponseOptionalFields: [] = [] -export type HandleLnurlPayResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - routes_ItemOptions?: EmptyOptions - routes_CustomCheck?: (v: Empty[]) => boolean - pr_CustomCheck?: (v: string) => boolean -} -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.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 (!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 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 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 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 GetInviteTokenStateRequest = { - invite_token: string -} -export const GetInviteTokenStateRequestOptionalFields: [] = [] -export type GetInviteTokenStateRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - invite_token_CustomCheck?: (v: string) => boolean -} -export const GetInviteTokenStateRequestValidate = (o?: GetInviteTokenStateRequest, opts: GetInviteTokenStateRequestOptions = {}, path: string = 'GetInviteTokenStateRequest::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.invite_token !== 'string') return new Error(`${path}.invite_token: is not a string`) - if (opts.invite_token_CustomCheck && !opts.invite_token_CustomCheck(o.invite_token)) return new Error(`${path}.invite_token: custom check failed`) - - return null -} - -export type AppsMetrics = { - apps: AppMetrics[] -} -export const AppsMetricsOptionalFields: [] = [] -export type AppsMetricsOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - apps_ItemOptions?: AppMetricsOptions - apps_CustomCheck?: (v: AppMetrics[]) => boolean -} -export const AppsMetricsValidate = (o?: AppsMetrics, opts: AppsMetricsOptions = {}, path: string = 'AppsMetrics::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.apps)) return new Error(`${path}.apps: is not an array`) - for (let index = 0; index < o.apps.length; index++) { - const appsErr = AppMetricsValidate(o.apps[index], opts.apps_ItemOptions, `${path}.apps[${index}]`) - if (appsErr !== null) return appsErr - } - if (opts.apps_CustomCheck && !opts.apps_CustomCheck(o.apps)) return new Error(`${path}.apps: custom check failed`) - - return null -} - -export type BannedAppUser = { - nostr_pub: string - app_name: string - app_id: string - user_identifier: string -} -export const BannedAppUserOptionalFields: [] = [] -export type BannedAppUserOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - user_identifier_CustomCheck?: (v: string) => boolean - nostr_pub_CustomCheck?: (v: string) => boolean - app_name_CustomCheck?: (v: string) => boolean - app_id_CustomCheck?: (v: string) => boolean -} -export const BannedAppUserValidate = (o?: BannedAppUser, opts: BannedAppUserOptions = {}, path: string = 'BannedAppUser::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.app_name !== 'string') return new Error(`${path}.app_name: is not a string`) - if (opts.app_name_CustomCheck && !opts.app_name_CustomCheck(o.app_name)) return new Error(`${path}.app_name: custom check failed`) - - if (typeof o.app_id !== 'string') return new Error(`${path}.app_id: is not a string`) - if (opts.app_id_CustomCheck && !opts.app_id_CustomCheck(o.app_id)) return new Error(`${path}.app_id: 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.nostr_pub !== 'string') return new Error(`${path}.nostr_pub: is not a string`) - if (opts.nostr_pub_CustomCheck && !opts.nostr_pub_CustomCheck(o.nostr_pub)) return new Error(`${path}.nostr_pub: 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?: [] - 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 - tag_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.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`) - - 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`) - - return null -} - -export type UserOperation = { - type: UserOperationType - amount: number - identifier: string - tx_hash: string - paidAtUnix: number - inbound: boolean - operationId: string - service_fee: number - network_fee: number - confirmed: boolean - internal: boolean -} -export const UserOperationOptionalFields: [] = [] -export type UserOperationOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - operationId_CustomCheck?: (v: string) => boolean - service_fee_CustomCheck?: (v: number) => boolean - network_fee_CustomCheck?: (v: number) => boolean - confirmed_CustomCheck?: (v: boolean) => boolean - internal_CustomCheck?: (v: boolean) => boolean - paidAtUnix_CustomCheck?: (v: number) => boolean - inbound_CustomCheck?: (v: boolean) => boolean - identifier_CustomCheck?: (v: string) => boolean - tx_hash_CustomCheck?: (v: string) => boolean - type_CustomCheck?: (v: UserOperationType) => boolean - amount_CustomCheck?: (v: number) => boolean -} -export const UserOperationValidate = (o?: UserOperation, opts: UserOperationOptions = {}, path: string = 'UserOperation::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 (!enumCheckUserOperationType(o.type)) return new Error(`${path}.type: is not a valid UserOperationType`) - if (opts.type_CustomCheck && !opts.type_CustomCheck(o.type)) return new Error(`${path}.type: 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.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.tx_hash !== 'string') return new Error(`${path}.tx_hash: is not a string`) - if (opts.tx_hash_CustomCheck && !opts.tx_hash_CustomCheck(o.tx_hash)) return new Error(`${path}.tx_hash: custom check failed`) - - if (typeof o.internal !== 'boolean') return new Error(`${path}.internal: is not a boolean`) - if (opts.internal_CustomCheck && !opts.internal_CustomCheck(o.internal)) return new Error(`${path}.internal: custom check failed`) - - if (typeof o.paidAtUnix !== 'number') return new Error(`${path}.paidAtUnix: is not a number`) - if (opts.paidAtUnix_CustomCheck && !opts.paidAtUnix_CustomCheck(o.paidAtUnix)) return new Error(`${path}.paidAtUnix: custom check failed`) - - if (typeof o.inbound !== 'boolean') return new Error(`${path}.inbound: is not a boolean`) - if (opts.inbound_CustomCheck && !opts.inbound_CustomCheck(o.inbound)) return new Error(`${path}.inbound: custom check failed`) - - if (typeof o.operationId !== 'string') return new Error(`${path}.operationId: is not a string`) - if (opts.operationId_CustomCheck && !opts.operationId_CustomCheck(o.operationId)) return new Error(`${path}.operationId: 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`) - - if (typeof o.confirmed !== 'boolean') return new Error(`${path}.confirmed: is not a boolean`) - if (opts.confirmed_CustomCheck && !opts.confirmed_CustomCheck(o.confirmed)) return new Error(`${path}.confirmed: custom check failed`) - - return null -} - export type UseInviteLinkRequest = { invite_token: string } @@ -2445,95 +2346,194 @@ export const UseInviteLinkRequestValidate = (o?: UseInviteLinkRequest, opts: Use return null } -export type Application = { - npub: string - name: string - id: string +export type UserInfo = { balance: number + max_withdrawable: number + network_max_fee_bps: number + network_max_fee_fixed: number + service_fee_bps: number + userId: string + user_identifier: string } -export const ApplicationOptionalFields: [] = [] -export type ApplicationOptions = OptionsBaseMessage & { +export const UserInfoOptionalFields: [] = [] +export type UserInfoOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - name_CustomCheck?: (v: string) => boolean - id_CustomCheck?: (v: string) => boolean balance_CustomCheck?: (v: number) => boolean - npub_CustomCheck?: (v: string) => boolean + max_withdrawable_CustomCheck?: (v: number) => boolean + network_max_fee_bps_CustomCheck?: (v: number) => boolean + network_max_fee_fixed_CustomCheck?: (v: number) => boolean + service_fee_bps_CustomCheck?: (v: number) => boolean + userId_CustomCheck?: (v: string) => boolean + user_identifier_CustomCheck?: (v: string) => boolean } -export const ApplicationValidate = (o?: Application, opts: ApplicationOptions = {}, path: string = 'Application::root.'): Error | null => { +export const UserInfoValidate = (o?: UserInfo, opts: UserInfoOptions = {}, path: string = 'UserInfo::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`) + if (typeof o.max_withdrawable !== 'number') return new Error(`${path}.max_withdrawable: is not a number`) + if (opts.max_withdrawable_CustomCheck && !opts.max_withdrawable_CustomCheck(o.max_withdrawable)) return new Error(`${path}.max_withdrawable: custom check failed`) - return null -} + if (typeof o.network_max_fee_bps !== 'number') return new Error(`${path}.network_max_fee_bps: is not a number`) + if (opts.network_max_fee_bps_CustomCheck && !opts.network_max_fee_bps_CustomCheck(o.network_max_fee_bps)) return new Error(`${path}.network_max_fee_bps: custom check failed`) -export type SetMockAppUserBalanceRequest = { - user_identifier: string - amount: number -} -export const SetMockAppUserBalanceRequestOptionalFields: [] = [] -export type SetMockAppUserBalanceRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - amount_CustomCheck?: (v: number) => boolean - user_identifier_CustomCheck?: (v: string) => 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.network_max_fee_fixed !== 'number') return new Error(`${path}.network_max_fee_fixed: is not a number`) + if (opts.network_max_fee_fixed_CustomCheck && !opts.network_max_fee_fixed_CustomCheck(o.network_max_fee_fixed)) return new Error(`${path}.network_max_fee_fixed: custom check failed`) + + if (typeof o.service_fee_bps !== 'number') return new Error(`${path}.service_fee_bps: is not a number`) + if (opts.service_fee_bps_CustomCheck && !opts.service_fee_bps_CustomCheck(o.service_fee_bps)) return new Error(`${path}.service_fee_bps: custom check failed`) + + if (typeof o.userId !== 'string') return new Error(`${path}.userId: is not a string`) + if (opts.userId_CustomCheck && !opts.userId_CustomCheck(o.userId)) return new Error(`${path}.userId: 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 UserOperation = { + amount: number + confirmed: boolean + identifier: string + inbound: boolean + internal: boolean + network_fee: number + operationId: string + paidAtUnix: number + service_fee: number + tx_hash: string + type: UserOperationType +} +export const UserOperationOptionalFields: [] = [] +export type UserOperationOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + amount_CustomCheck?: (v: number) => boolean + confirmed_CustomCheck?: (v: boolean) => boolean + identifier_CustomCheck?: (v: string) => boolean + inbound_CustomCheck?: (v: boolean) => boolean + internal_CustomCheck?: (v: boolean) => boolean + network_fee_CustomCheck?: (v: number) => boolean + operationId_CustomCheck?: (v: string) => boolean + paidAtUnix_CustomCheck?: (v: number) => boolean + service_fee_CustomCheck?: (v: number) => boolean + tx_hash_CustomCheck?: (v: string) => boolean + type_CustomCheck?: (v: UserOperationType) => boolean +} +export const UserOperationValidate = (o?: UserOperation, opts: UserOperationOptions = {}, path: string = 'UserOperation::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`) + if (typeof o.confirmed !== 'boolean') return new Error(`${path}.confirmed: is not a boolean`) + if (opts.confirmed_CustomCheck && !opts.confirmed_CustomCheck(o.confirmed)) return new Error(`${path}.confirmed: custom check failed`) + + 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.inbound !== 'boolean') return new Error(`${path}.inbound: is not a boolean`) + if (opts.inbound_CustomCheck && !opts.inbound_CustomCheck(o.inbound)) return new Error(`${path}.inbound: custom check failed`) + + if (typeof o.internal !== 'boolean') return new Error(`${path}.internal: is not a boolean`) + if (opts.internal_CustomCheck && !opts.internal_CustomCheck(o.internal)) return new Error(`${path}.internal: 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`) + + if (typeof o.operationId !== 'string') return new Error(`${path}.operationId: is not a string`) + if (opts.operationId_CustomCheck && !opts.operationId_CustomCheck(o.operationId)) return new Error(`${path}.operationId: custom check failed`) + + if (typeof o.paidAtUnix !== 'number') return new Error(`${path}.paidAtUnix: is not a number`) + if (opts.paidAtUnix_CustomCheck && !opts.paidAtUnix_CustomCheck(o.paidAtUnix)) return new Error(`${path}.paidAtUnix: 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.tx_hash !== 'string') return new Error(`${path}.tx_hash: is not a string`) + if (opts.tx_hash_CustomCheck && !opts.tx_hash_CustomCheck(o.tx_hash)) return new Error(`${path}.tx_hash: custom check failed`) + + if (!enumCheckUserOperationType(o.type)) return new Error(`${path}.type: is not a valid UserOperationType`) + if (opts.type_CustomCheck && !opts.type_CustomCheck(o.type)) return new Error(`${path}.type: custom check failed`) + return null } -export type NewAddressRequest = { - addressType: AddressType +export type UserOperations = { + fromIndex: number + operations: UserOperation[] + toIndex: number } -export const NewAddressRequestOptionalFields: [] = [] -export type NewAddressRequestOptions = OptionsBaseMessage & { +export const UserOperationsOptionalFields: [] = [] +export type UserOperationsOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - addressType_CustomCheck?: (v: AddressType) => boolean + fromIndex_CustomCheck?: (v: number) => boolean + operations_ItemOptions?: UserOperationOptions + operations_CustomCheck?: (v: UserOperation[]) => boolean + toIndex_CustomCheck?: (v: number) => boolean } -export const NewAddressRequestValidate = (o?: NewAddressRequest, opts: NewAddressRequestOptions = {}, path: string = 'NewAddressRequest::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 (!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`) + 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.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`) + + 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`) return null } -export type CreateOneTimeInviteLinkRequest = { - sats?: number +export type UsersInfo = { + always_been_inactive: number + balance_avg: number + balance_median: number + negative_balance: number + no_balance: number + total: number } -export type CreateOneTimeInviteLinkRequestOptionalField = 'sats' -export const CreateOneTimeInviteLinkRequestOptionalFields: CreateOneTimeInviteLinkRequestOptionalField[] = ['sats'] -export type CreateOneTimeInviteLinkRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: CreateOneTimeInviteLinkRequestOptionalField[] - sats_CustomCheck?: (v?: number) => boolean +export const UsersInfoOptionalFields: [] = [] +export type UsersInfoOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + always_been_inactive_CustomCheck?: (v: number) => boolean + balance_avg_CustomCheck?: (v: number) => boolean + balance_median_CustomCheck?: (v: number) => boolean + negative_balance_CustomCheck?: (v: number) => boolean + no_balance_CustomCheck?: (v: number) => boolean + total_CustomCheck?: (v: number) => boolean } -export const CreateOneTimeInviteLinkRequestValidate = (o?: CreateOneTimeInviteLinkRequest, opts: CreateOneTimeInviteLinkRequestOptions = {}, path: string = 'CreateOneTimeInviteLinkRequest::root.'): Error | null => { +export const UsersInfoValidate = (o?: UsersInfo, opts: UsersInfoOptions = {}, path: string = 'UsersInfo::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 ((o.sats || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('sats')) && typeof o.sats !== 'number') return new Error(`${path}.sats: is not a number`) - if (opts.sats_CustomCheck && !opts.sats_CustomCheck(o.sats)) return new Error(`${path}.sats: custom check failed`) + if (typeof o.always_been_inactive !== 'number') return new Error(`${path}.always_been_inactive: is not a number`) + if (opts.always_been_inactive_CustomCheck && !opts.always_been_inactive_CustomCheck(o.always_been_inactive)) return new Error(`${path}.always_been_inactive: custom check failed`) + + if (typeof o.balance_avg !== 'number') return new Error(`${path}.balance_avg: is not a number`) + if (opts.balance_avg_CustomCheck && !opts.balance_avg_CustomCheck(o.balance_avg)) return new Error(`${path}.balance_avg: custom check failed`) + + if (typeof o.balance_median !== 'number') return new Error(`${path}.balance_median: is not a number`) + if (opts.balance_median_CustomCheck && !opts.balance_median_CustomCheck(o.balance_median)) return new Error(`${path}.balance_median: custom check failed`) + + if (typeof o.negative_balance !== 'number') return new Error(`${path}.negative_balance: is not a number`) + if (opts.negative_balance_CustomCheck && !opts.negative_balance_CustomCheck(o.negative_balance)) return new Error(`${path}.negative_balance: custom check failed`) + + if (typeof o.no_balance !== 'number') return new Error(`${path}.no_balance: is not a number`) + if (opts.no_balance_CustomCheck && !opts.no_balance_CustomCheck(o.no_balance)) return new Error(`${path}.no_balance: custom check failed`) + + if (typeof o.total !== 'number') return new Error(`${path}.total: is not a number`) + if (opts.total_CustomCheck && !opts.total_CustomCheck(o.total)) return new Error(`${path}.total: custom check failed`) return null } diff --git a/proto/protoc-gen-pub b/proto/protoc-gen-pub index 8d3c6d2b..37b547ae 100755 Binary files a/proto/protoc-gen-pub and b/proto/protoc-gen-pub differ diff --git a/proto/protoc-gen-pub_old b/proto/protoc-gen-pub_old deleted file mode 100755 index a725f736..00000000 Binary files a/proto/protoc-gen-pub_old and /dev/null differ