diff --git a/proto/autogenerated/debug.txt b/proto/autogenerated/debug.txt index 2b91e497..0a65d868 100644 --- a/proto/autogenerated/debug.txt +++ b/proto/autogenerated/debug.txt @@ -1,5 +1,5 @@ -([]*main.Method) (len=31 cap=32) { - (*main.Method)(0xc0002ee050)({ +([]*main.Method) (len=34 cap=64) { + (*main.Method)(0xc0002f0050)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -9,8 +9,8 @@ name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc0002fbce0)({ - authType: (*main.supportedAuth)(0xc0000a5680)({ + opts: (*main.methodOptions)(0xc0006150e0)({ + authType: (*main.supportedAuth)(0xc00024a570)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", encrypted: (bool) false, @@ -25,7 +25,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002ee0a0)({ + (*main.Method)(0xc0002f00a0)({ in: (main.MethodMessage) { name: (string) (len=25) "EncryptionExchangeRequest", hasZeroFields: (bool) false @@ -35,8 +35,8 @@ name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc0002fbe60)({ - authType: (*main.supportedAuth)(0xc0000a58f0)({ + opts: (*main.methodOptions)(0xc000615260)({ + authType: (*main.supportedAuth)(0xc00024a7e0)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", encrypted: (bool) false, @@ -51,7 +51,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002ee460)({ + (*main.Method)(0xc0002f0460)({ in: (main.MethodMessage) { name: (string) (len=17) "LndGetInfoRequest", hasZeroFields: (bool) false @@ -61,8 +61,8 @@ name: (string) (len=18) "LndGetInfoResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc000090480)({ - authType: (*main.supportedAuth)(0xc0000a5b30)({ + opts: (*main.methodOptions)(0xc0006153e0)({ + authType: (*main.supportedAuth)(0xc00024ac90)({ id: (string) (len=5) "admin", name: (string) (len=5) "Admin", encrypted: (bool) false, @@ -78,7 +78,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002ee690)({ + (*main.Method)(0xc0002f0690)({ in: (main.MethodMessage) { name: (string) (len=27) "SetMockInvoiceAsPaidRequest", hasZeroFields: (bool) false @@ -88,24 +88,23 @@ name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc000090660)({ - authType: (*main.supportedAuth)(0xc0000a5e30)({ - id: (string) (len=5) "admin", - name: (string) (len=5) "Admin", + opts: (*main.methodOptions)(0xc0006155c0)({ + authType: (*main.supportedAuth)(0xc00024b380)({ + id: (string) (len=5) "guest", + name: (string) (len=5) "Guest", encrypted: (bool) false, - context: (map[string]string) (len=1) { - (string) (len=8) "admin_id": (string) (len=6) "string" + context: (map[string]string) { } }), method: (string) (len=4) "post", route: (main.decodedRoute) { - route: (string) (len=32) "/api/admin/lnd/mock/invoice/paid", + route: (string) (len=26) "/api/lnd/mock/invoice/paid", params: ([]string) }, query: ([]string) }) }), - (*main.Method)(0xc0002ee820)({ + (*main.Method)(0xc0002f0820)({ in: (main.MethodMessage) { name: (string) (len=13) "AddAppRequest", hasZeroFields: (bool) false @@ -115,8 +114,8 @@ name: (string) (len=14) "AddAppResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc000090840)({ - authType: (*main.supportedAuth)(0xc00024a060)({ + opts: (*main.methodOptions)(0xc000615740)({ + authType: (*main.supportedAuth)(0xc00024b500)({ id: (string) (len=5) "admin", name: (string) (len=5) "Admin", encrypted: (bool) false, @@ -132,7 +131,34 @@ query: ([]string) }) }), - (*main.Method)(0xc0002ee8c0)({ + (*main.Method)(0xc0002f0870)({ + 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)(0xc0006158c0)({ + authType: (*main.supportedAuth)(0xc00024b980)({ + id: (string) (len=3) "app", + name: (string) (len=3) "App", + encrypted: (bool) false, + context: (map[string]string) (len=1) { + (string) (len=6) "app_id": (string) (len=6) "string" + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=12) "/api/app/get", + params: ([]string) + }, + query: ([]string) + }) + }), + (*main.Method)(0xc0002f0910)({ in: (main.MethodMessage) { name: (string) (len=17) "AddAppUserRequest", hasZeroFields: (bool) false @@ -142,8 +168,8 @@ name: (string) (len=7) "AppUser", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0000909c0)({ - authType: (*main.supportedAuth)(0xc00024a3c0)({ + opts: (*main.methodOptions)(0xc000615a40)({ + authType: (*main.supportedAuth)(0xc00024bb60)({ id: (string) (len=3) "app", name: (string) (len=3) "App", encrypted: (bool) false, @@ -159,7 +185,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002ee960)({ + (*main.Method)(0xc0002f09b0)({ in: (main.MethodMessage) { name: (string) (len=20) "AddAppInvoiceRequest", hasZeroFields: (bool) false @@ -169,8 +195,8 @@ name: (string) (len=18) "NewInvoiceResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc000090b40)({ - authType: (*main.supportedAuth)(0xc00024a5d0)({ + opts: (*main.methodOptions)(0xc000615bc0)({ + authType: (*main.supportedAuth)(0xc0002f8750)({ id: (string) (len=3) "app", name: (string) (len=3) "App", encrypted: (bool) false, @@ -186,7 +212,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002ee9b0)({ + (*main.Method)(0xc0002f0a00)({ in: (main.MethodMessage) { name: (string) (len=24) "AddAppUserInvoiceRequest", hasZeroFields: (bool) false @@ -196,8 +222,8 @@ name: (string) (len=18) "NewInvoiceResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc000090d20)({ - authType: (*main.supportedAuth)(0xc00024a810)({ + opts: (*main.methodOptions)(0xc000615da0)({ + authType: (*main.supportedAuth)(0xc0001ce030)({ id: (string) (len=3) "app", name: (string) (len=3) "App", encrypted: (bool) false, @@ -213,7 +239,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002eea50)({ + (*main.Method)(0xc0002f0aa0)({ in: (main.MethodMessage) { name: (string) (len=17) "GetAppUserRequest", hasZeroFields: (bool) false @@ -223,8 +249,8 @@ name: (string) (len=7) "AppUser", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc000090ea0)({ - authType: (*main.supportedAuth)(0xc00024acc0)({ + opts: (*main.methodOptions)(0xc000615f20)({ + authType: (*main.supportedAuth)(0xc0001ce0f0)({ id: (string) (len=3) "app", name: (string) (len=3) "App", encrypted: (bool) false, @@ -240,7 +266,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002eeaf0)({ + (*main.Method)(0xc0002f0b40)({ in: (main.MethodMessage) { name: (string) (len=24) "PayAppUserInvoiceRequest", hasZeroFields: (bool) false @@ -250,8 +276,8 @@ name: (string) (len=25) "PayAppUserInvoiceResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0000910e0)({ - authType: (*main.supportedAuth)(0xc00024b3b0)({ + opts: (*main.methodOptions)(0xc0002fd080)({ + authType: (*main.supportedAuth)(0xc0001ce1b0)({ id: (string) (len=3) "app", name: (string) (len=3) "App", encrypted: (bool) false, @@ -267,7 +293,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002eeb40)({ + (*main.Method)(0xc0002f0b90)({ in: (main.MethodMessage) { name: (string) (len=34) "SendAppUserToAppUserPaymentRequest", hasZeroFields: (bool) false @@ -277,8 +303,8 @@ name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc0000912c0)({ - authType: (*main.supportedAuth)(0xc00024b530)({ + opts: (*main.methodOptions)(0xc0002fd260)({ + authType: (*main.supportedAuth)(0xc0001ce270)({ id: (string) (len=3) "app", name: (string) (len=3) "App", encrypted: (bool) false, @@ -294,7 +320,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002eebe0)({ + (*main.Method)(0xc0002f0c30)({ in: (main.MethodMessage) { name: (string) (len=30) "SendAppUserToAppPaymentRequest", hasZeroFields: (bool) false @@ -304,8 +330,8 @@ name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc0000914a0)({ - authType: (*main.supportedAuth)(0xc00024b9b0)({ + opts: (*main.methodOptions)(0xc0002fd3e0)({ + authType: (*main.supportedAuth)(0xc0001ce330)({ id: (string) (len=3) "app", name: (string) (len=3) "App", encrypted: (bool) false, @@ -321,7 +347,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002eec30)({ + (*main.Method)(0xc0002f0c80)({ in: (main.MethodMessage) { name: (string) (len=26) "GetAppUserLNURLInfoRequest", hasZeroFields: (bool) false @@ -331,8 +357,8 @@ name: (string) (len=20) "LnurlPayInfoResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00075a0c0)({ - authType: (*main.supportedAuth)(0xc00024bb90)({ + opts: (*main.methodOptions)(0xc0002fd560)({ + authType: (*main.supportedAuth)(0xc0001ce3f0)({ id: (string) (len=3) "app", name: (string) (len=3) "App", encrypted: (bool) false, @@ -348,7 +374,61 @@ query: ([]string) }) }), - (*main.Method)(0xc0002eec80)({ + (*main.Method)(0xc0002f0cd0)({ + 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)(0xc0002fd6e0)({ + authType: (*main.supportedAuth)(0xc0001ce4b0)({ + id: (string) (len=3) "app", + name: (string) (len=3) "App", + encrypted: (bool) false, + context: (map[string]string) (len=1) { + (string) (len=6) "app_id": (string) (len=6) "string" + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=29) "/api/app/mock/user/blance/set", + params: ([]string) + }, + query: ([]string) + }) + }), + (*main.Method)(0xc0002f0d20)({ + 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)(0xc0002fd8c0)({ + authType: (*main.supportedAuth)(0xc0001ce570)({ + id: (string) (len=3) "app", + name: (string) (len=3) "App", + encrypted: (bool) false, + context: (map[string]string) (len=1) { + (string) (len=6) "app_id": (string) (len=6) "string" + } + }), + method: (string) (len=4) "post", + route: (main.decodedRoute) { + route: (string) (len=24) "/api/app/mock/blance/set", + params: ([]string) + }, + query: ([]string) + }) + }), + (*main.Method)(0xc0002f0d70)({ in: (main.MethodMessage) { name: (string) (len=14) "AddUserRequest", hasZeroFields: (bool) false @@ -358,8 +438,8 @@ name: (string) (len=15) "AddUserResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00075a240)({ - authType: (*main.supportedAuth)(0xc0002f9ef0)({ + opts: (*main.methodOptions)(0xc0002fda40)({ + authType: (*main.supportedAuth)(0xc0001ce630)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", encrypted: (bool) false, @@ -374,7 +454,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002eecd0)({ + (*main.Method)(0xc0002f0dc0)({ in: (main.MethodMessage) { name: (string) (len=15) "AuthUserRequest", hasZeroFields: (bool) false @@ -384,8 +464,8 @@ name: (string) (len=16) "AuthUserResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00075a3c0)({ - authType: (*main.supportedAuth)(0xc00075c060)({ + opts: (*main.methodOptions)(0xc0002fdbc0)({ + authType: (*main.supportedAuth)(0xc0001ce6f0)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", encrypted: (bool) false, @@ -400,7 +480,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002eed20)({ + (*main.Method)(0xc0002f0e10)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -410,8 +490,8 @@ name: (string) (len=8) "UserInfo", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00075a5a0)({ - authType: (*main.supportedAuth)(0xc00075c150)({ + opts: (*main.methodOptions)(0xc0002fdda0)({ + authType: (*main.supportedAuth)(0xc0001ce7e0)({ id: (string) (len=4) "user", name: (string) (len=4) "User", encrypted: (bool) false, @@ -427,7 +507,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002eedc0)({ + (*main.Method)(0xc0002f0eb0)({ in: (main.MethodMessage) { name: (string) (len=17) "AddProductRequest", hasZeroFields: (bool) false @@ -437,8 +517,8 @@ name: (string) (len=7) "Product", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00075a780)({ - authType: (*main.supportedAuth)(0xc00075c210)({ + opts: (*main.methodOptions)(0xc0002fdf80)({ + authType: (*main.supportedAuth)(0xc0001ce8a0)({ id: (string) (len=4) "user", name: (string) (len=4) "User", encrypted: (bool) false, @@ -454,7 +534,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002eee10)({ + (*main.Method)(0xc0002f0f00)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -464,8 +544,8 @@ name: (string) (len=18) "NewInvoiceResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00075ac00)({ - authType: (*main.supportedAuth)(0xc00075c360)({ + opts: (*main.methodOptions)(0xc000090960)({ + authType: (*main.supportedAuth)(0xc0001ce9f0)({ id: (string) (len=4) "user", name: (string) (len=4) "User", encrypted: (bool) false, @@ -483,7 +563,7 @@ } }) }), - (*main.Method)(0xc0002eee60)({ + (*main.Method)(0xc0002f0f50)({ in: (main.MethodMessage) { name: (string) (len=24) "GetUserOperationsRequest", hasZeroFields: (bool) false @@ -493,8 +573,8 @@ name: (string) (len=25) "GetUserOperationsResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00075ade0)({ - authType: (*main.supportedAuth)(0xc00075c420)({ + opts: (*main.methodOptions)(0xc000090b40)({ + authType: (*main.supportedAuth)(0xc0001ceab0)({ id: (string) (len=4) "user", name: (string) (len=4) "User", encrypted: (bool) false, @@ -510,7 +590,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002eef00)({ + (*main.Method)(0xc0002f0ff0)({ in: (main.MethodMessage) { name: (string) (len=17) "NewAddressRequest", hasZeroFields: (bool) false @@ -520,8 +600,8 @@ name: (string) (len=18) "NewAddressResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00075afc0)({ - authType: (*main.supportedAuth)(0xc00075c4e0)({ + opts: (*main.methodOptions)(0xc000090d20)({ + authType: (*main.supportedAuth)(0xc0001ceb70)({ id: (string) (len=4) "user", name: (string) (len=4) "User", encrypted: (bool) false, @@ -537,7 +617,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002eefa0)({ + (*main.Method)(0xc0002f1090)({ in: (main.MethodMessage) { name: (string) (len=17) "PayAddressRequest", hasZeroFields: (bool) false @@ -547,8 +627,8 @@ name: (string) (len=18) "PayAddressResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00075b1a0)({ - authType: (*main.supportedAuth)(0xc00075c5a0)({ + opts: (*main.methodOptions)(0xc000090f00)({ + authType: (*main.supportedAuth)(0xc0001cec30)({ id: (string) (len=4) "user", name: (string) (len=4) "User", encrypted: (bool) false, @@ -564,7 +644,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002ef040)({ + (*main.Method)(0xc0002f1130)({ in: (main.MethodMessage) { name: (string) (len=17) "NewInvoiceRequest", hasZeroFields: (bool) false @@ -574,8 +654,8 @@ name: (string) (len=18) "NewInvoiceResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00075b380)({ - authType: (*main.supportedAuth)(0xc00075c660)({ + opts: (*main.methodOptions)(0xc0000911a0)({ + authType: (*main.supportedAuth)(0xc0001cecf0)({ id: (string) (len=4) "user", name: (string) (len=4) "User", encrypted: (bool) false, @@ -591,7 +671,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002ef0e0)({ + (*main.Method)(0xc0002f11d0)({ in: (main.MethodMessage) { name: (string) (len=20) "DecodeInvoiceRequest", hasZeroFields: (bool) false @@ -601,8 +681,8 @@ name: (string) (len=21) "DecodeInvoiceResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00075b560)({ - authType: (*main.supportedAuth)(0xc00075c720)({ + opts: (*main.methodOptions)(0xc000091380)({ + authType: (*main.supportedAuth)(0xc0001cedb0)({ id: (string) (len=4) "user", name: (string) (len=4) "User", encrypted: (bool) false, @@ -618,7 +698,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002ef180)({ + (*main.Method)(0xc0002f1270)({ in: (main.MethodMessage) { name: (string) (len=17) "PayInvoiceRequest", hasZeroFields: (bool) false @@ -628,8 +708,8 @@ name: (string) (len=18) "PayInvoiceResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00075b740)({ - authType: (*main.supportedAuth)(0xc00075c7e0)({ + opts: (*main.methodOptions)(0xc0001d2060)({ + authType: (*main.supportedAuth)(0xc0001cee70)({ id: (string) (len=4) "user", name: (string) (len=4) "User", encrypted: (bool) false, @@ -645,7 +725,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002ef220)({ + (*main.Method)(0xc0002f1310)({ in: (main.MethodMessage) { name: (string) (len=18) "OpenChannelRequest", hasZeroFields: (bool) false @@ -655,8 +735,8 @@ name: (string) (len=19) "OpenChannelResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00075b920)({ - authType: (*main.supportedAuth)(0xc00075c8a0)({ + opts: (*main.methodOptions)(0xc0001d2240)({ + authType: (*main.supportedAuth)(0xc0001cef30)({ id: (string) (len=4) "user", name: (string) (len=4) "User", encrypted: (bool) false, @@ -672,7 +752,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002ef2c0)({ + (*main.Method)(0xc0002f13b0)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -682,8 +762,8 @@ name: (string) (len=17) "LnurlLinkResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00075bb00)({ - authType: (*main.supportedAuth)(0xc00075c960)({ + opts: (*main.methodOptions)(0xc0001d2420)({ + authType: (*main.supportedAuth)(0xc0001ceff0)({ id: (string) (len=4) "user", name: (string) (len=4) "User", encrypted: (bool) false, @@ -699,7 +779,7 @@ query: ([]string) }) }), - (*main.Method)(0xc0002ef360)({ + (*main.Method)(0xc0002f1450)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -709,8 +789,8 @@ name: (string) (len=25) "LnurlWithdrawInfoResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc00075be60)({ - authType: (*main.supportedAuth)(0xc00075cab0)({ + opts: (*main.methodOptions)(0xc0001d2780)({ + authType: (*main.supportedAuth)(0xc0001cf140)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", encrypted: (bool) false, @@ -727,7 +807,7 @@ } }) }), - (*main.Method)(0xc0002ef400)({ + (*main.Method)(0xc0002f14f0)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -737,8 +817,8 @@ name: (string) (len=5) "Empty", hasZeroFields: (bool) true }, - opts: (*main.methodOptions)(0xc0007601e0)({ - authType: (*main.supportedAuth)(0xc00075cc30)({ + opts: (*main.methodOptions)(0xc0001d2ae0)({ + authType: (*main.supportedAuth)(0xc0001cf2c0)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", encrypted: (bool) false, @@ -756,7 +836,7 @@ } }) }), - (*main.Method)(0xc0002ef4a0)({ + (*main.Method)(0xc0002f1590)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -766,8 +846,8 @@ name: (string) (len=20) "LnurlPayInfoResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc000760540)({ - authType: (*main.supportedAuth)(0xc00075cd80)({ + opts: (*main.methodOptions)(0xc0001d2e40)({ + authType: (*main.supportedAuth)(0xc0001cf410)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", encrypted: (bool) false, @@ -784,7 +864,7 @@ } }) }), - (*main.Method)(0xc0002ef540)({ + (*main.Method)(0xc0002f1630)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -794,8 +874,8 @@ name: (string) (len=22) "HandleLnurlPayResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc0007608a0)({ - authType: (*main.supportedAuth)(0xc00075cf00)({ + opts: (*main.methodOptions)(0xc0001d31a0)({ + authType: (*main.supportedAuth)(0xc0001cf590)({ id: (string) (len=5) "guest", name: (string) (len=5) "Guest", encrypted: (bool) false, @@ -813,7 +893,7 @@ } }) }), - (*main.Method)(0xc0002ef5e0)({ + (*main.Method)(0xc0002f16d0)({ in: (main.MethodMessage) { name: (string) (len=5) "Empty", hasZeroFields: (bool) true @@ -823,8 +903,8 @@ name: (string) (len=17) "LnurlLinkResponse", hasZeroFields: (bool) false }, - opts: (*main.methodOptions)(0xc000760a80)({ - authType: (*main.supportedAuth)(0xc00075cfc0)({ + opts: (*main.methodOptions)(0xc0001d3380)({ + authType: (*main.supportedAuth)(0xc0001cf650)({ id: (string) (len=4) "user", name: (string) (len=4) "User", encrypted: (bool) false, @@ -843,7 +923,7 @@ } ([]*main.Enum) (len=2 cap=2) { - (*main.Enum)(0xc0000a41e0)({ + (*main.Enum)(0xc0000a51d0)({ name: (string) (len=11) "AddressType", values: ([]main.EnumValue) (len=3 cap=4) { (main.EnumValue) { @@ -860,7 +940,7 @@ } } }), - (*main.Enum)(0xc0000a4270)({ + (*main.Enum)(0xc0000a5230)({ name: (string) (len=17) "UserOperationType", values: ([]main.EnumValue) (len=6 cap=8) { (main.EnumValue) { @@ -891,30 +971,12 @@ }) } -(map[string]*main.Message) (len=45) { - (string) (len=34) "SendAppUserToAppUserPaymentRequest": (*main.Message)(0xc0005a0600)({ - fullName: (string) (len=34) "SendAppUserToAppUserPaymentRequest", - name: (string) (len=34) "SendAppUserToAppUserPaymentRequest", - fields: ([]*main.Field) (len=3 cap=4) { - (*main.Field)(0xc00046f0e0)({ - name: (string) (len=20) "from_user_identifier", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f110)({ - 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 - }), - (*main.Field)(0xc00046f140)({ +(map[string]*main.Message) (len=48) { + (string) (len=24) "SetMockAppBalanceRequest": (*main.Message)(0xc0005a0740)({ + fullName: (string) (len=24) "SetMockAppBalanceRequest", + name: (string) (len=24) "SetMockAppBalanceRequest", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000473620)({ name: (string) (len=6) "amount", kind: (string) (len=5) "int64", isMap: (bool) false, @@ -925,26 +987,11 @@ }) } }), - (string) (len=18) "NewAddressResponse": (*main.Message)(0xc0005a0700)({ - fullName: (string) (len=18) "NewAddressResponse", - name: (string) (len=18) "NewAddressResponse", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00046f230)({ - 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 - }) - } - }), - (string) (len=20) "DecodeInvoiceRequest": (*main.Message)(0xc0005a0840)({ + (string) (len=20) "DecodeInvoiceRequest": (*main.Message)(0xc0005a0900)({ fullName: (string) (len=20) "DecodeInvoiceRequest", name: (string) (len=20) "DecodeInvoiceRequest", fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00046f3b0)({ + (*main.Field)(0xc000473800)({ name: (string) (len=7) "invoice", kind: (string) (len=6) "string", isMap: (bool) false, @@ -955,35 +1002,71 @@ }) } }), - (string) (len=17) "LnurlLinkResponse": (*main.Message)(0xc0005a09c0)({ - fullName: (string) (len=17) "LnurlLinkResponse", - name: (string) (len=17) "LnurlLinkResponse", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00046f5c0)({ - name: (string) (len=5) "lnurl", - kind: (string) (len=6) "string", + (string) (len=25) "GetUserOperationsResponse": (*main.Message)(0xc0005a0e80)({ + fullName: (string) (len=25) "GetUserOperationsResponse", + name: (string) (len=25) "GetUserOperationsResponse", + fields: ([]*main.Field) (len=6 cap=8) { + (*main.Field)(0xc0000a4de0)({ + name: (string) (len=31) "latestOutgoingInvoiceOperations", + kind: (string) (len=14) "UserOperations", isMap: (bool) false, isArray: (bool) false, isEnum: (bool) false, - isMessage: (bool) false, + isMessage: (bool) true, isOptional: (bool) false }), - (*main.Field)(0xc00046f5f0)({ - name: (string) (len=2) "k1", - kind: (string) (len=6) "string", + (*main.Field)(0xc0000a4e10)({ + name: (string) (len=31) "latestIncomingInvoiceOperations", + kind: (string) (len=14) "UserOperations", isMap: (bool) false, isArray: (bool) false, isEnum: (bool) false, - isMessage: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false + }), + (*main.Field)(0xc0000a4e40)({ + name: (string) (len=26) "latestOutgoingTxOperations", + kind: (string) (len=14) "UserOperations", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false + }), + (*main.Field)(0xc0000a4e70)({ + name: (string) (len=26) "latestIncomingTxOperations", + kind: (string) (len=14) "UserOperations", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false + }), + (*main.Field)(0xc0000a4ed0)({ + name: (string) (len=32) "latestOutgoingUserToUserPayemnts", + kind: (string) (len=14) "UserOperations", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false + }), + (*main.Field)(0xc0000a4f00)({ + name: (string) (len=32) "latestIncomingUserToUserPayemnts", + kind: (string) (len=14) "UserOperations", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) true, isOptional: (bool) false }) } }), - (string) (len=15) "AuthUserRequest": (*main.Message)(0xc0005a0bc0)({ - fullName: (string) (len=15) "AuthUserRequest", - name: (string) (len=15) "AuthUserRequest", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00046f9e0)({ + (string) (len=11) "Application": (*main.Message)(0xc0005a0400)({ + fullName: (string) (len=11) "Application", + name: (string) (len=11) "Application", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc000473020)({ name: (string) (len=4) "name", kind: (string) (len=6) "string", isMap: (bool) false, @@ -992,23 +1075,8 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00046fa10)({ - name: (string) (len=6) "secret", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=16) "AuthUserResponse": (*main.Message)(0xc0005a0c00)({ - fullName: (string) (len=16) "AuthUserResponse", - name: (string) (len=16) "AuthUserResponse", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00046fa40)({ - name: (string) (len=6) "userId", + (*main.Field)(0xc000473050)({ + name: (string) (len=2) "id", kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, @@ -1016,55 +1084,22 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00046fa70)({ - name: (string) (len=9) "authToken", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=14) "UserOperations": (*main.Message)(0xc0005a0d40)({ - fullName: (string) (len=14) "UserOperations", - name: (string) (len=14) "UserOperations", - fields: ([]*main.Field) (len=3 cap=4) { - (*main.Field)(0xc00046fce0)({ - name: (string) (len=9) "fromIndex", + (*main.Field)(0xc000473080)({ + name: (string) (len=7) "balance", kind: (string) (len=5) "int64", isMap: (bool) false, isArray: (bool) false, isEnum: (bool) false, isMessage: (bool) false, isOptional: (bool) false - }), - (*main.Field)(0xc00046fd10)({ - name: (string) (len=7) "toIndex", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046fd40)({ - name: (string) (len=10) "operations", - kind: (string) (len=13) "UserOperation", - isMap: (bool) false, - isArray: (bool) true, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false }) } }), - (string) (len=20) "AddAppInvoiceRequest": (*main.Message)(0xc0005a04c0)({ + (string) (len=20) "AddAppInvoiceRequest": (*main.Message)(0xc0005a0500)({ fullName: (string) (len=20) "AddAppInvoiceRequest", name: (string) (len=20) "AddAppInvoiceRequest", fields: ([]*main.Field) (len=3 cap=4) { - (*main.Field)(0xc00046ee70)({ + (*main.Field)(0xc000473230)({ name: (string) (len=16) "payer_identifier", kind: (string) (len=6) "string", isMap: (bool) false, @@ -1073,7 +1108,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00046eea0)({ + (*main.Field)(0xc000473260)({ name: (string) (len=17) "http_callback_url", kind: (string) (len=6) "string", isMap: (bool) false, @@ -1082,7 +1117,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00046eed0)({ + (*main.Field)(0xc000473290)({ name: (string) (len=11) "invoice_req", kind: (string) (len=17) "NewInvoiceRequest", isMap: (bool) false, @@ -1093,41 +1128,143 @@ }) } }), - (string) (len=25) "GetProductBuyLinkResponse": (*main.Message)(0xc0005a0e80)({ - fullName: (string) (len=25) "GetProductBuyLinkResponse", - name: (string) (len=25) "GetProductBuyLinkResponse", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00046ff80)({ - name: (string) (len=4) "link", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=17) "GetAppUserRequest": (*main.Message)(0xc0005a0540)({ - fullName: (string) (len=17) "GetAppUserRequest", - name: (string) (len=17) "GetAppUserRequest", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00046efc0)({ - name: (string) (len=15) "user_identifier", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=30) "SendAppUserToAppPaymentRequest": (*main.Message)(0xc0005a0640)({ - fullName: (string) (len=30) "SendAppUserToAppPaymentRequest", - name: (string) (len=30) "SendAppUserToAppPaymentRequest", + (string) (len=25) "PayAppUserInvoiceResponse": (*main.Message)(0xc0005a0600)({ + fullName: (string) (len=25) "PayAppUserInvoiceResponse", + name: (string) (len=25) "PayAppUserInvoiceResponse", fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00046f170)({ + (*main.Field)(0xc000473440)({ + name: (string) (len=8) "preimage", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473470)({ + 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 + }) + } + }), + (string) (len=20) "LnurlPayInfoResponse": (*main.Message)(0xc0005a0b80)({ + fullName: (string) (len=20) "LnurlPayInfoResponse", + name: (string) (len=20) "LnurlPayInfoResponse", + fields: ([]*main.Field) (len=5 cap=8) { + (*main.Field)(0xc000473bf0)({ + name: (string) (len=3) "tag", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473c20)({ + name: (string) (len=8) "callback", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473c50)({ + name: (string) (len=11) "maxSendable", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473c80)({ + name: (string) (len=11) "minSendable", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473cb0)({ + 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 + }) + } + }), + (string) (len=22) "HandleLnurlPayResponse": (*main.Message)(0xc0005a0bc0)({ + fullName: (string) (len=22) "HandleLnurlPayResponse", + name: (string) (len=22) "HandleLnurlPayResponse", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc000473ce0)({ + name: (string) (len=2) "pr", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473d10)({ + 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 + }) + } + }), + (string) (len=14) "AddUserRequest": (*main.Message)(0xc0005a0c00)({ + fullName: (string) (len=14) "AddUserRequest", + name: (string) (len=14) "AddUserRequest", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc000473d40)({ + name: (string) (len=11) "callbackUrl", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473d70)({ + name: (string) (len=4) "name", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473da0)({ + name: (string) (len=6) "secret", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=34) "SendAppUserToAppUserPaymentRequest": (*main.Message)(0xc0005a0640)({ + fullName: (string) (len=34) "SendAppUserToAppUserPaymentRequest", + name: (string) (len=34) "SendAppUserToAppUserPaymentRequest", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc0004734a0)({ name: (string) (len=20) "from_user_identifier", kind: (string) (len=6) "string", isMap: (bool) false, @@ -1136,7 +1273,16 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00046f1a0)({ + (*main.Field)(0xc0004734d0)({ + 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 + }), + (*main.Field)(0xc000473500)({ name: (string) (len=6) "amount", kind: (string) (len=5) "int64", isMap: (bool) false, @@ -1147,35 +1293,11 @@ }) } }), - (string) (len=18) "NewInvoiceResponse": (*main.Message)(0xc0005a0800)({ - fullName: (string) (len=18) "NewInvoiceResponse", - name: (string) (len=18) "NewInvoiceResponse", + (string) (len=21) "DecodeInvoiceResponse": (*main.Message)(0xc0005a0940)({ + fullName: (string) (len=21) "DecodeInvoiceResponse", + name: (string) (len=21) "DecodeInvoiceResponse", fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00046f380)({ - name: (string) (len=7) "invoice", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=17) "PayInvoiceRequest": (*main.Message)(0xc0005a08c0)({ - fullName: (string) (len=17) "PayInvoiceRequest", - name: (string) (len=17) "PayInvoiceRequest", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00046f410)({ - name: (string) (len=7) "invoice", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f440)({ + (*main.Field)(0xc000473830)({ name: (string) (len=6) "amount", kind: (string) (len=5) "int64", isMap: (bool) false, @@ -1186,39 +1308,12 @@ }) } }), - (string) (len=18) "OpenChannelRequest": (*main.Message)(0xc0005a0940)({ - fullName: (string) (len=18) "OpenChannelRequest", - name: (string) (len=18) "OpenChannelRequest", - fields: ([]*main.Field) (len=4 cap=4) { - (*main.Field)(0xc00046f4d0)({ - name: (string) (len=11) "destination", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f500)({ - name: (string) (len=13) "fundingAmount", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f530)({ - name: (string) (len=10) "pushAmount", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f560)({ - name: (string) (len=12) "closeAddress", + (string) (len=19) "OpenChannelResponse": (*main.Message)(0xc0005a0a40)({ + fullName: (string) (len=19) "OpenChannelResponse", + name: (string) (len=19) "OpenChannelResponse", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc0004739e0)({ + name: (string) (len=9) "channelId", kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, @@ -1228,11 +1323,68 @@ }) } }), - (string) (len=15) "AddUserResponse": (*main.Message)(0xc0005a0b80)({ + (string) (len=17) "PayAddressRequest": (*main.Message)(0xc0005a0800)({ + fullName: (string) (len=17) "PayAddressRequest", + name: (string) (len=17) "PayAddressRequest", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc0004736b0)({ + 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 + }), + (*main.Field)(0xc0004736e0)({ + 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 + }), + (*main.Field)(0xc000473710)({ + name: (string) (len=10) "targetConf", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=17) "LnurlLinkResponse": (*main.Message)(0xc0005a0a80)({ + fullName: (string) (len=17) "LnurlLinkResponse", + name: (string) (len=17) "LnurlLinkResponse", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc000473a10)({ + 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 + }), + (*main.Field)(0xc000473a40)({ + 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 + }) + } + }), + (string) (len=15) "AddUserResponse": (*main.Message)(0xc0005a0c40)({ fullName: (string) (len=15) "AddUserResponse", name: (string) (len=15) "AddUserResponse", fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00046f980)({ + (*main.Field)(0xc000473dd0)({ name: (string) (len=6) "userId", kind: (string) (len=6) "string", isMap: (bool) false, @@ -1241,7 +1393,232 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00046f9b0)({ + (*main.Field)(0xc000473e00)({ + name: (string) (len=9) "authToken", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=7) "Product": (*main.Message)(0xc0005a0f00)({ + fullName: (string) (len=7) "Product", + name: (string) (len=7) "Product", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc0000a4f90)({ + name: (string) (len=2) "id", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc0000a5080)({ + name: (string) (len=4) "name", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc0000a5140)({ + name: (string) (len=10) "price_sats", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=18) "LndGetInfoResponse": (*main.Message)(0xc0005a0380)({ + fullName: (string) (len=18) "LndGetInfoResponse", + name: (string) (len=18) "LndGetInfoResponse", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000472fc0)({ + name: (string) (len=5) "alias", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=17) "AddAppUserRequest": (*main.Message)(0xc0005a0480)({ + fullName: (string) (len=17) "AddAppUserRequest", + name: (string) (len=17) "AddAppUserRequest", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc000473110)({ + name: (string) (len=10) "identifier", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473140)({ + name: (string) (len=14) "fail_if_exists", + kind: (string) (len=4) "bool", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473170)({ + name: (string) (len=7) "balance", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=7) "AppUser": (*main.Message)(0xc0005a04c0)({ + fullName: (string) (len=7) "AppUser", + name: (string) (len=7) "AppUser", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc0004731a0)({ + name: (string) (len=10) "identifier", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc0004731d0)({ + name: (string) (len=4) "info", + kind: (string) (len=8) "UserInfo", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false + }), + (*main.Field)(0xc000473200)({ + name: (string) (len=16) "max_withdrawable", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=30) "SendAppUserToAppPaymentRequest": (*main.Message)(0xc0005a0680)({ + fullName: (string) (len=30) "SendAppUserToAppPaymentRequest", + name: (string) (len=30) "SendAppUserToAppPaymentRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc000473530)({ + name: (string) (len=20) "from_user_identifier", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473560)({ + name: (string) (len=6) "amount", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=18) "PayAddressResponse": (*main.Message)(0xc0005a0840)({ + fullName: (string) (len=18) "PayAddressResponse", + name: (string) (len=18) "PayAddressResponse", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000473740)({ + 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 + }) + } + }), + (string) (len=18) "PayInvoiceResponse": (*main.Message)(0xc0005a09c0)({ + fullName: (string) (len=18) "PayInvoiceResponse", + name: (string) (len=18) "PayInvoiceResponse", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc0004738c0)({ + name: (string) (len=8) "preimage", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc0004738f0)({ + 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 + }) + } + }), + (string) (len=15) "AuthUserRequest": (*main.Message)(0xc0005a0c80)({ + fullName: (string) (len=15) "AuthUserRequest", + name: (string) (len=15) "AuthUserRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc000473e30)({ + name: (string) (len=4) "name", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473e60)({ + name: (string) (len=6) "secret", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=16) "AuthUserResponse": (*main.Message)(0xc0005a0cc0)({ + fullName: (string) (len=16) "AuthUserResponse", + name: (string) (len=16) "AuthUserResponse", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc000473e90)({ + name: (string) (len=6) "userId", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473ec0)({ name: (string) (len=9) "authToken", kind: (string) (len=6) "string", isMap: (bool) false, @@ -1256,7 +1633,7 @@ fullName: (string) (len=27) "SetMockInvoiceAsPaidRequest", name: (string) (len=27) "SetMockInvoiceAsPaidRequest", fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00046ec00)({ + (*main.Field)(0xc000472f60)({ name: (string) (len=7) "invoice", kind: (string) (len=6) "string", isMap: (bool) false, @@ -1265,7 +1642,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00046ec30)({ + (*main.Field)(0xc000472f90)({ name: (string) (len=6) "amount", kind: (string) (len=5) "int64", isMap: (bool) false, @@ -1276,578 +1653,11 @@ }) } }), - (string) (len=14) "AddAppResponse": (*main.Message)(0xc0005a0400)({ - fullName: (string) (len=14) "AddAppResponse", - name: (string) (len=14) "AddAppResponse", - fields: ([]*main.Field) (len=3 cap=4) { - (*main.Field)(0xc00046ecc0)({ - name: (string) (len=4) "name", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046ecf0)({ - name: (string) (len=2) "id", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046ed20)({ - name: (string) (len=10) "auth_token", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=7) "AppUser": (*main.Message)(0xc0005a0480)({ - fullName: (string) (len=7) "AppUser", - name: (string) (len=7) "AppUser", - fields: ([]*main.Field) (len=3 cap=4) { - (*main.Field)(0xc00046ede0)({ - name: (string) (len=10) "identifier", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046ee10)({ - name: (string) (len=4) "info", - kind: (string) (len=8) "UserInfo", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false - }), - (*main.Field)(0xc00046ee40)({ - name: (string) (len=16) "max_withdrawable", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=25) "PayAppUserInvoiceResponse": (*main.Message)(0xc0005a05c0)({ - fullName: (string) (len=25) "PayAppUserInvoiceResponse", - name: (string) (len=25) "PayAppUserInvoiceResponse", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00046f080)({ - name: (string) (len=8) "preimage", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f0b0)({ - 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 - }) - } - }), - (string) (len=25) "GetUserOperationsResponse": (*main.Message)(0xc0005a0dc0)({ - fullName: (string) (len=25) "GetUserOperationsResponse", - name: (string) (len=25) "GetUserOperationsResponse", - fields: ([]*main.Field) (len=6 cap=8) { - (*main.Field)(0xc00046fd70)({ - name: (string) (len=31) "latestOutgoingInvoiceOperations", - kind: (string) (len=14) "UserOperations", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false - }), - (*main.Field)(0xc00046fda0)({ - name: (string) (len=31) "latestIncomingInvoiceOperations", - kind: (string) (len=14) "UserOperations", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false - }), - (*main.Field)(0xc00046fdd0)({ - name: (string) (len=26) "latestOutgoingTxOperations", - kind: (string) (len=14) "UserOperations", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false - }), - (*main.Field)(0xc00046fe00)({ - name: (string) (len=26) "latestIncomingTxOperations", - kind: (string) (len=14) "UserOperations", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false - }), - (*main.Field)(0xc00046fe30)({ - name: (string) (len=32) "latestOutgoingUserToUserPayemnts", - kind: (string) (len=14) "UserOperations", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false - }), - (*main.Field)(0xc00046fe60)({ - name: (string) (len=32) "latestIncomingUserToUserPayemnts", - kind: (string) (len=14) "UserOperations", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) true, - isOptional: (bool) false - }) - } - }), - (string) (len=25) "EncryptionExchangeRequest": (*main.Message)(0xc0005a02c0)({ - fullName: (string) (len=25) "EncryptionExchangeRequest", - name: (string) (len=25) "EncryptionExchangeRequest", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00046eb70)({ - 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 - }), - (*main.Field)(0xc00046eba0)({ - 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 - }) - } - }), - (string) (len=24) "AddAppUserInvoiceRequest": (*main.Message)(0xc0005a0500)({ - fullName: (string) (len=24) "AddAppUserInvoiceRequest", - name: (string) (len=24) "AddAppUserInvoiceRequest", - fields: ([]*main.Field) (len=4 cap=4) { - (*main.Field)(0xc00046ef00)({ - name: (string) (len=19) "receiver_identifier", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046ef30)({ - 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 - }), - (*main.Field)(0xc00046ef60)({ - 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 - }), - (*main.Field)(0xc00046ef90)({ - 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 - }) - } - }), - (string) (len=18) "PayAddressResponse": (*main.Message)(0xc0005a0780)({ - fullName: (string) (len=18) "PayAddressResponse", - name: (string) (len=18) "PayAddressResponse", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00046f2f0)({ - 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 - }) - } - }), - (string) (len=21) "DecodeInvoiceResponse": (*main.Message)(0xc0005a0880)({ - fullName: (string) (len=21) "DecodeInvoiceResponse", - name: (string) (len=21) "DecodeInvoiceResponse", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00046f3e0)({ - name: (string) (len=6) "amount", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=13) "UserOperation": (*main.Message)(0xc0005a0d00)({ - fullName: (string) (len=13) "UserOperation", - name: (string) (len=13) "UserOperation", - fields: ([]*main.Field) (len=4 cap=4) { - (*main.Field)(0xc00046fc20)({ - name: (string) (len=10) "paidAtUnix", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046fc50)({ - name: (string) (len=4) "type", - kind: (string) (len=17) "UserOperationType", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) true, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046fc80)({ - name: (string) (len=7) "inbound", - kind: (string) (len=4) "bool", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046fcb0)({ - name: (string) (len=6) "amount", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=18) "LndGetInfoResponse": (*main.Message)(0xc0005a0380)({ - fullName: (string) (len=18) "LndGetInfoResponse", - name: (string) (len=18) "LndGetInfoResponse", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00046ec60)({ - name: (string) (len=5) "alias", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=17) "NewAddressRequest": (*main.Message)(0xc0005a06c0)({ - fullName: (string) (len=17) "NewAddressRequest", - name: (string) (len=17) "NewAddressRequest", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00046f200)({ - name: (string) (len=11) "addressType", - kind: (string) (len=11) "AddressType", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) true, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=17) "PayAddressRequest": (*main.Message)(0xc0005a0740)({ - fullName: (string) (len=17) "PayAddressRequest", - name: (string) (len=17) "PayAddressRequest", - fields: ([]*main.Field) (len=3 cap=4) { - (*main.Field)(0xc00046f260)({ - 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 - }), - (*main.Field)(0xc00046f290)({ - 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 - }), - (*main.Field)(0xc00046f2c0)({ - name: (string) (len=10) "targetConf", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=20) "LnurlPayInfoResponse": (*main.Message)(0xc0005a0ac0)({ - fullName: (string) (len=20) "LnurlPayInfoResponse", - name: (string) (len=20) "LnurlPayInfoResponse", - fields: ([]*main.Field) (len=5 cap=8) { - (*main.Field)(0xc00046f7a0)({ - name: (string) (len=3) "tag", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f7d0)({ - name: (string) (len=8) "callback", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f800)({ - name: (string) (len=11) "maxSendable", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f830)({ - name: (string) (len=11) "minSendable", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f860)({ - 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 - }) - } - }), - (string) (len=26) "GetAppUserLNURLInfoRequest": (*main.Message)(0xc0005a0680)({ - fullName: (string) (len=26) "GetAppUserLNURLInfoRequest", - name: (string) (len=26) "GetAppUserLNURLInfoRequest", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00046f1d0)({ - name: (string) (len=15) "user_identifier", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=18) "PayInvoiceResponse": (*main.Message)(0xc0005a0900)({ - fullName: (string) (len=18) "PayInvoiceResponse", - name: (string) (len=18) "PayInvoiceResponse", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00046f470)({ - name: (string) (len=8) "preimage", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f4a0)({ - 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 - }) - } - }), - (string) (len=25) "LnurlWithdrawInfoResponse": (*main.Message)(0xc0005a0a40)({ - fullName: (string) (len=25) "LnurlWithdrawInfoResponse", - name: (string) (len=25) "LnurlWithdrawInfoResponse", - fields: ([]*main.Field) (len=8 cap=8) { - (*main.Field)(0xc00046f620)({ - name: (string) (len=3) "tag", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f650)({ - name: (string) (len=8) "callback", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f680)({ - name: (string) (len=2) "k1", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f6b0)({ - name: (string) (len=18) "defaultDescription", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f6e0)({ - name: (string) (len=15) "minWithdrawable", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f710)({ - name: (string) (len=15) "maxWithdrawable", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f740)({ - name: (string) (len=12) "balanceCheck", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f770)({ - name: (string) (len=7) "payLink", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=22) "HandleLnurlPayResponse": (*main.Message)(0xc0005a0b00)({ - fullName: (string) (len=22) "HandleLnurlPayResponse", - name: (string) (len=22) "HandleLnurlPayResponse", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00046f890)({ - name: (string) (len=2) "pr", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f8c0)({ - 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 - }) - } - }), - (string) (len=8) "UserInfo": (*main.Message)(0xc0005a0c40)({ - fullName: (string) (len=8) "UserInfo", - name: (string) (len=8) "UserInfo", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00046faa0)({ - name: (string) (len=6) "userId", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046fad0)({ - name: (string) (len=7) "balance", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), (string) (len=13) "AddAppRequest": (*main.Message)(0xc0005a03c0)({ fullName: (string) (len=13) "AddAppRequest", name: (string) (len=13) "AddAppRequest", fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00046ec90)({ + (*main.Field)(0xc000472ff0)({ name: (string) (len=4) "name", kind: (string) (len=6) "string", isMap: (bool) false, @@ -1858,125 +1668,11 @@ }) } }), - (string) (len=17) "NewInvoiceRequest": (*main.Message)(0xc0005a07c0)({ - fullName: (string) (len=17) "NewInvoiceRequest", - name: (string) (len=17) "NewInvoiceRequest", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00046f320)({ - name: (string) (len=10) "amountSats", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f350)({ - name: (string) (len=4) "memo", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=14) "AddUserRequest": (*main.Message)(0xc0005a0b40)({ - fullName: (string) (len=14) "AddUserRequest", - name: (string) (len=14) "AddUserRequest", - fields: ([]*main.Field) (len=3 cap=4) { - (*main.Field)(0xc00046f8f0)({ - name: (string) (len=11) "callbackUrl", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f920)({ - name: (string) (len=4) "name", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046f950)({ - name: (string) (len=6) "secret", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=17) "AddProductRequest": (*main.Message)(0xc0005a0e00)({ - fullName: (string) (len=17) "AddProductRequest", - name: (string) (len=17) "AddProductRequest", - fields: ([]*main.Field) (len=2 cap=2) { - (*main.Field)(0xc00046fe90)({ - name: (string) (len=4) "name", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046fec0)({ - name: (string) (len=10) "price_sats", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=7) "Product": (*main.Message)(0xc0005a0e40)({ - fullName: (string) (len=7) "Product", - name: (string) (len=7) "Product", - fields: ([]*main.Field) (len=3 cap=4) { - (*main.Field)(0xc00046fef0)({ - name: (string) (len=2) "id", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046ff20)({ - name: (string) (len=4) "name", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046ff50)({ - name: (string) (len=10) "price_sats", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=24) "PayAppUserInvoiceRequest": (*main.Message)(0xc0005a0580)({ + (string) (len=24) "PayAppUserInvoiceRequest": (*main.Message)(0xc0005a05c0)({ fullName: (string) (len=24) "PayAppUserInvoiceRequest", name: (string) (len=24) "PayAppUserInvoiceRequest", fields: ([]*main.Field) (len=3 cap=4) { - (*main.Field)(0xc00046eff0)({ + (*main.Field)(0xc0004733b0)({ name: (string) (len=15) "user_identifier", kind: (string) (len=6) "string", isMap: (bool) false, @@ -1985,7 +1681,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00046f020)({ + (*main.Field)(0xc0004733e0)({ name: (string) (len=7) "invoice", kind: (string) (len=6) "string", isMap: (bool) false, @@ -1994,7 +1690,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00046f050)({ + (*main.Field)(0xc000473410)({ name: (string) (len=6) "amount", kind: (string) (len=5) "int64", isMap: (bool) false, @@ -2005,60 +1701,12 @@ }) } }), - (string) (len=17) "LndGetInfoRequest": (*main.Message)(0xc0005a0300)({ - fullName: (string) (len=17) "LndGetInfoRequest", - name: (string) (len=17) "LndGetInfoRequest", + (string) (len=17) "GetAppUserRequest": (*main.Message)(0xc0005a0580)({ + fullName: (string) (len=17) "GetAppUserRequest", + name: (string) (len=17) "GetAppUserRequest", fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00046ebd0)({ - name: (string) (len=6) "nodeId", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=17) "AddAppUserRequest": (*main.Message)(0xc0005a0440)({ - fullName: (string) (len=17) "AddAppUserRequest", - name: (string) (len=17) "AddAppUserRequest", - fields: ([]*main.Field) (len=3 cap=4) { - (*main.Field)(0xc00046ed50)({ - name: (string) (len=10) "identifier", - kind: (string) (len=6) "string", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046ed80)({ - name: (string) (len=14) "fail_if_exists", - kind: (string) (len=4) "bool", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }), - (*main.Field)(0xc00046edb0)({ - name: (string) (len=7) "balance", - kind: (string) (len=5) "int64", - isMap: (bool) false, - isArray: (bool) false, - isEnum: (bool) false, - isMessage: (bool) false, - isOptional: (bool) false - }) - } - }), - (string) (len=19) "OpenChannelResponse": (*main.Message)(0xc0005a0980)({ - fullName: (string) (len=19) "OpenChannelResponse", - name: (string) (len=19) "OpenChannelResponse", - fields: ([]*main.Field) (len=1 cap=1) { - (*main.Field)(0xc00046f590)({ - name: (string) (len=9) "channelId", + (*main.Field)(0xc000473380)({ + name: (string) (len=15) "user_identifier", kind: (string) (len=6) "string", isMap: (bool) false, isArray: (bool) false, @@ -2068,11 +1716,113 @@ }) } }), - (string) (len=24) "GetUserOperationsRequest": (*main.Message)(0xc0005a0cc0)({ + (string) (len=17) "NewInvoiceRequest": (*main.Message)(0xc0005a0880)({ + fullName: (string) (len=17) "NewInvoiceRequest", + name: (string) (len=17) "NewInvoiceRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc000473770)({ + name: (string) (len=10) "amountSats", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc0004737a0)({ + name: (string) (len=4) "memo", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=25) "LnurlWithdrawInfoResponse": (*main.Message)(0xc0005a0b00)({ + fullName: (string) (len=25) "LnurlWithdrawInfoResponse", + name: (string) (len=25) "LnurlWithdrawInfoResponse", + fields: ([]*main.Field) (len=8 cap=8) { + (*main.Field)(0xc000473a70)({ + name: (string) (len=3) "tag", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473aa0)({ + name: (string) (len=8) "callback", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473ad0)({ + name: (string) (len=2) "k1", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473b00)({ + name: (string) (len=18) "defaultDescription", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473b30)({ + name: (string) (len=15) "minWithdrawable", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473b60)({ + name: (string) (len=15) "maxWithdrawable", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473b90)({ + name: (string) (len=12) "balanceCheck", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473bc0)({ + name: (string) (len=7) "payLink", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=24) "GetUserOperationsRequest": (*main.Message)(0xc0005a0d80)({ fullName: (string) (len=24) "GetUserOperationsRequest", name: (string) (len=24) "GetUserOperationsRequest", fields: ([]*main.Field) (len=6 cap=8) { - (*main.Field)(0xc00046fb00)({ + (*main.Field)(0xc000473f50)({ name: (string) (len=21) "latestIncomingInvoice", kind: (string) (len=5) "int64", isMap: (bool) false, @@ -2081,7 +1831,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00046fb30)({ + (*main.Field)(0xc000473f80)({ name: (string) (len=21) "latestOutgoingInvoice", kind: (string) (len=5) "int64", isMap: (bool) false, @@ -2090,7 +1840,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00046fb60)({ + (*main.Field)(0xc000473fb0)({ name: (string) (len=16) "latestIncomingTx", kind: (string) (len=5) "int64", isMap: (bool) false, @@ -2099,7 +1849,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00046fb90)({ + (*main.Field)(0xc0000a41e0)({ name: (string) (len=16) "latestOutgoingTx", kind: (string) (len=5) "int64", isMap: (bool) false, @@ -2108,7 +1858,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00046fbc0)({ + (*main.Field)(0xc0000a4210)({ name: (string) (len=31) "latestIncomingUserToUserPayment", kind: (string) (len=5) "int64", isMap: (bool) false, @@ -2117,7 +1867,7 @@ isMessage: (bool) false, isOptional: (bool) false }), - (*main.Field)(0xc00046fbf0)({ + (*main.Field)(0xc0000a4270)({ name: (string) (len=31) "latestOutgoingUserToUserPayment", kind: (string) (len=5) "int64", isMap: (bool) false, @@ -2128,14 +1878,407 @@ }) } }), + (string) (len=13) "UserOperation": (*main.Message)(0xc0005a0dc0)({ + fullName: (string) (len=13) "UserOperation", + name: (string) (len=13) "UserOperation", + fields: ([]*main.Field) (len=4 cap=4) { + (*main.Field)(0xc0000a42a0)({ + name: (string) (len=10) "paidAtUnix", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc0000a4300)({ + name: (string) (len=4) "type", + kind: (string) (len=17) "UserOperationType", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) true, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc0000a4330)({ + name: (string) (len=7) "inbound", + kind: (string) (len=4) "bool", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc0000a4570)({ + name: (string) (len=6) "amount", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=17) "AddProductRequest": (*main.Message)(0xc0005a0ec0)({ + fullName: (string) (len=17) "AddProductRequest", + name: (string) (len=17) "AddProductRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc0000a4f30)({ + name: (string) (len=4) "name", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc0000a4f60)({ + name: (string) (len=10) "price_sats", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), (string) (len=5) "Empty": (*main.Message)(0xc0005a0280)({ fullName: (string) (len=5) "Empty", name: (string) (len=5) "Empty", fields: ([]*main.Field) + }), + (string) (len=26) "GetAppUserLNURLInfoRequest": (*main.Message)(0xc0005a06c0)({ + fullName: (string) (len=26) "GetAppUserLNURLInfoRequest", + name: (string) (len=26) "GetAppUserLNURLInfoRequest", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000473590)({ + name: (string) (len=15) "user_identifier", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=28) "SetMockAppUserBalanceRequest": (*main.Message)(0xc0005a0700)({ + fullName: (string) (len=28) "SetMockAppUserBalanceRequest", + name: (string) (len=28) "SetMockAppUserBalanceRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc0004735c0)({ + name: (string) (len=15) "user_identifier", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc0004735f0)({ + name: (string) (len=6) "amount", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=17) "PayInvoiceRequest": (*main.Message)(0xc0005a0980)({ + fullName: (string) (len=17) "PayInvoiceRequest", + name: (string) (len=17) "PayInvoiceRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc000473860)({ + name: (string) (len=7) "invoice", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473890)({ + name: (string) (len=6) "amount", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=25) "GetProductBuyLinkResponse": (*main.Message)(0xc0005a0f40)({ + fullName: (string) (len=25) "GetProductBuyLinkResponse", + name: (string) (len=25) "GetProductBuyLinkResponse", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc0000a5170)({ + name: (string) (len=4) "link", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=25) "EncryptionExchangeRequest": (*main.Message)(0xc0005a02c0)({ + fullName: (string) (len=25) "EncryptionExchangeRequest", + name: (string) (len=25) "EncryptionExchangeRequest", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc000472ed0)({ + 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 + }), + (*main.Field)(0xc000472f00)({ + 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 + }) + } + }), + (string) (len=17) "LndGetInfoRequest": (*main.Message)(0xc0005a0300)({ + fullName: (string) (len=17) "LndGetInfoRequest", + name: (string) (len=17) "LndGetInfoRequest", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000472f30)({ + name: (string) (len=6) "nodeId", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=18) "NewAddressResponse": (*main.Message)(0xc0005a07c0)({ + fullName: (string) (len=18) "NewAddressResponse", + name: (string) (len=18) "NewAddressResponse", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000473680)({ + 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 + }) + } + }), + (string) (len=18) "NewInvoiceResponse": (*main.Message)(0xc0005a08c0)({ + fullName: (string) (len=18) "NewInvoiceResponse", + name: (string) (len=18) "NewInvoiceResponse", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc0004737d0)({ + name: (string) (len=7) "invoice", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=18) "OpenChannelRequest": (*main.Message)(0xc0005a0a00)({ + fullName: (string) (len=18) "OpenChannelRequest", + name: (string) (len=18) "OpenChannelRequest", + fields: ([]*main.Field) (len=4 cap=4) { + (*main.Field)(0xc000473920)({ + name: (string) (len=11) "destination", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473950)({ + name: (string) (len=13) "fundingAmount", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473980)({ + name: (string) (len=10) "pushAmount", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc0004739b0)({ + name: (string) (len=12) "closeAddress", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=8) "UserInfo": (*main.Message)(0xc0005a0d00)({ + fullName: (string) (len=8) "UserInfo", + name: (string) (len=8) "UserInfo", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc000473ef0)({ + name: (string) (len=6) "userId", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc000473f20)({ + name: (string) (len=7) "balance", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=14) "UserOperations": (*main.Message)(0xc0005a0e00)({ + fullName: (string) (len=14) "UserOperations", + name: (string) (len=14) "UserOperations", + fields: ([]*main.Field) (len=3 cap=4) { + (*main.Field)(0xc0000a4690)({ + name: (string) (len=9) "fromIndex", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc0000a46c0)({ + name: (string) (len=7) "toIndex", + kind: (string) (len=5) "int64", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc0000a4750)({ + name: (string) (len=10) "operations", + kind: (string) (len=13) "UserOperation", + isMap: (bool) false, + isArray: (bool) true, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false + }) + } + }), + (string) (len=14) "AddAppResponse": (*main.Message)(0xc0005a0440)({ + fullName: (string) (len=14) "AddAppResponse", + name: (string) (len=14) "AddAppResponse", + fields: ([]*main.Field) (len=2 cap=2) { + (*main.Field)(0xc0004730b0)({ + name: (string) (len=3) "app", + kind: (string) (len=11) "Application", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) true, + isOptional: (bool) false + }), + (*main.Field)(0xc0004730e0)({ + name: (string) (len=10) "auth_token", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }) + } + }), + (string) (len=24) "AddAppUserInvoiceRequest": (*main.Message)(0xc0005a0540)({ + fullName: (string) (len=24) "AddAppUserInvoiceRequest", + name: (string) (len=24) "AddAppUserInvoiceRequest", + fields: ([]*main.Field) (len=4 cap=4) { + (*main.Field)(0xc0004732c0)({ + name: (string) (len=19) "receiver_identifier", + kind: (string) (len=6) "string", + isMap: (bool) false, + isArray: (bool) false, + isEnum: (bool) false, + isMessage: (bool) false, + isOptional: (bool) false + }), + (*main.Field)(0xc0004732f0)({ + 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 + }), + (*main.Field)(0xc000473320)({ + 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 + }), + (*main.Field)(0xc000473350)({ + 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 + }) + } + }), + (string) (len=17) "NewAddressRequest": (*main.Message)(0xc0005a0780)({ + fullName: (string) (len=17) "NewAddressRequest", + name: (string) (len=17) "NewAddressRequest", + fields: ([]*main.Field) (len=1 cap=1) { + (*main.Field)(0xc000473650)({ + 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 + }) + } }) } -parsing file: structs 45 +parsing file: structs 48 parsing file: methods 2 -> [{guest Guest false map[]} {user User false map[user_id:string]} {admin Admin false map[admin_id:string]} {app App false map[app_id:string]}] diff --git a/proto/autogenerated/ts/express_server.ts b/proto/autogenerated/ts/express_server.ts index 9fb78377..3b07dd21 100644 --- a/proto/autogenerated/ts/express_server.ts +++ b/proto/autogenerated/ts/express_server.ts @@ -66,10 +66,10 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) if (!opts.allowNotImplementedMethods && !methods.SetMockInvoiceAsPaid) throw new Error('method: SetMockInvoiceAsPaid is not implemented') - app.post('/api/admin/lnd/mock/invoice/paid', async (req, res) => { + app.post('/api/lnd/mock/invoice/paid', async (req, res) => { try { if (!methods.SetMockInvoiceAsPaid) throw new Error('method: SetMockInvoiceAsPaid is not implemented') - const authContext = await opts.AdminAuthGuard(req.headers['authorization']) + const authContext = await opts.GuestAuthGuard(req.headers['authorization']) const request = req.body const error = Types.SetMockInvoiceAsPaidRequestValidate(request) if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) @@ -93,6 +93,17 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) + if (!opts.allowNotImplementedMethods && !methods.GetApp) throw new Error('method: GetApp is not implemented') + app.post('/api/app/get', async (req, res) => { + try { + if (!methods.GetApp) throw new Error('method: GetApp is not implemented') + const authContext = await opts.AppAuthGuard(req.headers['authorization']) + const query = req.query + const params = req.params + const response = await methods.GetApp({ ...authContext, ...query, ...params }) + res.json({status: 'OK', ...response}) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } + }) if (!opts.allowNotImplementedMethods && !methods.AddAppUser) throw new Error('method: AddAppUser is not implemented') app.post('/api/app/user/add', async (req, res) => { try { @@ -205,6 +216,34 @@ export default (methods: Types.ServerMethods, opts: ServerOptions) => { res.json({status: 'OK', ...response}) } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } }) + if (!opts.allowNotImplementedMethods && !methods.SetMockAppUserBalance) throw new Error('method: SetMockAppUserBalance is not implemented') + app.post('/api/app/mock/user/blance/set', async (req, res) => { + try { + if (!methods.SetMockAppUserBalance) throw new Error('method: SetMockAppUserBalance is not implemented') + const authContext = await opts.AppAuthGuard(req.headers['authorization']) + const request = req.body + const error = Types.SetMockAppUserBalanceRequestValidate(request) + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) + const query = req.query + const params = req.params + await methods.SetMockAppUserBalance({ ...authContext, ...query, ...params }, request) + res.json({status: 'OK'}) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } + }) + if (!opts.allowNotImplementedMethods && !methods.SetMockAppBalance) throw new Error('method: SetMockAppBalance is not implemented') + app.post('/api/app/mock/blance/set', async (req, res) => { + try { + if (!methods.SetMockAppBalance) throw new Error('method: SetMockAppBalance is not implemented') + const authContext = await opts.AppAuthGuard(req.headers['authorization']) + const request = req.body + const error = Types.SetMockAppBalanceRequestValidate(request) + if (error !== null) return logErrorAndReturnResponse(error, 'invalid request body', res, logger) + const query = req.query + const params = req.params + await methods.SetMockAppBalance({ ...authContext, ...query, ...params }, request) + res.json({status: 'OK'}) + } catch (ex) { const e = ex as any; logErrorAndReturnResponse(e, e.message || e, res, logger); if (opts.throwErrors) throw e } + }) if (!opts.allowNotImplementedMethods && !methods.AddUser) throw new Error('method: AddUser is not implemented') app.post('/api/user/add', async (req, res) => { try { diff --git a/proto/autogenerated/ts/http_client.ts b/proto/autogenerated/ts/http_client.ts index a1ae2762..4ee9bc4e 100644 --- a/proto/autogenerated/ts/http_client.ts +++ b/proto/autogenerated/ts/http_client.ts @@ -52,9 +52,9 @@ export default (params: ClientParams) => ({ return { status: 'ERROR', reason: 'invalid response' } }, SetMockInvoiceAsPaid: async (request: Types.SetMockInvoiceAsPaidRequest): Promise => { - const auth = await params.retrieveAdminAuth() - if (auth === null) throw new Error('retrieveAdminAuth() returned null') - let finalRoute = '/api/admin/lnd/mock/invoice/paid' + 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') { @@ -76,6 +76,20 @@ export default (params: ClientParams) => ({ } 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.ApplicationValidate(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') @@ -182,6 +196,28 @@ export default (params: ClientParams) => ({ } 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' } + }, AddUser: async (request: Types.AddUserRequest): Promise => { const auth = await params.retrieveGuestAuth() if (auth === null) throw new Error('retrieveGuestAuth() returned null') diff --git a/proto/autogenerated/ts/types.ts b/proto/autogenerated/ts/types.ts index 37c1f6f1..171dd249 100644 --- a/proto/autogenerated/ts/types.ts +++ b/proto/autogenerated/ts/types.ts @@ -32,12 +32,17 @@ export type SetMockInvoiceAsPaid_Query = { } export type SetMockInvoiceAsPaid_RouteParams = { } -export type SetMockInvoiceAsPaid_Context = SetMockInvoiceAsPaid_Query & SetMockInvoiceAsPaid_RouteParams & AdminContext +export type SetMockInvoiceAsPaid_Context = SetMockInvoiceAsPaid_Query & SetMockInvoiceAsPaid_RouteParams & GuestContext export type AddApp_Query = { } export type AddApp_RouteParams = { } export type AddApp_Context = AddApp_Query & AddApp_RouteParams & AdminContext +export type GetApp_Query = { +} +export type GetApp_RouteParams = { +} +export type GetApp_Context = GetApp_Query & GetApp_RouteParams & AppContext export type AddAppUser_Query = { } export type AddAppUser_RouteParams = { @@ -78,6 +83,16 @@ export type GetAppUserLNURLInfo_Query = { export type GetAppUserLNURLInfo_RouteParams = { } export type GetAppUserLNURLInfo_Context = GetAppUserLNURLInfo_Query & GetAppUserLNURLInfo_RouteParams & AppContext +export type SetMockAppUserBalance_Query = { +} +export type SetMockAppUserBalance_RouteParams = { +} +export type SetMockAppUserBalance_Context = SetMockAppUserBalance_Query & SetMockAppUserBalance_RouteParams & AppContext +export type SetMockAppBalance_Query = { +} +export type SetMockAppBalance_RouteParams = { +} +export type SetMockAppBalance_Context = SetMockAppBalance_Query & SetMockAppBalance_RouteParams & AppContext export type AddUser_Query = { } export type AddUser_RouteParams = { @@ -181,6 +196,7 @@ export type ServerMethods = { LndGetInfo?: (ctx: LndGetInfo_Context, req: LndGetInfoRequest) => Promise SetMockInvoiceAsPaid?: (ctx: SetMockInvoiceAsPaid_Context, req: SetMockInvoiceAsPaidRequest) => Promise AddApp?: (ctx: AddApp_Context, req: AddAppRequest) => Promise + GetApp?: (ctx: GetApp_Context) => Promise AddAppUser?: (ctx: AddAppUser_Context, req: AddAppUserRequest) => Promise AddAppInvoice?: (ctx: AddAppInvoice_Context, req: AddAppInvoiceRequest) => Promise AddAppUserInvoice?: (ctx: AddAppUserInvoice_Context, req: AddAppUserInvoiceRequest) => Promise @@ -189,6 +205,8 @@ export type ServerMethods = { SendAppUserToAppUserPayment?: (ctx: SendAppUserToAppUserPayment_Context, req: SendAppUserToAppUserPaymentRequest) => Promise SendAppUserToAppPayment?: (ctx: SendAppUserToAppPayment_Context, req: SendAppUserToAppPaymentRequest) => Promise GetAppUserLNURLInfo?: (ctx: GetAppUserLNURLInfo_Context, req: GetAppUserLNURLInfoRequest) => Promise + SetMockAppUserBalance?: (ctx: SetMockAppUserBalance_Context, req: SetMockAppUserBalanceRequest) => Promise + SetMockAppBalance?: (ctx: SetMockAppBalance_Context, req: SetMockAppBalanceRequest) => Promise AddUser?: (ctx: AddUser_Context, req: AddUserRequest) => Promise AuthUser?: (ctx: AuthUser_Context, req: AuthUserRequest) => Promise GetUserInfo?: (ctx: GetUserInfo_Context) => Promise @@ -235,45 +253,50 @@ export type OptionsBaseMessage = { allOptionalsAreSet?: true } -export type LndGetInfoResponse = { - alias: string +export type Application = { + name: string + id: string + balance: number } -export const LndGetInfoResponseOptionalFields: [] = [] -export type LndGetInfoResponseOptions = OptionsBaseMessage & { +export const ApplicationOptionalFields: [] = [] +export type ApplicationOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - alias_CustomCheck?: (v: string) => boolean + name_CustomCheck?: (v: string) => boolean + id_CustomCheck?: (v: string) => boolean + balance_CustomCheck?: (v: number) => boolean } -export const LndGetInfoResponseValidate = (o?: LndGetInfoResponse, opts: LndGetInfoResponseOptions = {}, path: string = 'LndGetInfoResponse::root.'): Error | null => { +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.alias !== 'string') return new Error(`${path}.alias: is not a string`) - if (opts.alias_CustomCheck && !opts.alias_CustomCheck(o.alias)) return new Error(`${path}.alias: custom check failed`) + if (typeof o.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`) return null } -export type AddAppUserInvoiceRequest = { - receiver_identifier: string +export type AddAppInvoiceRequest = { payer_identifier: string http_callback_url: string invoice_req: NewInvoiceRequest } -export const AddAppUserInvoiceRequestOptionalFields: [] = [] -export type AddAppUserInvoiceRequestOptions = OptionsBaseMessage & { +export const AddAppInvoiceRequestOptionalFields: [] = [] +export type AddAppInvoiceRequestOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - receiver_identifier_CustomCheck?: (v: string) => boolean payer_identifier_CustomCheck?: (v: string) => boolean http_callback_url_CustomCheck?: (v: string) => boolean invoice_req_Options?: NewInvoiceRequestOptions } -export const AddAppUserInvoiceRequestValidate = (o?: AddAppUserInvoiceRequest, opts: AddAppUserInvoiceRequestOptions = {}, path: string = 'AddAppUserInvoiceRequest::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.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`) @@ -287,20 +310,138 @@ export const AddAppUserInvoiceRequestValidate = (o?: AddAppUserInvoiceRequest, o return null } -export type PayAddressResponse = { - txId: string +export type PayAppUserInvoiceResponse = { + preimage: string + amount_paid: number } -export const PayAddressResponseOptionalFields: [] = [] -export type PayAddressResponseOptions = OptionsBaseMessage & { +export const PayAppUserInvoiceResponseOptionalFields: [] = [] +export type PayAppUserInvoiceResponseOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - txId_CustomCheck?: (v: string) => boolean + preimage_CustomCheck?: (v: string) => boolean + amount_paid_CustomCheck?: (v: number) => boolean } -export const PayAddressResponseValidate = (o?: PayAddressResponse, opts: PayAddressResponseOptions = {}, path: string = 'PayAddressResponse::root.'): Error | null => { +export const PayAppUserInvoiceResponseValidate = (o?: PayAppUserInvoiceResponse, opts: PayAppUserInvoiceResponseOptions = {}, path: string = 'PayAppUserInvoiceResponse::root.'): Error | null => { if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - if (typeof o.txId !== 'string') return new Error(`${path}.txId: is not a string`) - if (opts.txId_CustomCheck && !opts.txId_CustomCheck(o.txId)) return new Error(`${path}.txId: custom check failed`) + if (typeof o.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`) + + 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 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 GetUserOperationsResponse = { + latestOutgoingInvoiceOperations: UserOperations + latestIncomingInvoiceOperations: UserOperations + latestOutgoingTxOperations: UserOperations + latestIncomingTxOperations: UserOperations + latestOutgoingUserToUserPayemnts: UserOperations + latestIncomingUserToUserPayemnts: UserOperations +} +export const GetUserOperationsResponseOptionalFields: [] = [] +export type GetUserOperationsResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + latestOutgoingInvoiceOperations_Options?: UserOperationsOptions + latestIncomingInvoiceOperations_Options?: UserOperationsOptions + latestOutgoingTxOperations_Options?: UserOperationsOptions + latestIncomingTxOperations_Options?: UserOperationsOptions + latestOutgoingUserToUserPayemnts_Options?: UserOperationsOptions + latestIncomingUserToUserPayemnts_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 latestOutgoingInvoiceOperationsErr = UserOperationsValidate(o.latestOutgoingInvoiceOperations, opts.latestOutgoingInvoiceOperations_Options, `${path}.latestOutgoingInvoiceOperations`) + if (latestOutgoingInvoiceOperationsErr !== null) return latestOutgoingInvoiceOperationsErr + + + const latestIncomingInvoiceOperationsErr = UserOperationsValidate(o.latestIncomingInvoiceOperations, opts.latestIncomingInvoiceOperations_Options, `${path}.latestIncomingInvoiceOperations`) + if (latestIncomingInvoiceOperationsErr !== null) return latestIncomingInvoiceOperationsErr + + + const latestOutgoingTxOperationsErr = UserOperationsValidate(o.latestOutgoingTxOperations, opts.latestOutgoingTxOperations_Options, `${path}.latestOutgoingTxOperations`) + if (latestOutgoingTxOperationsErr !== null) return latestOutgoingTxOperationsErr + + + const latestIncomingTxOperationsErr = UserOperationsValidate(o.latestIncomingTxOperations, opts.latestIncomingTxOperations_Options, `${path}.latestIncomingTxOperations`) + if (latestIncomingTxOperationsErr !== null) return latestIncomingTxOperationsErr + + + const latestOutgoingUserToUserPayemntsErr = UserOperationsValidate(o.latestOutgoingUserToUserPayemnts, opts.latestOutgoingUserToUserPayemnts_Options, `${path}.latestOutgoingUserToUserPayemnts`) + if (latestOutgoingUserToUserPayemntsErr !== null) return latestOutgoingUserToUserPayemntsErr + + + const latestIncomingUserToUserPayemntsErr = UserOperationsValidate(o.latestIncomingUserToUserPayemnts, opts.latestIncomingUserToUserPayemnts_Options, `${path}.latestIncomingUserToUserPayemnts`) + if (latestIncomingUserToUserPayemntsErr !== null) return latestIncomingUserToUserPayemntsErr + + + 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 } @@ -323,99 +464,20 @@ export const DecodeInvoiceResponseValidate = (o?: DecodeInvoiceResponse, opts: D return null } -export type UserOperation = { - paidAtUnix: number - type: UserOperationType - inbound: boolean - amount: number +export type OpenChannelResponse = { + channelId: string } -export const UserOperationOptionalFields: [] = [] -export type UserOperationOptions = OptionsBaseMessage & { +export const OpenChannelResponseOptionalFields: [] = [] +export type OpenChannelResponseOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - paidAtUnix_CustomCheck?: (v: number) => boolean - type_CustomCheck?: (v: UserOperationType) => boolean - inbound_CustomCheck?: (v: boolean) => boolean - amount_CustomCheck?: (v: number) => boolean + channelId_CustomCheck?: (v: string) => boolean } -export const UserOperationValidate = (o?: UserOperation, opts: UserOperationOptions = {}, path: string = 'UserOperation::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 (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 (!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.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.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 GetAppUserLNURLInfoRequest = { - user_identifier: string -} -export const GetAppUserLNURLInfoRequestOptionalFields: [] = [] -export type GetAppUserLNURLInfoRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - 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.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 NewAddressRequest = { - addressType: AddressType -} -export const NewAddressRequestOptionalFields: [] = [] -export type NewAddressRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - addressType_CustomCheck?: (v: AddressType) => boolean -} -export const NewAddressRequestValidate = (o?: NewAddressRequest, opts: NewAddressRequestOptions = {}, path: string = 'NewAddressRequest::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (!enumCheckAddressType(o.addressType)) return new Error(`${path}.addressType: is not a valid AddressType`) - if (opts.addressType_CustomCheck && !opts.addressType_CustomCheck(o.addressType)) return new Error(`${path}.addressType: custom check failed`) - - return null -} - -export type PayAddressRequest = { - address: string - amoutSats: number - targetConf: number -} -export const PayAddressRequestOptionalFields: [] = [] -export type PayAddressRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - address_CustomCheck?: (v: string) => boolean - amoutSats_CustomCheck?: (v: number) => boolean - targetConf_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.targetConf !== 'number') return new Error(`${path}.targetConf: is not a number`) - if (opts.targetConf_CustomCheck && !opts.targetConf_CustomCheck(o.targetConf)) return new Error(`${path}.targetConf: 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 } @@ -458,6 +520,285 @@ export const LnurlPayInfoResponseValidate = (o?: LnurlPayInfoResponse, opts: Lnu 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 AddUserRequest = { + callbackUrl: string + name: string + secret: string +} +export const AddUserRequestOptionalFields: [] = [] +export type AddUserRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + callbackUrl_CustomCheck?: (v: string) => boolean + name_CustomCheck?: (v: string) => boolean + secret_CustomCheck?: (v: string) => boolean +} +export const AddUserRequestValidate = (o?: AddUserRequest, opts: AddUserRequestOptions = {}, path: string = 'AddUserRequest::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.callbackUrl !== 'string') return new Error(`${path}.callbackUrl: is not a string`) + if (opts.callbackUrl_CustomCheck && !opts.callbackUrl_CustomCheck(o.callbackUrl)) return new Error(`${path}.callbackUrl: 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.secret !== 'string') return new Error(`${path}.secret: is not a string`) + if (opts.secret_CustomCheck && !opts.secret_CustomCheck(o.secret)) return new Error(`${path}.secret: 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 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 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 PayAddressRequest = { + address: string + amoutSats: number + targetConf: number +} +export const PayAddressRequestOptionalFields: [] = [] +export type PayAddressRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + address_CustomCheck?: (v: string) => boolean + amoutSats_CustomCheck?: (v: number) => boolean + targetConf_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.targetConf !== 'number') return new Error(`${path}.targetConf: is not a number`) + if (opts.targetConf_CustomCheck && !opts.targetConf_CustomCheck(o.targetConf)) return new Error(`${path}.targetConf: custom check failed`) + + return null +} + +export type LnurlLinkResponse = { + lnurl: string + k1: string +} +export const LnurlLinkResponseOptionalFields: [] = [] +export type LnurlLinkResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + lnurl_CustomCheck?: (v: string) => boolean + k1_CustomCheck?: (v: string) => boolean +} +export const LnurlLinkResponseValidate = (o?: LnurlLinkResponse, opts: LnurlLinkResponseOptions = {}, path: string = 'LnurlLinkResponse::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.lnurl !== 'string') return new Error(`${path}.lnurl: is not a string`) + if (opts.lnurl_CustomCheck && !opts.lnurl_CustomCheck(o.lnurl)) return new Error(`${path}.lnurl: custom check failed`) + + if (typeof o.k1 !== 'string') return new Error(`${path}.k1: is not a string`) + if (opts.k1_CustomCheck && !opts.k1_CustomCheck(o.k1)) return new Error(`${path}.k1: custom check failed`) + + return null +} + +export type AddUserResponse = { + userId: string + authToken: string +} +export const AddUserResponseOptionalFields: [] = [] +export type AddUserResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + userId_CustomCheck?: (v: string) => boolean + authToken_CustomCheck?: (v: string) => boolean +} +export const AddUserResponseValidate = (o?: AddUserResponse, opts: AddUserResponseOptions = {}, path: string = 'AddUserResponse::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.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.authToken !== 'string') return new Error(`${path}.authToken: is not a string`) + if (opts.authToken_CustomCheck && !opts.authToken_CustomCheck(o.authToken)) return new Error(`${path}.authToken: custom check failed`) + + return null +} + +export type Product = { + id: string + name: string + price_sats: number +} +export const ProductOptionalFields: [] = [] +export type ProductOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + id_CustomCheck?: (v: string) => boolean + name_CustomCheck?: (v: string) => boolean + price_sats_CustomCheck?: (v: number) => boolean +} +export const ProductValidate = (o?: Product, opts: ProductOptions = {}, path: string = 'Product::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.id !== 'string') return new Error(`${path}.id: is not a string`) + if (opts.id_CustomCheck && !opts.id_CustomCheck(o.id)) return new Error(`${path}.id: custom check failed`) + + if (typeof o.name !== 'string') return new Error(`${path}.name: is not a string`) + if (opts.name_CustomCheck && !opts.name_CustomCheck(o.name)) return new Error(`${path}.name: custom check failed`) + + if (typeof o.price_sats !== 'number') return new Error(`${path}.price_sats: is not a number`) + if (opts.price_sats_CustomCheck && !opts.price_sats_CustomCheck(o.price_sats)) return new Error(`${path}.price_sats: custom check failed`) + + return null +} + +export type AuthUserResponse = { + userId: string + authToken: string +} +export const AuthUserResponseOptionalFields: [] = [] +export type AuthUserResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + userId_CustomCheck?: (v: string) => boolean + authToken_CustomCheck?: (v: string) => boolean +} +export const AuthUserResponseValidate = (o?: AuthUserResponse, opts: AuthUserResponseOptions = {}, path: string = 'AuthUserResponse::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.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.authToken !== 'string') return new Error(`${path}.authToken: is not a string`) + if (opts.authToken_CustomCheck && !opts.authToken_CustomCheck(o.authToken)) return new Error(`${path}.authToken: custom check failed`) + + return null +} + +export type SetMockInvoiceAsPaidRequest = { + invoice: string + amount: number +} +export const SetMockInvoiceAsPaidRequestOptionalFields: [] = [] +export type SetMockInvoiceAsPaidRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + invoice_CustomCheck?: (v: string) => boolean + amount_CustomCheck?: (v: number) => boolean +} +export const SetMockInvoiceAsPaidRequestValidate = (o?: SetMockInvoiceAsPaidRequest, opts: SetMockInvoiceAsPaidRequestOptions = {}, path: string = 'SetMockInvoiceAsPaidRequest::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.invoice !== 'string') return new Error(`${path}.invoice: is not a string`) + if (opts.invoice_CustomCheck && !opts.invoice_CustomCheck(o.invoice)) return new Error(`${path}.invoice: custom check failed`) + + 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 AddAppRequest = { name: string } @@ -476,6 +817,75 @@ export const AddAppRequestValidate = (o?: AddAppRequest, opts: AddAppRequestOpti return null } +export type PayAppUserInvoiceRequest = { + user_identifier: string + invoice: string + amount: number +} +export const PayAppUserInvoiceRequestOptionalFields: [] = [] +export type PayAppUserInvoiceRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + user_identifier_CustomCheck?: (v: string) => boolean + invoice_CustomCheck?: (v: string) => boolean + amount_CustomCheck?: (v: number) => boolean +} +export const PayAppUserInvoiceRequestValidate = (o?: PayAppUserInvoiceRequest, opts: PayAppUserInvoiceRequestOptions = {}, path: string = 'PayAppUserInvoiceRequest::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.user_identifier !== 'string') return new Error(`${path}.user_identifier: is not a string`) + if (opts.user_identifier_CustomCheck && !opts.user_identifier_CustomCheck(o.user_identifier)) return new Error(`${path}.user_identifier: custom check failed`) + + if (typeof o.invoice !== 'string') return new Error(`${path}.invoice: is not a string`) + if (opts.invoice_CustomCheck && !opts.invoice_CustomCheck(o.invoice)) return new Error(`${path}.invoice: custom check failed`) + + if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`) + if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`) + + return null +} + +export type 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 PayAddressResponse = { + txId: string +} +export const PayAddressResponseOptionalFields: [] = [] +export type PayAddressResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + 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.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 PayInvoiceResponse = { preimage: string amount_paid: number @@ -499,6 +909,124 @@ export const PayInvoiceResponseValidate = (o?: PayInvoiceResponse, opts: PayInvo return null } +export type AuthUserRequest = { + name: string + secret: string +} +export const AuthUserRequestOptionalFields: [] = [] +export type AuthUserRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + name_CustomCheck?: (v: string) => boolean + secret_CustomCheck?: (v: string) => boolean +} +export const AuthUserRequestValidate = (o?: AuthUserRequest, opts: AuthUserRequestOptions = {}, path: string = 'AuthUserRequest::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.secret !== 'string') return new Error(`${path}.secret: is not a string`) + if (opts.secret_CustomCheck && !opts.secret_CustomCheck(o.secret)) return new Error(`${path}.secret: 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 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 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 GetAppUserLNURLInfoRequest = { + user_identifier: string +} +export const GetAppUserLNURLInfoRequestOptionalFields: [] = [] +export type GetAppUserLNURLInfoRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + 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.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 SetMockAppUserBalanceRequest = { + user_identifier: string + amount: number +} +export const SetMockAppUserBalanceRequestOptionalFields: [] = [] +export type SetMockAppUserBalanceRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + user_identifier_CustomCheck?: (v: string) => boolean + amount_CustomCheck?: (v: number) => boolean +} +export const SetMockAppUserBalanceRequestValidate = (o?: SetMockAppUserBalanceRequest, opts: SetMockAppUserBalanceRequestOptions = {}, path: string = 'SetMockAppUserBalanceRequest::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.user_identifier !== 'string') return new Error(`${path}.user_identifier: is not a string`) + if (opts.user_identifier_CustomCheck && !opts.user_identifier_CustomCheck(o.user_identifier)) return new Error(`${path}.user_identifier: custom check failed`) + + if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`) + if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`) + + return null +} + export type LnurlWithdrawInfoResponse = { tag: string callback: string @@ -552,264 +1080,6 @@ export const LnurlWithdrawInfoResponseValidate = (o?: LnurlWithdrawInfoResponse, 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 UserInfo = { - userId: string - balance: number -} -export const UserInfoOptionalFields: [] = [] -export type UserInfoOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - userId_CustomCheck?: (v: string) => boolean - balance_CustomCheck?: (v: number) => 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.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 PayAppUserInvoiceRequest = { - user_identifier: string - invoice: string - amount: number -} -export const PayAppUserInvoiceRequestOptionalFields: [] = [] -export type PayAppUserInvoiceRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - user_identifier_CustomCheck?: (v: string) => boolean - invoice_CustomCheck?: (v: string) => boolean - amount_CustomCheck?: (v: number) => boolean -} -export const PayAppUserInvoiceRequestValidate = (o?: PayAppUserInvoiceRequest, opts: PayAppUserInvoiceRequestOptions = {}, path: string = 'PayAppUserInvoiceRequest::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.user_identifier !== 'string') return new Error(`${path}.user_identifier: is not a string`) - if (opts.user_identifier_CustomCheck && !opts.user_identifier_CustomCheck(o.user_identifier)) return new Error(`${path}.user_identifier: custom check failed`) - - if (typeof o.invoice !== 'string') return new Error(`${path}.invoice: is not a string`) - if (opts.invoice_CustomCheck && !opts.invoice_CustomCheck(o.invoice)) return new Error(`${path}.invoice: custom check failed`) - - if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`) - if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`) - - return null -} - -export type 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 AddUserRequest = { - callbackUrl: string - name: string - secret: string -} -export const AddUserRequestOptionalFields: [] = [] -export type AddUserRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - callbackUrl_CustomCheck?: (v: string) => boolean - name_CustomCheck?: (v: string) => boolean - secret_CustomCheck?: (v: string) => boolean -} -export const AddUserRequestValidate = (o?: AddUserRequest, opts: AddUserRequestOptions = {}, path: string = 'AddUserRequest::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.callbackUrl !== 'string') return new Error(`${path}.callbackUrl: is not a string`) - if (opts.callbackUrl_CustomCheck && !opts.callbackUrl_CustomCheck(o.callbackUrl)) return new Error(`${path}.callbackUrl: 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.secret !== 'string') return new Error(`${path}.secret: is not a string`) - if (opts.secret_CustomCheck && !opts.secret_CustomCheck(o.secret)) return new Error(`${path}.secret: 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 Product = { - id: string - name: string - price_sats: number -} -export const ProductOptionalFields: [] = [] -export type ProductOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - id_CustomCheck?: (v: string) => boolean - name_CustomCheck?: (v: string) => boolean - price_sats_CustomCheck?: (v: number) => boolean -} -export const ProductValidate = (o?: Product, opts: ProductOptions = {}, path: string = 'Product::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.id !== 'string') return new Error(`${path}.id: is not a string`) - if (opts.id_CustomCheck && !opts.id_CustomCheck(o.id)) return new Error(`${path}.id: custom check failed`) - - if (typeof o.name !== 'string') return new Error(`${path}.name: is not a string`) - if (opts.name_CustomCheck && !opts.name_CustomCheck(o.name)) return new Error(`${path}.name: custom check failed`) - - if (typeof o.price_sats !== 'number') return new Error(`${path}.price_sats: is not a number`) - if (opts.price_sats_CustomCheck && !opts.price_sats_CustomCheck(o.price_sats)) return new Error(`${path}.price_sats: custom check failed`) - - return null -} - -export type 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 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 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 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 GetUserOperationsRequest = { latestIncomingInvoice: number latestOutgoingInvoice: number @@ -853,112 +1123,32 @@ export const GetUserOperationsRequestValidate = (o?: GetUserOperationsRequest, o return null } -export type AuthUserResponse = { - userId: string - authToken: string -} -export const AuthUserResponseOptionalFields: [] = [] -export type AuthUserResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - userId_CustomCheck?: (v: string) => boolean - authToken_CustomCheck?: (v: string) => boolean -} -export const AuthUserResponseValidate = (o?: AuthUserResponse, opts: AuthUserResponseOptions = {}, path: string = 'AuthUserResponse::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.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.authToken !== 'string') return new Error(`${path}.authToken: is not a string`) - if (opts.authToken_CustomCheck && !opts.authToken_CustomCheck(o.authToken)) return new Error(`${path}.authToken: custom check failed`) - - return null -} - -export type UserOperations = { - fromIndex: number - toIndex: number - operations: UserOperation[] -} -export const UserOperationsOptionalFields: [] = [] -export type UserOperationsOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - fromIndex_CustomCheck?: (v: number) => boolean - toIndex_CustomCheck?: (v: number) => boolean - operations_ItemOptions?: UserOperationOptions - operations_CustomCheck?: (v: UserOperation[]) => boolean -} -export const UserOperationsValidate = (o?: UserOperations, opts: UserOperationsOptions = {}, path: string = 'UserOperations::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.fromIndex !== 'number') return new Error(`${path}.fromIndex: is not a number`) - if (opts.fromIndex_CustomCheck && !opts.fromIndex_CustomCheck(o.fromIndex)) return new Error(`${path}.fromIndex: custom check failed`) - - if (typeof o.toIndex !== 'number') return new Error(`${path}.toIndex: is not a number`) - if (opts.toIndex_CustomCheck && !opts.toIndex_CustomCheck(o.toIndex)) return new Error(`${path}.toIndex: custom check failed`) - - if (!Array.isArray(o.operations)) return new Error(`${path}.operations: is not an array`) - for (let index = 0; index < o.operations.length; index++) { - const operationsErr = UserOperationValidate(o.operations[index], opts.operations_ItemOptions, `${path}.operations[${index}]`) - if (operationsErr !== null) return operationsErr - } - if (opts.operations_CustomCheck && !opts.operations_CustomCheck(o.operations)) return new Error(`${path}.operations: custom check failed`) - - return null -} - -export type 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 SendAppUserToAppUserPaymentRequest = { - from_user_identifier: string - to_user_identifier: string +export type UserOperation = { + paidAtUnix: number + type: UserOperationType + inbound: boolean amount: number } -export const SendAppUserToAppUserPaymentRequestOptionalFields: [] = [] -export type SendAppUserToAppUserPaymentRequestOptions = OptionsBaseMessage & { +export const UserOperationOptionalFields: [] = [] +export type UserOperationOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - from_user_identifier_CustomCheck?: (v: string) => boolean - to_user_identifier_CustomCheck?: (v: string) => boolean + paidAtUnix_CustomCheck?: (v: number) => boolean + type_CustomCheck?: (v: UserOperationType) => boolean + inbound_CustomCheck?: (v: boolean) => boolean amount_CustomCheck?: (v: number) => boolean } -export const SendAppUserToAppUserPaymentRequestValidate = (o?: SendAppUserToAppUserPaymentRequest, opts: SendAppUserToAppUserPaymentRequestOptions = {}, path: string = 'SendAppUserToAppUserPaymentRequest::root.'): Error | null => { +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.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.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.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 (!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.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.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`) @@ -966,6 +1156,70 @@ export const SendAppUserToAppUserPaymentRequestValidate = (o?: SendAppUserToAppU 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 EncryptionExchangeRequest = { + publicKey: string + deviceId: string +} +export const EncryptionExchangeRequestOptionalFields: [] = [] +export type EncryptionExchangeRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + publicKey_CustomCheck?: (v: string) => boolean + deviceId_CustomCheck?: (v: string) => boolean +} +export const EncryptionExchangeRequestValidate = (o?: EncryptionExchangeRequest, opts: EncryptionExchangeRequestOptions = {}, path: string = 'EncryptionExchangeRequest::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (typeof o.publicKey !== 'string') return new Error(`${path}.publicKey: is not a string`) + if (opts.publicKey_CustomCheck && !opts.publicKey_CustomCheck(o.publicKey)) return new Error(`${path}.publicKey: custom check failed`) + + if (typeof o.deviceId !== 'string') return new Error(`${path}.deviceId: is not a string`) + if (opts.deviceId_CustomCheck && !opts.deviceId_CustomCheck(o.deviceId)) return new Error(`${path}.deviceId: custom check failed`) + + return null +} + +export type 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 NewAddressResponse = { address: string } @@ -984,193 +1238,6 @@ export const NewAddressResponseValidate = (o?: NewAddressResponse, opts: NewAddr return null } -export type DecodeInvoiceRequest = { - invoice: string -} -export const DecodeInvoiceRequestOptionalFields: [] = [] -export type DecodeInvoiceRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - invoice_CustomCheck?: (v: string) => boolean -} -export const DecodeInvoiceRequestValidate = (o?: DecodeInvoiceRequest, opts: DecodeInvoiceRequestOptions = {}, path: string = 'DecodeInvoiceRequest::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.invoice !== 'string') return new Error(`${path}.invoice: is not a string`) - if (opts.invoice_CustomCheck && !opts.invoice_CustomCheck(o.invoice)) return new Error(`${path}.invoice: custom check failed`) - - return null -} - -export type LnurlLinkResponse = { - lnurl: string - k1: string -} -export const LnurlLinkResponseOptionalFields: [] = [] -export type LnurlLinkResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - lnurl_CustomCheck?: (v: string) => boolean - k1_CustomCheck?: (v: string) => boolean -} -export const LnurlLinkResponseValidate = (o?: LnurlLinkResponse, opts: LnurlLinkResponseOptions = {}, path: string = 'LnurlLinkResponse::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.lnurl !== 'string') return new Error(`${path}.lnurl: is not a string`) - if (opts.lnurl_CustomCheck && !opts.lnurl_CustomCheck(o.lnurl)) return new Error(`${path}.lnurl: custom check failed`) - - if (typeof o.k1 !== 'string') return new Error(`${path}.k1: is not a string`) - if (opts.k1_CustomCheck && !opts.k1_CustomCheck(o.k1)) return new Error(`${path}.k1: custom check failed`) - - return null -} - -export type AuthUserRequest = { - name: string - secret: string -} -export const AuthUserRequestOptionalFields: [] = [] -export type AuthUserRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - name_CustomCheck?: (v: string) => boolean - secret_CustomCheck?: (v: string) => boolean -} -export const AuthUserRequestValidate = (o?: AuthUserRequest, opts: AuthUserRequestOptions = {}, path: string = 'AuthUserRequest::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.secret !== 'string') return new Error(`${path}.secret: is not a string`) - if (opts.secret_CustomCheck && !opts.secret_CustomCheck(o.secret)) return new Error(`${path}.secret: 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 AddUserResponse = { - userId: string - authToken: string -} -export const AddUserResponseOptionalFields: [] = [] -export type AddUserResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - userId_CustomCheck?: (v: string) => boolean - authToken_CustomCheck?: (v: string) => boolean -} -export const AddUserResponseValidate = (o?: AddUserResponse, opts: AddUserResponseOptions = {}, path: string = 'AddUserResponse::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.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.authToken !== 'string') return new Error(`${path}.authToken: is not a string`) - if (opts.authToken_CustomCheck && !opts.authToken_CustomCheck(o.authToken)) return new Error(`${path}.authToken: custom check failed`) - - return null -} - -export type SetMockInvoiceAsPaidRequest = { - invoice: string - amount: number -} -export const SetMockInvoiceAsPaidRequestOptionalFields: [] = [] -export type SetMockInvoiceAsPaidRequestOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - invoice_CustomCheck?: (v: string) => boolean - amount_CustomCheck?: (v: number) => boolean -} -export const SetMockInvoiceAsPaidRequestValidate = (o?: SetMockInvoiceAsPaidRequest, opts: SetMockInvoiceAsPaidRequestOptions = {}, path: string = 'SetMockInvoiceAsPaidRequest::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.invoice !== 'string') return new Error(`${path}.invoice: is not a string`) - if (opts.invoice_CustomCheck && !opts.invoice_CustomCheck(o.invoice)) return new Error(`${path}.invoice: custom check failed`) - - if (typeof o.amount !== 'number') return new Error(`${path}.amount: is not a number`) - if (opts.amount_CustomCheck && !opts.amount_CustomCheck(o.amount)) return new Error(`${path}.amount: custom check failed`) - - return null -} - -export type GetAppUserRequest = { - user_identifier: string -} -export 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 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 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 PayInvoiceRequest = { invoice: string amount: number @@ -1194,6 +1261,118 @@ export const PayInvoiceRequestValidate = (o?: PayInvoiceRequest, opts: PayInvoic 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 AddAppResponse = { + app: Application + auth_token: string +} +export const AddAppResponseOptionalFields: [] = [] +export type AddAppResponseOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + app_Options?: ApplicationOptions + auth_token_CustomCheck?: (v: string) => boolean +} +export const AddAppResponseValidate = (o?: AddAppResponse, opts: AddAppResponseOptions = {}, path: string = 'AddAppResponse::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + const appErr = ApplicationValidate(o.app, opts.app_Options, `${path}.app`) + if (appErr !== null) return appErr + + + if (typeof o.auth_token !== 'string') return new Error(`${path}.auth_token: is not a string`) + if (opts.auth_token_CustomCheck && !opts.auth_token_CustomCheck(o.auth_token)) return new Error(`${path}.auth_token: custom check failed`) + + return null +} + +export type AddAppUserInvoiceRequest = { + receiver_identifier: string + payer_identifier: string + http_callback_url: string + invoice_req: NewInvoiceRequest +} +export const AddAppUserInvoiceRequestOptionalFields: [] = [] +export type AddAppUserInvoiceRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + receiver_identifier_CustomCheck?: (v: string) => boolean + payer_identifier_CustomCheck?: (v: string) => boolean + http_callback_url_CustomCheck?: (v: string) => boolean + invoice_req_Options?: NewInvoiceRequestOptions +} +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 NewAddressRequest = { + addressType: AddressType +} +export const NewAddressRequestOptionalFields: [] = [] +export type NewAddressRequestOptions = OptionsBaseMessage & { + checkOptionalsAreSet?: [] + addressType_CustomCheck?: (v: AddressType) => boolean +} +export const NewAddressRequestValidate = (o?: NewAddressRequest, opts: NewAddressRequestOptions = {}, path: string = 'NewAddressRequest::root.'): Error | null => { + if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') + if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') + + if (!enumCheckAddressType(o.addressType)) return new Error(`${path}.addressType: is not a valid AddressType`) + if (opts.addressType_CustomCheck && !opts.addressType_CustomCheck(o.addressType)) return new Error(`${path}.addressType: custom check failed`) + + return null +} + +export type 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 OpenChannelRequest = { destination: string fundingAmount: number @@ -1227,154 +1406,58 @@ export const OpenChannelRequestValidate = (o?: OpenChannelRequest, opts: OpenCha return null } -export type EncryptionExchangeRequest = { - publicKey: string - deviceId: string +export type UserInfo = { + userId: string + balance: number } -export const EncryptionExchangeRequestOptionalFields: [] = [] -export type EncryptionExchangeRequestOptions = OptionsBaseMessage & { +export const UserInfoOptionalFields: [] = [] +export type UserInfoOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - publicKey_CustomCheck?: (v: string) => boolean - deviceId_CustomCheck?: (v: string) => boolean + userId_CustomCheck?: (v: string) => boolean + balance_CustomCheck?: (v: number) => boolean } -export const EncryptionExchangeRequestValidate = (o?: EncryptionExchangeRequest, opts: EncryptionExchangeRequestOptions = {}, path: string = 'EncryptionExchangeRequest::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.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.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.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.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 AddAppResponse = { - name: string - id: string - auth_token: string +export type UserOperations = { + fromIndex: number + toIndex: number + operations: UserOperation[] } -export const AddAppResponseOptionalFields: [] = [] -export type AddAppResponseOptions = OptionsBaseMessage & { +export const UserOperationsOptionalFields: [] = [] +export type UserOperationsOptions = OptionsBaseMessage & { checkOptionalsAreSet?: [] - name_CustomCheck?: (v: string) => boolean - id_CustomCheck?: (v: string) => boolean - auth_token_CustomCheck?: (v: string) => boolean + fromIndex_CustomCheck?: (v: number) => boolean + toIndex_CustomCheck?: (v: number) => boolean + operations_ItemOptions?: UserOperationOptions + operations_CustomCheck?: (v: UserOperation[]) => boolean } -export const AddAppResponseValidate = (o?: AddAppResponse, opts: AddAppResponseOptions = {}, path: string = 'AddAppResponse::root.'): Error | null => { +export const UserOperationsValidate = (o?: UserOperations, opts: UserOperationsOptions = {}, path: string = 'UserOperations::root.'): Error | null => { if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - if (typeof o.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.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.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.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 (typeof o.auth_token !== 'string') return new Error(`${path}.auth_token: is not a string`) - if (opts.auth_token_CustomCheck && !opts.auth_token_CustomCheck(o.auth_token)) return new Error(`${path}.auth_token: custom check failed`) - - return null -} - -export type AppUser = { - identifier: string - info: UserInfo - 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 PayAppUserInvoiceResponse = { - preimage: string - amount_paid: number -} -export const PayAppUserInvoiceResponseOptionalFields: [] = [] -export type PayAppUserInvoiceResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - preimage_CustomCheck?: (v: string) => boolean - amount_paid_CustomCheck?: (v: number) => boolean -} -export const PayAppUserInvoiceResponseValidate = (o?: PayAppUserInvoiceResponse, opts: PayAppUserInvoiceResponseOptions = {}, path: string = 'PayAppUserInvoiceResponse::root.'): Error | null => { - if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') - if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') - - if (typeof o.preimage !== 'string') return new Error(`${path}.preimage: is not a string`) - if (opts.preimage_CustomCheck && !opts.preimage_CustomCheck(o.preimage)) return new Error(`${path}.preimage: custom check failed`) - - if (typeof o.amount_paid !== 'number') return new Error(`${path}.amount_paid: is not a number`) - if (opts.amount_paid_CustomCheck && !opts.amount_paid_CustomCheck(o.amount_paid)) return new Error(`${path}.amount_paid: custom check failed`) - - return null -} - -export type GetUserOperationsResponse = { - latestOutgoingInvoiceOperations: UserOperations - latestIncomingInvoiceOperations: UserOperations - latestOutgoingTxOperations: UserOperations - latestIncomingTxOperations: UserOperations - latestOutgoingUserToUserPayemnts: UserOperations - latestIncomingUserToUserPayemnts: UserOperations -} -export const GetUserOperationsResponseOptionalFields: [] = [] -export type GetUserOperationsResponseOptions = OptionsBaseMessage & { - checkOptionalsAreSet?: [] - latestOutgoingInvoiceOperations_Options?: UserOperationsOptions - latestIncomingInvoiceOperations_Options?: UserOperationsOptions - latestOutgoingTxOperations_Options?: UserOperationsOptions - latestIncomingTxOperations_Options?: UserOperationsOptions - latestOutgoingUserToUserPayemnts_Options?: UserOperationsOptions - latestIncomingUserToUserPayemnts_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 latestOutgoingInvoiceOperationsErr = UserOperationsValidate(o.latestOutgoingInvoiceOperations, opts.latestOutgoingInvoiceOperations_Options, `${path}.latestOutgoingInvoiceOperations`) - if (latestOutgoingInvoiceOperationsErr !== null) return latestOutgoingInvoiceOperationsErr - - - const latestIncomingInvoiceOperationsErr = UserOperationsValidate(o.latestIncomingInvoiceOperations, opts.latestIncomingInvoiceOperations_Options, `${path}.latestIncomingInvoiceOperations`) - if (latestIncomingInvoiceOperationsErr !== null) return latestIncomingInvoiceOperationsErr - - - const latestOutgoingTxOperationsErr = UserOperationsValidate(o.latestOutgoingTxOperations, opts.latestOutgoingTxOperations_Options, `${path}.latestOutgoingTxOperations`) - if (latestOutgoingTxOperationsErr !== null) return latestOutgoingTxOperationsErr - - - const latestIncomingTxOperationsErr = UserOperationsValidate(o.latestIncomingTxOperations, opts.latestIncomingTxOperations_Options, `${path}.latestIncomingTxOperations`) - if (latestIncomingTxOperationsErr !== null) return latestIncomingTxOperationsErr - - - const latestOutgoingUserToUserPayemntsErr = UserOperationsValidate(o.latestOutgoingUserToUserPayemnts, opts.latestOutgoingUserToUserPayemnts_Options, `${path}.latestOutgoingUserToUserPayemnts`) - if (latestOutgoingUserToUserPayemntsErr !== null) return latestOutgoingUserToUserPayemntsErr - - - const latestIncomingUserToUserPayemntsErr = UserOperationsValidate(o.latestIncomingUserToUserPayemnts, opts.latestIncomingUserToUserPayemnts_Options, `${path}.latestIncomingUserToUserPayemnts`) - if (latestIncomingUserToUserPayemntsErr !== null) return latestIncomingUserToUserPayemntsErr - + if (!Array.isArray(o.operations)) return new Error(`${path}.operations: is not an array`) + for (let index = 0; index < o.operations.length; index++) { + const operationsErr = UserOperationValidate(o.operations[index], opts.operations_ItemOptions, `${path}.operations[${index}]`) + if (operationsErr !== null) return operationsErr + } + if (opts.operations_CustomCheck && !opts.operations_CustomCheck(o.operations)) return new Error(`${path}.operations: custom check failed`) return null } diff --git a/proto/service/methods.proto b/proto/service/methods.proto index a6e71461..e8b1a68b 100644 --- a/proto/service/methods.proto +++ b/proto/service/methods.proto @@ -89,9 +89,9 @@ service LightningPub { }; rpc SetMockInvoiceAsPaid(structs.SetMockInvoiceAsPaidRequest) returns (structs.Empty) { - option (auth_type) = "Admin"; + option (auth_type) = "Guest"; option (http_method) = "post"; - option (http_route) = "/api/admin/lnd/mock/invoice/paid"; + option (http_route) = "/api/lnd/mock/invoice/paid"; } // @@ -101,6 +101,12 @@ service LightningPub { option (http_method) = "post"; option (http_route) = "/api/admin/app/add"; }; + + rpc GetApp(structs.Empty) returns (structs.Application) { + option (auth_type) = "App"; + option (http_method) = "post"; + option (http_route) = "/api/app/get"; + } rpc AddAppUser(structs.AddAppUserRequest)returns (structs.AppUser) { option (auth_type) = "App"; @@ -149,6 +155,16 @@ service LightningPub { option (http_method) = "post"; option (http_route) = "/api/app/user/lnurl/pay/info"; } + rpc SetMockAppUserBalance(structs.SetMockAppUserBalanceRequest) returns (structs.Empty) { + option (auth_type) = "App"; + option (http_method) = "post"; + option (http_route) = "/api/app/mock/user/blance/set"; + } + rpc SetMockAppBalance(structs.SetMockAppBalanceRequest) returns (structs.Empty) { + option (auth_type) = "App"; + option (http_method) = "post"; + option (http_route) = "/api/app/mock/blance/set"; + } // diff --git a/proto/service/structs.proto b/proto/service/structs.proto index e1165f2d..33fbb403 100644 --- a/proto/service/structs.proto +++ b/proto/service/structs.proto @@ -29,11 +29,16 @@ message AddAppRequest { string name = 1; } -message AddAppResponse { +message Application { string name = 1; string id = 2; - string auth_token = 3; + int64 balance = 3; } +message AddAppResponse { + Application app = 1; + string auth_token = 2; +} + message AddAppUserRequest { string identifier = 1; @@ -91,6 +96,15 @@ message GetAppUserLNURLInfoRequest { string user_identifier = 1; } +message SetMockAppUserBalanceRequest { + string user_identifier = 1; + int64 amount = 2; +} + +message SetMockAppBalanceRequest { + int64 amount = 1; +} + enum AddressType { WITNESS_PUBKEY_HASH = 0; NESTED_PUBKEY_HASH = 1; diff --git a/src/services/lnd/index.ts b/src/services/lnd/index.ts index 8efb8de0..63440ecd 100644 --- a/src/services/lnd/index.ts +++ b/src/services/lnd/index.ts @@ -32,8 +32,10 @@ export interface LightningHandler { export default (settings: LndSettings, addressPaidCb: AddressPaidCb, invoicePaidCb: InvoicePaidCb): LightningHandler => { if (settings.mockLnd) { + console.log("registering mock lnd handler") return new MockLnd(settings, addressPaidCb, invoicePaidCb) } else { + console.log("registering prod lnd handler") return new LND(settings, addressPaidCb, invoicePaidCb) } } \ No newline at end of file diff --git a/src/services/lnd/lnd.ts b/src/services/lnd/lnd.ts index 11650835..fd3c4d27 100644 --- a/src/services/lnd/lnd.ts +++ b/src/services/lnd/lnd.ts @@ -157,7 +157,6 @@ export default class { this.checkReady() const abortController = new AbortController() const req = PayInvoiceReq(invoice, amount, feeLimit) - console.log(req) const stream = this.router.sendPaymentV2(req, { abort: abortController.signal }) return new Promise((res, rej) => { stream.responses.onError(error => { diff --git a/src/services/lnd/mock.ts b/src/services/lnd/mock.ts index a7921edc..0641cf9d 100644 --- a/src/services/lnd/mock.ts +++ b/src/services/lnd/mock.ts @@ -15,7 +15,7 @@ import { SendCoinsReq } from './sendCoinsReq.js'; import { LndSettings, AddressPaidCb, InvoicePaidCb, NodeInfo, Invoice, DecodedInvoice, PaidInvoice } from './settings.js'; export default class { - invoicesAwaiting: Record + invoicesAwaiting: Record = {} settings: LndSettings abortController = new AbortController() addressPaidCb: AddressPaidCb @@ -49,12 +49,16 @@ export default class { } async NewInvoice(value: number, memo: string, expiry: number): Promise { - const mockInvoice = "lnbcrtmock" + crypto.randomBytes(32).toString('hex') + const mockInvoice = "lnbcrtmockin" + crypto.randomBytes(32).toString('hex') this.invoicesAwaiting[mockInvoice] = { value, memo, expiryUnix: expiry + Date.now() / 1000 } return { payRequest: mockInvoice } } async DecodeInvoice(paymentRequest: string): Promise { + if (paymentRequest.startsWith('lnbcrtmockout')) { + const amt = this.decodeOutboundInvoice(paymentRequest) + return { numSatoshis: amt } + } const i = this.invoicesAwaiting[paymentRequest] if (!i) { throw new Error("invoice not found") @@ -70,15 +74,23 @@ export default class { return Math.max(0, Math.floor(amount * (1 - this.settings.feeRateLimit) - this.settings.feeFixedLimit)) } - async PayInvoice(invoice: string, amount: number, feeLimit: number): Promise { - if (!invoice.startsWith('lnbcrtmock')) { + decodeOutboundInvoice(invoice: string): number { + if (!invoice.startsWith('lnbcrtmockout')) { throw new Error("invalid mock invoice provided for payment") } - const amt = invoice.substring('lnbcrtmock'.length) + const amt = invoice.substring('lnbcrtmockout'.length).split("__")[0] if (isNaN(+amt)) { throw new Error("invalid mock invoice provided for payment") } - return { feeSat: 0, paymentPreimage: "all_good", valueSat: +amt || amount } + return +amt + } + + async PayInvoice(invoice: string, amount: number, feeLimit: number): Promise { + console.log('payng', invoice) + await new Promise(res => setTimeout(res, 200)) + const amt = this.decodeOutboundInvoice(invoice) + console.log('paid', invoice) + return { feeSat: 1, paymentPreimage: "all_good", valueSat: amt || amount } } async EstimateChainFees(address: string, amount: number, targetConf: number): Promise { diff --git a/src/services/main/applicationManager.ts b/src/services/main/applicationManager.ts index 189f7c88..1f7a2216 100644 --- a/src/services/main/applicationManager.ts +++ b/src/services/main/applicationManager.ts @@ -27,19 +27,45 @@ export default class { t = token.substring("Bearer ".length) } if (!t) throw new Error("no app token provided") - return (jwt.verify(token, this.settings.jwtSecret) as { appId: string }).appId + const decoded = jwt.verify(token, this.settings.jwtSecret) as { appId?: string } + if (!decoded.appId) { + throw new Error("the provided token is not an app token") + } + return decoded.appId + } + + async SetMockAppUserBalance(appId: string, req: Types.SetMockAppUserBalanceRequest) { + const user = await this.storage.applicationStorage.GetOrCreateApplicationUser(appId, req.user_identifier, 0) + await this.paymentManager.SetMockUserBalance(user.user.user_id, req.amount) + } + + async SetMockAppBalance(appId: string, req: Types.SetMockAppBalanceRequest) { + const app = await this.storage.applicationStorage.GetApplication(appId) + await this.paymentManager.SetMockUserBalance(app.owner.user_id, req.amount) } async AddApp(req: Types.AddAppRequest): Promise { const app = await this.storage.applicationStorage.AddApplication(req.name) return { - id: app.app_id, - name: app.name, + app: { + id: app.app_id, + name: app.name, + balance: 0 + }, auth_token: this.SignAppToken(app.app_id) } } + async GetApp(appId: string): Promise { + const app = await this.storage.applicationStorage.GetApplication(appId) + return { + name: app.name, + id: app.app_id, + balance: app.owner.balance_sats + } + } + async AddAppUser(appId: string, req: Types.AddAppUserRequest): Promise { let u: ApplicationUser if (req.fail_if_exists) { @@ -60,7 +86,7 @@ export default class { async AddAppInvoice(appId: string, req: Types.AddAppInvoiceRequest): Promise { const app = await this.storage.applicationStorage.GetApplication(appId) const payer = await this.storage.applicationStorage.GetOrCreateApplicationUser(appId, req.payer_identifier, 0) - const opts: InboundOptionals = { callbackUrl: req.http_callback_url, expiry: defaultInvoiceExpiry, expectedPayer: payer.user } + const opts: InboundOptionals = { callbackUrl: req.http_callback_url, expiry: defaultInvoiceExpiry, expectedPayer: payer.user, linkedApplication: app } return this.paymentManager.NewInvoice(app.owner.user_id, req.invoice_req, opts) } @@ -77,6 +103,7 @@ export default class { async GetAppUser(appId: string, req: Types.GetAppUserRequest): Promise { const user = await this.storage.applicationStorage.GetApplicationUser(appId, req.user_identifier) const max = this.paymentManager.GetMaxPayableInvoice(user.user.balance_sats) + console.log(max, user.user.balance_sats) return { max_withdrawable: max, identifier: req.user_identifier, info: { userId: user.user.user_id, balance: user.user.balance_sats @@ -85,14 +112,16 @@ export default class { } async PayAppUserInvoice(appId: string, req: Types.PayAppUserInvoiceRequest): Promise { + const app = await this.storage.applicationStorage.GetApplication(appId) const appUser = await this.storage.applicationStorage.GetApplicationUser(appId, req.user_identifier) - return this.paymentManager.PayInvoice(appUser.user.user_id, req) + return this.paymentManager.PayInvoice(appUser.user.user_id, req, app) } async SendAppUserToAppUserPayment(appId: string, req: Types.SendAppUserToAppUserPaymentRequest): Promise { const fromUser = await this.storage.applicationStorage.GetApplicationUser(appId, req.from_user_identifier) const toUser = await this.storage.applicationStorage.GetApplicationUser(appId, req.to_user_identifier) - await this.paymentManager.SendUserToUserPayment(fromUser.user.user_id, toUser.user.user_id, req.amount) + const app = await this.storage.applicationStorage.GetApplication(appId) + await this.paymentManager.SendUserToUserPayment(fromUser.user.user_id, toUser.user.user_id, req.amount, app) } async SendAppUserToAppPayment(appId: string, req: Types.SendAppUserToAppPaymentRequest): Promise { diff --git a/src/services/main/index.ts b/src/services/main/index.ts index 5d16593c..cc9818ba 100644 --- a/src/services/main/index.ts +++ b/src/services/main/index.ts @@ -73,11 +73,13 @@ export default class { const userInvoice = await this.storage.paymentStorage.GetInvoiceOwner(paymentRequest, tx) if (!userInvoice || userInvoice.paid_at_unix > 0) { return } const fee = this.paymentManager.getServiceFee(Types.UserOperationType.INCOMING_INVOICE, amount) - const maybeApp = await this.storage.applicationStorage.IsApplicationUser(userInvoice.user.user_id) try { // This call will fail if the invoice is already registered await this.storage.paymentStorage.FlagInvoiceAsPaid(userInvoice, amount, fee, tx) await this.storage.userStorage.IncrementUserBalance(userInvoice.user.user_id, amount - fee, tx) + if (userInvoice.linkedApplication) { + await this.storage.userStorage.IncrementUserBalance(userInvoice.linkedApplication.owner.user_id, fee, tx) + } await this.triggerPaidCallback(userInvoice.callbackUrl) } catch { //TODO diff --git a/src/services/main/paymentManager.ts b/src/services/main/paymentManager.ts index 262ba7ce..a3079b10 100644 --- a/src/services/main/paymentManager.ts +++ b/src/services/main/paymentManager.ts @@ -4,6 +4,7 @@ import * as Types from '../../../proto/autogenerated/ts/types.js' import { MainSettings } from './settings.js' import { InboundOptionals, defaultInvoiceExpiry } from '../storage/paymentStorage.js' import { LightningHandler } from '../lnd/index.js' +import { Application } from '../storage/entity/Application.js' interface UserOperationInfo { serial_id: number paid_amount: number @@ -39,9 +40,20 @@ export default class { } async SetMockInvoiceAsPaid(req: Types.SetMockInvoiceAsPaidRequest) { + if (!this.settings.lndSettings.mockLnd) { + throw new Error("mock disabled, cannot set invoice as paid") + } await this.lnd.SetMockInvoiceAsPaid(req.invoice, req.amount) } + async SetMockUserBalance(userId: string, balance: number) { + if (!this.settings.lndSettings.mockLnd) { + throw new Error("mock disabled, cannot set invoice as paid") + } + console.log("setting mock balance...") + await this.storage.userStorage.UpdateUser(userId, { balance_sats: balance }) + } + async NewAddress(userId: string, req: Types.NewAddressRequest): Promise { const res = await this.lnd.NewAddress(req.addressType) const userAddress = await this.storage.paymentStorage.AddUserAddress(userId, res.address) @@ -60,8 +72,12 @@ export default class { } async lockUserWithMinBalance(userId: string, minBalance: number) { + console.log("locking", userId) return this.storage.StartTransaction(async tx => { const user = await this.storage.userStorage.GetUser(userId, tx) + if (user.locked) { + throw new Error("user is already withdrawing") + } if (user.balance_sats < minBalance) { throw new Error("insufficient balance") } @@ -80,7 +96,7 @@ export default class { amount: Number(decoded.numSatoshis) } } - async PayInvoice(userId: string, req: Types.PayInvoiceRequest): Promise { + async PayInvoice(userId: string, req: Types.PayInvoiceRequest, linkedApplication?: Application): Promise { const decoded = await this.lnd.DecodeInvoice(req.invoice) if (decoded.numSatoshis !== 0 && req.amount !== 0) { throw new Error("invoice has value, do not provide amount the the request") @@ -92,11 +108,15 @@ export default class { const serviceFee = this.getServiceFee(Types.UserOperationType.OUTGOING_INVOICE, payAmount) const totalAmountToDecrement = payAmount + serviceFee - const routingFeeLimit = this.lnd.GetFeeLimitAmount(payAmount) await this.lockUserWithMinBalance(userId, totalAmountToDecrement + routingFeeLimit) const payment = await this.lnd.PayInvoice(req.invoice, req.amount, routingFeeLimit) await this.storage.userStorage.DecrementUserBalance(userId, totalAmountToDecrement + Number(payment.feeSat)) + if (linkedApplication) { + await this.storage.userStorage.IncrementUserBalance(linkedApplication.owner.user_id, serviceFee) + } else { + //const appOwner = await this.storage.applicationStorage.IsApplicationOwner(userId) + } await this.storage.userStorage.UnlockUser(userId) await this.storage.paymentStorage.AddUserInvoicePayment(userId, req.invoice, payAmount, Number(payment.feeSat), serviceFee) return { @@ -241,7 +261,7 @@ export default class { } } - async SendUserToUserPayment(fromUserId: string, toUserId: string, amount: number) { + async SendUserToUserPayment(fromUserId: string, toUserId: string, amount: number, linkedApplication?: Application) { await this.storage.StartTransaction(async tx => { const fromUser = await this.storage.userStorage.GetUser(fromUserId, tx) const toUser = await this.storage.userStorage.GetUser(toUserId, tx) @@ -253,6 +273,9 @@ export default class { await this.storage.userStorage.DecrementUserBalance(fromUser.user_id, amount, tx) await this.storage.userStorage.IncrementUserBalance(toUser.user_id, toIncrement, tx) await this.storage.paymentStorage.AddUserToUserPayment(fromUserId, toUserId, amount, fee) + if (linkedApplication) { + await this.storage.userStorage.IncrementUserBalance(linkedApplication.owner.user_id, fee) + } }) } diff --git a/src/services/main/userManager.ts b/src/services/main/userManager.ts index ca5dfffd..84a14914 100644 --- a/src/services/main/userManager.ts +++ b/src/services/main/userManager.ts @@ -15,13 +15,18 @@ export default class { } DecodeUserToken(token?: string): string { - if (!token) throw new Error("empty user token provided") + throw new Error("users methods temporarely disabled") + /*if (!token) throw new Error("empty user token provided") let t = token if (token.startsWith("Bearer ")) { t = token.substring("Bearer ".length) } if (!t) throw new Error("no user token provided") - return (jwt.verify(token, this.settings.jwtSecret) as { userId: string }).userId + const decoded = jwt.verify(token, this.settings.jwtSecret) as { userId?: string } + if (!decoded.userId) { + throw new Error("the provided token is not an app token") + } + return decoded.userId*/ } async AddBasicUser(req: Types.AddUserRequest): Promise { diff --git a/src/services/serverMethods/index.ts b/src/services/serverMethods/index.ts index 51fa6919..86f910e0 100644 --- a/src/services/serverMethods/index.ts +++ b/src/services/serverMethods/index.ts @@ -116,6 +116,9 @@ export default (mainHandler: Main): Types.ServerMethods => { if (err != null) throw new Error(err.message) return mainHandler.applicationManager.AddApp(req) }, + GetApp: async (ctx) => { + return mainHandler.applicationManager.GetApp(ctx.app_id) + }, AddAppUser: async (ctx, req) => { const err = Types.AddAppUserRequestValidate(req, { identifier_CustomCheck: id => id !== '' @@ -176,6 +179,16 @@ export default (mainHandler: Main): Types.ServerMethods => { }) if (err != null) throw new Error(err.message) return mainHandler.applicationManager.GetAppUserLNURLInfo(ctx.app_id, req) + }, + SetMockAppUserBalance: async (ctx, req) => { + const err = Types.SetMockAppUserBalanceRequestValidate(req, { + user_identifier_CustomCheck: id => id !== '' + }) + if (err != null) throw new Error(err.message) + await mainHandler.applicationManager.SetMockAppUserBalance(ctx.app_id, req) + }, + SetMockAppBalance: async (ctx, req) => { + await mainHandler.applicationManager.SetMockAppBalance(ctx.app_id, req) } } } \ No newline at end of file diff --git a/src/services/storage/applicationStorage.ts b/src/services/storage/applicationStorage.ts index 218b3bb6..ef9ea3fa 100644 --- a/src/services/storage/applicationStorage.ts +++ b/src/services/storage/applicationStorage.ts @@ -66,7 +66,6 @@ export default class { } if (found.application.app_id !== appId) { - console.log(found, appId) throw new Error("requested user does not belong to requestor application") } return found @@ -75,4 +74,8 @@ export default class { async IsApplicationUser(userId: string, entityManager = this.DB): Promise { return await entityManager.getRepository(ApplicationUser).findOne({ where: { user: { user_id: userId } } }) } + + async IsApplicationOwner(userId: string, entityManager = this.DB) { + return entityManager.getRepository(Application).findOne({ where: { owner: { user_id: userId } } }) + } } \ No newline at end of file diff --git a/src/services/storage/entity/UserReceivingInvoice.ts b/src/services/storage/entity/UserReceivingInvoice.ts index 5219773f..0df576d3 100644 --- a/src/services/storage/entity/UserReceivingInvoice.ts +++ b/src/services/storage/entity/UserReceivingInvoice.ts @@ -1,6 +1,7 @@ import { Entity, PrimaryGeneratedColumn, Column, Index, Check, ManyToOne, JoinColumn, CreateDateColumn, UpdateDateColumn } from "typeorm" import { Product } from "./Product.js" import { User } from "./User.js" +import { Application } from "./Application.js" @Entity() export class UserReceivingInvoice { @@ -37,6 +38,9 @@ export class UserReceivingInvoice { @ManyToOne(type => User, { eager: true }) payer: User | null + @ManyToOne(type => Application, { eager: true }) + linkedApplication: Application | null + @CreateDateColumn() created_at: Date diff --git a/src/services/storage/index.ts b/src/services/storage/index.ts index 16352b9d..5c160ea1 100644 --- a/src/services/storage/index.ts +++ b/src/services/storage/index.ts @@ -1,4 +1,4 @@ -import { DataSource, EntityManager, MoreThan, MoreThanOrEqual } from "typeorm" +import { DataSource, EntityManager, MoreThan, MoreThanOrEqual, TransactionAlreadyStartedError } from "typeorm" import crypto from 'crypto'; import NewDB, { DbSettings, LoadDbSettingsFromEnv } from "./db.js" import { User } from "./entity/User.js" @@ -29,6 +29,7 @@ export default class { applicationStorage: ApplicationStorage userStorage: UserStorage paymentStorage: PaymentStorage + pendingTx: boolean constructor(settings: StorageSettings) { this.settings = settings } @@ -40,6 +41,24 @@ export default class { this.paymentStorage = new PaymentStorage(this.DB, this.userStorage) } StartTransaction(exec: (entityManager: EntityManager) => Promise) { - return this.DB.transaction(exec) + if (this.pendingTx) { + throw new Error("cannot start transaction") + } + this.pendingTx = true + console.log("starting tx") + return this.DB.transaction(async tx => { + try { + await exec(tx) + console.log("tx done") + this.pendingTx = false + } catch (err) { + console.log("tx err") + this.pendingTx = false + throw err + } + + + }) + } } \ No newline at end of file diff --git a/src/services/storage/paymentStorage.ts b/src/services/storage/paymentStorage.ts index 2a473ea2..eebfa403 100644 --- a/src/services/storage/paymentStorage.ts +++ b/src/services/storage/paymentStorage.ts @@ -12,7 +12,8 @@ import UserStorage from './userStorage.js'; import { AddressReceivingTransaction } from './entity/AddressReceivingTransaction.js'; import { UserInvoicePayment } from './entity/UserInvoicePayment.js'; import { UserToUserPayment } from './entity/UserToUserPayment.js'; -export type InboundOptionals = { product?: Product, callbackUrl?: string, expiry: number, expectedPayer?: User } +import { Application } from './entity/Application.js'; +export type InboundOptionals = { product?: Product, callbackUrl?: string, expiry: number, expectedPayer?: User, linkedApplication?: Application } export const defaultInvoiceExpiry = 60 * 60 export default class { DB: DataSource | EntityManager @@ -83,7 +84,8 @@ export default class { user: user, product: options.product, expires_at_unix: Math.floor(Date.now() / 1000) + options.expiry, - payer: options.expectedPayer + payer: options.expectedPayer, + linkedApplication: options.linkedApplication }) return entityManager.getRepository(UserReceivingInvoice).save(newUserInvoice) } diff --git a/src/services/storage/userStorage.ts b/src/services/storage/userStorage.ts index cb7d0a20..a011df82 100644 --- a/src/services/storage/userStorage.ts +++ b/src/services/storage/userStorage.ts @@ -75,6 +75,7 @@ export default class { } } async UnlockUser(userId: string, entityManager = this.DB) { + console.log("unlocking", userId) const res = await entityManager.getRepository(User).update({ user_id: userId }, { locked: false }) @@ -102,4 +103,9 @@ export default class { throw new Error("unaffected balance decrement for " + userId) // TODO: fix logs doxing } } + + async UpdateUser(userId: string, update: Partial, entityManager = this.DB) { + const user = await this.GetUser(userId, entityManager) + await entityManager.getRepository(User).update(user.serial_id, update) + } } \ No newline at end of file