@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,377 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { Query } from "@lightsparkdev/core";
4
+ import autoBind from "auto-bind";
5
+ import LightsparkClient from "../client.js";
6
+ import BitcoinNetwork from "./BitcoinNetwork.js";
7
+ import BlockchainBalance, {
8
+ BlockchainBalanceFromJson,
9
+ } from "./BlockchainBalance.js";
10
+ import ChannelStatus from "./ChannelStatus.js";
11
+ import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
12
+ import LightsparkNodePurpose from "./LightsparkNodePurpose.js";
13
+ import LightsparkNodeStatus from "./LightsparkNodeStatus.js";
14
+ import LightsparkNodeToChannelsConnection, {
15
+ LightsparkNodeToChannelsConnectionFromJson,
16
+ } from "./LightsparkNodeToChannelsConnection.js";
17
+ import Node from "./Node.js";
18
+ import NodeAddressType from "./NodeAddressType.js";
19
+ import NodeToAddressesConnection, {
20
+ NodeToAddressesConnectionFromJson,
21
+ } from "./NodeToAddressesConnection.js";
22
+ import Secret, { SecretFromJson } from "./Secret.js";
23
+
24
+ /** This is a node that is managed by Lightspark and is managed within the current connected account. It contains many details about the node configuration, state, and metadata. **/
25
+ class LightsparkNode implements Node {
26
+ constructor(
27
+ public readonly id: string,
28
+ public readonly createdAt: string,
29
+ public readonly updatedAt: string,
30
+ public readonly bitcoinNetwork: BitcoinNetwork,
31
+ public readonly displayName: string,
32
+ public readonly accountId: string,
33
+ public readonly typename: string,
34
+ public readonly alias?: string,
35
+ public readonly color?: string,
36
+ public readonly conductivity?: number,
37
+ public readonly publicKey?: string,
38
+ public readonly blockchainBalance?: BlockchainBalance,
39
+ public readonly encryptedSigningPrivateKey?: Secret,
40
+ public readonly totalBalance?: CurrencyAmount,
41
+ public readonly totalLocalBalance?: CurrencyAmount,
42
+ public readonly localBalance?: CurrencyAmount,
43
+ public readonly purpose?: LightsparkNodePurpose,
44
+ public readonly remoteBalance?: CurrencyAmount,
45
+ public readonly status?: LightsparkNodeStatus
46
+ ) {
47
+ autoBind(this);
48
+ }
49
+
50
+ public async getAddresses(
51
+ client: LightsparkClient,
52
+ first: number | undefined = undefined,
53
+ types: NodeAddressType[] | undefined = undefined
54
+ ): Promise<NodeToAddressesConnection> {
55
+ return (await client.executeRawQuery({
56
+ queryPayload: `
57
+ query FetchNodeToAddressesConnection($entity_id: ID!, $first: Int, $types: [NodeAddressType!]) {
58
+ entity(id: $entity_id) {
59
+ ... on LightsparkNode {
60
+ addresses(, first: $first, types: $types) {
61
+ __typename
62
+ node_to_addresses_connection_count: count
63
+ node_to_addresses_connection_entities: entities {
64
+ __typename
65
+ node_address_address: address
66
+ node_address_type: type
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
72
+ `,
73
+ variables: { entity_id: this.id, first: first, types: types },
74
+ constructObject: (json) => {
75
+ const connection = json["entity"]["addresses"];
76
+ return NodeToAddressesConnectionFromJson(connection);
77
+ },
78
+ }))!;
79
+ }
80
+
81
+ public async getChannels(
82
+ client: LightsparkClient,
83
+ first: number | undefined = undefined,
84
+ statuses: ChannelStatus[] | undefined = undefined
85
+ ): Promise<LightsparkNodeToChannelsConnection> {
86
+ return (await client.executeRawQuery({
87
+ queryPayload: `
88
+ query FetchLightsparkNodeToChannelsConnection($entity_id: ID!, $first: Int, $statuses: [ChannelStatus!]) {
89
+ entity(id: $entity_id) {
90
+ ... on LightsparkNode {
91
+ channels(, first: $first, statuses: $statuses) {
92
+ __typename
93
+ lightspark_node_to_channels_connection_page_info: page_info {
94
+ __typename
95
+ page_info_has_next_page: has_next_page
96
+ page_info_has_previous_page: has_previous_page
97
+ page_info_start_cursor: start_cursor
98
+ page_info_end_cursor: end_cursor
99
+ }
100
+ lightspark_node_to_channels_connection_count: count
101
+ lightspark_node_to_channels_connection_entities: entities {
102
+ __typename
103
+ channel_id: id
104
+ channel_created_at: created_at
105
+ channel_updated_at: updated_at
106
+ channel_funding_transaction: funding_transaction {
107
+ id
108
+ }
109
+ channel_capacity: capacity {
110
+ __typename
111
+ currency_amount_original_value: original_value
112
+ currency_amount_original_unit: original_unit
113
+ currency_amount_preferred_currency_unit: preferred_currency_unit
114
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
115
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
116
+ }
117
+ channel_local_balance: local_balance {
118
+ __typename
119
+ currency_amount_original_value: original_value
120
+ currency_amount_original_unit: original_unit
121
+ currency_amount_preferred_currency_unit: preferred_currency_unit
122
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
123
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
124
+ }
125
+ channel_local_unsettled_balance: local_unsettled_balance {
126
+ __typename
127
+ currency_amount_original_value: original_value
128
+ currency_amount_original_unit: original_unit
129
+ currency_amount_preferred_currency_unit: preferred_currency_unit
130
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
131
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
132
+ }
133
+ channel_remote_balance: remote_balance {
134
+ __typename
135
+ currency_amount_original_value: original_value
136
+ currency_amount_original_unit: original_unit
137
+ currency_amount_preferred_currency_unit: preferred_currency_unit
138
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
139
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
140
+ }
141
+ channel_remote_unsettled_balance: remote_unsettled_balance {
142
+ __typename
143
+ currency_amount_original_value: original_value
144
+ currency_amount_original_unit: original_unit
145
+ currency_amount_preferred_currency_unit: preferred_currency_unit
146
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
147
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
148
+ }
149
+ channel_unsettled_balance: unsettled_balance {
150
+ __typename
151
+ currency_amount_original_value: original_value
152
+ currency_amount_original_unit: original_unit
153
+ currency_amount_preferred_currency_unit: preferred_currency_unit
154
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
155
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
156
+ }
157
+ channel_total_balance: total_balance {
158
+ __typename
159
+ currency_amount_original_value: original_value
160
+ currency_amount_original_unit: original_unit
161
+ currency_amount_preferred_currency_unit: preferred_currency_unit
162
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
163
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
164
+ }
165
+ channel_status: status
166
+ channel_estimated_force_closure_wait_minutes: estimated_force_closure_wait_minutes
167
+ channel_commit_fee: commit_fee {
168
+ __typename
169
+ currency_amount_original_value: original_value
170
+ currency_amount_original_unit: original_unit
171
+ currency_amount_preferred_currency_unit: preferred_currency_unit
172
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
173
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
174
+ }
175
+ channel_fees: fees {
176
+ __typename
177
+ channel_fees_base_fee: base_fee {
178
+ __typename
179
+ currency_amount_original_value: original_value
180
+ currency_amount_original_unit: original_unit
181
+ currency_amount_preferred_currency_unit: preferred_currency_unit
182
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
183
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
184
+ }
185
+ channel_fees_fee_rate_per_mil: fee_rate_per_mil
186
+ }
187
+ channel_remote_node: remote_node {
188
+ id
189
+ }
190
+ channel_local_node: local_node {
191
+ id
192
+ }
193
+ channel_short_channel_id: short_channel_id
194
+ }
195
+ }
196
+ }
197
+ }
198
+ }
199
+ `,
200
+ variables: { entity_id: this.id, first: first, statuses: statuses },
201
+ constructObject: (json) => {
202
+ const connection = json["entity"]["channels"];
203
+ return LightsparkNodeToChannelsConnectionFromJson(connection);
204
+ },
205
+ }))!;
206
+ }
207
+
208
+ static getLightsparkNodeQuery(id: string): Query<LightsparkNode> {
209
+ return {
210
+ queryPayload: `
211
+ query GetLightsparkNode($id: ID!) {
212
+ entity(id: $id) {
213
+ ... on LightsparkNode {
214
+ ...LightsparkNodeFragment
215
+ }
216
+ }
217
+ }
218
+
219
+ ${FRAGMENT}
220
+ `,
221
+ variables: { id },
222
+ constructObject: (data: any) => LightsparkNodeFromJson(data.entity),
223
+ };
224
+ }
225
+ }
226
+
227
+ export const LightsparkNodeFromJson = (obj: any): LightsparkNode => {
228
+ return new LightsparkNode(
229
+ obj["lightspark_node_id"],
230
+ obj["lightspark_node_created_at"],
231
+ obj["lightspark_node_updated_at"],
232
+ BitcoinNetwork[obj["lightspark_node_bitcoin_network"]] ??
233
+ BitcoinNetwork.FUTURE_VALUE,
234
+ obj["lightspark_node_display_name"],
235
+ obj["lightspark_node_account"].id,
236
+ "LightsparkNode",
237
+ obj["lightspark_node_alias"],
238
+ obj["lightspark_node_color"],
239
+ obj["lightspark_node_conductivity"],
240
+ obj["lightspark_node_public_key"],
241
+ !!obj["lightspark_node_blockchain_balance"]
242
+ ? BlockchainBalanceFromJson(obj["lightspark_node_blockchain_balance"])
243
+ : undefined,
244
+ !!obj["lightspark_node_encrypted_signing_private_key"]
245
+ ? SecretFromJson(obj["lightspark_node_encrypted_signing_private_key"])
246
+ : undefined,
247
+ !!obj["lightspark_node_total_balance"]
248
+ ? CurrencyAmountFromJson(obj["lightspark_node_total_balance"])
249
+ : undefined,
250
+ !!obj["lightspark_node_total_local_balance"]
251
+ ? CurrencyAmountFromJson(obj["lightspark_node_total_local_balance"])
252
+ : undefined,
253
+ !!obj["lightspark_node_local_balance"]
254
+ ? CurrencyAmountFromJson(obj["lightspark_node_local_balance"])
255
+ : undefined,
256
+ !!obj["lightspark_node_purpose"]
257
+ ? LightsparkNodePurpose[obj["lightspark_node_purpose"]] ??
258
+ LightsparkNodePurpose.FUTURE_VALUE
259
+ : null,
260
+ !!obj["lightspark_node_remote_balance"]
261
+ ? CurrencyAmountFromJson(obj["lightspark_node_remote_balance"])
262
+ : undefined,
263
+ !!obj["lightspark_node_status"]
264
+ ? LightsparkNodeStatus[obj["lightspark_node_status"]] ??
265
+ LightsparkNodeStatus.FUTURE_VALUE
266
+ : null
267
+ );
268
+ };
269
+
270
+ export const FRAGMENT = `
271
+ fragment LightsparkNodeFragment on LightsparkNode {
272
+ __typename
273
+ lightspark_node_id: id
274
+ lightspark_node_created_at: created_at
275
+ lightspark_node_updated_at: updated_at
276
+ lightspark_node_alias: alias
277
+ lightspark_node_bitcoin_network: bitcoin_network
278
+ lightspark_node_color: color
279
+ lightspark_node_conductivity: conductivity
280
+ lightspark_node_display_name: display_name
281
+ lightspark_node_public_key: public_key
282
+ lightspark_node_account: account {
283
+ id
284
+ }
285
+ lightspark_node_blockchain_balance: blockchain_balance {
286
+ __typename
287
+ blockchain_balance_total_balance: total_balance {
288
+ __typename
289
+ currency_amount_original_value: original_value
290
+ currency_amount_original_unit: original_unit
291
+ currency_amount_preferred_currency_unit: preferred_currency_unit
292
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
293
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
294
+ }
295
+ blockchain_balance_confirmed_balance: confirmed_balance {
296
+ __typename
297
+ currency_amount_original_value: original_value
298
+ currency_amount_original_unit: original_unit
299
+ currency_amount_preferred_currency_unit: preferred_currency_unit
300
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
301
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
302
+ }
303
+ blockchain_balance_unconfirmed_balance: unconfirmed_balance {
304
+ __typename
305
+ currency_amount_original_value: original_value
306
+ currency_amount_original_unit: original_unit
307
+ currency_amount_preferred_currency_unit: preferred_currency_unit
308
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
309
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
310
+ }
311
+ blockchain_balance_locked_balance: locked_balance {
312
+ __typename
313
+ currency_amount_original_value: original_value
314
+ currency_amount_original_unit: original_unit
315
+ currency_amount_preferred_currency_unit: preferred_currency_unit
316
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
317
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
318
+ }
319
+ blockchain_balance_required_reserve: required_reserve {
320
+ __typename
321
+ currency_amount_original_value: original_value
322
+ currency_amount_original_unit: original_unit
323
+ currency_amount_preferred_currency_unit: preferred_currency_unit
324
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
325
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
326
+ }
327
+ blockchain_balance_available_balance: available_balance {
328
+ __typename
329
+ currency_amount_original_value: original_value
330
+ currency_amount_original_unit: original_unit
331
+ currency_amount_preferred_currency_unit: preferred_currency_unit
332
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
333
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
334
+ }
335
+ }
336
+ lightspark_node_encrypted_signing_private_key: encrypted_signing_private_key {
337
+ __typename
338
+ secret_encrypted_value: encrypted_value
339
+ secret_cipher: cipher
340
+ }
341
+ lightspark_node_total_balance: total_balance {
342
+ __typename
343
+ currency_amount_original_value: original_value
344
+ currency_amount_original_unit: original_unit
345
+ currency_amount_preferred_currency_unit: preferred_currency_unit
346
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
347
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
348
+ }
349
+ lightspark_node_total_local_balance: total_local_balance {
350
+ __typename
351
+ currency_amount_original_value: original_value
352
+ currency_amount_original_unit: original_unit
353
+ currency_amount_preferred_currency_unit: preferred_currency_unit
354
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
355
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
356
+ }
357
+ lightspark_node_local_balance: local_balance {
358
+ __typename
359
+ currency_amount_original_value: original_value
360
+ currency_amount_original_unit: original_unit
361
+ currency_amount_preferred_currency_unit: preferred_currency_unit
362
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
363
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
364
+ }
365
+ lightspark_node_purpose: purpose
366
+ lightspark_node_remote_balance: remote_balance {
367
+ __typename
368
+ currency_amount_original_value: original_value
369
+ currency_amount_original_unit: original_unit
370
+ currency_amount_preferred_currency_unit: preferred_currency_unit
371
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
372
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
373
+ }
374
+ lightspark_node_status: status
375
+ }`;
376
+
377
+ export default LightsparkNode;
@@ -0,0 +1,17 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ export enum LightsparkNodePurpose {
4
+ /**
5
+ * This is an enum value that represents values that could be added in the future.
6
+ * Clients should support unknown values as more of them could be added without notice.
7
+ */
8
+ FUTURE_VALUE = "FUTURE_VALUE",
9
+
10
+ SEND = "SEND",
11
+
12
+ RECEIVE = "RECEIVE",
13
+
14
+ ROUTING = "ROUTING",
15
+ }
16
+
17
+ export default LightsparkNodePurpose;
@@ -0,0 +1,29 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ export enum LightsparkNodeStatus {
4
+ /**
5
+ * This is an enum value that represents values that could be added in the future.
6
+ * Clients should support unknown values as more of them could be added without notice.
7
+ */
8
+ FUTURE_VALUE = "FUTURE_VALUE",
9
+
10
+ CREATED = "CREATED",
11
+
12
+ DEPLOYED = "DEPLOYED",
13
+
14
+ STARTED = "STARTED",
15
+
16
+ SYNCING = "SYNCING",
17
+
18
+ READY = "READY",
19
+
20
+ STOPPED = "STOPPED",
21
+
22
+ TERMINATED = "TERMINATED",
23
+
24
+ WALLET_LOCKED = "WALLET_LOCKED",
25
+
26
+ FAILED_TO_DEPLOY = "FAILED_TO_DEPLOY",
27
+ }
28
+
29
+ export default LightsparkNodeStatus;
@@ -0,0 +1,50 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import Channel, { ChannelFromJson } from "./Channel.js";
4
+ import PageInfo, { PageInfoFromJson } from "./PageInfo.js";
5
+
6
+ type LightsparkNodeToChannelsConnection = {
7
+ /** An object that holds pagination information about the objects in this connection. **/
8
+ pageInfo: PageInfo;
9
+
10
+ /**
11
+ * The total count of objects in this connection, using the current filters. It is different from the
12
+ * number of objects returned in the current page (in the `entities` field).
13
+ **/
14
+ count: number;
15
+
16
+ /** The channels for the current page of this connection. **/
17
+ entities: Channel[];
18
+ };
19
+
20
+ export const LightsparkNodeToChannelsConnectionFromJson = (
21
+ obj: any
22
+ ): LightsparkNodeToChannelsConnection => {
23
+ return {
24
+ pageInfo: PageInfoFromJson(
25
+ obj["lightspark_node_to_channels_connection_page_info"]
26
+ ),
27
+ count: obj["lightspark_node_to_channels_connection_count"],
28
+ entities: obj["lightspark_node_to_channels_connection_entities"].map((e) =>
29
+ ChannelFromJson(e)
30
+ ),
31
+ } as LightsparkNodeToChannelsConnection;
32
+ };
33
+
34
+ export const FRAGMENT = `
35
+ fragment LightsparkNodeToChannelsConnectionFragment on LightsparkNodeToChannelsConnection {
36
+ __typename
37
+ lightspark_node_to_channels_connection_page_info: page_info {
38
+ __typename
39
+ page_info_has_next_page: has_next_page
40
+ page_info_has_previous_page: has_previous_page
41
+ page_info_start_cursor: start_cursor
42
+ page_info_end_cursor: end_cursor
43
+ }
44
+ lightspark_node_to_channels_connection_count: count
45
+ lightspark_node_to_channels_connection_entities: entities {
46
+ id
47
+ }
48
+ }`;
49
+
50
+ export default LightsparkNodeToChannelsConnection;