@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,13 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as FeeEstimateFragment } from "../objects/FeeEstimate.js";
4
+
5
+ export const BitcoinFeeEstimate = `
6
+ query BitcoinFeeEstimate($bitcoin_network: BitcoinNetwork!) {
7
+ bitcoin_fee_estimate(network: $bitcoin_network) {
8
+ ...FeeEstimateFragment
9
+ }
10
+ }
11
+
12
+ ${FeeEstimateFragment}
13
+ `;
@@ -0,0 +1,22 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as ApiTokenFragment } from "../objects/ApiToken.js";
4
+
5
+ export const CreateApiToken = `
6
+ mutation CreateApiToken(
7
+ $name: String!
8
+ $permissions: [Permission!]!
9
+ ) {
10
+ create_api_token(input: {
11
+ name: $name
12
+ permissions: $permissions
13
+ }) {
14
+ api_token {
15
+ ...ApiTokenFragment
16
+ }
17
+ client_secret
18
+ }
19
+ }
20
+
21
+ ${ApiTokenFragment}
22
+ `;
@@ -0,0 +1,18 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ export const CreateInvoice = `
4
+ mutation CreateInvoice(
5
+ $node_id: ID!
6
+ $amount_msats: Long!
7
+ $memo: String
8
+ $type: InvoiceType = null
9
+ ) {
10
+ create_invoice(input: { node_id: $node_id, amount_msats: $amount_msats, memo: $memo, invoice_type: $type }) {
11
+ invoice {
12
+ data {
13
+ encoded_payment_request
14
+ }
15
+ }
16
+ }
17
+ }
18
+ `;
@@ -0,0 +1,13 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ export const CreateNodeWalletAddress = `
4
+ mutation CreateNodeWalletAddress(
5
+ $node_id: ID!
6
+ ) {
7
+ create_node_wallet_address(input: {
8
+ node_id: $node_id
9
+ }) {
10
+ wallet_address
11
+ }
12
+ }
13
+ `;
@@ -0,0 +1,13 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as AccountFragment } from "../objects/Account.js";
4
+
5
+ export const CurrentAccount = `
6
+ query CurrentAccount {
7
+ current_account {
8
+ ...AccountFragment
9
+ }
10
+ }
11
+
12
+ ${AccountFragment}
13
+ `;
@@ -0,0 +1,16 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as InvoiceDataFragment } from "../objects/InvoiceData.js";
4
+
5
+ export const DecodeInvoice = `
6
+ query DecodeInvoice($encoded_payment_request: String!) {
7
+ decoded_payment_request(encoded_payment_request: $encoded_payment_request) {
8
+ __typename
9
+ ... on InvoiceData {
10
+ ...InvoiceDataFragment
11
+ }
12
+ }
13
+ }
14
+
15
+ ${InvoiceDataFragment}
16
+ `;
@@ -0,0 +1,13 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ export const DeleteApiToken = `
4
+ mutation DeleteApiToken(
5
+ $api_token_id: ID!
6
+ ) {
7
+ delete_api_token(input: {
8
+ api_token_id: $api_token_id
9
+ }) {
10
+ __typename
11
+ }
12
+ }
13
+ `;
@@ -0,0 +1,18 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as CurrencyAmountFragment } from "../objects/CurrencyAmount.js";
4
+
5
+ export const FundNode = `
6
+ mutation FundNode(
7
+ $node_id: ID!,
8
+ $amountSats: Long
9
+ ) {
10
+ fund_node(input: { node_id: $node_id, amount_sats: $amountMsats }) {
11
+ amount {
12
+ ...CurrencyAmountFragment
13
+ }
14
+ }
15
+ }
16
+
17
+ ${CurrencyAmountFragment}
18
+ `;
@@ -0,0 +1,21 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as LightningFeeEstimateFragment } from "../objects/LightningFeeEstimateOutput.js";
4
+
5
+ export const LightningFeeEstimateForInvoice = `
6
+ query LightningFeeEstimateForInvoice(
7
+ $node_id: ID!
8
+ $encoded_payment_request: String!
9
+ $amount_msats: Long
10
+ ) {
11
+ lightning_fee_estimate_for_invoice(input: {
12
+ node_id: $node_id,
13
+ encoded_payment_request: $encoded_payment_request,
14
+ amount_msats: $amount_msats
15
+ }) {
16
+ ...LightningFeeEstimateOutputFragment
17
+ }
18
+ }
19
+
20
+ ${LightningFeeEstimateFragment}
21
+ `;
@@ -0,0 +1,21 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as LightningFeeEstimateFragment } from "../objects/LightningFeeEstimateOutput.js";
4
+
5
+ export const LightningFeeEstimateForNode = `
6
+ query LightningFeeEstimateForNode(
7
+ $node_id: ID!
8
+ $destination_node_public_key: String!
9
+ $amount_msats: Long!
10
+ ) {
11
+ lightning_fee_estimate_for_node(input: {
12
+ node_id: $node_id,
13
+ destination_node_public_key: $destination_node_public_key,
14
+ amount_msats: $amount_msats
15
+ }) {
16
+ ...LightningFeeEstimateOutputFragment
17
+ }
18
+ }
19
+
20
+ ${LightningFeeEstimateFragment}
21
+ `;
@@ -0,0 +1,118 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { Maybe } from "@lightsparkdev/core";
4
+ import CurrencyAmount, {
5
+ FRAGMENT as CurrencyAmountFragment,
6
+ } from "../objects/CurrencyAmount.js";
7
+ import LightsparkNodePurpose from "../objects/LightsparkNodePurpose.js";
8
+ import LightsparkNodeStatus from "../objects/LightsparkNodeStatus.js";
9
+ import NodeAddressType from "../objects/NodeAddressType.js";
10
+
11
+ export type AccountDashboard = {
12
+ id: string;
13
+ name: Maybe<string>;
14
+ nodes: {
15
+ id: string;
16
+ color: Maybe<string>;
17
+ displayName: string;
18
+ purpose: Maybe<LightsparkNodePurpose>;
19
+ publicKey: Maybe<string>;
20
+ status: Maybe<LightsparkNodeStatus>;
21
+ addresses: {
22
+ count: number;
23
+ entities: {
24
+ address: string;
25
+ type: NodeAddressType;
26
+ }[];
27
+ };
28
+ localBalance: Maybe<CurrencyAmount>;
29
+ remoteBalance: Maybe<CurrencyAmount>;
30
+ blockchainBalance: {
31
+ availableBalance: Maybe<CurrencyAmount>;
32
+ totalBalance: Maybe<CurrencyAmount>;
33
+ } | null;
34
+ }[];
35
+ blockchainBalance: Maybe<{
36
+ l1Balance: Maybe<CurrencyAmount>;
37
+ requiredReserve: Maybe<CurrencyAmount>;
38
+ availableBalance: Maybe<CurrencyAmount>;
39
+ unconfirmedBalance: Maybe<CurrencyAmount>;
40
+ }>;
41
+ localBalance: Maybe<CurrencyAmount>;
42
+ remoteBalance: Maybe<CurrencyAmount>;
43
+ };
44
+
45
+ export const MultiNodeDashboard = `
46
+ query MultiNodeDashboard(
47
+ $network: BitcoinNetwork!,
48
+ $nodeIds: [ID!]
49
+ ) {
50
+ current_account {
51
+ id
52
+ name
53
+ dashboard_overview_nodes: nodes(
54
+ bitcoin_networks: [$network]
55
+ node_ids: $nodeIds
56
+ ) {
57
+ count
58
+ entities {
59
+ color
60
+ display_name
61
+ purpose
62
+ id
63
+ addresses(first: 1) {
64
+ entities {
65
+ address
66
+ type
67
+ __typename
68
+ }
69
+ count
70
+ __typename
71
+ }
72
+ public_key
73
+ status
74
+ local_balance {
75
+ ...CurrencyAmountFragment
76
+ }
77
+ remote_balance {
78
+ ...CurrencyAmountFragment
79
+ }
80
+ blockchain_balance {
81
+ available_balance {
82
+ ...CurrencyAmountFragment
83
+ }
84
+ total_balance {
85
+ ...CurrencyAmountFragment
86
+ }
87
+ __typename
88
+ }
89
+ __typename
90
+ }
91
+ __typename
92
+ }
93
+ blockchain_balance(bitcoin_networks: [$network], node_ids: $nodeIds) {
94
+ l1_balance: total_balance {
95
+ ...CurrencyAmountFragment
96
+ }
97
+ required_reserve {
98
+ ...CurrencyAmountFragment
99
+ }
100
+ available_balance {
101
+ ...CurrencyAmountFragment
102
+ }
103
+ unconfirmed_balance {
104
+ ...CurrencyAmountFragment
105
+ }
106
+ __typename
107
+ }
108
+ local_balance(bitcoin_networks: [$network], node_ids: $nodeIds) {
109
+ ...CurrencyAmountFragment
110
+ }
111
+ remote_balance(bitcoin_networks: [$network], node_ids: $nodeIds) {
112
+ ...CurrencyAmountFragment
113
+ }
114
+ }
115
+ }
116
+
117
+ ${CurrencyAmountFragment}
118
+ `;
@@ -0,0 +1,29 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as OutgoingPaymentFragment } from "../objects/OutgoingPayment.js";
4
+
5
+ export const PayInvoice = `
6
+ mutation PayInvoice(
7
+ $node_id: ID!
8
+ $encoded_invoice: String!
9
+ $timeout_secs: Int!
10
+ $maximum_fees_msats: Long!
11
+ $amount_msats: Long
12
+ ) {
13
+ pay_invoice(
14
+ input: {
15
+ node_id: $node_id
16
+ encoded_invoice: $encoded_invoice
17
+ timeout_secs: $timeout_secs
18
+ maximum_fees_msats: $maximum_fees_msats
19
+ amount_msats: $amount_msats
20
+ }
21
+ ) {
22
+ payment {
23
+ ...OutgoingPaymentFragment
24
+ }
25
+ }
26
+ }
27
+
28
+ ${OutgoingPaymentFragment}
29
+ `;
@@ -0,0 +1,15 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ export const RecoverNodeSigningKey = `
4
+ query RecoverNodeSigningKey($nodeId: ID!) {
5
+ entity(id: $nodeId) {
6
+ __typename
7
+ ... on LightsparkNode {
8
+ encrypted_signing_private_key {
9
+ encrypted_value
10
+ cipher
11
+ }
12
+ }
13
+ }
14
+ }
15
+ `;
@@ -0,0 +1,25 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as WithdrawalRequestFragment } from "../objects/WithdrawalRequest.js";
4
+
5
+ export const RequestWithdrawal = `
6
+ mutation RequestWithdrawal(
7
+ $node_id: ID!
8
+ $bitcoin_address: String!
9
+ $amount_sats: Long!
10
+ $withdrawal_mode: WithdrawalMode!
11
+ ) {
12
+ request_withdrawal(input: {
13
+ node_id: $node_id
14
+ bitcoin_address: $bitcoin_address
15
+ amount_sats: $amount_sats
16
+ withdrawal_mode: $withdrawal_mode
17
+ }) {
18
+ request {
19
+ ...WithdrawalRequestFragment
20
+ }
21
+ }
22
+ }
23
+
24
+ ${WithdrawalRequestFragment}
25
+ `;
@@ -0,0 +1,29 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as OutgoingPaymentFragment } from "../objects/OutgoingPayment.js";
4
+
5
+ export const SendPayment = `
6
+ mutation SendPayment(
7
+ $node_id: ID!
8
+ $destination_public_key: String!
9
+ $timeout_secs: Int!
10
+ $amount_msats: Long!
11
+ $maximum_fees_msats: Long!
12
+ ) {
13
+ send_payment(
14
+ input: {
15
+ node_id: $node_id
16
+ destination_public_key: $destination_public_key
17
+ timeout_secs: $timeout_secs
18
+ amount_msats: $amount_msats
19
+ maximum_fees_msats: $maximum_fees_msats
20
+ }
21
+ ) {
22
+ payment {
23
+ ...OutgoingPaymentFragment
24
+ }
25
+ }
26
+ }
27
+
28
+ ${OutgoingPaymentFragment}
29
+ `;
@@ -0,0 +1,116 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as CurrencyAmountFragment } from "../objects/CurrencyAmount.js";
4
+ import { FRAGMENT as TransactionFragment } from "../objects/Transaction.js";
5
+
6
+ export const SingleNodeDashboard = `
7
+ query SingleNodeDashboard(
8
+ $network: BitcoinNetwork!,
9
+ $nodeId: ID!,
10
+ $numTransactions: Int,
11
+ $transactionsAfterDate: DateTime,
12
+ $transactionTypes: [TransactionType!] = [PAYMENT, PAYMENT_REQUEST, ROUTE, L1_WITHDRAW, L1_DEPOSIT]
13
+ $transaction_statuses: [TransactionStatus!] = null
14
+ ) {
15
+ current_account {
16
+ id
17
+ name
18
+ dashboard_overview_nodes: nodes(
19
+ first: 1
20
+ bitcoin_networks: [$network]
21
+ node_ids: [$nodeId]
22
+ ) {
23
+ count
24
+ entities {
25
+ color
26
+ display_name
27
+ purpose
28
+ id
29
+ addresses(first: 1) {
30
+ entities {
31
+ address
32
+ type
33
+ __typename
34
+ }
35
+ count
36
+ __typename
37
+ }
38
+ public_key
39
+ status
40
+ total_local_balance {
41
+ ...CurrencyAmountFragment
42
+ }
43
+ local_balance {
44
+ ...CurrencyAmountFragment
45
+ }
46
+ remote_balance {
47
+ ...CurrencyAmountFragment
48
+ }
49
+ blockchain_balance {
50
+ confirmed_balance {
51
+ ...CurrencyAmountFragment
52
+ }
53
+ unconfirmed_balance {
54
+ ...CurrencyAmountFragment
55
+ }
56
+ available_balance {
57
+ ...CurrencyAmountFragment
58
+ }
59
+ total_balance {
60
+ ...CurrencyAmountFragment
61
+ }
62
+ __typename
63
+ }
64
+ __typename
65
+ }
66
+ __typename
67
+ }
68
+ blockchain_balance(bitcoin_networks: [$network], node_ids: [$nodeId]) {
69
+ total_balance: total_balance {
70
+ ...CurrencyAmountFragment
71
+ }
72
+ required_reserve {
73
+ ...CurrencyAmountFragment
74
+ }
75
+ available_balance {
76
+ ...CurrencyAmountFragment
77
+ }
78
+ unconfirmed_balance {
79
+ ...CurrencyAmountFragment
80
+ }
81
+ confirmed_balance {
82
+ ...CurrencyAmountFragment
83
+ }
84
+ __typename
85
+ }
86
+ local_balance(bitcoin_networks: [$network], node_ids: [$nodeId]) {
87
+ ...CurrencyAmountFragment
88
+ }
89
+ remote_balance(bitcoin_networks: [$network], node_ids: [$nodeId]) {
90
+ ...CurrencyAmountFragment
91
+ }
92
+ recent_transactions: transactions(
93
+ first: $numTransactions
94
+ types: $transactionTypes
95
+ bitcoin_network: $network
96
+ lightning_node_id: $nodeId
97
+ statuses: $transaction_statuses
98
+ after_date: $transactionsAfterDate
99
+ ) {
100
+ count
101
+ total_amount_transacted {
102
+ ...CurrencyAmountFragment
103
+ }
104
+ entities {
105
+ ...TransactionFragment
106
+ __typename
107
+ }
108
+ __typename
109
+ }
110
+ __typename
111
+ }
112
+ }
113
+
114
+ ${TransactionFragment}
115
+ ${CurrencyAmountFragment}
116
+ `;
@@ -0,0 +1,16 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as TransactionUpdateFragment } from "../objects/TransactionUpdate.js";
4
+
5
+ export const TransactionSubscription = `
6
+ subscription TransactionSubscription(
7
+ $nodeIds: [ID!]!
8
+ ) {
9
+ transactions(node_ids: $nodeIds) {
10
+ ...TransactionUpdateFragment
11
+ __typename
12
+ }
13
+ }
14
+
15
+ ${TransactionUpdateFragment}
16
+ `;
@@ -0,0 +1,42 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ import { FRAGMENT as CurrencyAmountFragment } from "../objects/CurrencyAmount.js";
4
+ import { FRAGMENT as TransactionFragment } from "../objects/Transaction.js";
5
+
6
+ export const TransactionsForNode = `
7
+ query TransactionsForNode(
8
+ $network: BitcoinNetwork!,
9
+ $nodeId: ID!,
10
+ $numTransactions: Int,
11
+ $afterDate: DateTime,
12
+ $transactionTypes: [TransactionType!] = [PAYMENT, PAYMENT_REQUEST, ROUTE, L1_WITHDRAW, L1_DEPOSIT]
13
+ $transaction_statuses: [TransactionStatus!] = null
14
+ ) {
15
+ current_account {
16
+ id
17
+ name
18
+ recent_transactions: transactions(
19
+ first: $numTransactions
20
+ types: $transactionTypes
21
+ bitcoin_network: $network
22
+ lightning_node_id: $nodeId
23
+ statuses: $transaction_statuses
24
+ after_date: $afterDate
25
+ ) {
26
+ count
27
+ total_amount_transacted {
28
+ ...CurrencyAmountFragment
29
+ }
30
+ entities {
31
+ ...TransactionFragment
32
+ __typename
33
+ }
34
+ __typename
35
+ }
36
+ __typename
37
+ }
38
+ }
39
+
40
+ ${TransactionFragment}
41
+ ${CurrencyAmountFragment}
42
+ `;
package/src/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
+
3
+ export * from "./auth/index.js";
4
+ export { default as LightsparkClient } from "./client.js";
5
+ export * from "./objects/index.js";