@lightsparkdev/lightspark-sdk 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/.fossa.yml +6 -0
  2. package/.prettierrc +1 -0
  3. package/.turbo/turbo-build.log +19 -0
  4. package/.turbo/turbo-lint.log +3 -0
  5. package/CHANGELOG.md +49 -0
  6. package/LICENSE +201 -0
  7. package/README.md +137 -0
  8. package/dist/Withdrawal-17e1c8af.d.ts +1672 -0
  9. package/dist/Withdrawal-27a4d10d.d.ts +1672 -0
  10. package/dist/chunk-3VRI7CHE.js +5508 -0
  11. package/dist/chunk-AGEUDR2V.js +4498 -0
  12. package/dist/chunk-N27QHRE4.js +5508 -0
  13. package/dist/client-3bba3f64.d.ts +1302 -0
  14. package/dist/index.cjs +6633 -0
  15. package/dist/index.d.ts +15 -0
  16. package/dist/index.js +1177 -0
  17. package/dist/objects/index.cjs +5347 -0
  18. package/dist/objects/index.d.ts +3 -0
  19. package/dist/objects/index.js +88 -0
  20. package/examples/node-scripts/authHelpers.ts +20 -0
  21. package/examples/node-scripts/createInvoice.ts +64 -0
  22. package/examples/node-scripts/example.ts +288 -0
  23. package/examples/node-scripts/getAccountDashboard.ts +24 -0
  24. package/examples/node-scripts/getNodeChannels.ts +34 -0
  25. package/examples/node-scripts/internalAuthHelpers.ts +26 -0
  26. package/examples/node-scripts/internal_example.ts +296 -0
  27. package/examples/node-scripts/package-lock.json +887 -0
  28. package/examples/node-scripts/package.json +22 -0
  29. package/examples/node-scripts/prettyPrintJsonForDocs.ts +62 -0
  30. package/examples/node-scripts/tsconfig.json +27 -0
  31. package/examples/oauth-example/README.md +19 -0
  32. package/examples/oauth-example/package-lock.json +16071 -0
  33. package/examples/oauth-example/package.json +50 -0
  34. package/examples/oauth-example/public/favicon.ico +0 -0
  35. package/examples/oauth-example/public/index.html +43 -0
  36. package/examples/oauth-example/public/logo192.png +0 -0
  37. package/examples/oauth-example/public/logo512.png +0 -0
  38. package/examples/oauth-example/public/manifest.json +25 -0
  39. package/examples/oauth-example/public/robots.txt +3 -0
  40. package/examples/oauth-example/src/App.css +7 -0
  41. package/examples/oauth-example/src/App.test.tsx +12 -0
  42. package/examples/oauth-example/src/App.tsx +16 -0
  43. package/examples/oauth-example/src/auth/AuthContext.ts +8 -0
  44. package/examples/oauth-example/src/auth/AuthProvider.tsx +44 -0
  45. package/examples/oauth-example/src/auth/RequireAuth.tsx +19 -0
  46. package/examples/oauth-example/src/auth/oauthProvider.ts +35 -0
  47. package/examples/oauth-example/src/components/Button.tsx +39 -0
  48. package/examples/oauth-example/src/components/CurrencyAmount.tsx +117 -0
  49. package/examples/oauth-example/src/components/Dashboard.tsx +158 -0
  50. package/examples/oauth-example/src/components/Table.tsx +22 -0
  51. package/examples/oauth-example/src/hooks/useAccountInfo.tsx +31 -0
  52. package/examples/oauth-example/src/icons/BitcoinB.tsx +20 -0
  53. package/examples/oauth-example/src/icons/Icon.tsx +121 -0
  54. package/examples/oauth-example/src/icons/Satoshi.tsx +28 -0
  55. package/examples/oauth-example/src/index.css +13 -0
  56. package/examples/oauth-example/src/index.tsx +23 -0
  57. package/examples/oauth-example/src/lightsparkclient/LightsparkClientContext.ts +10 -0
  58. package/examples/oauth-example/src/lightsparkclient/LightsparkClientProvider.tsx +53 -0
  59. package/examples/oauth-example/src/logo.svg +1 -0
  60. package/examples/oauth-example/src/pages/DashboardPage.tsx +71 -0
  61. package/examples/oauth-example/src/pages/LoginPage.tsx +63 -0
  62. package/examples/oauth-example/src/react-app-env.d.ts +1 -0
  63. package/examples/oauth-example/src/reportWebVitals.ts +15 -0
  64. package/examples/oauth-example/src/routes/index.tsx +15 -0
  65. package/examples/oauth-example/src/setupTests.ts +5 -0
  66. package/examples/oauth-example/src/utils/currency.ts +483 -0
  67. package/examples/oauth-example/tsconfig.json +20 -0
  68. package/examples/streaming-wallet-extension/.fossa.yml +6 -0
  69. package/examples/streaming-wallet-extension/README.md +17 -0
  70. package/examples/streaming-wallet-extension/craco.config.js +58 -0
  71. package/examples/streaming-wallet-extension/package-lock.json +18260 -0
  72. package/examples/streaming-wallet-extension/package.json +77 -0
  73. package/examples/streaming-wallet-extension/public/index.html +24 -0
  74. package/examples/streaming-wallet-extension/public/lightspark_full.png +0 -0
  75. package/examples/streaming-wallet-extension/public/lightspark_icon_circle.png +0 -0
  76. package/examples/streaming-wallet-extension/public/manifest.json +43 -0
  77. package/examples/streaming-wallet-extension/public/robots.txt +3 -0
  78. package/examples/streaming-wallet-extension/src/App.css +53 -0
  79. package/examples/streaming-wallet-extension/src/App.tsx +425 -0
  80. package/examples/streaming-wallet-extension/src/auth/AccountStorage.ts +28 -0
  81. package/examples/streaming-wallet-extension/src/auth/DemoAccountProvider.ts +99 -0
  82. package/examples/streaming-wallet-extension/src/auth/StreamingDemoCredentials.ts +10 -0
  83. package/examples/streaming-wallet-extension/src/background/PaymentStrategy.ts +36 -0
  84. package/examples/streaming-wallet-extension/src/background/PlaybackRange.ts +31 -0
  85. package/examples/streaming-wallet-extension/src/background/StreamingInvoiceHolder.ts +33 -0
  86. package/examples/streaming-wallet-extension/src/background/TransactionObserver.ts +66 -0
  87. package/examples/streaming-wallet-extension/src/background/VideoPlaybackRanges.ts +38 -0
  88. package/examples/streaming-wallet-extension/src/background/VideoProgressCache.ts +87 -0
  89. package/examples/streaming-wallet-extension/src/background/background.ts +145 -0
  90. package/examples/streaming-wallet-extension/src/background/messageHandling.ts +185 -0
  91. package/examples/streaming-wallet-extension/src/common/datetimes.ts +28 -0
  92. package/examples/streaming-wallet-extension/src/common/settings.ts +12 -0
  93. package/examples/streaming-wallet-extension/src/common/storage.ts +8 -0
  94. package/examples/streaming-wallet-extension/src/common/streamingTabs.ts +27 -0
  95. package/examples/streaming-wallet-extension/src/common/types.tsx +23 -0
  96. package/examples/streaming-wallet-extension/src/components/CirclePlusIcon.tsx +19 -0
  97. package/examples/streaming-wallet-extension/src/components/CurrencyAmount.tsx +110 -0
  98. package/examples/streaming-wallet-extension/src/components/CurrencyAmountRaw.tsx +195 -0
  99. package/examples/streaming-wallet-extension/src/components/LeftArrow.tsx +21 -0
  100. package/examples/streaming-wallet-extension/src/components/Loading.tsx +151 -0
  101. package/examples/streaming-wallet-extension/src/components/StreamingTransactionChip.tsx +95 -0
  102. package/examples/streaming-wallet-extension/src/components/TransactionRow.tsx +93 -0
  103. package/examples/streaming-wallet-extension/src/contentscript/content.ts +123 -0
  104. package/examples/streaming-wallet-extension/src/contentscript/lightsparkDemoDom.tsx +113 -0
  105. package/examples/streaming-wallet-extension/src/contentscript/videoElementParsers.ts +92 -0
  106. package/examples/streaming-wallet-extension/src/index.css +16 -0
  107. package/examples/streaming-wallet-extension/src/index.tsx +11 -0
  108. package/examples/streaming-wallet-extension/src/lightsparkClientProvider.tsx +26 -0
  109. package/examples/streaming-wallet-extension/src/react-app-env.d.ts +1 -0
  110. package/examples/streaming-wallet-extension/src/types/Messages.ts +17 -0
  111. package/examples/streaming-wallet-extension/tsconfig.json +20 -0
  112. package/package.json +87 -0
  113. package/src/auth/AccountTokenAuthProvider.ts +37 -0
  114. package/src/auth/index.ts +3 -0
  115. package/src/client.ts +759 -0
  116. package/src/graphql/BitcoinFeeEstimate.ts +13 -0
  117. package/src/graphql/CreateApiToken.ts +22 -0
  118. package/src/graphql/CreateInvoice.ts +18 -0
  119. package/src/graphql/CreateNodeWalletAddress.ts +13 -0
  120. package/src/graphql/CurrentAccount.ts +13 -0
  121. package/src/graphql/DecodeInvoice.ts +16 -0
  122. package/src/graphql/DeleteApiToken.ts +13 -0
  123. package/src/graphql/FundNode.ts +18 -0
  124. package/src/graphql/LightningFeeEstimateForInvoice.ts +21 -0
  125. package/src/graphql/LightningFeeEstimateForNode.ts +21 -0
  126. package/src/graphql/MultiNodeDashboard.ts +118 -0
  127. package/src/graphql/PayInvoice.ts +29 -0
  128. package/src/graphql/RecoverNodeSigningKey.ts +15 -0
  129. package/src/graphql/RequestWithdrawal.ts +25 -0
  130. package/src/graphql/SendPayment.ts +29 -0
  131. package/src/graphql/SingleNodeDashboard.ts +116 -0
  132. package/src/graphql/TransactionSubscription.ts +16 -0
  133. package/src/graphql/TransactionsForNode.ts +42 -0
  134. package/src/index.ts +5 -0
  135. package/src/objects/Account.ts +1222 -0
  136. package/src/objects/AccountToApiTokensConnection.ts +50 -0
  137. package/src/objects/AccountToChannelsConnection.ts +35 -0
  138. package/src/objects/AccountToNodesConnection.ts +62 -0
  139. package/src/objects/AccountToPaymentRequestsConnection.ts +50 -0
  140. package/src/objects/AccountToTransactionsConnection.ts +112 -0
  141. package/src/objects/ApiToken.ts +80 -0
  142. package/src/objects/BitcoinNetwork.ts +19 -0
  143. package/src/objects/BlockchainBalance.ts +102 -0
  144. package/src/objects/Channel.ts +283 -0
  145. package/src/objects/ChannelClosingTransaction.ts +150 -0
  146. package/src/objects/ChannelFees.ts +34 -0
  147. package/src/objects/ChannelOpeningTransaction.ts +150 -0
  148. package/src/objects/ChannelStatus.ts +25 -0
  149. package/src/objects/ChannelToTransactionsConnection.ts +86 -0
  150. package/src/objects/CreateApiTokenInput.ts +22 -0
  151. package/src/objects/CreateApiTokenOutput.ts +41 -0
  152. package/src/objects/CreateInvoiceInput.ts +27 -0
  153. package/src/objects/CreateInvoiceOutput.ts +21 -0
  154. package/src/objects/CreateNodeWalletAddressInput.ts +15 -0
  155. package/src/objects/CreateNodeWalletAddressOutput.ts +27 -0
  156. package/src/objects/CurrencyAmount.ts +55 -0
  157. package/src/objects/CurrencyUnit.ts +25 -0
  158. package/src/objects/DeleteApiTokenInput.ts +13 -0
  159. package/src/objects/DeleteApiTokenOutput.ts +23 -0
  160. package/src/objects/Deposit.ts +144 -0
  161. package/src/objects/Entity.ts +868 -0
  162. package/src/objects/FeeEstimate.ts +39 -0
  163. package/src/objects/FundNodeInput.ts +16 -0
  164. package/src/objects/FundNodeOutput.ts +28 -0
  165. package/src/objects/GraphNode.ts +110 -0
  166. package/src/objects/Hop.ts +108 -0
  167. package/src/objects/HtlcAttemptFailureCode.ts +65 -0
  168. package/src/objects/IncomingPayment.ts +141 -0
  169. package/src/objects/IncomingPaymentAttempt.ts +96 -0
  170. package/src/objects/IncomingPaymentAttemptStatus.ts +20 -0
  171. package/src/objects/IncomingPaymentToAttemptsConnection.ts +39 -0
  172. package/src/objects/Invoice.ts +226 -0
  173. package/src/objects/InvoiceData.ts +185 -0
  174. package/src/objects/InvoiceType.ts +15 -0
  175. package/src/objects/LightningFeeEstimateForInvoiceInput.ts +28 -0
  176. package/src/objects/LightningFeeEstimateForNodeInput.ts +25 -0
  177. package/src/objects/LightningFeeEstimateOutput.ts +33 -0
  178. package/src/objects/LightningTransaction.ts +393 -0
  179. package/src/objects/LightsparkNode.ts +377 -0
  180. package/src/objects/LightsparkNodePurpose.ts +17 -0
  181. package/src/objects/LightsparkNodeStatus.ts +29 -0
  182. package/src/objects/LightsparkNodeToChannelsConnection.ts +50 -0
  183. package/src/objects/Node.ts +273 -0
  184. package/src/objects/NodeAddress.ts +29 -0
  185. package/src/objects/NodeAddressType.ts +18 -0
  186. package/src/objects/NodeToAddressesConnection.ts +39 -0
  187. package/src/objects/OnChainTransaction.ts +318 -0
  188. package/src/objects/OutgoingPayment.ts +319 -0
  189. package/src/objects/OutgoingPaymentAttempt.ts +164 -0
  190. package/src/objects/OutgoingPaymentAttemptStatus.ts +18 -0
  191. package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +37 -0
  192. package/src/objects/OutgoingPaymentToAttemptsConnection.ts +39 -0
  193. package/src/objects/PageInfo.ts +31 -0
  194. package/src/objects/PayInvoiceInput.ts +33 -0
  195. package/src/objects/PayInvoiceOutput.ts +22 -0
  196. package/src/objects/PaymentFailureReason.ts +29 -0
  197. package/src/objects/PaymentRequest.ts +231 -0
  198. package/src/objects/PaymentRequestData.ts +183 -0
  199. package/src/objects/PaymentRequestStatus.ts +15 -0
  200. package/src/objects/Permission.ts +39 -0
  201. package/src/objects/RequestWithdrawalInput.ts +35 -0
  202. package/src/objects/RequestWithdrawalOutput.ts +24 -0
  203. package/src/objects/RichText.ts +19 -0
  204. package/src/objects/RoutingTransaction.ts +150 -0
  205. package/src/objects/RoutingTransactionFailureReason.ts +17 -0
  206. package/src/objects/Secret.ts +23 -0
  207. package/src/objects/SendPaymentInput.ts +30 -0
  208. package/src/objects/SendPaymentOutput.ts +22 -0
  209. package/src/objects/Transaction.ts +609 -0
  210. package/src/objects/TransactionFailures.ts +23 -0
  211. package/src/objects/TransactionStatus.ts +23 -0
  212. package/src/objects/TransactionType.ts +31 -0
  213. package/src/objects/TransactionUpdate.ts +67 -0
  214. package/src/objects/WalletDashboard.ts +32 -0
  215. package/src/objects/WebhookEventType.ts +15 -0
  216. package/src/objects/Withdrawal.ts +144 -0
  217. package/src/objects/WithdrawalMode.ts +15 -0
  218. package/src/objects/WithdrawalRequest.ts +224 -0
  219. package/src/objects/WithdrawalRequestStatus.ts +17 -0
  220. package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +57 -0
  221. package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +57 -0
  222. package/src/objects/index.ts +108 -0
  223. package/tsconfig.json +5 -0
@@ -0,0 +1,4498 @@
1
+ // src/objects/CurrencyUnit.ts
2
+ var CurrencyUnit = /* @__PURE__ */ ((CurrencyUnit2) => {
3
+ CurrencyUnit2["FUTURE_VALUE"] = "FUTURE_VALUE";
4
+ CurrencyUnit2["BITCOIN"] = "BITCOIN";
5
+ CurrencyUnit2["SATOSHI"] = "SATOSHI";
6
+ CurrencyUnit2["MILLISATOSHI"] = "MILLISATOSHI";
7
+ CurrencyUnit2["USD"] = "USD";
8
+ CurrencyUnit2["NANOBITCOIN"] = "NANOBITCOIN";
9
+ CurrencyUnit2["MICROBITCOIN"] = "MICROBITCOIN";
10
+ CurrencyUnit2["MILLIBITCOIN"] = "MILLIBITCOIN";
11
+ return CurrencyUnit2;
12
+ })(CurrencyUnit || {});
13
+ var CurrencyUnit_default = CurrencyUnit;
14
+
15
+ // src/objects/CurrencyAmount.ts
16
+ var CurrencyAmountFromJson = (obj) => {
17
+ return {
18
+ originalValue: obj["currency_amount_original_value"],
19
+ originalUnit: CurrencyUnit_default[obj["currency_amount_original_unit"]] ?? CurrencyUnit_default.FUTURE_VALUE,
20
+ preferredCurrencyUnit: CurrencyUnit_default[obj["currency_amount_preferred_currency_unit"]] ?? CurrencyUnit_default.FUTURE_VALUE,
21
+ preferredCurrencyValueRounded: obj["currency_amount_preferred_currency_value_rounded"],
22
+ preferredCurrencyValueApprox: obj["currency_amount_preferred_currency_value_approx"]
23
+ };
24
+ };
25
+ var FRAGMENT = `
26
+ fragment CurrencyAmountFragment on CurrencyAmount {
27
+ __typename
28
+ currency_amount_original_value: original_value
29
+ currency_amount_original_unit: original_unit
30
+ currency_amount_preferred_currency_unit: preferred_currency_unit
31
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
32
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
33
+ }`;
34
+
35
+ // src/objects/FeeEstimate.ts
36
+ var FeeEstimateFromJson = (obj) => {
37
+ return {
38
+ feeFast: CurrencyAmountFromJson(obj["fee_estimate_fee_fast"]),
39
+ feeMin: CurrencyAmountFromJson(obj["fee_estimate_fee_min"])
40
+ };
41
+ };
42
+ var FRAGMENT2 = `
43
+ fragment FeeEstimateFragment on FeeEstimate {
44
+ __typename
45
+ fee_estimate_fee_fast: fee_fast {
46
+ __typename
47
+ currency_amount_original_value: original_value
48
+ currency_amount_original_unit: original_unit
49
+ currency_amount_preferred_currency_unit: preferred_currency_unit
50
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
51
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
52
+ }
53
+ fee_estimate_fee_min: fee_min {
54
+ __typename
55
+ currency_amount_original_value: original_value
56
+ currency_amount_original_unit: original_unit
57
+ currency_amount_preferred_currency_unit: preferred_currency_unit
58
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
59
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
60
+ }
61
+ }`;
62
+
63
+ // src/objects/Permission.ts
64
+ var Permission = /* @__PURE__ */ ((Permission2) => {
65
+ Permission2["FUTURE_VALUE"] = "FUTURE_VALUE";
66
+ Permission2["ALL"] = "ALL";
67
+ Permission2["MAINNET_VIEW"] = "MAINNET_VIEW";
68
+ Permission2["MAINNET_TRANSACT"] = "MAINNET_TRANSACT";
69
+ Permission2["MAINNET_MANAGE"] = "MAINNET_MANAGE";
70
+ Permission2["TESTNET_VIEW"] = "TESTNET_VIEW";
71
+ Permission2["TESTNET_TRANSACT"] = "TESTNET_TRANSACT";
72
+ Permission2["TESTNET_MANAGE"] = "TESTNET_MANAGE";
73
+ Permission2["REGTEST_VIEW"] = "REGTEST_VIEW";
74
+ Permission2["REGTEST_TRANSACT"] = "REGTEST_TRANSACT";
75
+ Permission2["REGTEST_MANAGE"] = "REGTEST_MANAGE";
76
+ Permission2["USER_VIEW"] = "USER_VIEW";
77
+ Permission2["USER_MANAGE"] = "USER_MANAGE";
78
+ Permission2["ACCOUNT_VIEW"] = "ACCOUNT_VIEW";
79
+ Permission2["ACCOUNT_MANAGE"] = "ACCOUNT_MANAGE";
80
+ return Permission2;
81
+ })(Permission || {});
82
+ var Permission_default = Permission;
83
+
84
+ // src/objects/ApiToken.ts
85
+ var ApiTokenFromJson = (obj) => {
86
+ return {
87
+ id: obj["api_token_id"],
88
+ createdAt: obj["api_token_created_at"],
89
+ updatedAt: obj["api_token_updated_at"],
90
+ clientId: obj["api_token_client_id"],
91
+ name: obj["api_token_name"],
92
+ permissions: obj["api_token_permissions"].map((e) => Permission_default[e]),
93
+ typename: "ApiToken"
94
+ };
95
+ };
96
+ var FRAGMENT3 = `
97
+ fragment ApiTokenFragment on ApiToken {
98
+ __typename
99
+ api_token_id: id
100
+ api_token_created_at: created_at
101
+ api_token_updated_at: updated_at
102
+ api_token_client_id: client_id
103
+ api_token_name: name
104
+ api_token_permissions: permissions
105
+ }`;
106
+ var getApiTokenQuery = (id) => {
107
+ return {
108
+ queryPayload: `
109
+ query GetApiToken($id: ID!) {
110
+ entity(id: $id) {
111
+ ... on ApiToken {
112
+ ...ApiTokenFragment
113
+ }
114
+ }
115
+ }
116
+
117
+ ${FRAGMENT3}
118
+ `,
119
+ variables: { id },
120
+ constructObject: (data) => ApiTokenFromJson(data.entity)
121
+ };
122
+ };
123
+
124
+ // src/objects/BitcoinNetwork.ts
125
+ var BitcoinNetwork = /* @__PURE__ */ ((BitcoinNetwork2) => {
126
+ BitcoinNetwork2["FUTURE_VALUE"] = "FUTURE_VALUE";
127
+ BitcoinNetwork2["MAINNET"] = "MAINNET";
128
+ BitcoinNetwork2["REGTEST"] = "REGTEST";
129
+ BitcoinNetwork2["SIGNET"] = "SIGNET";
130
+ BitcoinNetwork2["TESTNET"] = "TESTNET";
131
+ return BitcoinNetwork2;
132
+ })(BitcoinNetwork || {});
133
+ var BitcoinNetwork_default = BitcoinNetwork;
134
+
135
+ // src/objects/BlockchainBalance.ts
136
+ var BlockchainBalanceFromJson = (obj) => {
137
+ return {
138
+ totalBalance: !!obj["blockchain_balance_total_balance"] ? CurrencyAmountFromJson(obj["blockchain_balance_total_balance"]) : void 0,
139
+ confirmedBalance: !!obj["blockchain_balance_confirmed_balance"] ? CurrencyAmountFromJson(obj["blockchain_balance_confirmed_balance"]) : void 0,
140
+ unconfirmedBalance: !!obj["blockchain_balance_unconfirmed_balance"] ? CurrencyAmountFromJson(obj["blockchain_balance_unconfirmed_balance"]) : void 0,
141
+ lockedBalance: !!obj["blockchain_balance_locked_balance"] ? CurrencyAmountFromJson(obj["blockchain_balance_locked_balance"]) : void 0,
142
+ requiredReserve: !!obj["blockchain_balance_required_reserve"] ? CurrencyAmountFromJson(obj["blockchain_balance_required_reserve"]) : void 0,
143
+ availableBalance: !!obj["blockchain_balance_available_balance"] ? CurrencyAmountFromJson(obj["blockchain_balance_available_balance"]) : void 0
144
+ };
145
+ };
146
+
147
+ // src/objects/NodeAddressType.ts
148
+ var NodeAddressType = /* @__PURE__ */ ((NodeAddressType2) => {
149
+ NodeAddressType2["FUTURE_VALUE"] = "FUTURE_VALUE";
150
+ NodeAddressType2["IPV4"] = "IPV4";
151
+ NodeAddressType2["IPV6"] = "IPV6";
152
+ NodeAddressType2["TOR"] = "TOR";
153
+ return NodeAddressType2;
154
+ })(NodeAddressType || {});
155
+ var NodeAddressType_default = NodeAddressType;
156
+
157
+ // src/objects/NodeAddress.ts
158
+ var NodeAddressFromJson = (obj) => {
159
+ return {
160
+ address: obj["node_address_address"],
161
+ type: NodeAddressType_default[obj["node_address_type"]] ?? NodeAddressType_default.FUTURE_VALUE
162
+ };
163
+ };
164
+
165
+ // src/objects/NodeToAddressesConnection.ts
166
+ var NodeToAddressesConnectionFromJson = (obj) => {
167
+ return {
168
+ count: obj["node_to_addresses_connection_count"],
169
+ entities: obj["node_to_addresses_connection_entities"].map(
170
+ (e) => NodeAddressFromJson(e)
171
+ )
172
+ };
173
+ };
174
+
175
+ // src/objects/GraphNode.ts
176
+ import autoBind from "auto-bind";
177
+ var GraphNode = class {
178
+ constructor(id, createdAt, updatedAt, bitcoinNetwork, displayName, typename, alias, color, conductivity, publicKey) {
179
+ this.id = id;
180
+ this.createdAt = createdAt;
181
+ this.updatedAt = updatedAt;
182
+ this.bitcoinNetwork = bitcoinNetwork;
183
+ this.displayName = displayName;
184
+ this.typename = typename;
185
+ this.alias = alias;
186
+ this.color = color;
187
+ this.conductivity = conductivity;
188
+ this.publicKey = publicKey;
189
+ autoBind(this);
190
+ }
191
+ async getAddresses(client, first = void 0, types = void 0) {
192
+ return await client.executeRawQuery({
193
+ queryPayload: `
194
+ query FetchNodeToAddressesConnection($entity_id: ID!, $first: Int, $types: [NodeAddressType!]) {
195
+ entity(id: $entity_id) {
196
+ ... on GraphNode {
197
+ addresses(, first: $first, types: $types) {
198
+ __typename
199
+ node_to_addresses_connection_count: count
200
+ node_to_addresses_connection_entities: entities {
201
+ __typename
202
+ node_address_address: address
203
+ node_address_type: type
204
+ }
205
+ }
206
+ }
207
+ }
208
+ }
209
+ `,
210
+ variables: { entity_id: this.id, first, types },
211
+ constructObject: (json) => {
212
+ const connection = json["entity"]["addresses"];
213
+ return NodeToAddressesConnectionFromJson(connection);
214
+ }
215
+ });
216
+ }
217
+ static getGraphNodeQuery(id) {
218
+ return {
219
+ queryPayload: `
220
+ query GetGraphNode($id: ID!) {
221
+ entity(id: $id) {
222
+ ... on GraphNode {
223
+ ...GraphNodeFragment
224
+ }
225
+ }
226
+ }
227
+
228
+ ${FRAGMENT4}
229
+ `,
230
+ variables: { id },
231
+ constructObject: (data) => GraphNodeFromJson(data.entity)
232
+ };
233
+ }
234
+ };
235
+ var GraphNodeFromJson = (obj) => {
236
+ return new GraphNode(
237
+ obj["graph_node_id"],
238
+ obj["graph_node_created_at"],
239
+ obj["graph_node_updated_at"],
240
+ BitcoinNetwork_default[obj["graph_node_bitcoin_network"]] ?? BitcoinNetwork_default.FUTURE_VALUE,
241
+ obj["graph_node_display_name"],
242
+ "GraphNode",
243
+ obj["graph_node_alias"],
244
+ obj["graph_node_color"],
245
+ obj["graph_node_conductivity"],
246
+ obj["graph_node_public_key"]
247
+ );
248
+ };
249
+ var FRAGMENT4 = `
250
+ fragment GraphNodeFragment on GraphNode {
251
+ __typename
252
+ graph_node_id: id
253
+ graph_node_created_at: created_at
254
+ graph_node_updated_at: updated_at
255
+ graph_node_alias: alias
256
+ graph_node_bitcoin_network: bitcoin_network
257
+ graph_node_color: color
258
+ graph_node_conductivity: conductivity
259
+ graph_node_display_name: display_name
260
+ graph_node_public_key: public_key
261
+ }`;
262
+ var GraphNode_default = GraphNode;
263
+
264
+ // src/objects/LightsparkNodePurpose.ts
265
+ var LightsparkNodePurpose = /* @__PURE__ */ ((LightsparkNodePurpose2) => {
266
+ LightsparkNodePurpose2["FUTURE_VALUE"] = "FUTURE_VALUE";
267
+ LightsparkNodePurpose2["SEND"] = "SEND";
268
+ LightsparkNodePurpose2["RECEIVE"] = "RECEIVE";
269
+ LightsparkNodePurpose2["ROUTING"] = "ROUTING";
270
+ return LightsparkNodePurpose2;
271
+ })(LightsparkNodePurpose || {});
272
+ var LightsparkNodePurpose_default = LightsparkNodePurpose;
273
+
274
+ // src/objects/LightsparkNodeStatus.ts
275
+ var LightsparkNodeStatus = /* @__PURE__ */ ((LightsparkNodeStatus2) => {
276
+ LightsparkNodeStatus2["FUTURE_VALUE"] = "FUTURE_VALUE";
277
+ LightsparkNodeStatus2["CREATED"] = "CREATED";
278
+ LightsparkNodeStatus2["DEPLOYED"] = "DEPLOYED";
279
+ LightsparkNodeStatus2["STARTED"] = "STARTED";
280
+ LightsparkNodeStatus2["SYNCING"] = "SYNCING";
281
+ LightsparkNodeStatus2["READY"] = "READY";
282
+ LightsparkNodeStatus2["STOPPED"] = "STOPPED";
283
+ LightsparkNodeStatus2["TERMINATED"] = "TERMINATED";
284
+ LightsparkNodeStatus2["WALLET_LOCKED"] = "WALLET_LOCKED";
285
+ LightsparkNodeStatus2["FAILED_TO_DEPLOY"] = "FAILED_TO_DEPLOY";
286
+ return LightsparkNodeStatus2;
287
+ })(LightsparkNodeStatus || {});
288
+ var LightsparkNodeStatus_default = LightsparkNodeStatus;
289
+
290
+ // src/objects/ChannelFees.ts
291
+ var ChannelFeesFromJson = (obj) => {
292
+ return {
293
+ baseFee: !!obj["channel_fees_base_fee"] ? CurrencyAmountFromJson(obj["channel_fees_base_fee"]) : void 0,
294
+ feeRatePerMil: obj["channel_fees_fee_rate_per_mil"]
295
+ };
296
+ };
297
+
298
+ // src/objects/ChannelStatus.ts
299
+ var ChannelStatus = /* @__PURE__ */ ((ChannelStatus2) => {
300
+ ChannelStatus2["FUTURE_VALUE"] = "FUTURE_VALUE";
301
+ ChannelStatus2["OK"] = "OK";
302
+ ChannelStatus2["PENDING"] = "PENDING";
303
+ ChannelStatus2["OFFLINE"] = "OFFLINE";
304
+ ChannelStatus2["UNBALANCED_FOR_SEND"] = "UNBALANCED_FOR_SEND";
305
+ ChannelStatus2["UNBALANCED_FOR_RECEIVE"] = "UNBALANCED_FOR_RECEIVE";
306
+ ChannelStatus2["CLOSED"] = "CLOSED";
307
+ ChannelStatus2["ERROR"] = "ERROR";
308
+ return ChannelStatus2;
309
+ })(ChannelStatus || {});
310
+ var ChannelStatus_default = ChannelStatus;
311
+
312
+ // src/objects/ChannelToTransactionsConnection.ts
313
+ var ChannelToTransactionsConnectionFromJson = (obj) => {
314
+ return {
315
+ count: obj["channel_to_transactions_connection_count"],
316
+ averageFee: !!obj["channel_to_transactions_connection_average_fee"] ? CurrencyAmountFromJson(
317
+ obj["channel_to_transactions_connection_average_fee"]
318
+ ) : void 0,
319
+ totalAmountTransacted: !!obj["channel_to_transactions_connection_total_amount_transacted"] ? CurrencyAmountFromJson(
320
+ obj["channel_to_transactions_connection_total_amount_transacted"]
321
+ ) : void 0,
322
+ totalFees: !!obj["channel_to_transactions_connection_total_fees"] ? CurrencyAmountFromJson(
323
+ obj["channel_to_transactions_connection_total_fees"]
324
+ ) : void 0
325
+ };
326
+ };
327
+
328
+ // src/objects/Channel.ts
329
+ import autoBind2 from "auto-bind";
330
+ var Channel = class {
331
+ constructor(id, createdAt, updatedAt, localNodeId, typename, fundingTransactionId, capacity, localBalance, localUnsettledBalance, remoteBalance, remoteUnsettledBalance, unsettledBalance, totalBalance, status, estimatedForceClosureWaitMinutes, commitFee, fees, remoteNodeId, shortChannelId) {
332
+ this.id = id;
333
+ this.createdAt = createdAt;
334
+ this.updatedAt = updatedAt;
335
+ this.localNodeId = localNodeId;
336
+ this.typename = typename;
337
+ this.fundingTransactionId = fundingTransactionId;
338
+ this.capacity = capacity;
339
+ this.localBalance = localBalance;
340
+ this.localUnsettledBalance = localUnsettledBalance;
341
+ this.remoteBalance = remoteBalance;
342
+ this.remoteUnsettledBalance = remoteUnsettledBalance;
343
+ this.unsettledBalance = unsettledBalance;
344
+ this.totalBalance = totalBalance;
345
+ this.status = status;
346
+ this.estimatedForceClosureWaitMinutes = estimatedForceClosureWaitMinutes;
347
+ this.commitFee = commitFee;
348
+ this.fees = fees;
349
+ this.remoteNodeId = remoteNodeId;
350
+ this.shortChannelId = shortChannelId;
351
+ autoBind2(this);
352
+ }
353
+ async getUptimePercentage(client, afterDate = void 0, beforeDate = void 0) {
354
+ return await client.executeRawQuery({
355
+ queryPayload: `
356
+ query FetchChannelUptimePercentage($entity_id: ID!, $after_date: DateTime, $before_date: DateTime) {
357
+ entity(id: $entity_id) {
358
+ ... on Channel {
359
+ uptime_percentage(, after_date: $after_date, before_date: $before_date)
360
+ }
361
+ }
362
+ }
363
+ `,
364
+ variables: {
365
+ entity_id: this.id,
366
+ after_date: afterDate,
367
+ before_date: beforeDate
368
+ },
369
+ constructObject: (json) => {
370
+ const connection = json["entity"]["uptime_percentage"];
371
+ return connection;
372
+ }
373
+ });
374
+ }
375
+ async getTransactions(client, types = void 0, afterDate = void 0, beforeDate = void 0) {
376
+ return await client.executeRawQuery({
377
+ queryPayload: `
378
+ query FetchChannelToTransactionsConnection($entity_id: ID!, $types: [TransactionType!], $after_date: DateTime, $before_date: DateTime) {
379
+ entity(id: $entity_id) {
380
+ ... on Channel {
381
+ transactions(, types: $types, after_date: $after_date, before_date: $before_date) {
382
+ __typename
383
+ channel_to_transactions_connection_count: count
384
+ channel_to_transactions_connection_average_fee: average_fee {
385
+ __typename
386
+ currency_amount_original_value: original_value
387
+ currency_amount_original_unit: original_unit
388
+ currency_amount_preferred_currency_unit: preferred_currency_unit
389
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
390
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
391
+ }
392
+ channel_to_transactions_connection_total_amount_transacted: total_amount_transacted {
393
+ __typename
394
+ currency_amount_original_value: original_value
395
+ currency_amount_original_unit: original_unit
396
+ currency_amount_preferred_currency_unit: preferred_currency_unit
397
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
398
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
399
+ }
400
+ channel_to_transactions_connection_total_fees: total_fees {
401
+ __typename
402
+ currency_amount_original_value: original_value
403
+ currency_amount_original_unit: original_unit
404
+ currency_amount_preferred_currency_unit: preferred_currency_unit
405
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
406
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
407
+ }
408
+ }
409
+ }
410
+ }
411
+ }
412
+ `,
413
+ variables: {
414
+ entity_id: this.id,
415
+ types,
416
+ after_date: afterDate,
417
+ before_date: beforeDate
418
+ },
419
+ constructObject: (json) => {
420
+ const connection = json["entity"]["transactions"];
421
+ return ChannelToTransactionsConnectionFromJson(connection);
422
+ }
423
+ });
424
+ }
425
+ static getChannelQuery(id) {
426
+ return {
427
+ queryPayload: `
428
+ query GetChannel($id: ID!) {
429
+ entity(id: $id) {
430
+ ... on Channel {
431
+ ...ChannelFragment
432
+ }
433
+ }
434
+ }
435
+
436
+ ${FRAGMENT5}
437
+ `,
438
+ variables: { id },
439
+ constructObject: (data) => ChannelFromJson(data.entity)
440
+ };
441
+ }
442
+ };
443
+ var ChannelFromJson = (obj) => {
444
+ return new Channel(
445
+ obj["channel_id"],
446
+ obj["channel_created_at"],
447
+ obj["channel_updated_at"],
448
+ obj["channel_local_node"].id,
449
+ "Channel",
450
+ obj["channel_funding_transaction"]?.id ?? void 0,
451
+ !!obj["channel_capacity"] ? CurrencyAmountFromJson(obj["channel_capacity"]) : void 0,
452
+ !!obj["channel_local_balance"] ? CurrencyAmountFromJson(obj["channel_local_balance"]) : void 0,
453
+ !!obj["channel_local_unsettled_balance"] ? CurrencyAmountFromJson(obj["channel_local_unsettled_balance"]) : void 0,
454
+ !!obj["channel_remote_balance"] ? CurrencyAmountFromJson(obj["channel_remote_balance"]) : void 0,
455
+ !!obj["channel_remote_unsettled_balance"] ? CurrencyAmountFromJson(obj["channel_remote_unsettled_balance"]) : void 0,
456
+ !!obj["channel_unsettled_balance"] ? CurrencyAmountFromJson(obj["channel_unsettled_balance"]) : void 0,
457
+ !!obj["channel_total_balance"] ? CurrencyAmountFromJson(obj["channel_total_balance"]) : void 0,
458
+ !!obj["channel_status"] ? ChannelStatus_default[obj["channel_status"]] ?? ChannelStatus_default.FUTURE_VALUE : null,
459
+ obj["channel_estimated_force_closure_wait_minutes"],
460
+ !!obj["channel_commit_fee"] ? CurrencyAmountFromJson(obj["channel_commit_fee"]) : void 0,
461
+ !!obj["channel_fees"] ? ChannelFeesFromJson(obj["channel_fees"]) : void 0,
462
+ obj["channel_remote_node"]?.id ?? void 0,
463
+ obj["channel_short_channel_id"]
464
+ );
465
+ };
466
+ var FRAGMENT5 = `
467
+ fragment ChannelFragment on Channel {
468
+ __typename
469
+ channel_id: id
470
+ channel_created_at: created_at
471
+ channel_updated_at: updated_at
472
+ channel_funding_transaction: funding_transaction {
473
+ id
474
+ }
475
+ channel_capacity: capacity {
476
+ __typename
477
+ currency_amount_original_value: original_value
478
+ currency_amount_original_unit: original_unit
479
+ currency_amount_preferred_currency_unit: preferred_currency_unit
480
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
481
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
482
+ }
483
+ channel_local_balance: local_balance {
484
+ __typename
485
+ currency_amount_original_value: original_value
486
+ currency_amount_original_unit: original_unit
487
+ currency_amount_preferred_currency_unit: preferred_currency_unit
488
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
489
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
490
+ }
491
+ channel_local_unsettled_balance: local_unsettled_balance {
492
+ __typename
493
+ currency_amount_original_value: original_value
494
+ currency_amount_original_unit: original_unit
495
+ currency_amount_preferred_currency_unit: preferred_currency_unit
496
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
497
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
498
+ }
499
+ channel_remote_balance: remote_balance {
500
+ __typename
501
+ currency_amount_original_value: original_value
502
+ currency_amount_original_unit: original_unit
503
+ currency_amount_preferred_currency_unit: preferred_currency_unit
504
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
505
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
506
+ }
507
+ channel_remote_unsettled_balance: remote_unsettled_balance {
508
+ __typename
509
+ currency_amount_original_value: original_value
510
+ currency_amount_original_unit: original_unit
511
+ currency_amount_preferred_currency_unit: preferred_currency_unit
512
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
513
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
514
+ }
515
+ channel_unsettled_balance: unsettled_balance {
516
+ __typename
517
+ currency_amount_original_value: original_value
518
+ currency_amount_original_unit: original_unit
519
+ currency_amount_preferred_currency_unit: preferred_currency_unit
520
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
521
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
522
+ }
523
+ channel_total_balance: total_balance {
524
+ __typename
525
+ currency_amount_original_value: original_value
526
+ currency_amount_original_unit: original_unit
527
+ currency_amount_preferred_currency_unit: preferred_currency_unit
528
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
529
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
530
+ }
531
+ channel_status: status
532
+ channel_estimated_force_closure_wait_minutes: estimated_force_closure_wait_minutes
533
+ channel_commit_fee: commit_fee {
534
+ __typename
535
+ currency_amount_original_value: original_value
536
+ currency_amount_original_unit: original_unit
537
+ currency_amount_preferred_currency_unit: preferred_currency_unit
538
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
539
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
540
+ }
541
+ channel_fees: fees {
542
+ __typename
543
+ channel_fees_base_fee: base_fee {
544
+ __typename
545
+ currency_amount_original_value: original_value
546
+ currency_amount_original_unit: original_unit
547
+ currency_amount_preferred_currency_unit: preferred_currency_unit
548
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
549
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
550
+ }
551
+ channel_fees_fee_rate_per_mil: fee_rate_per_mil
552
+ }
553
+ channel_remote_node: remote_node {
554
+ id
555
+ }
556
+ channel_local_node: local_node {
557
+ id
558
+ }
559
+ channel_short_channel_id: short_channel_id
560
+ }`;
561
+ var Channel_default = Channel;
562
+
563
+ // src/objects/PageInfo.ts
564
+ var PageInfoFromJson = (obj) => {
565
+ return {
566
+ hasNextPage: obj["page_info_has_next_page"],
567
+ hasPreviousPage: obj["page_info_has_previous_page"],
568
+ startCursor: obj["page_info_start_cursor"],
569
+ endCursor: obj["page_info_end_cursor"]
570
+ };
571
+ };
572
+
573
+ // src/objects/LightsparkNodeToChannelsConnection.ts
574
+ var LightsparkNodeToChannelsConnectionFromJson = (obj) => {
575
+ return {
576
+ pageInfo: PageInfoFromJson(
577
+ obj["lightspark_node_to_channels_connection_page_info"]
578
+ ),
579
+ count: obj["lightspark_node_to_channels_connection_count"],
580
+ entities: obj["lightspark_node_to_channels_connection_entities"].map(
581
+ (e) => ChannelFromJson(e)
582
+ )
583
+ };
584
+ };
585
+
586
+ // src/objects/Secret.ts
587
+ var SecretFromJson = (obj) => {
588
+ return {
589
+ encryptedValue: obj["secret_encrypted_value"],
590
+ cipher: obj["secret_cipher"]
591
+ };
592
+ };
593
+
594
+ // src/objects/LightsparkNode.ts
595
+ import autoBind3 from "auto-bind";
596
+ var LightsparkNode = class {
597
+ constructor(id, createdAt, updatedAt, bitcoinNetwork, displayName, accountId, typename, alias, color, conductivity, publicKey, blockchainBalance, encryptedSigningPrivateKey, totalBalance, totalLocalBalance, localBalance, purpose, remoteBalance, status) {
598
+ this.id = id;
599
+ this.createdAt = createdAt;
600
+ this.updatedAt = updatedAt;
601
+ this.bitcoinNetwork = bitcoinNetwork;
602
+ this.displayName = displayName;
603
+ this.accountId = accountId;
604
+ this.typename = typename;
605
+ this.alias = alias;
606
+ this.color = color;
607
+ this.conductivity = conductivity;
608
+ this.publicKey = publicKey;
609
+ this.blockchainBalance = blockchainBalance;
610
+ this.encryptedSigningPrivateKey = encryptedSigningPrivateKey;
611
+ this.totalBalance = totalBalance;
612
+ this.totalLocalBalance = totalLocalBalance;
613
+ this.localBalance = localBalance;
614
+ this.purpose = purpose;
615
+ this.remoteBalance = remoteBalance;
616
+ this.status = status;
617
+ autoBind3(this);
618
+ }
619
+ async getAddresses(client, first = void 0, types = void 0) {
620
+ return await client.executeRawQuery({
621
+ queryPayload: `
622
+ query FetchNodeToAddressesConnection($entity_id: ID!, $first: Int, $types: [NodeAddressType!]) {
623
+ entity(id: $entity_id) {
624
+ ... on LightsparkNode {
625
+ addresses(, first: $first, types: $types) {
626
+ __typename
627
+ node_to_addresses_connection_count: count
628
+ node_to_addresses_connection_entities: entities {
629
+ __typename
630
+ node_address_address: address
631
+ node_address_type: type
632
+ }
633
+ }
634
+ }
635
+ }
636
+ }
637
+ `,
638
+ variables: { entity_id: this.id, first, types },
639
+ constructObject: (json) => {
640
+ const connection = json["entity"]["addresses"];
641
+ return NodeToAddressesConnectionFromJson(connection);
642
+ }
643
+ });
644
+ }
645
+ async getChannels(client, first = void 0, statuses = void 0) {
646
+ return await client.executeRawQuery({
647
+ queryPayload: `
648
+ query FetchLightsparkNodeToChannelsConnection($entity_id: ID!, $first: Int, $statuses: [ChannelStatus!]) {
649
+ entity(id: $entity_id) {
650
+ ... on LightsparkNode {
651
+ channels(, first: $first, statuses: $statuses) {
652
+ __typename
653
+ lightspark_node_to_channels_connection_page_info: page_info {
654
+ __typename
655
+ page_info_has_next_page: has_next_page
656
+ page_info_has_previous_page: has_previous_page
657
+ page_info_start_cursor: start_cursor
658
+ page_info_end_cursor: end_cursor
659
+ }
660
+ lightspark_node_to_channels_connection_count: count
661
+ lightspark_node_to_channels_connection_entities: entities {
662
+ __typename
663
+ channel_id: id
664
+ channel_created_at: created_at
665
+ channel_updated_at: updated_at
666
+ channel_funding_transaction: funding_transaction {
667
+ id
668
+ }
669
+ channel_capacity: capacity {
670
+ __typename
671
+ currency_amount_original_value: original_value
672
+ currency_amount_original_unit: original_unit
673
+ currency_amount_preferred_currency_unit: preferred_currency_unit
674
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
675
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
676
+ }
677
+ channel_local_balance: local_balance {
678
+ __typename
679
+ currency_amount_original_value: original_value
680
+ currency_amount_original_unit: original_unit
681
+ currency_amount_preferred_currency_unit: preferred_currency_unit
682
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
683
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
684
+ }
685
+ channel_local_unsettled_balance: local_unsettled_balance {
686
+ __typename
687
+ currency_amount_original_value: original_value
688
+ currency_amount_original_unit: original_unit
689
+ currency_amount_preferred_currency_unit: preferred_currency_unit
690
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
691
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
692
+ }
693
+ channel_remote_balance: remote_balance {
694
+ __typename
695
+ currency_amount_original_value: original_value
696
+ currency_amount_original_unit: original_unit
697
+ currency_amount_preferred_currency_unit: preferred_currency_unit
698
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
699
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
700
+ }
701
+ channel_remote_unsettled_balance: remote_unsettled_balance {
702
+ __typename
703
+ currency_amount_original_value: original_value
704
+ currency_amount_original_unit: original_unit
705
+ currency_amount_preferred_currency_unit: preferred_currency_unit
706
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
707
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
708
+ }
709
+ channel_unsettled_balance: unsettled_balance {
710
+ __typename
711
+ currency_amount_original_value: original_value
712
+ currency_amount_original_unit: original_unit
713
+ currency_amount_preferred_currency_unit: preferred_currency_unit
714
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
715
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
716
+ }
717
+ channel_total_balance: total_balance {
718
+ __typename
719
+ currency_amount_original_value: original_value
720
+ currency_amount_original_unit: original_unit
721
+ currency_amount_preferred_currency_unit: preferred_currency_unit
722
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
723
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
724
+ }
725
+ channel_status: status
726
+ channel_estimated_force_closure_wait_minutes: estimated_force_closure_wait_minutes
727
+ channel_commit_fee: commit_fee {
728
+ __typename
729
+ currency_amount_original_value: original_value
730
+ currency_amount_original_unit: original_unit
731
+ currency_amount_preferred_currency_unit: preferred_currency_unit
732
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
733
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
734
+ }
735
+ channel_fees: fees {
736
+ __typename
737
+ channel_fees_base_fee: base_fee {
738
+ __typename
739
+ currency_amount_original_value: original_value
740
+ currency_amount_original_unit: original_unit
741
+ currency_amount_preferred_currency_unit: preferred_currency_unit
742
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
743
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
744
+ }
745
+ channel_fees_fee_rate_per_mil: fee_rate_per_mil
746
+ }
747
+ channel_remote_node: remote_node {
748
+ id
749
+ }
750
+ channel_local_node: local_node {
751
+ id
752
+ }
753
+ channel_short_channel_id: short_channel_id
754
+ }
755
+ }
756
+ }
757
+ }
758
+ }
759
+ `,
760
+ variables: { entity_id: this.id, first, statuses },
761
+ constructObject: (json) => {
762
+ const connection = json["entity"]["channels"];
763
+ return LightsparkNodeToChannelsConnectionFromJson(connection);
764
+ }
765
+ });
766
+ }
767
+ static getLightsparkNodeQuery(id) {
768
+ return {
769
+ queryPayload: `
770
+ query GetLightsparkNode($id: ID!) {
771
+ entity(id: $id) {
772
+ ... on LightsparkNode {
773
+ ...LightsparkNodeFragment
774
+ }
775
+ }
776
+ }
777
+
778
+ ${FRAGMENT6}
779
+ `,
780
+ variables: { id },
781
+ constructObject: (data) => LightsparkNodeFromJson(data.entity)
782
+ };
783
+ }
784
+ };
785
+ var LightsparkNodeFromJson = (obj) => {
786
+ return new LightsparkNode(
787
+ obj["lightspark_node_id"],
788
+ obj["lightspark_node_created_at"],
789
+ obj["lightspark_node_updated_at"],
790
+ BitcoinNetwork_default[obj["lightspark_node_bitcoin_network"]] ?? BitcoinNetwork_default.FUTURE_VALUE,
791
+ obj["lightspark_node_display_name"],
792
+ obj["lightspark_node_account"].id,
793
+ "LightsparkNode",
794
+ obj["lightspark_node_alias"],
795
+ obj["lightspark_node_color"],
796
+ obj["lightspark_node_conductivity"],
797
+ obj["lightspark_node_public_key"],
798
+ !!obj["lightspark_node_blockchain_balance"] ? BlockchainBalanceFromJson(obj["lightspark_node_blockchain_balance"]) : void 0,
799
+ !!obj["lightspark_node_encrypted_signing_private_key"] ? SecretFromJson(obj["lightspark_node_encrypted_signing_private_key"]) : void 0,
800
+ !!obj["lightspark_node_total_balance"] ? CurrencyAmountFromJson(obj["lightspark_node_total_balance"]) : void 0,
801
+ !!obj["lightspark_node_total_local_balance"] ? CurrencyAmountFromJson(obj["lightspark_node_total_local_balance"]) : void 0,
802
+ !!obj["lightspark_node_local_balance"] ? CurrencyAmountFromJson(obj["lightspark_node_local_balance"]) : void 0,
803
+ !!obj["lightspark_node_purpose"] ? LightsparkNodePurpose_default[obj["lightspark_node_purpose"]] ?? LightsparkNodePurpose_default.FUTURE_VALUE : null,
804
+ !!obj["lightspark_node_remote_balance"] ? CurrencyAmountFromJson(obj["lightspark_node_remote_balance"]) : void 0,
805
+ !!obj["lightspark_node_status"] ? LightsparkNodeStatus_default[obj["lightspark_node_status"]] ?? LightsparkNodeStatus_default.FUTURE_VALUE : null
806
+ );
807
+ };
808
+ var FRAGMENT6 = `
809
+ fragment LightsparkNodeFragment on LightsparkNode {
810
+ __typename
811
+ lightspark_node_id: id
812
+ lightspark_node_created_at: created_at
813
+ lightspark_node_updated_at: updated_at
814
+ lightspark_node_alias: alias
815
+ lightspark_node_bitcoin_network: bitcoin_network
816
+ lightspark_node_color: color
817
+ lightspark_node_conductivity: conductivity
818
+ lightspark_node_display_name: display_name
819
+ lightspark_node_public_key: public_key
820
+ lightspark_node_account: account {
821
+ id
822
+ }
823
+ lightspark_node_blockchain_balance: blockchain_balance {
824
+ __typename
825
+ blockchain_balance_total_balance: total_balance {
826
+ __typename
827
+ currency_amount_original_value: original_value
828
+ currency_amount_original_unit: original_unit
829
+ currency_amount_preferred_currency_unit: preferred_currency_unit
830
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
831
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
832
+ }
833
+ blockchain_balance_confirmed_balance: confirmed_balance {
834
+ __typename
835
+ currency_amount_original_value: original_value
836
+ currency_amount_original_unit: original_unit
837
+ currency_amount_preferred_currency_unit: preferred_currency_unit
838
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
839
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
840
+ }
841
+ blockchain_balance_unconfirmed_balance: unconfirmed_balance {
842
+ __typename
843
+ currency_amount_original_value: original_value
844
+ currency_amount_original_unit: original_unit
845
+ currency_amount_preferred_currency_unit: preferred_currency_unit
846
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
847
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
848
+ }
849
+ blockchain_balance_locked_balance: locked_balance {
850
+ __typename
851
+ currency_amount_original_value: original_value
852
+ currency_amount_original_unit: original_unit
853
+ currency_amount_preferred_currency_unit: preferred_currency_unit
854
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
855
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
856
+ }
857
+ blockchain_balance_required_reserve: required_reserve {
858
+ __typename
859
+ currency_amount_original_value: original_value
860
+ currency_amount_original_unit: original_unit
861
+ currency_amount_preferred_currency_unit: preferred_currency_unit
862
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
863
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
864
+ }
865
+ blockchain_balance_available_balance: available_balance {
866
+ __typename
867
+ currency_amount_original_value: original_value
868
+ currency_amount_original_unit: original_unit
869
+ currency_amount_preferred_currency_unit: preferred_currency_unit
870
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
871
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
872
+ }
873
+ }
874
+ lightspark_node_encrypted_signing_private_key: encrypted_signing_private_key {
875
+ __typename
876
+ secret_encrypted_value: encrypted_value
877
+ secret_cipher: cipher
878
+ }
879
+ lightspark_node_total_balance: total_balance {
880
+ __typename
881
+ currency_amount_original_value: original_value
882
+ currency_amount_original_unit: original_unit
883
+ currency_amount_preferred_currency_unit: preferred_currency_unit
884
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
885
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
886
+ }
887
+ lightspark_node_total_local_balance: total_local_balance {
888
+ __typename
889
+ currency_amount_original_value: original_value
890
+ currency_amount_original_unit: original_unit
891
+ currency_amount_preferred_currency_unit: preferred_currency_unit
892
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
893
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
894
+ }
895
+ lightspark_node_local_balance: local_balance {
896
+ __typename
897
+ currency_amount_original_value: original_value
898
+ currency_amount_original_unit: original_unit
899
+ currency_amount_preferred_currency_unit: preferred_currency_unit
900
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
901
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
902
+ }
903
+ lightspark_node_purpose: purpose
904
+ lightspark_node_remote_balance: remote_balance {
905
+ __typename
906
+ currency_amount_original_value: original_value
907
+ currency_amount_original_unit: original_unit
908
+ currency_amount_preferred_currency_unit: preferred_currency_unit
909
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
910
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
911
+ }
912
+ lightspark_node_status: status
913
+ }`;
914
+ var LightsparkNode_default = LightsparkNode;
915
+
916
+ // src/objects/Node.ts
917
+ import { LightsparkException } from "@lightsparkdev/core";
918
+ import autoBind4 from "auto-bind";
919
+ var Node = class {
920
+ constructor(id, createdAt, updatedAt, bitcoinNetwork, displayName, typename, alias, color, conductivity, publicKey) {
921
+ this.id = id;
922
+ this.createdAt = createdAt;
923
+ this.updatedAt = updatedAt;
924
+ this.bitcoinNetwork = bitcoinNetwork;
925
+ this.displayName = displayName;
926
+ this.typename = typename;
927
+ this.alias = alias;
928
+ this.color = color;
929
+ this.conductivity = conductivity;
930
+ this.publicKey = publicKey;
931
+ autoBind4(this);
932
+ }
933
+ async getAddresses(client, first = void 0, types = void 0) {
934
+ return await client.executeRawQuery({
935
+ queryPayload: `
936
+ query FetchNodeToAddressesConnection($entity_id: ID!, $first: Int, $types: [NodeAddressType!]) {
937
+ entity(id: $entity_id) {
938
+ ... on Node {
939
+ addresses(, first: $first, types: $types) {
940
+ __typename
941
+ node_to_addresses_connection_count: count
942
+ node_to_addresses_connection_entities: entities {
943
+ __typename
944
+ node_address_address: address
945
+ node_address_type: type
946
+ }
947
+ }
948
+ }
949
+ }
950
+ }
951
+ `,
952
+ variables: { entity_id: this.id, first, types },
953
+ constructObject: (json) => {
954
+ const connection = json["entity"]["addresses"];
955
+ return NodeToAddressesConnectionFromJson(connection);
956
+ }
957
+ });
958
+ }
959
+ static getNodeQuery(id) {
960
+ return {
961
+ queryPayload: `
962
+ query GetNode($id: ID!) {
963
+ entity(id: $id) {
964
+ ... on Node {
965
+ ...NodeFragment
966
+ }
967
+ }
968
+ }
969
+
970
+ ${FRAGMENT7}
971
+ `,
972
+ variables: { id },
973
+ constructObject: (data) => NodeFromJson(data.entity)
974
+ };
975
+ }
976
+ };
977
+ var NodeFromJson = (obj) => {
978
+ if (obj["__typename"] == "GraphNode") {
979
+ return new GraphNode_default(
980
+ obj["graph_node_id"],
981
+ obj["graph_node_created_at"],
982
+ obj["graph_node_updated_at"],
983
+ BitcoinNetwork_default[obj["graph_node_bitcoin_network"]] ?? BitcoinNetwork_default.FUTURE_VALUE,
984
+ obj["graph_node_display_name"],
985
+ "GraphNode",
986
+ obj["graph_node_alias"],
987
+ obj["graph_node_color"],
988
+ obj["graph_node_conductivity"],
989
+ obj["graph_node_public_key"]
990
+ );
991
+ }
992
+ if (obj["__typename"] == "LightsparkNode") {
993
+ return new LightsparkNode_default(
994
+ obj["lightspark_node_id"],
995
+ obj["lightspark_node_created_at"],
996
+ obj["lightspark_node_updated_at"],
997
+ BitcoinNetwork_default[obj["lightspark_node_bitcoin_network"]] ?? BitcoinNetwork_default.FUTURE_VALUE,
998
+ obj["lightspark_node_display_name"],
999
+ obj["lightspark_node_account"].id,
1000
+ "LightsparkNode",
1001
+ obj["lightspark_node_alias"],
1002
+ obj["lightspark_node_color"],
1003
+ obj["lightspark_node_conductivity"],
1004
+ obj["lightspark_node_public_key"],
1005
+ !!obj["lightspark_node_blockchain_balance"] ? BlockchainBalanceFromJson(obj["lightspark_node_blockchain_balance"]) : void 0,
1006
+ !!obj["lightspark_node_encrypted_signing_private_key"] ? SecretFromJson(obj["lightspark_node_encrypted_signing_private_key"]) : void 0,
1007
+ !!obj["lightspark_node_total_balance"] ? CurrencyAmountFromJson(obj["lightspark_node_total_balance"]) : void 0,
1008
+ !!obj["lightspark_node_total_local_balance"] ? CurrencyAmountFromJson(obj["lightspark_node_total_local_balance"]) : void 0,
1009
+ !!obj["lightspark_node_local_balance"] ? CurrencyAmountFromJson(obj["lightspark_node_local_balance"]) : void 0,
1010
+ !!obj["lightspark_node_purpose"] ? LightsparkNodePurpose_default[obj["lightspark_node_purpose"]] ?? LightsparkNodePurpose_default.FUTURE_VALUE : null,
1011
+ !!obj["lightspark_node_remote_balance"] ? CurrencyAmountFromJson(obj["lightspark_node_remote_balance"]) : void 0,
1012
+ !!obj["lightspark_node_status"] ? LightsparkNodeStatus_default[obj["lightspark_node_status"]] ?? LightsparkNodeStatus_default.FUTURE_VALUE : null
1013
+ );
1014
+ }
1015
+ throw new LightsparkException(
1016
+ "DeserializationError",
1017
+ `Couldn't find a concrete type for interface Node corresponding to the typename=${obj["__typename"]}`
1018
+ );
1019
+ };
1020
+ var FRAGMENT7 = `
1021
+ fragment NodeFragment on Node {
1022
+ __typename
1023
+ ... on GraphNode {
1024
+ __typename
1025
+ graph_node_id: id
1026
+ graph_node_created_at: created_at
1027
+ graph_node_updated_at: updated_at
1028
+ graph_node_alias: alias
1029
+ graph_node_bitcoin_network: bitcoin_network
1030
+ graph_node_color: color
1031
+ graph_node_conductivity: conductivity
1032
+ graph_node_display_name: display_name
1033
+ graph_node_public_key: public_key
1034
+ }
1035
+ ... on LightsparkNode {
1036
+ __typename
1037
+ lightspark_node_id: id
1038
+ lightspark_node_created_at: created_at
1039
+ lightspark_node_updated_at: updated_at
1040
+ lightspark_node_alias: alias
1041
+ lightspark_node_bitcoin_network: bitcoin_network
1042
+ lightspark_node_color: color
1043
+ lightspark_node_conductivity: conductivity
1044
+ lightspark_node_display_name: display_name
1045
+ lightspark_node_public_key: public_key
1046
+ lightspark_node_account: account {
1047
+ id
1048
+ }
1049
+ lightspark_node_blockchain_balance: blockchain_balance {
1050
+ __typename
1051
+ blockchain_balance_total_balance: total_balance {
1052
+ __typename
1053
+ currency_amount_original_value: original_value
1054
+ currency_amount_original_unit: original_unit
1055
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1056
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1057
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1058
+ }
1059
+ blockchain_balance_confirmed_balance: confirmed_balance {
1060
+ __typename
1061
+ currency_amount_original_value: original_value
1062
+ currency_amount_original_unit: original_unit
1063
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1064
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1065
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1066
+ }
1067
+ blockchain_balance_unconfirmed_balance: unconfirmed_balance {
1068
+ __typename
1069
+ currency_amount_original_value: original_value
1070
+ currency_amount_original_unit: original_unit
1071
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1072
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1073
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1074
+ }
1075
+ blockchain_balance_locked_balance: locked_balance {
1076
+ __typename
1077
+ currency_amount_original_value: original_value
1078
+ currency_amount_original_unit: original_unit
1079
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1080
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1081
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1082
+ }
1083
+ blockchain_balance_required_reserve: required_reserve {
1084
+ __typename
1085
+ currency_amount_original_value: original_value
1086
+ currency_amount_original_unit: original_unit
1087
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1088
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1089
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1090
+ }
1091
+ blockchain_balance_available_balance: available_balance {
1092
+ __typename
1093
+ currency_amount_original_value: original_value
1094
+ currency_amount_original_unit: original_unit
1095
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1096
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1097
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1098
+ }
1099
+ }
1100
+ lightspark_node_encrypted_signing_private_key: encrypted_signing_private_key {
1101
+ __typename
1102
+ secret_encrypted_value: encrypted_value
1103
+ secret_cipher: cipher
1104
+ }
1105
+ lightspark_node_total_balance: total_balance {
1106
+ __typename
1107
+ currency_amount_original_value: original_value
1108
+ currency_amount_original_unit: original_unit
1109
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1110
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1111
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1112
+ }
1113
+ lightspark_node_total_local_balance: total_local_balance {
1114
+ __typename
1115
+ currency_amount_original_value: original_value
1116
+ currency_amount_original_unit: original_unit
1117
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1118
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1119
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1120
+ }
1121
+ lightspark_node_local_balance: local_balance {
1122
+ __typename
1123
+ currency_amount_original_value: original_value
1124
+ currency_amount_original_unit: original_unit
1125
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1126
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1127
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1128
+ }
1129
+ lightspark_node_purpose: purpose
1130
+ lightspark_node_remote_balance: remote_balance {
1131
+ __typename
1132
+ currency_amount_original_value: original_value
1133
+ currency_amount_original_unit: original_unit
1134
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1135
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1136
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1137
+ }
1138
+ lightspark_node_status: status
1139
+ }
1140
+ }`;
1141
+ var Node_default = Node;
1142
+
1143
+ // src/objects/InvoiceData.ts
1144
+ var InvoiceDataFromJson = (obj) => {
1145
+ return {
1146
+ encodedPaymentRequest: obj["invoice_data_encoded_payment_request"],
1147
+ bitcoinNetwork: BitcoinNetwork_default[obj["invoice_data_bitcoin_network"]] ?? BitcoinNetwork_default.FUTURE_VALUE,
1148
+ paymentHash: obj["invoice_data_payment_hash"],
1149
+ amount: CurrencyAmountFromJson(obj["invoice_data_amount"]),
1150
+ createdAt: obj["invoice_data_created_at"],
1151
+ expiresAt: obj["invoice_data_expires_at"],
1152
+ destination: NodeFromJson(obj["invoice_data_destination"]),
1153
+ typename: "InvoiceData",
1154
+ memo: obj["invoice_data_memo"]
1155
+ };
1156
+ };
1157
+ var FRAGMENT8 = `
1158
+ fragment InvoiceDataFragment on InvoiceData {
1159
+ __typename
1160
+ invoice_data_encoded_payment_request: encoded_payment_request
1161
+ invoice_data_bitcoin_network: bitcoin_network
1162
+ invoice_data_payment_hash: payment_hash
1163
+ invoice_data_amount: amount {
1164
+ __typename
1165
+ currency_amount_original_value: original_value
1166
+ currency_amount_original_unit: original_unit
1167
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1168
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1169
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1170
+ }
1171
+ invoice_data_created_at: created_at
1172
+ invoice_data_expires_at: expires_at
1173
+ invoice_data_destination: destination {
1174
+ __typename
1175
+ ... on GraphNode {
1176
+ __typename
1177
+ graph_node_id: id
1178
+ graph_node_created_at: created_at
1179
+ graph_node_updated_at: updated_at
1180
+ graph_node_alias: alias
1181
+ graph_node_bitcoin_network: bitcoin_network
1182
+ graph_node_color: color
1183
+ graph_node_conductivity: conductivity
1184
+ graph_node_display_name: display_name
1185
+ graph_node_public_key: public_key
1186
+ }
1187
+ ... on LightsparkNode {
1188
+ __typename
1189
+ lightspark_node_id: id
1190
+ lightspark_node_created_at: created_at
1191
+ lightspark_node_updated_at: updated_at
1192
+ lightspark_node_alias: alias
1193
+ lightspark_node_bitcoin_network: bitcoin_network
1194
+ lightspark_node_color: color
1195
+ lightspark_node_conductivity: conductivity
1196
+ lightspark_node_display_name: display_name
1197
+ lightspark_node_public_key: public_key
1198
+ lightspark_node_account: account {
1199
+ id
1200
+ }
1201
+ lightspark_node_blockchain_balance: blockchain_balance {
1202
+ __typename
1203
+ blockchain_balance_total_balance: total_balance {
1204
+ __typename
1205
+ currency_amount_original_value: original_value
1206
+ currency_amount_original_unit: original_unit
1207
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1208
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1209
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1210
+ }
1211
+ blockchain_balance_confirmed_balance: confirmed_balance {
1212
+ __typename
1213
+ currency_amount_original_value: original_value
1214
+ currency_amount_original_unit: original_unit
1215
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1216
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1217
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1218
+ }
1219
+ blockchain_balance_unconfirmed_balance: unconfirmed_balance {
1220
+ __typename
1221
+ currency_amount_original_value: original_value
1222
+ currency_amount_original_unit: original_unit
1223
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1224
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1225
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1226
+ }
1227
+ blockchain_balance_locked_balance: locked_balance {
1228
+ __typename
1229
+ currency_amount_original_value: original_value
1230
+ currency_amount_original_unit: original_unit
1231
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1232
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1233
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1234
+ }
1235
+ blockchain_balance_required_reserve: required_reserve {
1236
+ __typename
1237
+ currency_amount_original_value: original_value
1238
+ currency_amount_original_unit: original_unit
1239
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1240
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1241
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1242
+ }
1243
+ blockchain_balance_available_balance: available_balance {
1244
+ __typename
1245
+ currency_amount_original_value: original_value
1246
+ currency_amount_original_unit: original_unit
1247
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1248
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1249
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1250
+ }
1251
+ }
1252
+ lightspark_node_encrypted_signing_private_key: encrypted_signing_private_key {
1253
+ __typename
1254
+ secret_encrypted_value: encrypted_value
1255
+ secret_cipher: cipher
1256
+ }
1257
+ lightspark_node_total_balance: total_balance {
1258
+ __typename
1259
+ currency_amount_original_value: original_value
1260
+ currency_amount_original_unit: original_unit
1261
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1262
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1263
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1264
+ }
1265
+ lightspark_node_total_local_balance: total_local_balance {
1266
+ __typename
1267
+ currency_amount_original_value: original_value
1268
+ currency_amount_original_unit: original_unit
1269
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1270
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1271
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1272
+ }
1273
+ lightspark_node_local_balance: local_balance {
1274
+ __typename
1275
+ currency_amount_original_value: original_value
1276
+ currency_amount_original_unit: original_unit
1277
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1278
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1279
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1280
+ }
1281
+ lightspark_node_purpose: purpose
1282
+ lightspark_node_remote_balance: remote_balance {
1283
+ __typename
1284
+ currency_amount_original_value: original_value
1285
+ currency_amount_original_unit: original_unit
1286
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1287
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1288
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1289
+ }
1290
+ lightspark_node_status: status
1291
+ }
1292
+ }
1293
+ invoice_data_memo: memo
1294
+ }`;
1295
+
1296
+ // src/objects/LightningFeeEstimateOutput.ts
1297
+ var FRAGMENT9 = `
1298
+ fragment LightningFeeEstimateOutputFragment on LightningFeeEstimateOutput {
1299
+ __typename
1300
+ lightning_fee_estimate_output_fee_estimate: fee_estimate {
1301
+ __typename
1302
+ currency_amount_original_value: original_value
1303
+ currency_amount_original_unit: original_unit
1304
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1305
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1306
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1307
+ }
1308
+ }`;
1309
+
1310
+ // src/objects/HtlcAttemptFailureCode.ts
1311
+ var HtlcAttemptFailureCode = /* @__PURE__ */ ((HtlcAttemptFailureCode2) => {
1312
+ HtlcAttemptFailureCode2["FUTURE_VALUE"] = "FUTURE_VALUE";
1313
+ HtlcAttemptFailureCode2["INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS"] = "INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS";
1314
+ HtlcAttemptFailureCode2["INCORRECT_PAYMENT_AMOUNT"] = "INCORRECT_PAYMENT_AMOUNT";
1315
+ HtlcAttemptFailureCode2["FINAL_INCORRECT_CLTV_EXPIRY"] = "FINAL_INCORRECT_CLTV_EXPIRY";
1316
+ HtlcAttemptFailureCode2["FINAL_INCORRECT_HTLC_AMOUNT"] = "FINAL_INCORRECT_HTLC_AMOUNT";
1317
+ HtlcAttemptFailureCode2["FINAL_EXPIRY_TOO_SOON"] = "FINAL_EXPIRY_TOO_SOON";
1318
+ HtlcAttemptFailureCode2["INVALID_REALM"] = "INVALID_REALM";
1319
+ HtlcAttemptFailureCode2["EXPIRY_TOO_SOON"] = "EXPIRY_TOO_SOON";
1320
+ HtlcAttemptFailureCode2["INVALID_ONION_VERSION"] = "INVALID_ONION_VERSION";
1321
+ HtlcAttemptFailureCode2["INVALID_ONION_HMAC"] = "INVALID_ONION_HMAC";
1322
+ HtlcAttemptFailureCode2["INVALID_ONION_KEY"] = "INVALID_ONION_KEY";
1323
+ HtlcAttemptFailureCode2["AMOUNT_BELOW_MINIMUM"] = "AMOUNT_BELOW_MINIMUM";
1324
+ HtlcAttemptFailureCode2["FEE_INSUFFICIENT"] = "FEE_INSUFFICIENT";
1325
+ HtlcAttemptFailureCode2["INCORRECT_CLTV_EXPIRY"] = "INCORRECT_CLTV_EXPIRY";
1326
+ HtlcAttemptFailureCode2["CHANNEL_DISABLED"] = "CHANNEL_DISABLED";
1327
+ HtlcAttemptFailureCode2["TEMPORARY_CHANNEL_FAILURE"] = "TEMPORARY_CHANNEL_FAILURE";
1328
+ HtlcAttemptFailureCode2["REQUIRED_NODE_FEATURE_MISSING"] = "REQUIRED_NODE_FEATURE_MISSING";
1329
+ HtlcAttemptFailureCode2["REQUIRED_CHANNEL_FEATURE_MISSING"] = "REQUIRED_CHANNEL_FEATURE_MISSING";
1330
+ HtlcAttemptFailureCode2["UNKNOWN_NEXT_PEER"] = "UNKNOWN_NEXT_PEER";
1331
+ HtlcAttemptFailureCode2["TEMPORARY_NODE_FAILURE"] = "TEMPORARY_NODE_FAILURE";
1332
+ HtlcAttemptFailureCode2["PERMANENT_NODE_FAILURE"] = "PERMANENT_NODE_FAILURE";
1333
+ HtlcAttemptFailureCode2["PERMANENT_CHANNEL_FAILURE"] = "PERMANENT_CHANNEL_FAILURE";
1334
+ HtlcAttemptFailureCode2["EXPIRY_TOO_FAR"] = "EXPIRY_TOO_FAR";
1335
+ HtlcAttemptFailureCode2["MPP_TIMEOUT"] = "MPP_TIMEOUT";
1336
+ HtlcAttemptFailureCode2["INVALID_ONION_PAYLOAD"] = "INVALID_ONION_PAYLOAD";
1337
+ HtlcAttemptFailureCode2["INTERNAL_FAILURE"] = "INTERNAL_FAILURE";
1338
+ HtlcAttemptFailureCode2["UNKNOWN_FAILURE"] = "UNKNOWN_FAILURE";
1339
+ HtlcAttemptFailureCode2["UNREADABLE_FAILURE"] = "UNREADABLE_FAILURE";
1340
+ return HtlcAttemptFailureCode2;
1341
+ })(HtlcAttemptFailureCode || {});
1342
+ var HtlcAttemptFailureCode_default = HtlcAttemptFailureCode;
1343
+
1344
+ // src/objects/OutgoingPaymentAttemptStatus.ts
1345
+ var OutgoingPaymentAttemptStatus = /* @__PURE__ */ ((OutgoingPaymentAttemptStatus2) => {
1346
+ OutgoingPaymentAttemptStatus2["FUTURE_VALUE"] = "FUTURE_VALUE";
1347
+ OutgoingPaymentAttemptStatus2["IN_FLIGHT"] = "IN_FLIGHT";
1348
+ OutgoingPaymentAttemptStatus2["SUCCEEDED"] = "SUCCEEDED";
1349
+ OutgoingPaymentAttemptStatus2["FAILED"] = "FAILED";
1350
+ return OutgoingPaymentAttemptStatus2;
1351
+ })(OutgoingPaymentAttemptStatus || {});
1352
+ var OutgoingPaymentAttemptStatus_default = OutgoingPaymentAttemptStatus;
1353
+
1354
+ // src/objects/Hop.ts
1355
+ var HopFromJson = (obj) => {
1356
+ return {
1357
+ id: obj["hop_id"],
1358
+ createdAt: obj["hop_created_at"],
1359
+ updatedAt: obj["hop_updated_at"],
1360
+ index: obj["hop_index"],
1361
+ typename: "Hop",
1362
+ destinationId: obj["hop_destination"]?.id ?? void 0,
1363
+ publicKey: obj["hop_public_key"],
1364
+ amountToForward: !!obj["hop_amount_to_forward"] ? CurrencyAmountFromJson(obj["hop_amount_to_forward"]) : void 0,
1365
+ fee: !!obj["hop_fee"] ? CurrencyAmountFromJson(obj["hop_fee"]) : void 0,
1366
+ expiryBlockHeight: obj["hop_expiry_block_height"]
1367
+ };
1368
+ };
1369
+ var FRAGMENT10 = `
1370
+ fragment HopFragment on Hop {
1371
+ __typename
1372
+ hop_id: id
1373
+ hop_created_at: created_at
1374
+ hop_updated_at: updated_at
1375
+ hop_destination: destination {
1376
+ id
1377
+ }
1378
+ hop_index: index
1379
+ hop_public_key: public_key
1380
+ hop_amount_to_forward: amount_to_forward {
1381
+ __typename
1382
+ currency_amount_original_value: original_value
1383
+ currency_amount_original_unit: original_unit
1384
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1385
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1386
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1387
+ }
1388
+ hop_fee: fee {
1389
+ __typename
1390
+ currency_amount_original_value: original_value
1391
+ currency_amount_original_unit: original_unit
1392
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1393
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1394
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1395
+ }
1396
+ hop_expiry_block_height: expiry_block_height
1397
+ }`;
1398
+ var getHopQuery = (id) => {
1399
+ return {
1400
+ queryPayload: `
1401
+ query GetHop($id: ID!) {
1402
+ entity(id: $id) {
1403
+ ... on Hop {
1404
+ ...HopFragment
1405
+ }
1406
+ }
1407
+ }
1408
+
1409
+ ${FRAGMENT10}
1410
+ `,
1411
+ variables: { id },
1412
+ constructObject: (data) => HopFromJson(data.entity)
1413
+ };
1414
+ };
1415
+
1416
+ // src/objects/OutgoingPaymentAttemptToHopsConnection.ts
1417
+ var OutgoingPaymentAttemptToHopsConnectionFromJson = (obj) => {
1418
+ return {
1419
+ count: obj["outgoing_payment_attempt_to_hops_connection_count"],
1420
+ entities: obj["outgoing_payment_attempt_to_hops_connection_entities"].map(
1421
+ (e) => HopFromJson(e)
1422
+ )
1423
+ };
1424
+ };
1425
+
1426
+ // src/objects/OutgoingPaymentAttempt.ts
1427
+ import autoBind5 from "auto-bind";
1428
+ var OutgoingPaymentAttempt = class {
1429
+ constructor(id, createdAt, updatedAt, status, outgoingPaymentId, typename, failureCode, failureSourceIndex, resolvedAt, amount, fees) {
1430
+ this.id = id;
1431
+ this.createdAt = createdAt;
1432
+ this.updatedAt = updatedAt;
1433
+ this.status = status;
1434
+ this.outgoingPaymentId = outgoingPaymentId;
1435
+ this.typename = typename;
1436
+ this.failureCode = failureCode;
1437
+ this.failureSourceIndex = failureSourceIndex;
1438
+ this.resolvedAt = resolvedAt;
1439
+ this.amount = amount;
1440
+ this.fees = fees;
1441
+ autoBind5(this);
1442
+ }
1443
+ async getHops(client, first = void 0) {
1444
+ return await client.executeRawQuery({
1445
+ queryPayload: `
1446
+ query FetchOutgoingPaymentAttemptToHopsConnection($entity_id: ID!, $first: Int) {
1447
+ entity(id: $entity_id) {
1448
+ ... on OutgoingPaymentAttempt {
1449
+ hops(, first: $first) {
1450
+ __typename
1451
+ outgoing_payment_attempt_to_hops_connection_count: count
1452
+ outgoing_payment_attempt_to_hops_connection_entities: entities {
1453
+ __typename
1454
+ hop_id: id
1455
+ hop_created_at: created_at
1456
+ hop_updated_at: updated_at
1457
+ hop_destination: destination {
1458
+ id
1459
+ }
1460
+ hop_index: index
1461
+ hop_public_key: public_key
1462
+ hop_amount_to_forward: amount_to_forward {
1463
+ __typename
1464
+ currency_amount_original_value: original_value
1465
+ currency_amount_original_unit: original_unit
1466
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1467
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1468
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1469
+ }
1470
+ hop_fee: fee {
1471
+ __typename
1472
+ currency_amount_original_value: original_value
1473
+ currency_amount_original_unit: original_unit
1474
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1475
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1476
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1477
+ }
1478
+ hop_expiry_block_height: expiry_block_height
1479
+ }
1480
+ }
1481
+ }
1482
+ }
1483
+ }
1484
+ `,
1485
+ variables: { entity_id: this.id, first },
1486
+ constructObject: (json) => {
1487
+ const connection = json["entity"]["hops"];
1488
+ return OutgoingPaymentAttemptToHopsConnectionFromJson(connection);
1489
+ }
1490
+ });
1491
+ }
1492
+ static getOutgoingPaymentAttemptQuery(id) {
1493
+ return {
1494
+ queryPayload: `
1495
+ query GetOutgoingPaymentAttempt($id: ID!) {
1496
+ entity(id: $id) {
1497
+ ... on OutgoingPaymentAttempt {
1498
+ ...OutgoingPaymentAttemptFragment
1499
+ }
1500
+ }
1501
+ }
1502
+
1503
+ ${FRAGMENT11}
1504
+ `,
1505
+ variables: { id },
1506
+ constructObject: (data) => OutgoingPaymentAttemptFromJson(data.entity)
1507
+ };
1508
+ }
1509
+ };
1510
+ var OutgoingPaymentAttemptFromJson = (obj) => {
1511
+ return new OutgoingPaymentAttempt(
1512
+ obj["outgoing_payment_attempt_id"],
1513
+ obj["outgoing_payment_attempt_created_at"],
1514
+ obj["outgoing_payment_attempt_updated_at"],
1515
+ OutgoingPaymentAttemptStatus_default[obj["outgoing_payment_attempt_status"]] ?? OutgoingPaymentAttemptStatus_default.FUTURE_VALUE,
1516
+ obj["outgoing_payment_attempt_outgoing_payment"].id,
1517
+ "OutgoingPaymentAttempt",
1518
+ !!obj["outgoing_payment_attempt_failure_code"] ? HtlcAttemptFailureCode_default[obj["outgoing_payment_attempt_failure_code"]] ?? HtlcAttemptFailureCode_default.FUTURE_VALUE : null,
1519
+ obj["outgoing_payment_attempt_failure_source_index"],
1520
+ obj["outgoing_payment_attempt_resolved_at"],
1521
+ !!obj["outgoing_payment_attempt_amount"] ? CurrencyAmountFromJson(obj["outgoing_payment_attempt_amount"]) : void 0,
1522
+ !!obj["outgoing_payment_attempt_fees"] ? CurrencyAmountFromJson(obj["outgoing_payment_attempt_fees"]) : void 0
1523
+ );
1524
+ };
1525
+ var FRAGMENT11 = `
1526
+ fragment OutgoingPaymentAttemptFragment on OutgoingPaymentAttempt {
1527
+ __typename
1528
+ outgoing_payment_attempt_id: id
1529
+ outgoing_payment_attempt_created_at: created_at
1530
+ outgoing_payment_attempt_updated_at: updated_at
1531
+ outgoing_payment_attempt_status: status
1532
+ outgoing_payment_attempt_failure_code: failure_code
1533
+ outgoing_payment_attempt_failure_source_index: failure_source_index
1534
+ outgoing_payment_attempt_resolved_at: resolved_at
1535
+ outgoing_payment_attempt_amount: amount {
1536
+ __typename
1537
+ currency_amount_original_value: original_value
1538
+ currency_amount_original_unit: original_unit
1539
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1540
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1541
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1542
+ }
1543
+ outgoing_payment_attempt_fees: fees {
1544
+ __typename
1545
+ currency_amount_original_value: original_value
1546
+ currency_amount_original_unit: original_unit
1547
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1548
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1549
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1550
+ }
1551
+ outgoing_payment_attempt_outgoing_payment: outgoing_payment {
1552
+ id
1553
+ }
1554
+ }`;
1555
+ var OutgoingPaymentAttempt_default = OutgoingPaymentAttempt;
1556
+
1557
+ // src/objects/OutgoingPaymentToAttemptsConnection.ts
1558
+ var OutgoingPaymentToAttemptsConnectionFromJson = (obj) => {
1559
+ return {
1560
+ count: obj["outgoing_payment_to_attempts_connection_count"],
1561
+ entities: obj["outgoing_payment_to_attempts_connection_entities"].map(
1562
+ (e) => OutgoingPaymentAttemptFromJson(e)
1563
+ )
1564
+ };
1565
+ };
1566
+
1567
+ // src/objects/PaymentFailureReason.ts
1568
+ var PaymentFailureReason = /* @__PURE__ */ ((PaymentFailureReason2) => {
1569
+ PaymentFailureReason2["FUTURE_VALUE"] = "FUTURE_VALUE";
1570
+ PaymentFailureReason2["NONE"] = "NONE";
1571
+ PaymentFailureReason2["TIMEOUT"] = "TIMEOUT";
1572
+ PaymentFailureReason2["NO_ROUTE"] = "NO_ROUTE";
1573
+ PaymentFailureReason2["ERROR"] = "ERROR";
1574
+ PaymentFailureReason2["INCORRECT_PAYMENT_DETAILS"] = "INCORRECT_PAYMENT_DETAILS";
1575
+ PaymentFailureReason2["INSUFFICIENT_BALANCE"] = "INSUFFICIENT_BALANCE";
1576
+ PaymentFailureReason2["INVOICE_ALREADY_PAID"] = "INVOICE_ALREADY_PAID";
1577
+ PaymentFailureReason2["SELF_PAYMENT"] = "SELF_PAYMENT";
1578
+ PaymentFailureReason2["INVOICE_EXPIRED"] = "INVOICE_EXPIRED";
1579
+ return PaymentFailureReason2;
1580
+ })(PaymentFailureReason || {});
1581
+ var PaymentFailureReason_default = PaymentFailureReason;
1582
+
1583
+ // src/objects/PaymentRequestData.ts
1584
+ import { LightsparkException as LightsparkException2 } from "@lightsparkdev/core";
1585
+ var PaymentRequestDataFromJson = (obj) => {
1586
+ if (obj["__typename"] == "InvoiceData") {
1587
+ return {
1588
+ encodedPaymentRequest: obj["invoice_data_encoded_payment_request"],
1589
+ bitcoinNetwork: BitcoinNetwork_default[obj["invoice_data_bitcoin_network"]] ?? BitcoinNetwork_default.FUTURE_VALUE,
1590
+ paymentHash: obj["invoice_data_payment_hash"],
1591
+ amount: CurrencyAmountFromJson(obj["invoice_data_amount"]),
1592
+ createdAt: obj["invoice_data_created_at"],
1593
+ expiresAt: obj["invoice_data_expires_at"],
1594
+ destination: NodeFromJson(obj["invoice_data_destination"]),
1595
+ typename: "InvoiceData",
1596
+ memo: obj["invoice_data_memo"]
1597
+ };
1598
+ }
1599
+ throw new LightsparkException2(
1600
+ "DeserializationError",
1601
+ `Couldn't find a concrete type for interface PaymentRequestData corresponding to the typename=${obj["__typename"]}`
1602
+ );
1603
+ };
1604
+
1605
+ // src/objects/RichText.ts
1606
+ var RichTextFromJson = (obj) => {
1607
+ return {
1608
+ text: obj["rich_text_text"]
1609
+ };
1610
+ };
1611
+
1612
+ // src/objects/TransactionStatus.ts
1613
+ var TransactionStatus = /* @__PURE__ */ ((TransactionStatus2) => {
1614
+ TransactionStatus2["FUTURE_VALUE"] = "FUTURE_VALUE";
1615
+ TransactionStatus2["SUCCESS"] = "SUCCESS";
1616
+ TransactionStatus2["FAILED"] = "FAILED";
1617
+ TransactionStatus2["PENDING"] = "PENDING";
1618
+ TransactionStatus2["NOT_STARTED"] = "NOT_STARTED";
1619
+ TransactionStatus2["EXPIRED"] = "EXPIRED";
1620
+ TransactionStatus2["CANCELLED"] = "CANCELLED";
1621
+ return TransactionStatus2;
1622
+ })(TransactionStatus || {});
1623
+ var TransactionStatus_default = TransactionStatus;
1624
+
1625
+ // src/objects/OutgoingPayment.ts
1626
+ import autoBind6 from "auto-bind";
1627
+ var OutgoingPayment = class {
1628
+ constructor(id, createdAt, updatedAt, status, amount, originId, typename, resolvedAt, transactionHash, destinationId, fees, paymentRequestData, failureReason, failureMessage) {
1629
+ this.id = id;
1630
+ this.createdAt = createdAt;
1631
+ this.updatedAt = updatedAt;
1632
+ this.status = status;
1633
+ this.amount = amount;
1634
+ this.originId = originId;
1635
+ this.typename = typename;
1636
+ this.resolvedAt = resolvedAt;
1637
+ this.transactionHash = transactionHash;
1638
+ this.destinationId = destinationId;
1639
+ this.fees = fees;
1640
+ this.paymentRequestData = paymentRequestData;
1641
+ this.failureReason = failureReason;
1642
+ this.failureMessage = failureMessage;
1643
+ autoBind6(this);
1644
+ }
1645
+ async getAttempts(client, first = void 0) {
1646
+ return await client.executeRawQuery({
1647
+ queryPayload: `
1648
+ query FetchOutgoingPaymentToAttemptsConnection($entity_id: ID!, $first: Int) {
1649
+ entity(id: $entity_id) {
1650
+ ... on OutgoingPayment {
1651
+ attempts(, first: $first) {
1652
+ __typename
1653
+ outgoing_payment_to_attempts_connection_count: count
1654
+ outgoing_payment_to_attempts_connection_entities: entities {
1655
+ __typename
1656
+ outgoing_payment_attempt_id: id
1657
+ outgoing_payment_attempt_created_at: created_at
1658
+ outgoing_payment_attempt_updated_at: updated_at
1659
+ outgoing_payment_attempt_status: status
1660
+ outgoing_payment_attempt_failure_code: failure_code
1661
+ outgoing_payment_attempt_failure_source_index: failure_source_index
1662
+ outgoing_payment_attempt_resolved_at: resolved_at
1663
+ outgoing_payment_attempt_amount: amount {
1664
+ __typename
1665
+ currency_amount_original_value: original_value
1666
+ currency_amount_original_unit: original_unit
1667
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1668
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1669
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1670
+ }
1671
+ outgoing_payment_attempt_fees: fees {
1672
+ __typename
1673
+ currency_amount_original_value: original_value
1674
+ currency_amount_original_unit: original_unit
1675
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1676
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1677
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1678
+ }
1679
+ outgoing_payment_attempt_outgoing_payment: outgoing_payment {
1680
+ id
1681
+ }
1682
+ }
1683
+ }
1684
+ }
1685
+ }
1686
+ }
1687
+ `,
1688
+ variables: { entity_id: this.id, first },
1689
+ constructObject: (json) => {
1690
+ const connection = json["entity"]["attempts"];
1691
+ return OutgoingPaymentToAttemptsConnectionFromJson(connection);
1692
+ }
1693
+ });
1694
+ }
1695
+ static getOutgoingPaymentQuery(id) {
1696
+ return {
1697
+ queryPayload: `
1698
+ query GetOutgoingPayment($id: ID!) {
1699
+ entity(id: $id) {
1700
+ ... on OutgoingPayment {
1701
+ ...OutgoingPaymentFragment
1702
+ }
1703
+ }
1704
+ }
1705
+
1706
+ ${FRAGMENT12}
1707
+ `,
1708
+ variables: { id },
1709
+ constructObject: (data) => OutgoingPaymentFromJson(data.entity)
1710
+ };
1711
+ }
1712
+ };
1713
+ var OutgoingPaymentFromJson = (obj) => {
1714
+ return new OutgoingPayment(
1715
+ obj["outgoing_payment_id"],
1716
+ obj["outgoing_payment_created_at"],
1717
+ obj["outgoing_payment_updated_at"],
1718
+ TransactionStatus_default[obj["outgoing_payment_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
1719
+ CurrencyAmountFromJson(obj["outgoing_payment_amount"]),
1720
+ obj["outgoing_payment_origin"].id,
1721
+ "OutgoingPayment",
1722
+ obj["outgoing_payment_resolved_at"],
1723
+ obj["outgoing_payment_transaction_hash"],
1724
+ obj["outgoing_payment_destination"]?.id ?? void 0,
1725
+ !!obj["outgoing_payment_fees"] ? CurrencyAmountFromJson(obj["outgoing_payment_fees"]) : void 0,
1726
+ !!obj["outgoing_payment_payment_request_data"] ? PaymentRequestDataFromJson(obj["outgoing_payment_payment_request_data"]) : void 0,
1727
+ !!obj["outgoing_payment_failure_reason"] ? PaymentFailureReason_default[obj["outgoing_payment_failure_reason"]] ?? PaymentFailureReason_default.FUTURE_VALUE : null,
1728
+ !!obj["outgoing_payment_failure_message"] ? RichTextFromJson(obj["outgoing_payment_failure_message"]) : void 0
1729
+ );
1730
+ };
1731
+ var FRAGMENT12 = `
1732
+ fragment OutgoingPaymentFragment on OutgoingPayment {
1733
+ __typename
1734
+ outgoing_payment_id: id
1735
+ outgoing_payment_created_at: created_at
1736
+ outgoing_payment_updated_at: updated_at
1737
+ outgoing_payment_status: status
1738
+ outgoing_payment_resolved_at: resolved_at
1739
+ outgoing_payment_amount: amount {
1740
+ __typename
1741
+ currency_amount_original_value: original_value
1742
+ currency_amount_original_unit: original_unit
1743
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1744
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1745
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1746
+ }
1747
+ outgoing_payment_transaction_hash: transaction_hash
1748
+ outgoing_payment_origin: origin {
1749
+ id
1750
+ }
1751
+ outgoing_payment_destination: destination {
1752
+ id
1753
+ }
1754
+ outgoing_payment_fees: fees {
1755
+ __typename
1756
+ currency_amount_original_value: original_value
1757
+ currency_amount_original_unit: original_unit
1758
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1759
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1760
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1761
+ }
1762
+ outgoing_payment_payment_request_data: payment_request_data {
1763
+ __typename
1764
+ ... on InvoiceData {
1765
+ __typename
1766
+ invoice_data_encoded_payment_request: encoded_payment_request
1767
+ invoice_data_bitcoin_network: bitcoin_network
1768
+ invoice_data_payment_hash: payment_hash
1769
+ invoice_data_amount: amount {
1770
+ __typename
1771
+ currency_amount_original_value: original_value
1772
+ currency_amount_original_unit: original_unit
1773
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1774
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1775
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1776
+ }
1777
+ invoice_data_created_at: created_at
1778
+ invoice_data_expires_at: expires_at
1779
+ invoice_data_destination: destination {
1780
+ __typename
1781
+ ... on GraphNode {
1782
+ __typename
1783
+ graph_node_id: id
1784
+ graph_node_created_at: created_at
1785
+ graph_node_updated_at: updated_at
1786
+ graph_node_alias: alias
1787
+ graph_node_bitcoin_network: bitcoin_network
1788
+ graph_node_color: color
1789
+ graph_node_conductivity: conductivity
1790
+ graph_node_display_name: display_name
1791
+ graph_node_public_key: public_key
1792
+ }
1793
+ ... on LightsparkNode {
1794
+ __typename
1795
+ lightspark_node_id: id
1796
+ lightspark_node_created_at: created_at
1797
+ lightspark_node_updated_at: updated_at
1798
+ lightspark_node_alias: alias
1799
+ lightspark_node_bitcoin_network: bitcoin_network
1800
+ lightspark_node_color: color
1801
+ lightspark_node_conductivity: conductivity
1802
+ lightspark_node_display_name: display_name
1803
+ lightspark_node_public_key: public_key
1804
+ lightspark_node_account: account {
1805
+ id
1806
+ }
1807
+ lightspark_node_blockchain_balance: blockchain_balance {
1808
+ __typename
1809
+ blockchain_balance_total_balance: total_balance {
1810
+ __typename
1811
+ currency_amount_original_value: original_value
1812
+ currency_amount_original_unit: original_unit
1813
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1814
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1815
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1816
+ }
1817
+ blockchain_balance_confirmed_balance: confirmed_balance {
1818
+ __typename
1819
+ currency_amount_original_value: original_value
1820
+ currency_amount_original_unit: original_unit
1821
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1822
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1823
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1824
+ }
1825
+ blockchain_balance_unconfirmed_balance: unconfirmed_balance {
1826
+ __typename
1827
+ currency_amount_original_value: original_value
1828
+ currency_amount_original_unit: original_unit
1829
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1830
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1831
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1832
+ }
1833
+ blockchain_balance_locked_balance: locked_balance {
1834
+ __typename
1835
+ currency_amount_original_value: original_value
1836
+ currency_amount_original_unit: original_unit
1837
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1838
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1839
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1840
+ }
1841
+ blockchain_balance_required_reserve: required_reserve {
1842
+ __typename
1843
+ currency_amount_original_value: original_value
1844
+ currency_amount_original_unit: original_unit
1845
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1846
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1847
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1848
+ }
1849
+ blockchain_balance_available_balance: available_balance {
1850
+ __typename
1851
+ currency_amount_original_value: original_value
1852
+ currency_amount_original_unit: original_unit
1853
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1854
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1855
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1856
+ }
1857
+ }
1858
+ lightspark_node_encrypted_signing_private_key: encrypted_signing_private_key {
1859
+ __typename
1860
+ secret_encrypted_value: encrypted_value
1861
+ secret_cipher: cipher
1862
+ }
1863
+ lightspark_node_total_balance: total_balance {
1864
+ __typename
1865
+ currency_amount_original_value: original_value
1866
+ currency_amount_original_unit: original_unit
1867
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1868
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1869
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1870
+ }
1871
+ lightspark_node_total_local_balance: total_local_balance {
1872
+ __typename
1873
+ currency_amount_original_value: original_value
1874
+ currency_amount_original_unit: original_unit
1875
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1876
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1877
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1878
+ }
1879
+ lightspark_node_local_balance: local_balance {
1880
+ __typename
1881
+ currency_amount_original_value: original_value
1882
+ currency_amount_original_unit: original_unit
1883
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1884
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1885
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1886
+ }
1887
+ lightspark_node_purpose: purpose
1888
+ lightspark_node_remote_balance: remote_balance {
1889
+ __typename
1890
+ currency_amount_original_value: original_value
1891
+ currency_amount_original_unit: original_unit
1892
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1893
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1894
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1895
+ }
1896
+ lightspark_node_status: status
1897
+ }
1898
+ }
1899
+ invoice_data_memo: memo
1900
+ }
1901
+ }
1902
+ outgoing_payment_failure_reason: failure_reason
1903
+ outgoing_payment_failure_message: failure_message {
1904
+ __typename
1905
+ rich_text_text: text
1906
+ }
1907
+ }`;
1908
+ var OutgoingPayment_default = OutgoingPayment;
1909
+
1910
+ // src/objects/WithdrawalMode.ts
1911
+ var WithdrawalMode = /* @__PURE__ */ ((WithdrawalMode2) => {
1912
+ WithdrawalMode2["FUTURE_VALUE"] = "FUTURE_VALUE";
1913
+ WithdrawalMode2["WALLET_ONLY"] = "WALLET_ONLY";
1914
+ WithdrawalMode2["WALLET_THEN_CHANNELS"] = "WALLET_THEN_CHANNELS";
1915
+ return WithdrawalMode2;
1916
+ })(WithdrawalMode || {});
1917
+ var WithdrawalMode_default = WithdrawalMode;
1918
+
1919
+ // src/objects/WithdrawalRequestStatus.ts
1920
+ var WithdrawalRequestStatus = /* @__PURE__ */ ((WithdrawalRequestStatus2) => {
1921
+ WithdrawalRequestStatus2["FUTURE_VALUE"] = "FUTURE_VALUE";
1922
+ WithdrawalRequestStatus2["FAILED"] = "FAILED";
1923
+ WithdrawalRequestStatus2["IN_PROGRESS"] = "IN_PROGRESS";
1924
+ WithdrawalRequestStatus2["SUCCESSFUL"] = "SUCCESSFUL";
1925
+ return WithdrawalRequestStatus2;
1926
+ })(WithdrawalRequestStatus || {});
1927
+ var WithdrawalRequestStatus_default = WithdrawalRequestStatus;
1928
+
1929
+ // src/objects/ChannelClosingTransaction.ts
1930
+ var ChannelClosingTransactionFromJson = (obj) => {
1931
+ return {
1932
+ id: obj["channel_closing_transaction_id"],
1933
+ createdAt: obj["channel_closing_transaction_created_at"],
1934
+ updatedAt: obj["channel_closing_transaction_updated_at"],
1935
+ status: TransactionStatus_default[obj["channel_closing_transaction_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
1936
+ amount: CurrencyAmountFromJson(obj["channel_closing_transaction_amount"]),
1937
+ blockHeight: obj["channel_closing_transaction_block_height"],
1938
+ destinationAddresses: obj["channel_closing_transaction_destination_addresses"],
1939
+ typename: "ChannelClosingTransaction",
1940
+ resolvedAt: obj["channel_closing_transaction_resolved_at"],
1941
+ transactionHash: obj["channel_closing_transaction_transaction_hash"],
1942
+ fees: !!obj["channel_closing_transaction_fees"] ? CurrencyAmountFromJson(obj["channel_closing_transaction_fees"]) : void 0,
1943
+ blockHash: obj["channel_closing_transaction_block_hash"],
1944
+ numConfirmations: obj["channel_closing_transaction_num_confirmations"],
1945
+ channelId: obj["channel_closing_transaction_channel"]?.id ?? void 0
1946
+ };
1947
+ };
1948
+ var FRAGMENT13 = `
1949
+ fragment ChannelClosingTransactionFragment on ChannelClosingTransaction {
1950
+ __typename
1951
+ channel_closing_transaction_id: id
1952
+ channel_closing_transaction_created_at: created_at
1953
+ channel_closing_transaction_updated_at: updated_at
1954
+ channel_closing_transaction_status: status
1955
+ channel_closing_transaction_resolved_at: resolved_at
1956
+ channel_closing_transaction_amount: amount {
1957
+ __typename
1958
+ currency_amount_original_value: original_value
1959
+ currency_amount_original_unit: original_unit
1960
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1961
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1962
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1963
+ }
1964
+ channel_closing_transaction_transaction_hash: transaction_hash
1965
+ channel_closing_transaction_fees: fees {
1966
+ __typename
1967
+ currency_amount_original_value: original_value
1968
+ currency_amount_original_unit: original_unit
1969
+ currency_amount_preferred_currency_unit: preferred_currency_unit
1970
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1971
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1972
+ }
1973
+ channel_closing_transaction_block_hash: block_hash
1974
+ channel_closing_transaction_block_height: block_height
1975
+ channel_closing_transaction_destination_addresses: destination_addresses
1976
+ channel_closing_transaction_num_confirmations: num_confirmations
1977
+ channel_closing_transaction_channel: channel {
1978
+ id
1979
+ }
1980
+ }`;
1981
+ var getChannelClosingTransactionQuery = (id) => {
1982
+ return {
1983
+ queryPayload: `
1984
+ query GetChannelClosingTransaction($id: ID!) {
1985
+ entity(id: $id) {
1986
+ ... on ChannelClosingTransaction {
1987
+ ...ChannelClosingTransactionFragment
1988
+ }
1989
+ }
1990
+ }
1991
+
1992
+ ${FRAGMENT13}
1993
+ `,
1994
+ variables: { id },
1995
+ constructObject: (data) => ChannelClosingTransactionFromJson(data.entity)
1996
+ };
1997
+ };
1998
+
1999
+ // src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts
2000
+ var WithdrawalRequestToChannelClosingTransactionsConnectionFromJson = (obj) => {
2001
+ return {
2002
+ pageInfo: PageInfoFromJson(
2003
+ obj["withdrawal_request_to_channel_closing_transactions_connection_page_info"]
2004
+ ),
2005
+ count: obj["withdrawal_request_to_channel_closing_transactions_connection_count"],
2006
+ entities: obj["withdrawal_request_to_channel_closing_transactions_connection_entities"].map((e) => ChannelClosingTransactionFromJson(e))
2007
+ };
2008
+ };
2009
+
2010
+ // src/objects/ChannelOpeningTransaction.ts
2011
+ var ChannelOpeningTransactionFromJson = (obj) => {
2012
+ return {
2013
+ id: obj["channel_opening_transaction_id"],
2014
+ createdAt: obj["channel_opening_transaction_created_at"],
2015
+ updatedAt: obj["channel_opening_transaction_updated_at"],
2016
+ status: TransactionStatus_default[obj["channel_opening_transaction_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
2017
+ amount: CurrencyAmountFromJson(obj["channel_opening_transaction_amount"]),
2018
+ blockHeight: obj["channel_opening_transaction_block_height"],
2019
+ destinationAddresses: obj["channel_opening_transaction_destination_addresses"],
2020
+ typename: "ChannelOpeningTransaction",
2021
+ resolvedAt: obj["channel_opening_transaction_resolved_at"],
2022
+ transactionHash: obj["channel_opening_transaction_transaction_hash"],
2023
+ fees: !!obj["channel_opening_transaction_fees"] ? CurrencyAmountFromJson(obj["channel_opening_transaction_fees"]) : void 0,
2024
+ blockHash: obj["channel_opening_transaction_block_hash"],
2025
+ numConfirmations: obj["channel_opening_transaction_num_confirmations"],
2026
+ channelId: obj["channel_opening_transaction_channel"]?.id ?? void 0
2027
+ };
2028
+ };
2029
+ var FRAGMENT14 = `
2030
+ fragment ChannelOpeningTransactionFragment on ChannelOpeningTransaction {
2031
+ __typename
2032
+ channel_opening_transaction_id: id
2033
+ channel_opening_transaction_created_at: created_at
2034
+ channel_opening_transaction_updated_at: updated_at
2035
+ channel_opening_transaction_status: status
2036
+ channel_opening_transaction_resolved_at: resolved_at
2037
+ channel_opening_transaction_amount: amount {
2038
+ __typename
2039
+ currency_amount_original_value: original_value
2040
+ currency_amount_original_unit: original_unit
2041
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2042
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2043
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2044
+ }
2045
+ channel_opening_transaction_transaction_hash: transaction_hash
2046
+ channel_opening_transaction_fees: fees {
2047
+ __typename
2048
+ currency_amount_original_value: original_value
2049
+ currency_amount_original_unit: original_unit
2050
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2051
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2052
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2053
+ }
2054
+ channel_opening_transaction_block_hash: block_hash
2055
+ channel_opening_transaction_block_height: block_height
2056
+ channel_opening_transaction_destination_addresses: destination_addresses
2057
+ channel_opening_transaction_num_confirmations: num_confirmations
2058
+ channel_opening_transaction_channel: channel {
2059
+ id
2060
+ }
2061
+ }`;
2062
+ var getChannelOpeningTransactionQuery = (id) => {
2063
+ return {
2064
+ queryPayload: `
2065
+ query GetChannelOpeningTransaction($id: ID!) {
2066
+ entity(id: $id) {
2067
+ ... on ChannelOpeningTransaction {
2068
+ ...ChannelOpeningTransactionFragment
2069
+ }
2070
+ }
2071
+ }
2072
+
2073
+ ${FRAGMENT14}
2074
+ `,
2075
+ variables: { id },
2076
+ constructObject: (data) => ChannelOpeningTransactionFromJson(data.entity)
2077
+ };
2078
+ };
2079
+
2080
+ // src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts
2081
+ var WithdrawalRequestToChannelOpeningTransactionsConnectionFromJson = (obj) => {
2082
+ return {
2083
+ pageInfo: PageInfoFromJson(
2084
+ obj["withdrawal_request_to_channel_opening_transactions_connection_page_info"]
2085
+ ),
2086
+ count: obj["withdrawal_request_to_channel_opening_transactions_connection_count"],
2087
+ entities: obj["withdrawal_request_to_channel_opening_transactions_connection_entities"].map((e) => ChannelOpeningTransactionFromJson(e))
2088
+ };
2089
+ };
2090
+
2091
+ // src/objects/WithdrawalRequest.ts
2092
+ import autoBind7 from "auto-bind";
2093
+ var WithdrawalRequest = class {
2094
+ constructor(id, createdAt, updatedAt, amount, bitcoinAddress, withdrawalMode, status, typename, completedAt, withdrawalId) {
2095
+ this.id = id;
2096
+ this.createdAt = createdAt;
2097
+ this.updatedAt = updatedAt;
2098
+ this.amount = amount;
2099
+ this.bitcoinAddress = bitcoinAddress;
2100
+ this.withdrawalMode = withdrawalMode;
2101
+ this.status = status;
2102
+ this.typename = typename;
2103
+ this.completedAt = completedAt;
2104
+ this.withdrawalId = withdrawalId;
2105
+ autoBind7(this);
2106
+ }
2107
+ async getChannelClosingTransactions(client, first = void 0) {
2108
+ return await client.executeRawQuery({
2109
+ queryPayload: `
2110
+ query FetchWithdrawalRequestToChannelClosingTransactionsConnection($entity_id: ID!, $first: Int) {
2111
+ entity(id: $entity_id) {
2112
+ ... on WithdrawalRequest {
2113
+ channel_closing_transactions(, first: $first) {
2114
+ __typename
2115
+ withdrawal_request_to_channel_closing_transactions_connection_page_info: page_info {
2116
+ __typename
2117
+ page_info_has_next_page: has_next_page
2118
+ page_info_has_previous_page: has_previous_page
2119
+ page_info_start_cursor: start_cursor
2120
+ page_info_end_cursor: end_cursor
2121
+ }
2122
+ withdrawal_request_to_channel_closing_transactions_connection_count: count
2123
+ withdrawal_request_to_channel_closing_transactions_connection_entities: entities {
2124
+ __typename
2125
+ channel_closing_transaction_id: id
2126
+ channel_closing_transaction_created_at: created_at
2127
+ channel_closing_transaction_updated_at: updated_at
2128
+ channel_closing_transaction_status: status
2129
+ channel_closing_transaction_resolved_at: resolved_at
2130
+ channel_closing_transaction_amount: amount {
2131
+ __typename
2132
+ currency_amount_original_value: original_value
2133
+ currency_amount_original_unit: original_unit
2134
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2135
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2136
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2137
+ }
2138
+ channel_closing_transaction_transaction_hash: transaction_hash
2139
+ channel_closing_transaction_fees: fees {
2140
+ __typename
2141
+ currency_amount_original_value: original_value
2142
+ currency_amount_original_unit: original_unit
2143
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2144
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2145
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2146
+ }
2147
+ channel_closing_transaction_block_hash: block_hash
2148
+ channel_closing_transaction_block_height: block_height
2149
+ channel_closing_transaction_destination_addresses: destination_addresses
2150
+ channel_closing_transaction_num_confirmations: num_confirmations
2151
+ channel_closing_transaction_channel: channel {
2152
+ id
2153
+ }
2154
+ }
2155
+ }
2156
+ }
2157
+ }
2158
+ }
2159
+ `,
2160
+ variables: { entity_id: this.id, first },
2161
+ constructObject: (json) => {
2162
+ const connection = json["entity"]["channel_closing_transactions"];
2163
+ return WithdrawalRequestToChannelClosingTransactionsConnectionFromJson(
2164
+ connection
2165
+ );
2166
+ }
2167
+ });
2168
+ }
2169
+ async getChannelOpeningTransactions(client, first = void 0) {
2170
+ return await client.executeRawQuery({
2171
+ queryPayload: `
2172
+ query FetchWithdrawalRequestToChannelOpeningTransactionsConnection($entity_id: ID!, $first: Int) {
2173
+ entity(id: $entity_id) {
2174
+ ... on WithdrawalRequest {
2175
+ channel_opening_transactions(, first: $first) {
2176
+ __typename
2177
+ withdrawal_request_to_channel_opening_transactions_connection_page_info: page_info {
2178
+ __typename
2179
+ page_info_has_next_page: has_next_page
2180
+ page_info_has_previous_page: has_previous_page
2181
+ page_info_start_cursor: start_cursor
2182
+ page_info_end_cursor: end_cursor
2183
+ }
2184
+ withdrawal_request_to_channel_opening_transactions_connection_count: count
2185
+ withdrawal_request_to_channel_opening_transactions_connection_entities: entities {
2186
+ __typename
2187
+ channel_opening_transaction_id: id
2188
+ channel_opening_transaction_created_at: created_at
2189
+ channel_opening_transaction_updated_at: updated_at
2190
+ channel_opening_transaction_status: status
2191
+ channel_opening_transaction_resolved_at: resolved_at
2192
+ channel_opening_transaction_amount: amount {
2193
+ __typename
2194
+ currency_amount_original_value: original_value
2195
+ currency_amount_original_unit: original_unit
2196
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2197
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2198
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2199
+ }
2200
+ channel_opening_transaction_transaction_hash: transaction_hash
2201
+ channel_opening_transaction_fees: fees {
2202
+ __typename
2203
+ currency_amount_original_value: original_value
2204
+ currency_amount_original_unit: original_unit
2205
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2206
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2207
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2208
+ }
2209
+ channel_opening_transaction_block_hash: block_hash
2210
+ channel_opening_transaction_block_height: block_height
2211
+ channel_opening_transaction_destination_addresses: destination_addresses
2212
+ channel_opening_transaction_num_confirmations: num_confirmations
2213
+ channel_opening_transaction_channel: channel {
2214
+ id
2215
+ }
2216
+ }
2217
+ }
2218
+ }
2219
+ }
2220
+ }
2221
+ `,
2222
+ variables: { entity_id: this.id, first },
2223
+ constructObject: (json) => {
2224
+ const connection = json["entity"]["channel_opening_transactions"];
2225
+ return WithdrawalRequestToChannelOpeningTransactionsConnectionFromJson(
2226
+ connection
2227
+ );
2228
+ }
2229
+ });
2230
+ }
2231
+ static getWithdrawalRequestQuery(id) {
2232
+ return {
2233
+ queryPayload: `
2234
+ query GetWithdrawalRequest($id: ID!) {
2235
+ entity(id: $id) {
2236
+ ... on WithdrawalRequest {
2237
+ ...WithdrawalRequestFragment
2238
+ }
2239
+ }
2240
+ }
2241
+
2242
+ ${FRAGMENT15}
2243
+ `,
2244
+ variables: { id },
2245
+ constructObject: (data) => WithdrawalRequestFromJson(data.entity)
2246
+ };
2247
+ }
2248
+ };
2249
+ var WithdrawalRequestFromJson = (obj) => {
2250
+ return new WithdrawalRequest(
2251
+ obj["withdrawal_request_id"],
2252
+ obj["withdrawal_request_created_at"],
2253
+ obj["withdrawal_request_updated_at"],
2254
+ CurrencyAmountFromJson(obj["withdrawal_request_amount"]),
2255
+ obj["withdrawal_request_bitcoin_address"],
2256
+ WithdrawalMode_default[obj["withdrawal_request_withdrawal_mode"]] ?? WithdrawalMode_default.FUTURE_VALUE,
2257
+ WithdrawalRequestStatus_default[obj["withdrawal_request_status"]] ?? WithdrawalRequestStatus_default.FUTURE_VALUE,
2258
+ "WithdrawalRequest",
2259
+ obj["withdrawal_request_completed_at"],
2260
+ obj["withdrawal_request_withdrawal"]?.id ?? void 0
2261
+ );
2262
+ };
2263
+ var FRAGMENT15 = `
2264
+ fragment WithdrawalRequestFragment on WithdrawalRequest {
2265
+ __typename
2266
+ withdrawal_request_id: id
2267
+ withdrawal_request_created_at: created_at
2268
+ withdrawal_request_updated_at: updated_at
2269
+ withdrawal_request_amount: amount {
2270
+ __typename
2271
+ currency_amount_original_value: original_value
2272
+ currency_amount_original_unit: original_unit
2273
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2274
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2275
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2276
+ }
2277
+ withdrawal_request_bitcoin_address: bitcoin_address
2278
+ withdrawal_request_withdrawal_mode: withdrawal_mode
2279
+ withdrawal_request_status: status
2280
+ withdrawal_request_completed_at: completed_at
2281
+ withdrawal_request_withdrawal: withdrawal {
2282
+ id
2283
+ }
2284
+ }`;
2285
+ var WithdrawalRequest_default = WithdrawalRequest;
2286
+
2287
+ // src/objects/IncomingPaymentAttemptStatus.ts
2288
+ var IncomingPaymentAttemptStatus = /* @__PURE__ */ ((IncomingPaymentAttemptStatus2) => {
2289
+ IncomingPaymentAttemptStatus2["FUTURE_VALUE"] = "FUTURE_VALUE";
2290
+ IncomingPaymentAttemptStatus2["ACCEPTED"] = "ACCEPTED";
2291
+ IncomingPaymentAttemptStatus2["SETTLED"] = "SETTLED";
2292
+ IncomingPaymentAttemptStatus2["CANCELED"] = "CANCELED";
2293
+ IncomingPaymentAttemptStatus2["UNKNOWN"] = "UNKNOWN";
2294
+ return IncomingPaymentAttemptStatus2;
2295
+ })(IncomingPaymentAttemptStatus || {});
2296
+ var IncomingPaymentAttemptStatus_default = IncomingPaymentAttemptStatus;
2297
+
2298
+ // src/objects/IncomingPaymentAttempt.ts
2299
+ var IncomingPaymentAttemptFromJson = (obj) => {
2300
+ return {
2301
+ id: obj["incoming_payment_attempt_id"],
2302
+ createdAt: obj["incoming_payment_attempt_created_at"],
2303
+ updatedAt: obj["incoming_payment_attempt_updated_at"],
2304
+ status: IncomingPaymentAttemptStatus_default[obj["incoming_payment_attempt_status"]] ?? IncomingPaymentAttemptStatus_default.FUTURE_VALUE,
2305
+ amount: CurrencyAmountFromJson(obj["incoming_payment_attempt_amount"]),
2306
+ channelId: obj["incoming_payment_attempt_channel"].id,
2307
+ typename: "IncomingPaymentAttempt",
2308
+ resolvedAt: obj["incoming_payment_attempt_resolved_at"]
2309
+ };
2310
+ };
2311
+ var FRAGMENT16 = `
2312
+ fragment IncomingPaymentAttemptFragment on IncomingPaymentAttempt {
2313
+ __typename
2314
+ incoming_payment_attempt_id: id
2315
+ incoming_payment_attempt_created_at: created_at
2316
+ incoming_payment_attempt_updated_at: updated_at
2317
+ incoming_payment_attempt_status: status
2318
+ incoming_payment_attempt_resolved_at: resolved_at
2319
+ incoming_payment_attempt_amount: amount {
2320
+ __typename
2321
+ currency_amount_original_value: original_value
2322
+ currency_amount_original_unit: original_unit
2323
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2324
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2325
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2326
+ }
2327
+ incoming_payment_attempt_channel: channel {
2328
+ id
2329
+ }
2330
+ }`;
2331
+ var getIncomingPaymentAttemptQuery = (id) => {
2332
+ return {
2333
+ queryPayload: `
2334
+ query GetIncomingPaymentAttempt($id: ID!) {
2335
+ entity(id: $id) {
2336
+ ... on IncomingPaymentAttempt {
2337
+ ...IncomingPaymentAttemptFragment
2338
+ }
2339
+ }
2340
+ }
2341
+
2342
+ ${FRAGMENT16}
2343
+ `,
2344
+ variables: { id },
2345
+ constructObject: (data) => IncomingPaymentAttemptFromJson(data.entity)
2346
+ };
2347
+ };
2348
+
2349
+ // src/objects/IncomingPaymentToAttemptsConnection.ts
2350
+ var IncomingPaymentToAttemptsConnectionFromJson = (obj) => {
2351
+ return {
2352
+ count: obj["incoming_payment_to_attempts_connection_count"],
2353
+ entities: obj["incoming_payment_to_attempts_connection_entities"].map(
2354
+ (e) => IncomingPaymentAttemptFromJson(e)
2355
+ )
2356
+ };
2357
+ };
2358
+
2359
+ // src/objects/IncomingPayment.ts
2360
+ import autoBind8 from "auto-bind";
2361
+ var IncomingPayment = class {
2362
+ constructor(id, createdAt, updatedAt, status, amount, destinationId, typename, resolvedAt, transactionHash, originId, paymentRequestId) {
2363
+ this.id = id;
2364
+ this.createdAt = createdAt;
2365
+ this.updatedAt = updatedAt;
2366
+ this.status = status;
2367
+ this.amount = amount;
2368
+ this.destinationId = destinationId;
2369
+ this.typename = typename;
2370
+ this.resolvedAt = resolvedAt;
2371
+ this.transactionHash = transactionHash;
2372
+ this.originId = originId;
2373
+ this.paymentRequestId = paymentRequestId;
2374
+ autoBind8(this);
2375
+ }
2376
+ async getAttempts(client, first = void 0, statuses = void 0) {
2377
+ return await client.executeRawQuery({
2378
+ queryPayload: `
2379
+ query FetchIncomingPaymentToAttemptsConnection($entity_id: ID!, $first: Int, $statuses: [IncomingPaymentAttemptStatus!]) {
2380
+ entity(id: $entity_id) {
2381
+ ... on IncomingPayment {
2382
+ attempts(, first: $first, statuses: $statuses) {
2383
+ __typename
2384
+ incoming_payment_to_attempts_connection_count: count
2385
+ incoming_payment_to_attempts_connection_entities: entities {
2386
+ __typename
2387
+ incoming_payment_attempt_id: id
2388
+ incoming_payment_attempt_created_at: created_at
2389
+ incoming_payment_attempt_updated_at: updated_at
2390
+ incoming_payment_attempt_status: status
2391
+ incoming_payment_attempt_resolved_at: resolved_at
2392
+ incoming_payment_attempt_amount: amount {
2393
+ __typename
2394
+ currency_amount_original_value: original_value
2395
+ currency_amount_original_unit: original_unit
2396
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2397
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2398
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2399
+ }
2400
+ incoming_payment_attempt_channel: channel {
2401
+ id
2402
+ }
2403
+ }
2404
+ }
2405
+ }
2406
+ }
2407
+ }
2408
+ `,
2409
+ variables: { entity_id: this.id, first, statuses },
2410
+ constructObject: (json) => {
2411
+ const connection = json["entity"]["attempts"];
2412
+ return IncomingPaymentToAttemptsConnectionFromJson(connection);
2413
+ }
2414
+ });
2415
+ }
2416
+ static getIncomingPaymentQuery(id) {
2417
+ return {
2418
+ queryPayload: `
2419
+ query GetIncomingPayment($id: ID!) {
2420
+ entity(id: $id) {
2421
+ ... on IncomingPayment {
2422
+ ...IncomingPaymentFragment
2423
+ }
2424
+ }
2425
+ }
2426
+
2427
+ ${FRAGMENT17}
2428
+ `,
2429
+ variables: { id },
2430
+ constructObject: (data) => IncomingPaymentFromJson(data.entity)
2431
+ };
2432
+ }
2433
+ };
2434
+ var IncomingPaymentFromJson = (obj) => {
2435
+ return new IncomingPayment(
2436
+ obj["incoming_payment_id"],
2437
+ obj["incoming_payment_created_at"],
2438
+ obj["incoming_payment_updated_at"],
2439
+ TransactionStatus_default[obj["incoming_payment_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
2440
+ CurrencyAmountFromJson(obj["incoming_payment_amount"]),
2441
+ obj["incoming_payment_destination"].id,
2442
+ "IncomingPayment",
2443
+ obj["incoming_payment_resolved_at"],
2444
+ obj["incoming_payment_transaction_hash"],
2445
+ obj["incoming_payment_origin"]?.id ?? void 0,
2446
+ obj["incoming_payment_payment_request"]?.id ?? void 0
2447
+ );
2448
+ };
2449
+ var FRAGMENT17 = `
2450
+ fragment IncomingPaymentFragment on IncomingPayment {
2451
+ __typename
2452
+ incoming_payment_id: id
2453
+ incoming_payment_created_at: created_at
2454
+ incoming_payment_updated_at: updated_at
2455
+ incoming_payment_status: status
2456
+ incoming_payment_resolved_at: resolved_at
2457
+ incoming_payment_amount: amount {
2458
+ __typename
2459
+ currency_amount_original_value: original_value
2460
+ currency_amount_original_unit: original_unit
2461
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2462
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2463
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2464
+ }
2465
+ incoming_payment_transaction_hash: transaction_hash
2466
+ incoming_payment_origin: origin {
2467
+ id
2468
+ }
2469
+ incoming_payment_destination: destination {
2470
+ id
2471
+ }
2472
+ incoming_payment_payment_request: payment_request {
2473
+ id
2474
+ }
2475
+ }`;
2476
+ var IncomingPayment_default = IncomingPayment;
2477
+
2478
+ // src/objects/RoutingTransactionFailureReason.ts
2479
+ var RoutingTransactionFailureReason = /* @__PURE__ */ ((RoutingTransactionFailureReason2) => {
2480
+ RoutingTransactionFailureReason2["FUTURE_VALUE"] = "FUTURE_VALUE";
2481
+ RoutingTransactionFailureReason2["INCOMING_LINK_FAILURE"] = "INCOMING_LINK_FAILURE";
2482
+ RoutingTransactionFailureReason2["OUTGOING_LINK_FAILURE"] = "OUTGOING_LINK_FAILURE";
2483
+ RoutingTransactionFailureReason2["FORWARDING_FAILURE"] = "FORWARDING_FAILURE";
2484
+ return RoutingTransactionFailureReason2;
2485
+ })(RoutingTransactionFailureReason || {});
2486
+ var RoutingTransactionFailureReason_default = RoutingTransactionFailureReason;
2487
+
2488
+ // src/objects/Transaction.ts
2489
+ import { LightsparkException as LightsparkException3 } from "@lightsparkdev/core";
2490
+ var TransactionFromJson = (obj) => {
2491
+ if (obj["__typename"] == "ChannelClosingTransaction") {
2492
+ return {
2493
+ id: obj["channel_closing_transaction_id"],
2494
+ createdAt: obj["channel_closing_transaction_created_at"],
2495
+ updatedAt: obj["channel_closing_transaction_updated_at"],
2496
+ status: TransactionStatus_default[obj["channel_closing_transaction_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
2497
+ amount: CurrencyAmountFromJson(obj["channel_closing_transaction_amount"]),
2498
+ blockHeight: obj["channel_closing_transaction_block_height"],
2499
+ destinationAddresses: obj["channel_closing_transaction_destination_addresses"],
2500
+ typename: "ChannelClosingTransaction",
2501
+ resolvedAt: obj["channel_closing_transaction_resolved_at"],
2502
+ transactionHash: obj["channel_closing_transaction_transaction_hash"],
2503
+ fees: !!obj["channel_closing_transaction_fees"] ? CurrencyAmountFromJson(obj["channel_closing_transaction_fees"]) : void 0,
2504
+ blockHash: obj["channel_closing_transaction_block_hash"],
2505
+ numConfirmations: obj["channel_closing_transaction_num_confirmations"],
2506
+ channelId: obj["channel_closing_transaction_channel"]?.id ?? void 0
2507
+ };
2508
+ }
2509
+ if (obj["__typename"] == "ChannelOpeningTransaction") {
2510
+ return {
2511
+ id: obj["channel_opening_transaction_id"],
2512
+ createdAt: obj["channel_opening_transaction_created_at"],
2513
+ updatedAt: obj["channel_opening_transaction_updated_at"],
2514
+ status: TransactionStatus_default[obj["channel_opening_transaction_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
2515
+ amount: CurrencyAmountFromJson(obj["channel_opening_transaction_amount"]),
2516
+ blockHeight: obj["channel_opening_transaction_block_height"],
2517
+ destinationAddresses: obj["channel_opening_transaction_destination_addresses"],
2518
+ typename: "ChannelOpeningTransaction",
2519
+ resolvedAt: obj["channel_opening_transaction_resolved_at"],
2520
+ transactionHash: obj["channel_opening_transaction_transaction_hash"],
2521
+ fees: !!obj["channel_opening_transaction_fees"] ? CurrencyAmountFromJson(obj["channel_opening_transaction_fees"]) : void 0,
2522
+ blockHash: obj["channel_opening_transaction_block_hash"],
2523
+ numConfirmations: obj["channel_opening_transaction_num_confirmations"],
2524
+ channelId: obj["channel_opening_transaction_channel"]?.id ?? void 0
2525
+ };
2526
+ }
2527
+ if (obj["__typename"] == "Deposit") {
2528
+ return {
2529
+ id: obj["deposit_id"],
2530
+ createdAt: obj["deposit_created_at"],
2531
+ updatedAt: obj["deposit_updated_at"],
2532
+ status: TransactionStatus_default[obj["deposit_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
2533
+ amount: CurrencyAmountFromJson(obj["deposit_amount"]),
2534
+ blockHeight: obj["deposit_block_height"],
2535
+ destinationAddresses: obj["deposit_destination_addresses"],
2536
+ destinationId: obj["deposit_destination"].id,
2537
+ typename: "Deposit",
2538
+ resolvedAt: obj["deposit_resolved_at"],
2539
+ transactionHash: obj["deposit_transaction_hash"],
2540
+ fees: !!obj["deposit_fees"] ? CurrencyAmountFromJson(obj["deposit_fees"]) : void 0,
2541
+ blockHash: obj["deposit_block_hash"],
2542
+ numConfirmations: obj["deposit_num_confirmations"]
2543
+ };
2544
+ }
2545
+ if (obj["__typename"] == "IncomingPayment") {
2546
+ return new IncomingPayment_default(
2547
+ obj["incoming_payment_id"],
2548
+ obj["incoming_payment_created_at"],
2549
+ obj["incoming_payment_updated_at"],
2550
+ TransactionStatus_default[obj["incoming_payment_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
2551
+ CurrencyAmountFromJson(obj["incoming_payment_amount"]),
2552
+ obj["incoming_payment_destination"].id,
2553
+ "IncomingPayment",
2554
+ obj["incoming_payment_resolved_at"],
2555
+ obj["incoming_payment_transaction_hash"],
2556
+ obj["incoming_payment_origin"]?.id ?? void 0,
2557
+ obj["incoming_payment_payment_request"]?.id ?? void 0
2558
+ );
2559
+ }
2560
+ if (obj["__typename"] == "OutgoingPayment") {
2561
+ return new OutgoingPayment_default(
2562
+ obj["outgoing_payment_id"],
2563
+ obj["outgoing_payment_created_at"],
2564
+ obj["outgoing_payment_updated_at"],
2565
+ TransactionStatus_default[obj["outgoing_payment_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
2566
+ CurrencyAmountFromJson(obj["outgoing_payment_amount"]),
2567
+ obj["outgoing_payment_origin"].id,
2568
+ "OutgoingPayment",
2569
+ obj["outgoing_payment_resolved_at"],
2570
+ obj["outgoing_payment_transaction_hash"],
2571
+ obj["outgoing_payment_destination"]?.id ?? void 0,
2572
+ !!obj["outgoing_payment_fees"] ? CurrencyAmountFromJson(obj["outgoing_payment_fees"]) : void 0,
2573
+ !!obj["outgoing_payment_payment_request_data"] ? PaymentRequestDataFromJson(
2574
+ obj["outgoing_payment_payment_request_data"]
2575
+ ) : void 0,
2576
+ !!obj["outgoing_payment_failure_reason"] ? PaymentFailureReason_default[obj["outgoing_payment_failure_reason"]] ?? PaymentFailureReason_default.FUTURE_VALUE : null,
2577
+ !!obj["outgoing_payment_failure_message"] ? RichTextFromJson(obj["outgoing_payment_failure_message"]) : void 0
2578
+ );
2579
+ }
2580
+ if (obj["__typename"] == "RoutingTransaction") {
2581
+ return {
2582
+ id: obj["routing_transaction_id"],
2583
+ createdAt: obj["routing_transaction_created_at"],
2584
+ updatedAt: obj["routing_transaction_updated_at"],
2585
+ status: TransactionStatus_default[obj["routing_transaction_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
2586
+ amount: CurrencyAmountFromJson(obj["routing_transaction_amount"]),
2587
+ typename: "RoutingTransaction",
2588
+ resolvedAt: obj["routing_transaction_resolved_at"],
2589
+ transactionHash: obj["routing_transaction_transaction_hash"],
2590
+ incomingChannelId: obj["routing_transaction_incoming_channel"]?.id ?? void 0,
2591
+ outgoingChannelId: obj["routing_transaction_outgoing_channel"]?.id ?? void 0,
2592
+ fees: !!obj["routing_transaction_fees"] ? CurrencyAmountFromJson(obj["routing_transaction_fees"]) : void 0,
2593
+ failureMessage: !!obj["routing_transaction_failure_message"] ? RichTextFromJson(obj["routing_transaction_failure_message"]) : void 0,
2594
+ failureReason: !!obj["routing_transaction_failure_reason"] ? RoutingTransactionFailureReason_default[obj["routing_transaction_failure_reason"]] ?? RoutingTransactionFailureReason_default.FUTURE_VALUE : null
2595
+ };
2596
+ }
2597
+ if (obj["__typename"] == "Withdrawal") {
2598
+ return {
2599
+ id: obj["withdrawal_id"],
2600
+ createdAt: obj["withdrawal_created_at"],
2601
+ updatedAt: obj["withdrawal_updated_at"],
2602
+ status: TransactionStatus_default[obj["withdrawal_status"]] ?? TransactionStatus_default.FUTURE_VALUE,
2603
+ amount: CurrencyAmountFromJson(obj["withdrawal_amount"]),
2604
+ blockHeight: obj["withdrawal_block_height"],
2605
+ destinationAddresses: obj["withdrawal_destination_addresses"],
2606
+ originId: obj["withdrawal_origin"].id,
2607
+ typename: "Withdrawal",
2608
+ resolvedAt: obj["withdrawal_resolved_at"],
2609
+ transactionHash: obj["withdrawal_transaction_hash"],
2610
+ fees: !!obj["withdrawal_fees"] ? CurrencyAmountFromJson(obj["withdrawal_fees"]) : void 0,
2611
+ blockHash: obj["withdrawal_block_hash"],
2612
+ numConfirmations: obj["withdrawal_num_confirmations"]
2613
+ };
2614
+ }
2615
+ throw new LightsparkException3(
2616
+ "DeserializationError",
2617
+ `Couldn't find a concrete type for interface Transaction corresponding to the typename=${obj["__typename"]}`
2618
+ );
2619
+ };
2620
+ var FRAGMENT18 = `
2621
+ fragment TransactionFragment on Transaction {
2622
+ __typename
2623
+ ... on ChannelClosingTransaction {
2624
+ __typename
2625
+ channel_closing_transaction_id: id
2626
+ channel_closing_transaction_created_at: created_at
2627
+ channel_closing_transaction_updated_at: updated_at
2628
+ channel_closing_transaction_status: status
2629
+ channel_closing_transaction_resolved_at: resolved_at
2630
+ channel_closing_transaction_amount: amount {
2631
+ __typename
2632
+ currency_amount_original_value: original_value
2633
+ currency_amount_original_unit: original_unit
2634
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2635
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2636
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2637
+ }
2638
+ channel_closing_transaction_transaction_hash: transaction_hash
2639
+ channel_closing_transaction_fees: fees {
2640
+ __typename
2641
+ currency_amount_original_value: original_value
2642
+ currency_amount_original_unit: original_unit
2643
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2644
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2645
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2646
+ }
2647
+ channel_closing_transaction_block_hash: block_hash
2648
+ channel_closing_transaction_block_height: block_height
2649
+ channel_closing_transaction_destination_addresses: destination_addresses
2650
+ channel_closing_transaction_num_confirmations: num_confirmations
2651
+ channel_closing_transaction_channel: channel {
2652
+ id
2653
+ }
2654
+ }
2655
+ ... on ChannelOpeningTransaction {
2656
+ __typename
2657
+ channel_opening_transaction_id: id
2658
+ channel_opening_transaction_created_at: created_at
2659
+ channel_opening_transaction_updated_at: updated_at
2660
+ channel_opening_transaction_status: status
2661
+ channel_opening_transaction_resolved_at: resolved_at
2662
+ channel_opening_transaction_amount: amount {
2663
+ __typename
2664
+ currency_amount_original_value: original_value
2665
+ currency_amount_original_unit: original_unit
2666
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2667
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2668
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2669
+ }
2670
+ channel_opening_transaction_transaction_hash: transaction_hash
2671
+ channel_opening_transaction_fees: fees {
2672
+ __typename
2673
+ currency_amount_original_value: original_value
2674
+ currency_amount_original_unit: original_unit
2675
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2676
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2677
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2678
+ }
2679
+ channel_opening_transaction_block_hash: block_hash
2680
+ channel_opening_transaction_block_height: block_height
2681
+ channel_opening_transaction_destination_addresses: destination_addresses
2682
+ channel_opening_transaction_num_confirmations: num_confirmations
2683
+ channel_opening_transaction_channel: channel {
2684
+ id
2685
+ }
2686
+ }
2687
+ ... on Deposit {
2688
+ __typename
2689
+ deposit_id: id
2690
+ deposit_created_at: created_at
2691
+ deposit_updated_at: updated_at
2692
+ deposit_status: status
2693
+ deposit_resolved_at: resolved_at
2694
+ deposit_amount: amount {
2695
+ __typename
2696
+ currency_amount_original_value: original_value
2697
+ currency_amount_original_unit: original_unit
2698
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2699
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2700
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2701
+ }
2702
+ deposit_transaction_hash: transaction_hash
2703
+ deposit_fees: fees {
2704
+ __typename
2705
+ currency_amount_original_value: original_value
2706
+ currency_amount_original_unit: original_unit
2707
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2708
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2709
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2710
+ }
2711
+ deposit_block_hash: block_hash
2712
+ deposit_block_height: block_height
2713
+ deposit_destination_addresses: destination_addresses
2714
+ deposit_num_confirmations: num_confirmations
2715
+ deposit_destination: destination {
2716
+ id
2717
+ }
2718
+ }
2719
+ ... on IncomingPayment {
2720
+ __typename
2721
+ incoming_payment_id: id
2722
+ incoming_payment_created_at: created_at
2723
+ incoming_payment_updated_at: updated_at
2724
+ incoming_payment_status: status
2725
+ incoming_payment_resolved_at: resolved_at
2726
+ incoming_payment_amount: amount {
2727
+ __typename
2728
+ currency_amount_original_value: original_value
2729
+ currency_amount_original_unit: original_unit
2730
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2731
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2732
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2733
+ }
2734
+ incoming_payment_transaction_hash: transaction_hash
2735
+ incoming_payment_origin: origin {
2736
+ id
2737
+ }
2738
+ incoming_payment_destination: destination {
2739
+ id
2740
+ }
2741
+ incoming_payment_payment_request: payment_request {
2742
+ id
2743
+ }
2744
+ }
2745
+ ... on OutgoingPayment {
2746
+ __typename
2747
+ outgoing_payment_id: id
2748
+ outgoing_payment_created_at: created_at
2749
+ outgoing_payment_updated_at: updated_at
2750
+ outgoing_payment_status: status
2751
+ outgoing_payment_resolved_at: resolved_at
2752
+ outgoing_payment_amount: amount {
2753
+ __typename
2754
+ currency_amount_original_value: original_value
2755
+ currency_amount_original_unit: original_unit
2756
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2757
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2758
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2759
+ }
2760
+ outgoing_payment_transaction_hash: transaction_hash
2761
+ outgoing_payment_origin: origin {
2762
+ id
2763
+ }
2764
+ outgoing_payment_destination: destination {
2765
+ id
2766
+ }
2767
+ outgoing_payment_fees: fees {
2768
+ __typename
2769
+ currency_amount_original_value: original_value
2770
+ currency_amount_original_unit: original_unit
2771
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2772
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2773
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2774
+ }
2775
+ outgoing_payment_payment_request_data: payment_request_data {
2776
+ __typename
2777
+ ... on InvoiceData {
2778
+ __typename
2779
+ invoice_data_encoded_payment_request: encoded_payment_request
2780
+ invoice_data_bitcoin_network: bitcoin_network
2781
+ invoice_data_payment_hash: payment_hash
2782
+ invoice_data_amount: amount {
2783
+ __typename
2784
+ currency_amount_original_value: original_value
2785
+ currency_amount_original_unit: original_unit
2786
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2787
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2788
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2789
+ }
2790
+ invoice_data_created_at: created_at
2791
+ invoice_data_expires_at: expires_at
2792
+ invoice_data_destination: destination {
2793
+ __typename
2794
+ ... on GraphNode {
2795
+ __typename
2796
+ graph_node_id: id
2797
+ graph_node_created_at: created_at
2798
+ graph_node_updated_at: updated_at
2799
+ graph_node_alias: alias
2800
+ graph_node_bitcoin_network: bitcoin_network
2801
+ graph_node_color: color
2802
+ graph_node_conductivity: conductivity
2803
+ graph_node_display_name: display_name
2804
+ graph_node_public_key: public_key
2805
+ }
2806
+ ... on LightsparkNode {
2807
+ __typename
2808
+ lightspark_node_id: id
2809
+ lightspark_node_created_at: created_at
2810
+ lightspark_node_updated_at: updated_at
2811
+ lightspark_node_alias: alias
2812
+ lightspark_node_bitcoin_network: bitcoin_network
2813
+ lightspark_node_color: color
2814
+ lightspark_node_conductivity: conductivity
2815
+ lightspark_node_display_name: display_name
2816
+ lightspark_node_public_key: public_key
2817
+ lightspark_node_account: account {
2818
+ id
2819
+ }
2820
+ lightspark_node_blockchain_balance: blockchain_balance {
2821
+ __typename
2822
+ blockchain_balance_total_balance: total_balance {
2823
+ __typename
2824
+ currency_amount_original_value: original_value
2825
+ currency_amount_original_unit: original_unit
2826
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2827
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2828
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2829
+ }
2830
+ blockchain_balance_confirmed_balance: confirmed_balance {
2831
+ __typename
2832
+ currency_amount_original_value: original_value
2833
+ currency_amount_original_unit: original_unit
2834
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2835
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2836
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2837
+ }
2838
+ blockchain_balance_unconfirmed_balance: unconfirmed_balance {
2839
+ __typename
2840
+ currency_amount_original_value: original_value
2841
+ currency_amount_original_unit: original_unit
2842
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2843
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2844
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2845
+ }
2846
+ blockchain_balance_locked_balance: locked_balance {
2847
+ __typename
2848
+ currency_amount_original_value: original_value
2849
+ currency_amount_original_unit: original_unit
2850
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2851
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2852
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2853
+ }
2854
+ blockchain_balance_required_reserve: required_reserve {
2855
+ __typename
2856
+ currency_amount_original_value: original_value
2857
+ currency_amount_original_unit: original_unit
2858
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2859
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2860
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2861
+ }
2862
+ blockchain_balance_available_balance: available_balance {
2863
+ __typename
2864
+ currency_amount_original_value: original_value
2865
+ currency_amount_original_unit: original_unit
2866
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2867
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2868
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2869
+ }
2870
+ }
2871
+ lightspark_node_encrypted_signing_private_key: encrypted_signing_private_key {
2872
+ __typename
2873
+ secret_encrypted_value: encrypted_value
2874
+ secret_cipher: cipher
2875
+ }
2876
+ lightspark_node_total_balance: total_balance {
2877
+ __typename
2878
+ currency_amount_original_value: original_value
2879
+ currency_amount_original_unit: original_unit
2880
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2881
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2882
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2883
+ }
2884
+ lightspark_node_total_local_balance: total_local_balance {
2885
+ __typename
2886
+ currency_amount_original_value: original_value
2887
+ currency_amount_original_unit: original_unit
2888
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2889
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2890
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2891
+ }
2892
+ lightspark_node_local_balance: local_balance {
2893
+ __typename
2894
+ currency_amount_original_value: original_value
2895
+ currency_amount_original_unit: original_unit
2896
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2897
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2898
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2899
+ }
2900
+ lightspark_node_purpose: purpose
2901
+ lightspark_node_remote_balance: remote_balance {
2902
+ __typename
2903
+ currency_amount_original_value: original_value
2904
+ currency_amount_original_unit: original_unit
2905
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2906
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2907
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2908
+ }
2909
+ lightspark_node_status: status
2910
+ }
2911
+ }
2912
+ invoice_data_memo: memo
2913
+ }
2914
+ }
2915
+ outgoing_payment_failure_reason: failure_reason
2916
+ outgoing_payment_failure_message: failure_message {
2917
+ __typename
2918
+ rich_text_text: text
2919
+ }
2920
+ }
2921
+ ... on RoutingTransaction {
2922
+ __typename
2923
+ routing_transaction_id: id
2924
+ routing_transaction_created_at: created_at
2925
+ routing_transaction_updated_at: updated_at
2926
+ routing_transaction_status: status
2927
+ routing_transaction_resolved_at: resolved_at
2928
+ routing_transaction_amount: amount {
2929
+ __typename
2930
+ currency_amount_original_value: original_value
2931
+ currency_amount_original_unit: original_unit
2932
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2933
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2934
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2935
+ }
2936
+ routing_transaction_transaction_hash: transaction_hash
2937
+ routing_transaction_incoming_channel: incoming_channel {
2938
+ id
2939
+ }
2940
+ routing_transaction_outgoing_channel: outgoing_channel {
2941
+ id
2942
+ }
2943
+ routing_transaction_fees: fees {
2944
+ __typename
2945
+ currency_amount_original_value: original_value
2946
+ currency_amount_original_unit: original_unit
2947
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2948
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2949
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2950
+ }
2951
+ routing_transaction_failure_message: failure_message {
2952
+ __typename
2953
+ rich_text_text: text
2954
+ }
2955
+ routing_transaction_failure_reason: failure_reason
2956
+ }
2957
+ ... on Withdrawal {
2958
+ __typename
2959
+ withdrawal_id: id
2960
+ withdrawal_created_at: created_at
2961
+ withdrawal_updated_at: updated_at
2962
+ withdrawal_status: status
2963
+ withdrawal_resolved_at: resolved_at
2964
+ withdrawal_amount: amount {
2965
+ __typename
2966
+ currency_amount_original_value: original_value
2967
+ currency_amount_original_unit: original_unit
2968
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2969
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2970
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2971
+ }
2972
+ withdrawal_transaction_hash: transaction_hash
2973
+ withdrawal_fees: fees {
2974
+ __typename
2975
+ currency_amount_original_value: original_value
2976
+ currency_amount_original_unit: original_unit
2977
+ currency_amount_preferred_currency_unit: preferred_currency_unit
2978
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
2979
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
2980
+ }
2981
+ withdrawal_block_hash: block_hash
2982
+ withdrawal_block_height: block_height
2983
+ withdrawal_destination_addresses: destination_addresses
2984
+ withdrawal_num_confirmations: num_confirmations
2985
+ withdrawal_origin: origin {
2986
+ id
2987
+ }
2988
+ }
2989
+ }`;
2990
+ var getTransactionQuery = (id) => {
2991
+ return {
2992
+ queryPayload: `
2993
+ query GetTransaction($id: ID!) {
2994
+ entity(id: $id) {
2995
+ ... on Transaction {
2996
+ ...TransactionFragment
2997
+ }
2998
+ }
2999
+ }
3000
+
3001
+ ${FRAGMENT18}
3002
+ `,
3003
+ variables: { id },
3004
+ constructObject: (data) => TransactionFromJson(data.entity)
3005
+ };
3006
+ };
3007
+
3008
+ // src/objects/TransactionUpdate.ts
3009
+ var TransactionUpdateFromJson = (obj) => {
3010
+ return {
3011
+ id: obj["id"],
3012
+ createdAt: obj["created_at"],
3013
+ updatedAt: obj["updated_at"],
3014
+ status: TransactionStatus_default[obj["status"]] ?? TransactionStatus_default.FUTURE_VALUE,
3015
+ amount: CurrencyAmountFromJson(obj["amount"]),
3016
+ typename: obj["__typename"] ?? "TransactionUpdate",
3017
+ resolvedAt: obj["resolved_at"],
3018
+ transactionHash: obj["transaction_hash"]
3019
+ };
3020
+ };
3021
+ var FRAGMENT19 = `
3022
+ fragment TransactionUpdateFragment on Transaction {
3023
+ __typename
3024
+ id
3025
+ created_at
3026
+ updated_at
3027
+ status
3028
+ resolved_at
3029
+ amount {
3030
+ __typename
3031
+ currency_amount_original_value: original_value
3032
+ currency_amount_original_unit: original_unit
3033
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3034
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3035
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3036
+ }
3037
+ transaction_hash
3038
+ }`;
3039
+
3040
+ // src/objects/AccountToApiTokensConnection.ts
3041
+ var AccountToApiTokensConnectionFromJson = (obj) => {
3042
+ return {
3043
+ pageInfo: PageInfoFromJson(
3044
+ obj["account_to_api_tokens_connection_page_info"]
3045
+ ),
3046
+ count: obj["account_to_api_tokens_connection_count"],
3047
+ entities: obj["account_to_api_tokens_connection_entities"].map(
3048
+ (e) => ApiTokenFromJson(e)
3049
+ )
3050
+ };
3051
+ };
3052
+
3053
+ // src/objects/AccountToChannelsConnection.ts
3054
+ import autoBind9 from "auto-bind";
3055
+ var AccountToChannelsConnection = class {
3056
+ constructor(count, entities) {
3057
+ this.count = count;
3058
+ this.entities = entities;
3059
+ autoBind9(this);
3060
+ }
3061
+ };
3062
+ var AccountToChannelsConnectionFromJson = (obj) => {
3063
+ return new AccountToChannelsConnection(
3064
+ obj["account_to_channels_connection_count"],
3065
+ obj["account_to_channels_connection_entities"].map(
3066
+ (e) => ChannelFromJson(e)
3067
+ )
3068
+ );
3069
+ };
3070
+ var AccountToChannelsConnection_default = AccountToChannelsConnection;
3071
+
3072
+ // src/objects/AccountToNodesConnection.ts
3073
+ var AccountToNodesConnectionFromJson = (obj) => {
3074
+ return {
3075
+ pageInfo: PageInfoFromJson(obj["account_to_nodes_connection_page_info"]),
3076
+ count: obj["account_to_nodes_connection_count"],
3077
+ entities: obj["account_to_nodes_connection_entities"].map(
3078
+ (e) => LightsparkNodeFromJson(e)
3079
+ ),
3080
+ purpose: !!obj["account_to_nodes_connection_purpose"] ? LightsparkNodePurpose_default[obj["account_to_nodes_connection_purpose"]] ?? LightsparkNodePurpose_default.FUTURE_VALUE : null
3081
+ };
3082
+ };
3083
+
3084
+ // src/objects/PaymentRequestStatus.ts
3085
+ var PaymentRequestStatus = /* @__PURE__ */ ((PaymentRequestStatus2) => {
3086
+ PaymentRequestStatus2["FUTURE_VALUE"] = "FUTURE_VALUE";
3087
+ PaymentRequestStatus2["OPEN"] = "OPEN";
3088
+ PaymentRequestStatus2["CLOSED"] = "CLOSED";
3089
+ return PaymentRequestStatus2;
3090
+ })(PaymentRequestStatus || {});
3091
+ var PaymentRequestStatus_default = PaymentRequestStatus;
3092
+
3093
+ // src/objects/PaymentRequest.ts
3094
+ import { LightsparkException as LightsparkException4 } from "@lightsparkdev/core";
3095
+ var PaymentRequestFromJson = (obj) => {
3096
+ if (obj["__typename"] == "Invoice") {
3097
+ return {
3098
+ id: obj["invoice_id"],
3099
+ createdAt: obj["invoice_created_at"],
3100
+ updatedAt: obj["invoice_updated_at"],
3101
+ data: InvoiceDataFromJson(obj["invoice_data"]),
3102
+ status: PaymentRequestStatus_default[obj["invoice_status"]] ?? PaymentRequestStatus_default.FUTURE_VALUE,
3103
+ typename: "Invoice",
3104
+ amountPaid: !!obj["invoice_amount_paid"] ? CurrencyAmountFromJson(obj["invoice_amount_paid"]) : void 0
3105
+ };
3106
+ }
3107
+ throw new LightsparkException4(
3108
+ "DeserializationError",
3109
+ `Couldn't find a concrete type for interface PaymentRequest corresponding to the typename=${obj["__typename"]}`
3110
+ );
3111
+ };
3112
+ var FRAGMENT20 = `
3113
+ fragment PaymentRequestFragment on PaymentRequest {
3114
+ __typename
3115
+ ... on Invoice {
3116
+ __typename
3117
+ invoice_id: id
3118
+ invoice_created_at: created_at
3119
+ invoice_updated_at: updated_at
3120
+ invoice_data: data {
3121
+ __typename
3122
+ invoice_data_encoded_payment_request: encoded_payment_request
3123
+ invoice_data_bitcoin_network: bitcoin_network
3124
+ invoice_data_payment_hash: payment_hash
3125
+ invoice_data_amount: amount {
3126
+ __typename
3127
+ currency_amount_original_value: original_value
3128
+ currency_amount_original_unit: original_unit
3129
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3130
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3131
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3132
+ }
3133
+ invoice_data_created_at: created_at
3134
+ invoice_data_expires_at: expires_at
3135
+ invoice_data_destination: destination {
3136
+ __typename
3137
+ ... on GraphNode {
3138
+ __typename
3139
+ graph_node_id: id
3140
+ graph_node_created_at: created_at
3141
+ graph_node_updated_at: updated_at
3142
+ graph_node_alias: alias
3143
+ graph_node_bitcoin_network: bitcoin_network
3144
+ graph_node_color: color
3145
+ graph_node_conductivity: conductivity
3146
+ graph_node_display_name: display_name
3147
+ graph_node_public_key: public_key
3148
+ }
3149
+ ... on LightsparkNode {
3150
+ __typename
3151
+ lightspark_node_id: id
3152
+ lightspark_node_created_at: created_at
3153
+ lightspark_node_updated_at: updated_at
3154
+ lightspark_node_alias: alias
3155
+ lightspark_node_bitcoin_network: bitcoin_network
3156
+ lightspark_node_color: color
3157
+ lightspark_node_conductivity: conductivity
3158
+ lightspark_node_display_name: display_name
3159
+ lightspark_node_public_key: public_key
3160
+ lightspark_node_account: account {
3161
+ id
3162
+ }
3163
+ lightspark_node_blockchain_balance: blockchain_balance {
3164
+ __typename
3165
+ blockchain_balance_total_balance: total_balance {
3166
+ __typename
3167
+ currency_amount_original_value: original_value
3168
+ currency_amount_original_unit: original_unit
3169
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3170
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3171
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3172
+ }
3173
+ blockchain_balance_confirmed_balance: confirmed_balance {
3174
+ __typename
3175
+ currency_amount_original_value: original_value
3176
+ currency_amount_original_unit: original_unit
3177
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3178
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3179
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3180
+ }
3181
+ blockchain_balance_unconfirmed_balance: unconfirmed_balance {
3182
+ __typename
3183
+ currency_amount_original_value: original_value
3184
+ currency_amount_original_unit: original_unit
3185
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3186
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3187
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3188
+ }
3189
+ blockchain_balance_locked_balance: locked_balance {
3190
+ __typename
3191
+ currency_amount_original_value: original_value
3192
+ currency_amount_original_unit: original_unit
3193
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3194
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3195
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3196
+ }
3197
+ blockchain_balance_required_reserve: required_reserve {
3198
+ __typename
3199
+ currency_amount_original_value: original_value
3200
+ currency_amount_original_unit: original_unit
3201
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3202
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3203
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3204
+ }
3205
+ blockchain_balance_available_balance: available_balance {
3206
+ __typename
3207
+ currency_amount_original_value: original_value
3208
+ currency_amount_original_unit: original_unit
3209
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3210
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3211
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3212
+ }
3213
+ }
3214
+ lightspark_node_encrypted_signing_private_key: encrypted_signing_private_key {
3215
+ __typename
3216
+ secret_encrypted_value: encrypted_value
3217
+ secret_cipher: cipher
3218
+ }
3219
+ lightspark_node_total_balance: total_balance {
3220
+ __typename
3221
+ currency_amount_original_value: original_value
3222
+ currency_amount_original_unit: original_unit
3223
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3224
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3225
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3226
+ }
3227
+ lightspark_node_total_local_balance: total_local_balance {
3228
+ __typename
3229
+ currency_amount_original_value: original_value
3230
+ currency_amount_original_unit: original_unit
3231
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3232
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3233
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3234
+ }
3235
+ lightspark_node_local_balance: local_balance {
3236
+ __typename
3237
+ currency_amount_original_value: original_value
3238
+ currency_amount_original_unit: original_unit
3239
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3240
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3241
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3242
+ }
3243
+ lightspark_node_purpose: purpose
3244
+ lightspark_node_remote_balance: remote_balance {
3245
+ __typename
3246
+ currency_amount_original_value: original_value
3247
+ currency_amount_original_unit: original_unit
3248
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3249
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3250
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3251
+ }
3252
+ lightspark_node_status: status
3253
+ }
3254
+ }
3255
+ invoice_data_memo: memo
3256
+ }
3257
+ invoice_status: status
3258
+ invoice_amount_paid: amount_paid {
3259
+ __typename
3260
+ currency_amount_original_value: original_value
3261
+ currency_amount_original_unit: original_unit
3262
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3263
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3264
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3265
+ }
3266
+ }
3267
+ }`;
3268
+ var getPaymentRequestQuery = (id) => {
3269
+ return {
3270
+ queryPayload: `
3271
+ query GetPaymentRequest($id: ID!) {
3272
+ entity(id: $id) {
3273
+ ... on PaymentRequest {
3274
+ ...PaymentRequestFragment
3275
+ }
3276
+ }
3277
+ }
3278
+
3279
+ ${FRAGMENT20}
3280
+ `,
3281
+ variables: { id },
3282
+ constructObject: (data) => PaymentRequestFromJson(data.entity)
3283
+ };
3284
+ };
3285
+
3286
+ // src/objects/AccountToPaymentRequestsConnection.ts
3287
+ var AccountToPaymentRequestsConnectionFromJson = (obj) => {
3288
+ return {
3289
+ entities: obj["account_to_payment_requests_connection_entities"].map(
3290
+ (e) => PaymentRequestFromJson(e)
3291
+ ),
3292
+ pageInfo: PageInfoFromJson(
3293
+ obj["account_to_payment_requests_connection_page_info"]
3294
+ ),
3295
+ count: obj["account_to_payment_requests_connection_count"]
3296
+ };
3297
+ };
3298
+
3299
+ // src/objects/AccountToTransactionsConnection.ts
3300
+ var AccountToTransactionsConnectionFromJson = (obj) => {
3301
+ return {
3302
+ count: obj["account_to_transactions_connection_count"],
3303
+ entities: obj["account_to_transactions_connection_entities"].map(
3304
+ (e) => TransactionFromJson(e)
3305
+ ),
3306
+ pageInfo: PageInfoFromJson(
3307
+ obj["account_to_transactions_connection_page_info"]
3308
+ ),
3309
+ profitLoss: !!obj["account_to_transactions_connection_profit_loss"] ? CurrencyAmountFromJson(
3310
+ obj["account_to_transactions_connection_profit_loss"]
3311
+ ) : void 0,
3312
+ averageFeeEarned: !!obj["account_to_transactions_connection_average_fee_earned"] ? CurrencyAmountFromJson(
3313
+ obj["account_to_transactions_connection_average_fee_earned"]
3314
+ ) : void 0,
3315
+ totalAmountTransacted: !!obj["account_to_transactions_connection_total_amount_transacted"] ? CurrencyAmountFromJson(
3316
+ obj["account_to_transactions_connection_total_amount_transacted"]
3317
+ ) : void 0
3318
+ };
3319
+ };
3320
+
3321
+ // src/objects/Account.ts
3322
+ import autoBind10 from "auto-bind";
3323
+ var Account = class {
3324
+ constructor(id, createdAt, updatedAt, typename, name) {
3325
+ this.id = id;
3326
+ this.createdAt = createdAt;
3327
+ this.updatedAt = updatedAt;
3328
+ this.typename = typename;
3329
+ this.name = name;
3330
+ autoBind10(this);
3331
+ }
3332
+ async getApiTokens(client, first = void 0) {
3333
+ return await client.executeRawQuery({
3334
+ queryPayload: `
3335
+ query FetchAccountToApiTokensConnection($first: Int) {
3336
+ current_account {
3337
+ ... on Account {
3338
+ api_tokens(, first: $first) {
3339
+ __typename
3340
+ account_to_api_tokens_connection_page_info: page_info {
3341
+ __typename
3342
+ page_info_has_next_page: has_next_page
3343
+ page_info_has_previous_page: has_previous_page
3344
+ page_info_start_cursor: start_cursor
3345
+ page_info_end_cursor: end_cursor
3346
+ }
3347
+ account_to_api_tokens_connection_count: count
3348
+ account_to_api_tokens_connection_entities: entities {
3349
+ __typename
3350
+ api_token_id: id
3351
+ api_token_created_at: created_at
3352
+ api_token_updated_at: updated_at
3353
+ api_token_client_id: client_id
3354
+ api_token_name: name
3355
+ api_token_permissions: permissions
3356
+ }
3357
+ }
3358
+ }
3359
+ }
3360
+ }
3361
+ `,
3362
+ variables: { first },
3363
+ constructObject: (json) => {
3364
+ const connection = json["current_account"]["api_tokens"];
3365
+ return AccountToApiTokensConnectionFromJson(connection);
3366
+ }
3367
+ });
3368
+ }
3369
+ async getBlockchainBalance(client, bitcoinNetworks = void 0, nodeIds = void 0) {
3370
+ return await client.executeRawQuery({
3371
+ queryPayload: `
3372
+ query FetchAccountBlockchainBalance($bitcoin_networks: [BitcoinNetwork!], $node_ids: [ID!]) {
3373
+ current_account {
3374
+ ... on Account {
3375
+ blockchain_balance(, bitcoin_networks: $bitcoin_networks, node_ids: $node_ids) {
3376
+ __typename
3377
+ blockchain_balance_total_balance: total_balance {
3378
+ __typename
3379
+ currency_amount_original_value: original_value
3380
+ currency_amount_original_unit: original_unit
3381
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3382
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3383
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3384
+ }
3385
+ blockchain_balance_confirmed_balance: confirmed_balance {
3386
+ __typename
3387
+ currency_amount_original_value: original_value
3388
+ currency_amount_original_unit: original_unit
3389
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3390
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3391
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3392
+ }
3393
+ blockchain_balance_unconfirmed_balance: unconfirmed_balance {
3394
+ __typename
3395
+ currency_amount_original_value: original_value
3396
+ currency_amount_original_unit: original_unit
3397
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3398
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3399
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3400
+ }
3401
+ blockchain_balance_locked_balance: locked_balance {
3402
+ __typename
3403
+ currency_amount_original_value: original_value
3404
+ currency_amount_original_unit: original_unit
3405
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3406
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3407
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3408
+ }
3409
+ blockchain_balance_required_reserve: required_reserve {
3410
+ __typename
3411
+ currency_amount_original_value: original_value
3412
+ currency_amount_original_unit: original_unit
3413
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3414
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3415
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3416
+ }
3417
+ blockchain_balance_available_balance: available_balance {
3418
+ __typename
3419
+ currency_amount_original_value: original_value
3420
+ currency_amount_original_unit: original_unit
3421
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3422
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3423
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3424
+ }
3425
+ }
3426
+ }
3427
+ }
3428
+ }
3429
+ `,
3430
+ variables: { bitcoin_networks: bitcoinNetworks, node_ids: nodeIds },
3431
+ constructObject: (json) => {
3432
+ const connection = json["current_account"]["blockchain_balance"];
3433
+ return !!connection ? BlockchainBalanceFromJson(connection) : null;
3434
+ }
3435
+ });
3436
+ }
3437
+ async getConductivity(client, bitcoinNetworks = void 0, nodeIds = void 0) {
3438
+ return await client.executeRawQuery({
3439
+ queryPayload: `
3440
+ query FetchAccountConductivity($bitcoin_networks: [BitcoinNetwork!], $node_ids: [ID!]) {
3441
+ current_account {
3442
+ ... on Account {
3443
+ conductivity(, bitcoin_networks: $bitcoin_networks, node_ids: $node_ids)
3444
+ }
3445
+ }
3446
+ }
3447
+ `,
3448
+ variables: { bitcoin_networks: bitcoinNetworks, node_ids: nodeIds },
3449
+ constructObject: (json) => {
3450
+ const connection = json["current_account"]["conductivity"];
3451
+ return connection;
3452
+ }
3453
+ });
3454
+ }
3455
+ async getLocalBalance(client, bitcoinNetworks = void 0, nodeIds = void 0) {
3456
+ return await client.executeRawQuery({
3457
+ queryPayload: `
3458
+ query FetchAccountLocalBalance($bitcoin_networks: [BitcoinNetwork!], $node_ids: [ID!]) {
3459
+ current_account {
3460
+ ... on Account {
3461
+ local_balance(, bitcoin_networks: $bitcoin_networks, node_ids: $node_ids) {
3462
+ __typename
3463
+ currency_amount_original_value: original_value
3464
+ currency_amount_original_unit: original_unit
3465
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3466
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3467
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3468
+ }
3469
+ }
3470
+ }
3471
+ }
3472
+ `,
3473
+ variables: { bitcoin_networks: bitcoinNetworks, node_ids: nodeIds },
3474
+ constructObject: (json) => {
3475
+ const connection = json["current_account"]["local_balance"];
3476
+ return !!connection ? CurrencyAmountFromJson(connection) : null;
3477
+ }
3478
+ });
3479
+ }
3480
+ async getNodes(client, first = void 0, bitcoinNetworks = void 0, nodeIds = void 0) {
3481
+ return await client.executeRawQuery({
3482
+ queryPayload: `
3483
+ query FetchAccountToNodesConnection($first: Int, $bitcoin_networks: [BitcoinNetwork!], $node_ids: [ID!]) {
3484
+ current_account {
3485
+ ... on Account {
3486
+ nodes(, first: $first, bitcoin_networks: $bitcoin_networks, node_ids: $node_ids) {
3487
+ __typename
3488
+ account_to_nodes_connection_page_info: page_info {
3489
+ __typename
3490
+ page_info_has_next_page: has_next_page
3491
+ page_info_has_previous_page: has_previous_page
3492
+ page_info_start_cursor: start_cursor
3493
+ page_info_end_cursor: end_cursor
3494
+ }
3495
+ account_to_nodes_connection_count: count
3496
+ account_to_nodes_connection_purpose: purpose
3497
+ account_to_nodes_connection_entities: entities {
3498
+ __typename
3499
+ lightspark_node_id: id
3500
+ lightspark_node_created_at: created_at
3501
+ lightspark_node_updated_at: updated_at
3502
+ lightspark_node_alias: alias
3503
+ lightspark_node_bitcoin_network: bitcoin_network
3504
+ lightspark_node_color: color
3505
+ lightspark_node_conductivity: conductivity
3506
+ lightspark_node_display_name: display_name
3507
+ lightspark_node_public_key: public_key
3508
+ lightspark_node_account: account {
3509
+ id
3510
+ }
3511
+ lightspark_node_blockchain_balance: blockchain_balance {
3512
+ __typename
3513
+ blockchain_balance_total_balance: total_balance {
3514
+ __typename
3515
+ currency_amount_original_value: original_value
3516
+ currency_amount_original_unit: original_unit
3517
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3518
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3519
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3520
+ }
3521
+ blockchain_balance_confirmed_balance: confirmed_balance {
3522
+ __typename
3523
+ currency_amount_original_value: original_value
3524
+ currency_amount_original_unit: original_unit
3525
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3526
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3527
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3528
+ }
3529
+ blockchain_balance_unconfirmed_balance: unconfirmed_balance {
3530
+ __typename
3531
+ currency_amount_original_value: original_value
3532
+ currency_amount_original_unit: original_unit
3533
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3534
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3535
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3536
+ }
3537
+ blockchain_balance_locked_balance: locked_balance {
3538
+ __typename
3539
+ currency_amount_original_value: original_value
3540
+ currency_amount_original_unit: original_unit
3541
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3542
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3543
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3544
+ }
3545
+ blockchain_balance_required_reserve: required_reserve {
3546
+ __typename
3547
+ currency_amount_original_value: original_value
3548
+ currency_amount_original_unit: original_unit
3549
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3550
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3551
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3552
+ }
3553
+ blockchain_balance_available_balance: available_balance {
3554
+ __typename
3555
+ currency_amount_original_value: original_value
3556
+ currency_amount_original_unit: original_unit
3557
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3558
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3559
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3560
+ }
3561
+ }
3562
+ lightspark_node_encrypted_signing_private_key: encrypted_signing_private_key {
3563
+ __typename
3564
+ secret_encrypted_value: encrypted_value
3565
+ secret_cipher: cipher
3566
+ }
3567
+ lightspark_node_total_balance: total_balance {
3568
+ __typename
3569
+ currency_amount_original_value: original_value
3570
+ currency_amount_original_unit: original_unit
3571
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3572
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3573
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3574
+ }
3575
+ lightspark_node_total_local_balance: total_local_balance {
3576
+ __typename
3577
+ currency_amount_original_value: original_value
3578
+ currency_amount_original_unit: original_unit
3579
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3580
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3581
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3582
+ }
3583
+ lightspark_node_local_balance: local_balance {
3584
+ __typename
3585
+ currency_amount_original_value: original_value
3586
+ currency_amount_original_unit: original_unit
3587
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3588
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3589
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3590
+ }
3591
+ lightspark_node_purpose: purpose
3592
+ lightspark_node_remote_balance: remote_balance {
3593
+ __typename
3594
+ currency_amount_original_value: original_value
3595
+ currency_amount_original_unit: original_unit
3596
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3597
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3598
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3599
+ }
3600
+ lightspark_node_status: status
3601
+ }
3602
+ }
3603
+ }
3604
+ }
3605
+ }
3606
+ `,
3607
+ variables: {
3608
+ first,
3609
+ bitcoin_networks: bitcoinNetworks,
3610
+ node_ids: nodeIds
3611
+ },
3612
+ constructObject: (json) => {
3613
+ const connection = json["current_account"]["nodes"];
3614
+ return AccountToNodesConnectionFromJson(connection);
3615
+ }
3616
+ });
3617
+ }
3618
+ async getRemoteBalance(client, bitcoinNetworks = void 0, nodeIds = void 0) {
3619
+ return await client.executeRawQuery({
3620
+ queryPayload: `
3621
+ query FetchAccountRemoteBalance($bitcoin_networks: [BitcoinNetwork!], $node_ids: [ID!]) {
3622
+ current_account {
3623
+ ... on Account {
3624
+ remote_balance(, bitcoin_networks: $bitcoin_networks, node_ids: $node_ids) {
3625
+ __typename
3626
+ currency_amount_original_value: original_value
3627
+ currency_amount_original_unit: original_unit
3628
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3629
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3630
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3631
+ }
3632
+ }
3633
+ }
3634
+ }
3635
+ `,
3636
+ variables: { bitcoin_networks: bitcoinNetworks, node_ids: nodeIds },
3637
+ constructObject: (json) => {
3638
+ const connection = json["current_account"]["remote_balance"];
3639
+ return !!connection ? CurrencyAmountFromJson(connection) : null;
3640
+ }
3641
+ });
3642
+ }
3643
+ async getUptimePercentage(client, afterDate = void 0, beforeDate = void 0, bitcoinNetworks = void 0, nodeIds = void 0) {
3644
+ return await client.executeRawQuery({
3645
+ queryPayload: `
3646
+ query FetchAccountUptimePercentage($after_date: DateTime, $before_date: DateTime, $bitcoin_networks: [BitcoinNetwork!], $node_ids: [ID!]) {
3647
+ current_account {
3648
+ ... on Account {
3649
+ uptime_percentage(, after_date: $after_date, before_date: $before_date, bitcoin_networks: $bitcoin_networks, node_ids: $node_ids)
3650
+ }
3651
+ }
3652
+ }
3653
+ `,
3654
+ variables: {
3655
+ after_date: afterDate,
3656
+ before_date: beforeDate,
3657
+ bitcoin_networks: bitcoinNetworks,
3658
+ node_ids: nodeIds
3659
+ },
3660
+ constructObject: (json) => {
3661
+ const connection = json["current_account"]["uptime_percentage"];
3662
+ return connection;
3663
+ }
3664
+ });
3665
+ }
3666
+ async getChannels(client, bitcoinNetwork, lightningNodeId = void 0, afterDate = void 0, beforeDate = void 0, first = void 0) {
3667
+ return await client.executeRawQuery({
3668
+ queryPayload: `
3669
+ query FetchAccountToChannelsConnection($bitcoin_network: BitcoinNetwork!, $lightning_node_id: ID, $after_date: DateTime, $before_date: DateTime, $first: Int) {
3670
+ current_account {
3671
+ ... on Account {
3672
+ channels(, bitcoin_network: $bitcoin_network, lightning_node_id: $lightning_node_id, after_date: $after_date, before_date: $before_date, first: $first) {
3673
+ __typename
3674
+ account_to_channels_connection_count: count
3675
+ account_to_channels_connection_entities: entities {
3676
+ __typename
3677
+ channel_id: id
3678
+ channel_created_at: created_at
3679
+ channel_updated_at: updated_at
3680
+ channel_funding_transaction: funding_transaction {
3681
+ id
3682
+ }
3683
+ channel_capacity: capacity {
3684
+ __typename
3685
+ currency_amount_original_value: original_value
3686
+ currency_amount_original_unit: original_unit
3687
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3688
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3689
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3690
+ }
3691
+ channel_local_balance: local_balance {
3692
+ __typename
3693
+ currency_amount_original_value: original_value
3694
+ currency_amount_original_unit: original_unit
3695
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3696
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3697
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3698
+ }
3699
+ channel_local_unsettled_balance: local_unsettled_balance {
3700
+ __typename
3701
+ currency_amount_original_value: original_value
3702
+ currency_amount_original_unit: original_unit
3703
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3704
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3705
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3706
+ }
3707
+ channel_remote_balance: remote_balance {
3708
+ __typename
3709
+ currency_amount_original_value: original_value
3710
+ currency_amount_original_unit: original_unit
3711
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3712
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3713
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3714
+ }
3715
+ channel_remote_unsettled_balance: remote_unsettled_balance {
3716
+ __typename
3717
+ currency_amount_original_value: original_value
3718
+ currency_amount_original_unit: original_unit
3719
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3720
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3721
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3722
+ }
3723
+ channel_unsettled_balance: unsettled_balance {
3724
+ __typename
3725
+ currency_amount_original_value: original_value
3726
+ currency_amount_original_unit: original_unit
3727
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3728
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3729
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3730
+ }
3731
+ channel_total_balance: total_balance {
3732
+ __typename
3733
+ currency_amount_original_value: original_value
3734
+ currency_amount_original_unit: original_unit
3735
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3736
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3737
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3738
+ }
3739
+ channel_status: status
3740
+ channel_estimated_force_closure_wait_minutes: estimated_force_closure_wait_minutes
3741
+ channel_commit_fee: commit_fee {
3742
+ __typename
3743
+ currency_amount_original_value: original_value
3744
+ currency_amount_original_unit: original_unit
3745
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3746
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3747
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3748
+ }
3749
+ channel_fees: fees {
3750
+ __typename
3751
+ channel_fees_base_fee: base_fee {
3752
+ __typename
3753
+ currency_amount_original_value: original_value
3754
+ currency_amount_original_unit: original_unit
3755
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3756
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3757
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3758
+ }
3759
+ channel_fees_fee_rate_per_mil: fee_rate_per_mil
3760
+ }
3761
+ channel_remote_node: remote_node {
3762
+ id
3763
+ }
3764
+ channel_local_node: local_node {
3765
+ id
3766
+ }
3767
+ channel_short_channel_id: short_channel_id
3768
+ }
3769
+ }
3770
+ }
3771
+ }
3772
+ }
3773
+ `,
3774
+ variables: {
3775
+ bitcoin_network: bitcoinNetwork,
3776
+ lightning_node_id: lightningNodeId,
3777
+ after_date: afterDate,
3778
+ before_date: beforeDate,
3779
+ first
3780
+ },
3781
+ constructObject: (json) => {
3782
+ const connection = json["current_account"]["channels"];
3783
+ return AccountToChannelsConnectionFromJson(connection);
3784
+ }
3785
+ });
3786
+ }
3787
+ async getTransactions(client, first = void 0, after = void 0, types = void 0, afterDate = void 0, beforeDate = void 0, bitcoinNetwork = void 0, lightningNodeId = void 0, statuses = void 0, excludeFailures = void 0) {
3788
+ return await client.executeRawQuery({
3789
+ queryPayload: `
3790
+ query FetchAccountToTransactionsConnection($first: Int, $after: String, $types: [TransactionType!], $after_date: DateTime, $before_date: DateTime, $bitcoin_network: BitcoinNetwork, $lightning_node_id: ID, $statuses: [TransactionStatus!], $exclude_failures: TransactionFailures) {
3791
+ current_account {
3792
+ ... on Account {
3793
+ transactions(, first: $first, after: $after, types: $types, after_date: $after_date, before_date: $before_date, bitcoin_network: $bitcoin_network, lightning_node_id: $lightning_node_id, statuses: $statuses, exclude_failures: $exclude_failures) {
3794
+ __typename
3795
+ account_to_transactions_connection_profit_loss: profit_loss {
3796
+ __typename
3797
+ currency_amount_original_value: original_value
3798
+ currency_amount_original_unit: original_unit
3799
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3800
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3801
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3802
+ }
3803
+ account_to_transactions_connection_average_fee_earned: average_fee_earned {
3804
+ __typename
3805
+ currency_amount_original_value: original_value
3806
+ currency_amount_original_unit: original_unit
3807
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3808
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3809
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3810
+ }
3811
+ account_to_transactions_connection_count: count
3812
+ account_to_transactions_connection_total_amount_transacted: total_amount_transacted {
3813
+ __typename
3814
+ currency_amount_original_value: original_value
3815
+ currency_amount_original_unit: original_unit
3816
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3817
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3818
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3819
+ }
3820
+ account_to_transactions_connection_entities: entities {
3821
+ __typename
3822
+ ... on ChannelClosingTransaction {
3823
+ __typename
3824
+ channel_closing_transaction_id: id
3825
+ channel_closing_transaction_created_at: created_at
3826
+ channel_closing_transaction_updated_at: updated_at
3827
+ channel_closing_transaction_status: status
3828
+ channel_closing_transaction_resolved_at: resolved_at
3829
+ channel_closing_transaction_amount: amount {
3830
+ __typename
3831
+ currency_amount_original_value: original_value
3832
+ currency_amount_original_unit: original_unit
3833
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3834
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3835
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3836
+ }
3837
+ channel_closing_transaction_transaction_hash: transaction_hash
3838
+ channel_closing_transaction_fees: fees {
3839
+ __typename
3840
+ currency_amount_original_value: original_value
3841
+ currency_amount_original_unit: original_unit
3842
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3843
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3844
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3845
+ }
3846
+ channel_closing_transaction_block_hash: block_hash
3847
+ channel_closing_transaction_block_height: block_height
3848
+ channel_closing_transaction_destination_addresses: destination_addresses
3849
+ channel_closing_transaction_num_confirmations: num_confirmations
3850
+ channel_closing_transaction_channel: channel {
3851
+ id
3852
+ }
3853
+ }
3854
+ ... on ChannelOpeningTransaction {
3855
+ __typename
3856
+ channel_opening_transaction_id: id
3857
+ channel_opening_transaction_created_at: created_at
3858
+ channel_opening_transaction_updated_at: updated_at
3859
+ channel_opening_transaction_status: status
3860
+ channel_opening_transaction_resolved_at: resolved_at
3861
+ channel_opening_transaction_amount: amount {
3862
+ __typename
3863
+ currency_amount_original_value: original_value
3864
+ currency_amount_original_unit: original_unit
3865
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3866
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3867
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3868
+ }
3869
+ channel_opening_transaction_transaction_hash: transaction_hash
3870
+ channel_opening_transaction_fees: fees {
3871
+ __typename
3872
+ currency_amount_original_value: original_value
3873
+ currency_amount_original_unit: original_unit
3874
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3875
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3876
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3877
+ }
3878
+ channel_opening_transaction_block_hash: block_hash
3879
+ channel_opening_transaction_block_height: block_height
3880
+ channel_opening_transaction_destination_addresses: destination_addresses
3881
+ channel_opening_transaction_num_confirmations: num_confirmations
3882
+ channel_opening_transaction_channel: channel {
3883
+ id
3884
+ }
3885
+ }
3886
+ ... on Deposit {
3887
+ __typename
3888
+ deposit_id: id
3889
+ deposit_created_at: created_at
3890
+ deposit_updated_at: updated_at
3891
+ deposit_status: status
3892
+ deposit_resolved_at: resolved_at
3893
+ deposit_amount: amount {
3894
+ __typename
3895
+ currency_amount_original_value: original_value
3896
+ currency_amount_original_unit: original_unit
3897
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3898
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3899
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3900
+ }
3901
+ deposit_transaction_hash: transaction_hash
3902
+ deposit_fees: fees {
3903
+ __typename
3904
+ currency_amount_original_value: original_value
3905
+ currency_amount_original_unit: original_unit
3906
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3907
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3908
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3909
+ }
3910
+ deposit_block_hash: block_hash
3911
+ deposit_block_height: block_height
3912
+ deposit_destination_addresses: destination_addresses
3913
+ deposit_num_confirmations: num_confirmations
3914
+ deposit_destination: destination {
3915
+ id
3916
+ }
3917
+ }
3918
+ ... on IncomingPayment {
3919
+ __typename
3920
+ incoming_payment_id: id
3921
+ incoming_payment_created_at: created_at
3922
+ incoming_payment_updated_at: updated_at
3923
+ incoming_payment_status: status
3924
+ incoming_payment_resolved_at: resolved_at
3925
+ incoming_payment_amount: amount {
3926
+ __typename
3927
+ currency_amount_original_value: original_value
3928
+ currency_amount_original_unit: original_unit
3929
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3930
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3931
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3932
+ }
3933
+ incoming_payment_transaction_hash: transaction_hash
3934
+ incoming_payment_origin: origin {
3935
+ id
3936
+ }
3937
+ incoming_payment_destination: destination {
3938
+ id
3939
+ }
3940
+ incoming_payment_payment_request: payment_request {
3941
+ id
3942
+ }
3943
+ }
3944
+ ... on OutgoingPayment {
3945
+ __typename
3946
+ outgoing_payment_id: id
3947
+ outgoing_payment_created_at: created_at
3948
+ outgoing_payment_updated_at: updated_at
3949
+ outgoing_payment_status: status
3950
+ outgoing_payment_resolved_at: resolved_at
3951
+ outgoing_payment_amount: amount {
3952
+ __typename
3953
+ currency_amount_original_value: original_value
3954
+ currency_amount_original_unit: original_unit
3955
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3956
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3957
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3958
+ }
3959
+ outgoing_payment_transaction_hash: transaction_hash
3960
+ outgoing_payment_origin: origin {
3961
+ id
3962
+ }
3963
+ outgoing_payment_destination: destination {
3964
+ id
3965
+ }
3966
+ outgoing_payment_fees: fees {
3967
+ __typename
3968
+ currency_amount_original_value: original_value
3969
+ currency_amount_original_unit: original_unit
3970
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3971
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3972
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3973
+ }
3974
+ outgoing_payment_payment_request_data: payment_request_data {
3975
+ __typename
3976
+ ... on InvoiceData {
3977
+ __typename
3978
+ invoice_data_encoded_payment_request: encoded_payment_request
3979
+ invoice_data_bitcoin_network: bitcoin_network
3980
+ invoice_data_payment_hash: payment_hash
3981
+ invoice_data_amount: amount {
3982
+ __typename
3983
+ currency_amount_original_value: original_value
3984
+ currency_amount_original_unit: original_unit
3985
+ currency_amount_preferred_currency_unit: preferred_currency_unit
3986
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
3987
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
3988
+ }
3989
+ invoice_data_created_at: created_at
3990
+ invoice_data_expires_at: expires_at
3991
+ invoice_data_destination: destination {
3992
+ __typename
3993
+ ... on GraphNode {
3994
+ __typename
3995
+ graph_node_id: id
3996
+ graph_node_created_at: created_at
3997
+ graph_node_updated_at: updated_at
3998
+ graph_node_alias: alias
3999
+ graph_node_bitcoin_network: bitcoin_network
4000
+ graph_node_color: color
4001
+ graph_node_conductivity: conductivity
4002
+ graph_node_display_name: display_name
4003
+ graph_node_public_key: public_key
4004
+ }
4005
+ ... on LightsparkNode {
4006
+ __typename
4007
+ lightspark_node_id: id
4008
+ lightspark_node_created_at: created_at
4009
+ lightspark_node_updated_at: updated_at
4010
+ lightspark_node_alias: alias
4011
+ lightspark_node_bitcoin_network: bitcoin_network
4012
+ lightspark_node_color: color
4013
+ lightspark_node_conductivity: conductivity
4014
+ lightspark_node_display_name: display_name
4015
+ lightspark_node_public_key: public_key
4016
+ lightspark_node_account: account {
4017
+ id
4018
+ }
4019
+ lightspark_node_blockchain_balance: blockchain_balance {
4020
+ __typename
4021
+ blockchain_balance_total_balance: total_balance {
4022
+ __typename
4023
+ currency_amount_original_value: original_value
4024
+ currency_amount_original_unit: original_unit
4025
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4026
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4027
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4028
+ }
4029
+ blockchain_balance_confirmed_balance: confirmed_balance {
4030
+ __typename
4031
+ currency_amount_original_value: original_value
4032
+ currency_amount_original_unit: original_unit
4033
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4034
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4035
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4036
+ }
4037
+ blockchain_balance_unconfirmed_balance: unconfirmed_balance {
4038
+ __typename
4039
+ currency_amount_original_value: original_value
4040
+ currency_amount_original_unit: original_unit
4041
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4042
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4043
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4044
+ }
4045
+ blockchain_balance_locked_balance: locked_balance {
4046
+ __typename
4047
+ currency_amount_original_value: original_value
4048
+ currency_amount_original_unit: original_unit
4049
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4050
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4051
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4052
+ }
4053
+ blockchain_balance_required_reserve: required_reserve {
4054
+ __typename
4055
+ currency_amount_original_value: original_value
4056
+ currency_amount_original_unit: original_unit
4057
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4058
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4059
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4060
+ }
4061
+ blockchain_balance_available_balance: available_balance {
4062
+ __typename
4063
+ currency_amount_original_value: original_value
4064
+ currency_amount_original_unit: original_unit
4065
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4066
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4067
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4068
+ }
4069
+ }
4070
+ lightspark_node_encrypted_signing_private_key: encrypted_signing_private_key {
4071
+ __typename
4072
+ secret_encrypted_value: encrypted_value
4073
+ secret_cipher: cipher
4074
+ }
4075
+ lightspark_node_total_balance: total_balance {
4076
+ __typename
4077
+ currency_amount_original_value: original_value
4078
+ currency_amount_original_unit: original_unit
4079
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4080
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4081
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4082
+ }
4083
+ lightspark_node_total_local_balance: total_local_balance {
4084
+ __typename
4085
+ currency_amount_original_value: original_value
4086
+ currency_amount_original_unit: original_unit
4087
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4088
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4089
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4090
+ }
4091
+ lightspark_node_local_balance: local_balance {
4092
+ __typename
4093
+ currency_amount_original_value: original_value
4094
+ currency_amount_original_unit: original_unit
4095
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4096
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4097
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4098
+ }
4099
+ lightspark_node_purpose: purpose
4100
+ lightspark_node_remote_balance: remote_balance {
4101
+ __typename
4102
+ currency_amount_original_value: original_value
4103
+ currency_amount_original_unit: original_unit
4104
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4105
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4106
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4107
+ }
4108
+ lightspark_node_status: status
4109
+ }
4110
+ }
4111
+ invoice_data_memo: memo
4112
+ }
4113
+ }
4114
+ outgoing_payment_failure_reason: failure_reason
4115
+ outgoing_payment_failure_message: failure_message {
4116
+ __typename
4117
+ rich_text_text: text
4118
+ }
4119
+ }
4120
+ ... on RoutingTransaction {
4121
+ __typename
4122
+ routing_transaction_id: id
4123
+ routing_transaction_created_at: created_at
4124
+ routing_transaction_updated_at: updated_at
4125
+ routing_transaction_status: status
4126
+ routing_transaction_resolved_at: resolved_at
4127
+ routing_transaction_amount: amount {
4128
+ __typename
4129
+ currency_amount_original_value: original_value
4130
+ currency_amount_original_unit: original_unit
4131
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4132
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4133
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4134
+ }
4135
+ routing_transaction_transaction_hash: transaction_hash
4136
+ routing_transaction_incoming_channel: incoming_channel {
4137
+ id
4138
+ }
4139
+ routing_transaction_outgoing_channel: outgoing_channel {
4140
+ id
4141
+ }
4142
+ routing_transaction_fees: fees {
4143
+ __typename
4144
+ currency_amount_original_value: original_value
4145
+ currency_amount_original_unit: original_unit
4146
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4147
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4148
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4149
+ }
4150
+ routing_transaction_failure_message: failure_message {
4151
+ __typename
4152
+ rich_text_text: text
4153
+ }
4154
+ routing_transaction_failure_reason: failure_reason
4155
+ }
4156
+ ... on Withdrawal {
4157
+ __typename
4158
+ withdrawal_id: id
4159
+ withdrawal_created_at: created_at
4160
+ withdrawal_updated_at: updated_at
4161
+ withdrawal_status: status
4162
+ withdrawal_resolved_at: resolved_at
4163
+ withdrawal_amount: amount {
4164
+ __typename
4165
+ currency_amount_original_value: original_value
4166
+ currency_amount_original_unit: original_unit
4167
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4168
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4169
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4170
+ }
4171
+ withdrawal_transaction_hash: transaction_hash
4172
+ withdrawal_fees: fees {
4173
+ __typename
4174
+ currency_amount_original_value: original_value
4175
+ currency_amount_original_unit: original_unit
4176
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4177
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4178
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4179
+ }
4180
+ withdrawal_block_hash: block_hash
4181
+ withdrawal_block_height: block_height
4182
+ withdrawal_destination_addresses: destination_addresses
4183
+ withdrawal_num_confirmations: num_confirmations
4184
+ withdrawal_origin: origin {
4185
+ id
4186
+ }
4187
+ }
4188
+ }
4189
+ account_to_transactions_connection_page_info: page_info {
4190
+ __typename
4191
+ page_info_has_next_page: has_next_page
4192
+ page_info_has_previous_page: has_previous_page
4193
+ page_info_start_cursor: start_cursor
4194
+ page_info_end_cursor: end_cursor
4195
+ }
4196
+ }
4197
+ }
4198
+ }
4199
+ }
4200
+ `,
4201
+ variables: {
4202
+ first,
4203
+ after,
4204
+ types,
4205
+ after_date: afterDate,
4206
+ before_date: beforeDate,
4207
+ bitcoin_network: bitcoinNetwork,
4208
+ lightning_node_id: lightningNodeId,
4209
+ statuses,
4210
+ exclude_failures: excludeFailures
4211
+ },
4212
+ constructObject: (json) => {
4213
+ const connection = json["current_account"]["transactions"];
4214
+ return AccountToTransactionsConnectionFromJson(connection);
4215
+ }
4216
+ });
4217
+ }
4218
+ async getPaymentRequests(client, first = void 0, after = void 0, afterDate = void 0, beforeDate = void 0, bitcoinNetwork = void 0, lightningNodeId = void 0) {
4219
+ return await client.executeRawQuery({
4220
+ queryPayload: `
4221
+ query FetchAccountToPaymentRequestsConnection($first: Int, $after: String, $after_date: DateTime, $before_date: DateTime, $bitcoin_network: BitcoinNetwork, $lightning_node_id: ID) {
4222
+ current_account {
4223
+ ... on Account {
4224
+ payment_requests(, first: $first, after: $after, after_date: $after_date, before_date: $before_date, bitcoin_network: $bitcoin_network, lightning_node_id: $lightning_node_id) {
4225
+ __typename
4226
+ account_to_payment_requests_connection_count: count
4227
+ account_to_payment_requests_connection_entities: entities {
4228
+ __typename
4229
+ ... on Invoice {
4230
+ __typename
4231
+ invoice_id: id
4232
+ invoice_created_at: created_at
4233
+ invoice_updated_at: updated_at
4234
+ invoice_data: data {
4235
+ __typename
4236
+ invoice_data_encoded_payment_request: encoded_payment_request
4237
+ invoice_data_bitcoin_network: bitcoin_network
4238
+ invoice_data_payment_hash: payment_hash
4239
+ invoice_data_amount: amount {
4240
+ __typename
4241
+ currency_amount_original_value: original_value
4242
+ currency_amount_original_unit: original_unit
4243
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4244
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4245
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4246
+ }
4247
+ invoice_data_created_at: created_at
4248
+ invoice_data_expires_at: expires_at
4249
+ invoice_data_destination: destination {
4250
+ __typename
4251
+ ... on GraphNode {
4252
+ __typename
4253
+ graph_node_id: id
4254
+ graph_node_created_at: created_at
4255
+ graph_node_updated_at: updated_at
4256
+ graph_node_alias: alias
4257
+ graph_node_bitcoin_network: bitcoin_network
4258
+ graph_node_color: color
4259
+ graph_node_conductivity: conductivity
4260
+ graph_node_display_name: display_name
4261
+ graph_node_public_key: public_key
4262
+ }
4263
+ ... on LightsparkNode {
4264
+ __typename
4265
+ lightspark_node_id: id
4266
+ lightspark_node_created_at: created_at
4267
+ lightspark_node_updated_at: updated_at
4268
+ lightspark_node_alias: alias
4269
+ lightspark_node_bitcoin_network: bitcoin_network
4270
+ lightspark_node_color: color
4271
+ lightspark_node_conductivity: conductivity
4272
+ lightspark_node_display_name: display_name
4273
+ lightspark_node_public_key: public_key
4274
+ lightspark_node_account: account {
4275
+ id
4276
+ }
4277
+ lightspark_node_blockchain_balance: blockchain_balance {
4278
+ __typename
4279
+ blockchain_balance_total_balance: total_balance {
4280
+ __typename
4281
+ currency_amount_original_value: original_value
4282
+ currency_amount_original_unit: original_unit
4283
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4284
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4285
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4286
+ }
4287
+ blockchain_balance_confirmed_balance: confirmed_balance {
4288
+ __typename
4289
+ currency_amount_original_value: original_value
4290
+ currency_amount_original_unit: original_unit
4291
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4292
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4293
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4294
+ }
4295
+ blockchain_balance_unconfirmed_balance: unconfirmed_balance {
4296
+ __typename
4297
+ currency_amount_original_value: original_value
4298
+ currency_amount_original_unit: original_unit
4299
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4300
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4301
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4302
+ }
4303
+ blockchain_balance_locked_balance: locked_balance {
4304
+ __typename
4305
+ currency_amount_original_value: original_value
4306
+ currency_amount_original_unit: original_unit
4307
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4308
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4309
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4310
+ }
4311
+ blockchain_balance_required_reserve: required_reserve {
4312
+ __typename
4313
+ currency_amount_original_value: original_value
4314
+ currency_amount_original_unit: original_unit
4315
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4316
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4317
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4318
+ }
4319
+ blockchain_balance_available_balance: available_balance {
4320
+ __typename
4321
+ currency_amount_original_value: original_value
4322
+ currency_amount_original_unit: original_unit
4323
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4324
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4325
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4326
+ }
4327
+ }
4328
+ lightspark_node_encrypted_signing_private_key: encrypted_signing_private_key {
4329
+ __typename
4330
+ secret_encrypted_value: encrypted_value
4331
+ secret_cipher: cipher
4332
+ }
4333
+ lightspark_node_total_balance: total_balance {
4334
+ __typename
4335
+ currency_amount_original_value: original_value
4336
+ currency_amount_original_unit: original_unit
4337
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4338
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4339
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4340
+ }
4341
+ lightspark_node_total_local_balance: total_local_balance {
4342
+ __typename
4343
+ currency_amount_original_value: original_value
4344
+ currency_amount_original_unit: original_unit
4345
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4346
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4347
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4348
+ }
4349
+ lightspark_node_local_balance: local_balance {
4350
+ __typename
4351
+ currency_amount_original_value: original_value
4352
+ currency_amount_original_unit: original_unit
4353
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4354
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4355
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4356
+ }
4357
+ lightspark_node_purpose: purpose
4358
+ lightspark_node_remote_balance: remote_balance {
4359
+ __typename
4360
+ currency_amount_original_value: original_value
4361
+ currency_amount_original_unit: original_unit
4362
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4363
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4364
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4365
+ }
4366
+ lightspark_node_status: status
4367
+ }
4368
+ }
4369
+ invoice_data_memo: memo
4370
+ }
4371
+ invoice_status: status
4372
+ invoice_amount_paid: amount_paid {
4373
+ __typename
4374
+ currency_amount_original_value: original_value
4375
+ currency_amount_original_unit: original_unit
4376
+ currency_amount_preferred_currency_unit: preferred_currency_unit
4377
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
4378
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
4379
+ }
4380
+ }
4381
+ }
4382
+ account_to_payment_requests_connection_page_info: page_info {
4383
+ __typename
4384
+ page_info_has_next_page: has_next_page
4385
+ page_info_has_previous_page: has_previous_page
4386
+ page_info_start_cursor: start_cursor
4387
+ page_info_end_cursor: end_cursor
4388
+ }
4389
+ }
4390
+ }
4391
+ }
4392
+ }
4393
+ `,
4394
+ variables: {
4395
+ first,
4396
+ after,
4397
+ after_date: afterDate,
4398
+ before_date: beforeDate,
4399
+ bitcoin_network: bitcoinNetwork,
4400
+ lightning_node_id: lightningNodeId
4401
+ },
4402
+ constructObject: (json) => {
4403
+ const connection = json["current_account"]["payment_requests"];
4404
+ return AccountToPaymentRequestsConnectionFromJson(connection);
4405
+ }
4406
+ });
4407
+ }
4408
+ static getAccountQuery() {
4409
+ return {
4410
+ queryPayload: `
4411
+ query GetAccount {
4412
+ current_account {
4413
+ ... on Account {
4414
+ ...AccountFragment
4415
+ }
4416
+ }
4417
+ }
4418
+
4419
+ ${FRAGMENT21}
4420
+ `,
4421
+ variables: {},
4422
+ constructObject: (data) => AccountFromJson(data.current_account)
4423
+ };
4424
+ }
4425
+ };
4426
+ var AccountFromJson = (obj) => {
4427
+ return new Account(
4428
+ obj["account_id"],
4429
+ obj["account_created_at"],
4430
+ obj["account_updated_at"],
4431
+ "Account",
4432
+ obj["account_name"]
4433
+ );
4434
+ };
4435
+ var FRAGMENT21 = `
4436
+ fragment AccountFragment on Account {
4437
+ __typename
4438
+ account_id: id
4439
+ account_created_at: created_at
4440
+ account_updated_at: updated_at
4441
+ account_name: name
4442
+ }`;
4443
+ var Account_default = Account;
4444
+
4445
+ export {
4446
+ CurrencyUnit_default,
4447
+ CurrencyAmountFromJson,
4448
+ FRAGMENT,
4449
+ FeeEstimateFromJson,
4450
+ FRAGMENT2,
4451
+ Permission_default,
4452
+ ApiTokenFromJson,
4453
+ FRAGMENT3,
4454
+ getApiTokenQuery,
4455
+ BitcoinNetwork_default,
4456
+ NodeAddressType_default,
4457
+ GraphNode_default,
4458
+ LightsparkNodePurpose_default,
4459
+ LightsparkNodeStatus_default,
4460
+ ChannelStatus_default,
4461
+ Channel_default,
4462
+ LightsparkNode_default,
4463
+ Node_default,
4464
+ InvoiceDataFromJson,
4465
+ FRAGMENT8 as FRAGMENT4,
4466
+ FRAGMENT9 as FRAGMENT5,
4467
+ HtlcAttemptFailureCode_default,
4468
+ OutgoingPaymentAttemptStatus_default,
4469
+ getHopQuery,
4470
+ OutgoingPaymentAttempt_default,
4471
+ PaymentFailureReason_default,
4472
+ PaymentRequestDataFromJson,
4473
+ RichTextFromJson,
4474
+ TransactionStatus_default,
4475
+ OutgoingPaymentFromJson,
4476
+ FRAGMENT12 as FRAGMENT6,
4477
+ OutgoingPayment_default,
4478
+ WithdrawalMode_default,
4479
+ WithdrawalRequestStatus_default,
4480
+ getChannelClosingTransactionQuery,
4481
+ getChannelOpeningTransactionQuery,
4482
+ WithdrawalRequestFromJson,
4483
+ FRAGMENT15 as FRAGMENT7,
4484
+ WithdrawalRequest_default,
4485
+ IncomingPaymentAttemptStatus_default,
4486
+ getIncomingPaymentAttemptQuery,
4487
+ IncomingPayment_default,
4488
+ RoutingTransactionFailureReason_default,
4489
+ TransactionFromJson,
4490
+ FRAGMENT18 as FRAGMENT8,
4491
+ getTransactionQuery,
4492
+ TransactionUpdateFromJson,
4493
+ FRAGMENT19 as FRAGMENT9,
4494
+ AccountToChannelsConnection_default,
4495
+ PaymentRequestStatus_default,
4496
+ getPaymentRequestQuery,
4497
+ Account_default
4498
+ };