@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,86 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
4
+
5
+ type ChannelToTransactionsConnection = {
6
+ /**
7
+ * The total count of objects in this connection, using the current filters. It is different from the
8
+ * number of objects returned in the current page (in the `entities` field).
9
+ **/
10
+ count: number;
11
+
12
+ /**
13
+ * The average fee for the transactions that transited through this channel, according to the filters
14
+ * and constraints of the connection.
15
+ **/
16
+ averageFee?: CurrencyAmount;
17
+
18
+ /**
19
+ * The total amount transacted for the transactions that transited through this channel, according to
20
+ * the filters and constraints of the connection.
21
+ **/
22
+ totalAmountTransacted?: CurrencyAmount;
23
+
24
+ /**
25
+ * The total amount of fees for the transactions that transited through this channel, according to the
26
+ * filters and constraints of the connection.
27
+ **/
28
+ totalFees?: CurrencyAmount;
29
+ };
30
+
31
+ export const ChannelToTransactionsConnectionFromJson = (
32
+ obj: any
33
+ ): ChannelToTransactionsConnection => {
34
+ return {
35
+ count: obj["channel_to_transactions_connection_count"],
36
+ averageFee: !!obj["channel_to_transactions_connection_average_fee"]
37
+ ? CurrencyAmountFromJson(
38
+ obj["channel_to_transactions_connection_average_fee"]
39
+ )
40
+ : undefined,
41
+ totalAmountTransacted: !!obj[
42
+ "channel_to_transactions_connection_total_amount_transacted"
43
+ ]
44
+ ? CurrencyAmountFromJson(
45
+ obj["channel_to_transactions_connection_total_amount_transacted"]
46
+ )
47
+ : undefined,
48
+ totalFees: !!obj["channel_to_transactions_connection_total_fees"]
49
+ ? CurrencyAmountFromJson(
50
+ obj["channel_to_transactions_connection_total_fees"]
51
+ )
52
+ : undefined,
53
+ } as ChannelToTransactionsConnection;
54
+ };
55
+
56
+ export const FRAGMENT = `
57
+ fragment ChannelToTransactionsConnectionFragment on ChannelToTransactionsConnection {
58
+ __typename
59
+ channel_to_transactions_connection_count: count
60
+ channel_to_transactions_connection_average_fee: average_fee {
61
+ __typename
62
+ currency_amount_original_value: original_value
63
+ currency_amount_original_unit: original_unit
64
+ currency_amount_preferred_currency_unit: preferred_currency_unit
65
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
66
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
67
+ }
68
+ channel_to_transactions_connection_total_amount_transacted: total_amount_transacted {
69
+ __typename
70
+ currency_amount_original_value: original_value
71
+ currency_amount_original_unit: original_unit
72
+ currency_amount_preferred_currency_unit: preferred_currency_unit
73
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
74
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
75
+ }
76
+ channel_to_transactions_connection_total_fees: total_fees {
77
+ __typename
78
+ currency_amount_original_value: original_value
79
+ currency_amount_original_unit: original_unit
80
+ currency_amount_preferred_currency_unit: preferred_currency_unit
81
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
82
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
83
+ }
84
+ }`;
85
+
86
+ export default ChannelToTransactionsConnection;
@@ -0,0 +1,22 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import Permission from "./Permission.js";
4
+
5
+ type CreateApiTokenInput = {
6
+ /** An arbitrary name that the user can choose to identify the API token in a list. **/
7
+ name: string;
8
+
9
+ /** List of permissions to grant to the API token **/
10
+ permissions: Permission[];
11
+ };
12
+
13
+ export const CreateApiTokenInputFromJson = (obj: any): CreateApiTokenInput => {
14
+ return {
15
+ name: obj["create_api_token_input_name"],
16
+ permissions: obj["create_api_token_input_permissions"].map(
17
+ (e) => Permission[e]
18
+ ),
19
+ } as CreateApiTokenInput;
20
+ };
21
+
22
+ export default CreateApiTokenInput;
@@ -0,0 +1,41 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import ApiToken, { ApiTokenFromJson } from "./ApiToken.js";
4
+
5
+ type CreateApiTokenOutput = {
6
+ /** The API Token that has been created. **/
7
+ apiToken: ApiToken;
8
+
9
+ /**
10
+ * The secret that should be used to authenticate against our API. This secret is not stored and will
11
+ * never be available again after this. You must keep this secret secure as it grants access to your
12
+ * account.
13
+ **/
14
+ clientSecret: string;
15
+ };
16
+
17
+ export const CreateApiTokenOutputFromJson = (
18
+ obj: any
19
+ ): CreateApiTokenOutput => {
20
+ return {
21
+ apiToken: ApiTokenFromJson(obj["create_api_token_output_api_token"]),
22
+ clientSecret: obj["create_api_token_output_client_secret"],
23
+ } as CreateApiTokenOutput;
24
+ };
25
+
26
+ export const FRAGMENT = `
27
+ fragment CreateApiTokenOutputFragment on CreateApiTokenOutput {
28
+ __typename
29
+ create_api_token_output_api_token: api_token {
30
+ __typename
31
+ api_token_id: id
32
+ api_token_created_at: created_at
33
+ api_token_updated_at: updated_at
34
+ api_token_client_id: client_id
35
+ api_token_name: name
36
+ api_token_permissions: permissions
37
+ }
38
+ create_api_token_output_client_secret: client_secret
39
+ }`;
40
+
41
+ export default CreateApiTokenOutput;
@@ -0,0 +1,27 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import InvoiceType from "./InvoiceType.js";
4
+
5
+ type CreateInvoiceInput = {
6
+ nodeId: string;
7
+
8
+ amountMsats: number;
9
+
10
+ memo?: string;
11
+
12
+ invoiceType?: InvoiceType;
13
+ };
14
+
15
+ export const CreateInvoiceInputFromJson = (obj: any): CreateInvoiceInput => {
16
+ return {
17
+ nodeId: obj["create_invoice_input_node_id"],
18
+ amountMsats: obj["create_invoice_input_amount_msats"],
19
+ memo: obj["create_invoice_input_memo"],
20
+ invoiceType: !!obj["create_invoice_input_invoice_type"]
21
+ ? InvoiceType[obj["create_invoice_input_invoice_type"]] ??
22
+ InvoiceType.FUTURE_VALUE
23
+ : null,
24
+ } as CreateInvoiceInput;
25
+ };
26
+
27
+ export default CreateInvoiceInput;
@@ -0,0 +1,21 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ type CreateInvoiceOutput = {
4
+ invoiceId: string;
5
+ };
6
+
7
+ export const CreateInvoiceOutputFromJson = (obj: any): CreateInvoiceOutput => {
8
+ return {
9
+ invoiceId: obj["create_invoice_output_invoice"].id,
10
+ } as CreateInvoiceOutput;
11
+ };
12
+
13
+ export const FRAGMENT = `
14
+ fragment CreateInvoiceOutputFragment on CreateInvoiceOutput {
15
+ __typename
16
+ create_invoice_output_invoice: invoice {
17
+ id
18
+ }
19
+ }`;
20
+
21
+ export default CreateInvoiceOutput;
@@ -0,0 +1,15 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ type CreateNodeWalletAddressInput = {
4
+ nodeId: string;
5
+ };
6
+
7
+ export const CreateNodeWalletAddressInputFromJson = (
8
+ obj: any
9
+ ): CreateNodeWalletAddressInput => {
10
+ return {
11
+ nodeId: obj["create_node_wallet_address_input_node_id"],
12
+ } as CreateNodeWalletAddressInput;
13
+ };
14
+
15
+ export default CreateNodeWalletAddressInput;
@@ -0,0 +1,27 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ type CreateNodeWalletAddressOutput = {
4
+ nodeId: string;
5
+
6
+ walletAddress: string;
7
+ };
8
+
9
+ export const CreateNodeWalletAddressOutputFromJson = (
10
+ obj: any
11
+ ): CreateNodeWalletAddressOutput => {
12
+ return {
13
+ nodeId: obj["create_node_wallet_address_output_node"].id,
14
+ walletAddress: obj["create_node_wallet_address_output_wallet_address"],
15
+ } as CreateNodeWalletAddressOutput;
16
+ };
17
+
18
+ export const FRAGMENT = `
19
+ fragment CreateNodeWalletAddressOutputFragment on CreateNodeWalletAddressOutput {
20
+ __typename
21
+ create_node_wallet_address_output_node: node {
22
+ id
23
+ }
24
+ create_node_wallet_address_output_wallet_address: wallet_address
25
+ }`;
26
+
27
+ export default CreateNodeWalletAddressOutput;
@@ -0,0 +1,55 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import CurrencyUnit from "./CurrencyUnit.js";
4
+
5
+ /** Represents the value and unit for an amount of currency. **/
6
+ type CurrencyAmount = {
7
+ /** The original numeric value for this CurrencyAmount. **/
8
+ originalValue: number;
9
+
10
+ /** The original unit of currency for this CurrencyAmount. **/
11
+ originalUnit: CurrencyUnit;
12
+
13
+ /** The unit of user's preferred currency. **/
14
+ preferredCurrencyUnit: CurrencyUnit;
15
+
16
+ /**
17
+ * The rounded numeric value for this CurrencyAmount in the very base level of user's preferred
18
+ * currency. For example, for USD, the value will be in cents.
19
+ **/
20
+ preferredCurrencyValueRounded: number;
21
+
22
+ /**
23
+ * The approximate float value for this CurrencyAmount in the very base level of user's preferred
24
+ * currency. For example, for USD, the value will be in cents.
25
+ **/
26
+ preferredCurrencyValueApprox: number;
27
+ };
28
+
29
+ export const CurrencyAmountFromJson = (obj: any): CurrencyAmount => {
30
+ return {
31
+ originalValue: obj["currency_amount_original_value"],
32
+ originalUnit:
33
+ CurrencyUnit[obj["currency_amount_original_unit"]] ??
34
+ CurrencyUnit.FUTURE_VALUE,
35
+ preferredCurrencyUnit:
36
+ CurrencyUnit[obj["currency_amount_preferred_currency_unit"]] ??
37
+ CurrencyUnit.FUTURE_VALUE,
38
+ preferredCurrencyValueRounded:
39
+ obj["currency_amount_preferred_currency_value_rounded"],
40
+ preferredCurrencyValueApprox:
41
+ obj["currency_amount_preferred_currency_value_approx"],
42
+ } as CurrencyAmount;
43
+ };
44
+
45
+ export const FRAGMENT = `
46
+ fragment CurrencyAmountFragment on CurrencyAmount {
47
+ __typename
48
+ currency_amount_original_value: original_value
49
+ currency_amount_original_unit: original_unit
50
+ currency_amount_preferred_currency_unit: preferred_currency_unit
51
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
52
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
53
+ }`;
54
+
55
+ export default CurrencyAmount;
@@ -0,0 +1,25 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ export enum CurrencyUnit {
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
+ /** Bitcoin is the cryptocurrency native to the Bitcoin network. It is used as the native medium for value transfer for the Lightning Network. **/
10
+ BITCOIN = "BITCOIN",
11
+ /** 0.00000001 (10e-8) Bitcoin or one hundred millionth of a Bitcoin. This is the unit most commonly used in Lightning transactions. **/
12
+ SATOSHI = "SATOSHI",
13
+ /** 0.001 Satoshi, or 10e-11 Bitcoin. We recommend using the Satoshi unit instead when possible. **/
14
+ MILLISATOSHI = "MILLISATOSHI",
15
+ /** United States Dollar. **/
16
+ USD = "USD",
17
+ /** 0.000000001 (10e-9) Bitcoin or a billionth of a Bitcoin. We recommend using the Satoshi unit instead when possible. **/
18
+ NANOBITCOIN = "NANOBITCOIN",
19
+ /** 0.000001 (10e-6) Bitcoin or a millionth of a Bitcoin. We recommend using the Satoshi unit instead when possible. **/
20
+ MICROBITCOIN = "MICROBITCOIN",
21
+ /** 0.001 (10e-3) Bitcoin or a thousandth of a Bitcoin. We recommend using the Satoshi unit instead when possible. **/
22
+ MILLIBITCOIN = "MILLIBITCOIN",
23
+ }
24
+
25
+ export default CurrencyUnit;
@@ -0,0 +1,13 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ type DeleteApiTokenInput = {
4
+ apiTokenId: string;
5
+ };
6
+
7
+ export const DeleteApiTokenInputFromJson = (obj: any): DeleteApiTokenInput => {
8
+ return {
9
+ apiTokenId: obj["delete_api_token_input_api_token_id"],
10
+ } as DeleteApiTokenInput;
11
+ };
12
+
13
+ export default DeleteApiTokenInput;
@@ -0,0 +1,23 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ type DeleteApiTokenOutput = {
4
+ accountId: string;
5
+ };
6
+
7
+ export const DeleteApiTokenOutputFromJson = (
8
+ obj: any
9
+ ): DeleteApiTokenOutput => {
10
+ return {
11
+ accountId: obj["delete_api_token_output_account"].id,
12
+ } as DeleteApiTokenOutput;
13
+ };
14
+
15
+ export const FRAGMENT = `
16
+ fragment DeleteApiTokenOutputFragment on DeleteApiTokenOutput {
17
+ __typename
18
+ delete_api_token_output_account: account {
19
+ id
20
+ }
21
+ }`;
22
+
23
+ export default DeleteApiTokenOutput;
@@ -0,0 +1,144 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { Query } from "@lightsparkdev/core";
4
+ import CurrencyAmount, { CurrencyAmountFromJson } from "./CurrencyAmount.js";
5
+ import Entity from "./Entity.js";
6
+ import OnChainTransaction from "./OnChainTransaction.js";
7
+ import Transaction from "./Transaction.js";
8
+ import TransactionStatus from "./TransactionStatus.js";
9
+
10
+ /** The transaction on Bitcoin blockchain to fund the Lightspark node's wallet. **/
11
+ type Deposit = OnChainTransaction &
12
+ Transaction &
13
+ Entity & {
14
+ /**
15
+ * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
16
+ * string.
17
+ **/
18
+ id: string;
19
+
20
+ /** The date and time when this transaction was initiated. **/
21
+ createdAt: string;
22
+
23
+ /** The date and time when the entity was last updated. **/
24
+ updatedAt: string;
25
+
26
+ /** The current status of this transaction. **/
27
+ status: TransactionStatus;
28
+
29
+ /** The amount of money involved in this transaction. **/
30
+ amount: CurrencyAmount;
31
+
32
+ /**
33
+ * The height of the block that included this transaction. This will be zero for unconfirmed
34
+ * transactions.
35
+ **/
36
+ blockHeight: number;
37
+
38
+ /** The Bitcoin blockchain addresses this transaction was sent to. **/
39
+ destinationAddresses: string[];
40
+
41
+ /** The recipient Lightspark node this deposit was sent to. **/
42
+ destinationId: string;
43
+
44
+ /** The typename of the object **/
45
+ typename: string;
46
+
47
+ /** The date and time when this transaction was completed or failed. **/
48
+ resolvedAt?: string;
49
+
50
+ /** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
51
+ transactionHash?: string;
52
+
53
+ /**
54
+ * The fees that were paid by the wallet sending the transaction to commit it to the Bitcoin
55
+ * blockchain.
56
+ **/
57
+ fees?: CurrencyAmount;
58
+
59
+ /**
60
+ * The hash of the block that included this transaction. This will be null for unconfirmed
61
+ * transactions.
62
+ **/
63
+ blockHash?: string;
64
+
65
+ /** The number of blockchain confirmations for this transaction in real time. **/
66
+ numConfirmations?: number;
67
+ };
68
+
69
+ export const DepositFromJson = (obj: any): Deposit => {
70
+ return {
71
+ id: obj["deposit_id"],
72
+ createdAt: obj["deposit_created_at"],
73
+ updatedAt: obj["deposit_updated_at"],
74
+ status:
75
+ TransactionStatus[obj["deposit_status"]] ??
76
+ TransactionStatus.FUTURE_VALUE,
77
+ amount: CurrencyAmountFromJson(obj["deposit_amount"]),
78
+ blockHeight: obj["deposit_block_height"],
79
+ destinationAddresses: obj["deposit_destination_addresses"],
80
+ destinationId: obj["deposit_destination"].id,
81
+ typename: "Deposit",
82
+ resolvedAt: obj["deposit_resolved_at"],
83
+ transactionHash: obj["deposit_transaction_hash"],
84
+ fees: !!obj["deposit_fees"]
85
+ ? CurrencyAmountFromJson(obj["deposit_fees"])
86
+ : undefined,
87
+ blockHash: obj["deposit_block_hash"],
88
+ numConfirmations: obj["deposit_num_confirmations"],
89
+ } as Deposit;
90
+ };
91
+
92
+ export const FRAGMENT = `
93
+ fragment DepositFragment on Deposit {
94
+ __typename
95
+ deposit_id: id
96
+ deposit_created_at: created_at
97
+ deposit_updated_at: updated_at
98
+ deposit_status: status
99
+ deposit_resolved_at: resolved_at
100
+ deposit_amount: amount {
101
+ __typename
102
+ currency_amount_original_value: original_value
103
+ currency_amount_original_unit: original_unit
104
+ currency_amount_preferred_currency_unit: preferred_currency_unit
105
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
106
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
107
+ }
108
+ deposit_transaction_hash: transaction_hash
109
+ deposit_fees: fees {
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
+ deposit_block_hash: block_hash
118
+ deposit_block_height: block_height
119
+ deposit_destination_addresses: destination_addresses
120
+ deposit_num_confirmations: num_confirmations
121
+ deposit_destination: destination {
122
+ id
123
+ }
124
+ }`;
125
+
126
+ export const getDepositQuery = (id: string): Query<Deposit> => {
127
+ return {
128
+ queryPayload: `
129
+ query GetDeposit($id: ID!) {
130
+ entity(id: $id) {
131
+ ... on Deposit {
132
+ ...DepositFragment
133
+ }
134
+ }
135
+ }
136
+
137
+ ${FRAGMENT}
138
+ `,
139
+ variables: { id },
140
+ constructObject: (data: any) => DepositFromJson(data.entity),
141
+ };
142
+ };
143
+
144
+ export default Deposit;