@lightsparkdev/lightspark-sdk 1.1.7 → 1.2.0

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 (121) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/{chunk-7UT6YX37.js → chunk-VTPDR6P4.js} +393 -275
  3. package/dist/{index-d31f4469.d.ts → index-f040db9f.d.ts} +678 -386
  4. package/dist/index.cjs +396 -278
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.js +7 -7
  7. package/dist/objects/index.cjs +395 -277
  8. package/dist/objects/index.d.ts +1 -1
  9. package/dist/objects/index.js +5 -5
  10. package/package.json +2 -2
  11. package/src/objects/Account.ts +13 -2
  12. package/src/objects/AccountToApiTokensConnection.ts +16 -5
  13. package/src/objects/AccountToChannelsConnection.ts +9 -0
  14. package/src/objects/AccountToNodesConnection.ts +19 -5
  15. package/src/objects/AccountToPaymentRequestsConnection.ts +21 -5
  16. package/src/objects/AccountToTransactionsConnection.ts +33 -9
  17. package/src/objects/AccountToWalletsConnection.ts +13 -4
  18. package/src/objects/ApiToken.ts +13 -3
  19. package/src/objects/Balances.ts +17 -3
  20. package/src/objects/BlockchainBalance.ts +34 -9
  21. package/src/objects/Channel.ts +61 -16
  22. package/src/objects/ChannelClosingTransaction.ts +81 -61
  23. package/src/objects/ChannelFees.ts +16 -5
  24. package/src/objects/ChannelOpeningTransaction.ts +81 -61
  25. package/src/objects/ChannelSnapshot.ts +32 -8
  26. package/src/objects/ChannelToTransactionsConnection.ts +26 -6
  27. package/src/objects/Connection.ts +205 -10
  28. package/src/objects/CreateApiTokenInput.ts +8 -2
  29. package/src/objects/CreateApiTokenOutput.ts +9 -3
  30. package/src/objects/CreateInvoiceInput.ts +14 -5
  31. package/src/objects/CreateInvoiceOutput.ts +7 -2
  32. package/src/objects/CreateLnurlInvoiceInput.ts +13 -3
  33. package/src/objects/CreateNodeWalletAddressInput.ts +9 -2
  34. package/src/objects/CreateNodeWalletAddressOutput.ts +10 -2
  35. package/src/objects/CreateTestModeInvoiceInput.ts +14 -4
  36. package/src/objects/CreateTestModeInvoiceOutput.ts +10 -2
  37. package/src/objects/CreateTestModePaymentInput.ts +12 -3
  38. package/src/objects/CreateTestModePaymentoutput.ts +12 -2
  39. package/src/objects/CreateUmaInvoiceInput.ts +13 -3
  40. package/src/objects/CurrencyAmount.ts +13 -2
  41. package/src/objects/DeclineToSignMessagesInput.ts +9 -2
  42. package/src/objects/DeclineToSignMessagesOutput.ts +15 -3
  43. package/src/objects/DeleteApiTokenInput.ts +7 -2
  44. package/src/objects/DeleteApiTokenOutput.ts +7 -2
  45. package/src/objects/Deposit.ts +77 -61
  46. package/src/objects/Entity.ts +2 -2
  47. package/src/objects/FeeEstimate.ts +12 -3
  48. package/src/objects/FundNodeInput.ts +9 -3
  49. package/src/objects/FundNodeOutput.ts +11 -3
  50. package/src/objects/GraphNode.ts +21 -5
  51. package/src/objects/Hop.ts +27 -9
  52. package/src/objects/IdAndSignature.ts +8 -2
  53. package/src/objects/IncomingPayment.ts +33 -7
  54. package/src/objects/IncomingPaymentAttempt.ts +21 -5
  55. package/src/objects/IncomingPaymentToAttemptsConnection.ts +21 -5
  56. package/src/objects/Invoice.ts +37 -24
  57. package/src/objects/InvoiceData.ts +21 -6
  58. package/src/objects/LightningFeeEstimateForInvoiceInput.ts +13 -3
  59. package/src/objects/LightningFeeEstimateForNodeInput.ts +12 -2
  60. package/src/objects/LightningFeeEstimateOutput.ts +15 -3
  61. package/src/objects/LightningTransaction.ts +117 -28
  62. package/src/objects/LightsparkNode.ts +250 -210
  63. package/src/objects/LightsparkNodeOwner.ts +35 -4
  64. package/src/objects/LightsparkNodeToChannelsConnection.ts +17 -4
  65. package/src/objects/LightsparkNodeWithOSK.ts +66 -17
  66. package/src/objects/LightsparkNodeWithRemoteSigning.ts +62 -15
  67. package/src/objects/Node.ts +209 -68
  68. package/src/objects/NodeAddress.ts +8 -2
  69. package/src/objects/NodeToAddressesConnection.ts +13 -3
  70. package/src/objects/OnChainTransaction.ts +156 -44
  71. package/src/objects/OutgoingPayment.ts +53 -14
  72. package/src/objects/OutgoingPaymentAttempt.ts +37 -8
  73. package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +18 -5
  74. package/src/objects/OutgoingPaymentToAttemptsConnection.ts +17 -4
  75. package/src/objects/OutgoingPaymentsForInvoiceQueryInput.ts +12 -3
  76. package/src/objects/OutgoingPaymentsForInvoiceQueryOutput.ts +11 -2
  77. package/src/objects/PageInfo.ts +14 -6
  78. package/src/objects/PayInvoiceInput.ts +12 -3
  79. package/src/objects/PayInvoiceOutput.ts +7 -2
  80. package/src/objects/PayUmaInvoiceInput.ts +12 -3
  81. package/src/objects/PaymentRequest.ts +27 -5
  82. package/src/objects/PaymentRequestData.ts +27 -4
  83. package/src/objects/PostTransactionData.ts +12 -3
  84. package/src/objects/RegisterPaymentInput.ts +10 -2
  85. package/src/objects/RegisterPaymentOutput.ts +9 -2
  86. package/src/objects/ReleaseChannelPerCommitmentSecretInput.ts +13 -2
  87. package/src/objects/ReleaseChannelPerCommitmentSecretOutput.ts +9 -2
  88. package/src/objects/ReleasePaymentPreimageInput.ts +10 -2
  89. package/src/objects/ReleasePaymentPreimageOutput.ts +9 -2
  90. package/src/objects/RequestWithdrawalInput.ts +12 -2
  91. package/src/objects/RequestWithdrawalOutput.ts +9 -2
  92. package/src/objects/RichText.ts +7 -2
  93. package/src/objects/RoutingTransaction.ts +62 -41
  94. package/src/objects/ScreenNodeInput.ts +8 -2
  95. package/src/objects/ScreenNodeOutput.ts +7 -2
  96. package/src/objects/Secret.ts +8 -2
  97. package/src/objects/SendPaymentInput.ts +11 -2
  98. package/src/objects/SendPaymentOutput.ts +7 -2
  99. package/src/objects/SetInvoicePaymentHashInput.ts +12 -3
  100. package/src/objects/SetInvoicePaymentHashOutput.ts +9 -2
  101. package/src/objects/SignInvoiceInput.ts +9 -2
  102. package/src/objects/SignInvoiceOutput.ts +7 -2
  103. package/src/objects/SignMessagesInput.ts +13 -3
  104. package/src/objects/SignMessagesOutput.ts +13 -3
  105. package/src/objects/Signable.ts +10 -3
  106. package/src/objects/SignablePayload.ts +18 -5
  107. package/src/objects/Transaction.ts +206 -9
  108. package/src/objects/TransactionFailures.ts +11 -4
  109. package/src/objects/UpdateChannelPerCommitmentPointInput.ts +13 -2
  110. package/src/objects/UpdateChannelPerCommitmentPointOutput.ts +9 -2
  111. package/src/objects/UpdateNodeSharedSecretInput.ts +10 -2
  112. package/src/objects/UpdateNodeSharedSecretOutput.ts +9 -2
  113. package/src/objects/Wallet.ts +22 -5
  114. package/src/objects/WalletToPaymentRequestsConnection.ts +21 -5
  115. package/src/objects/WalletToTransactionsConnection.ts +16 -5
  116. package/src/objects/Withdrawal.ts +77 -61
  117. package/src/objects/WithdrawalRequest.ts +25 -4
  118. package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +19 -4
  119. package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +19 -4
  120. package/src/objects/index.ts +5 -2
  121. package/src/tests/serialization.test.ts +18 -0
@@ -1,4 +1,4 @@
1
- export { A as Account, a as AccountToApiTokensConnection, b as AccountToChannelsConnection, c as AccountToNodesConnection, d as AccountToPaymentRequestsConnection, e as AccountToTransactionsConnection, f as AccountToWalletsConnection, g as ApiToken, B as Balances, i as BlockchainBalance, C as Channel, j as ChannelClosingTransaction, l as ChannelFees, m as ChannelOpeningTransaction, o as ChannelSnapshot, p as ChannelStatus, q as ChannelToTransactionsConnection, r as ComplianceProvider, s as Connection, t as CreateApiTokenInput, u as CreateApiTokenOutput, v as CreateInvoiceInput, w as CreateInvoiceOutput, x as CreateLnurlInvoiceInput, y as CreateNodeWalletAddressInput, z as CreateNodeWalletAddressOutput, D as CreateTestModeInvoiceInput, E as CreateTestModeInvoiceOutput, F as CreateTestModePaymentInput, G as CreateTestModePaymentoutput, H as CreateUmaInvoiceInput, I as CurrencyAmount, J as CurrencyUnit, K as DeclineToSignMessagesInput, M as DeclineToSignMessagesOutput, N as DeleteApiTokenInput, O as DeleteApiTokenOutput, P as Deposit, R as Entity, S as FeeEstimate, T as FundNodeInput, U as FundNodeOutput, V as GraphNode, X as Hop, Z as HtlcAttemptFailureCode, _ as IdAndSignature, $ as IncomingPayment, a0 as IncomingPaymentAttempt, a2 as IncomingPaymentAttemptStatus, a3 as IncomingPaymentToAttemptsConnection, a4 as Invoice, a6 as InvoiceData, a7 as InvoiceType, a8 as LightningFeeEstimateForInvoiceInput, a9 as LightningFeeEstimateForNodeInput, aa as LightningFeeEstimateOutput, ab as LightningTransaction, ad as LightsparkNode, ae as LightsparkNodeOwner, ag as LightsparkNodeStatus, ah as LightsparkNodeToChannelsConnection, ai as LightsparkNodeWithOSK, aj as LightsparkNodeWithRemoteSigning, ak as Node, al as NodeAddress, am as NodeAddressType, an as NodeToAddressesConnection, ao as OnChainTransaction, aq as OutgoingPayment, ar as OutgoingPaymentAttempt, as as OutgoingPaymentAttemptStatus, at as OutgoingPaymentAttemptToHopsConnection, aw as OutgoingPaymentToAttemptsConnection, au as OutgoingPaymentsForInvoiceQueryInput, av as OutgoingPaymentsForInvoiceQueryOutput, ax as PageInfo, ay as PayInvoiceInput, az as PayInvoiceOutput, aG as PayUmaInvoiceInput, aA as PaymentDirection, aB as PaymentFailureReason, aC as PaymentRequest, aE as PaymentRequestData, aF as PaymentRequestStatus, aH as Permission, aI as PostTransactionData, aJ as RegisterPaymentInput, aK as RegisterPaymentOutput, aL as ReleaseChannelPerCommitmentSecretInput, aM as ReleaseChannelPerCommitmentSecretOutput, aN as ReleasePaymentPreimageInput, aO as ReleasePaymentPreimageOutput, aP as RemoteSigningSubEventType, aQ as RequestWithdrawalInput, aR as RequestWithdrawalOutput, aS as RichText, aT as RiskRating, aU as RoutingTransaction, aW as RoutingTransactionFailureReason, aX as ScreenNodeInput, aY as ScreenNodeOutput, aZ as Secret, a_ as SendPaymentInput, a$ as SendPaymentOutput, b0 as SetInvoicePaymentHashInput, b1 as SetInvoicePaymentHashOutput, b7 as SignInvoiceInput, b8 as SignInvoiceOutput, b9 as SignMessagesInput, ba as SignMessagesOutput, b2 as Signable, b4 as SignablePayload, b6 as SignablePayloadStatus, bb as SingleNodeDashboard, bc as Transaction, be as TransactionFailures, bf as TransactionStatus, bg as TransactionType, bh as TransactionUpdate, bi as UpdateChannelPerCommitmentPointInput, bj as UpdateChannelPerCommitmentPointOutput, bk as UpdateNodeSharedSecretInput, bl as UpdateNodeSharedSecretOutput, bm as Wallet, bn as WalletStatus, bo as WalletToPaymentRequestsConnection, bp as WalletToTransactionsConnection, W as WebhookEventType, bq as Withdrawal, bs as WithdrawalMode, bt as WithdrawalRequest, bu as WithdrawalRequestStatus, bv as WithdrawalRequestToChannelClosingTransactionsConnection, bw as WithdrawalRequestToChannelOpeningTransactionsConnection, h as getApiTokenQuery, k as getChannelClosingTransactionQuery, n as getChannelOpeningTransactionQuery, Q as getDepositQuery, Y as getHopQuery, a1 as getIncomingPaymentAttemptQuery, a5 as getInvoiceQuery, ac as getLightningTransactionQuery, af as getLightsparkNodeOwnerQuery, ap as getOnChainTransactionQuery, aD as getPaymentRequestQuery, aV as getRoutingTransactionQuery, b5 as getSignablePayloadQuery, b3 as getSignableQuery, bd as getTransactionQuery, br as getWithdrawalQuery } from '../index-d31f4469.js';
1
+ export { A as Account, a as AccountToApiTokensConnection, b as AccountToChannelsConnection, c as AccountToNodesConnection, d as AccountToPaymentRequestsConnection, e as AccountToTransactionsConnection, f as AccountToWalletsConnection, g as ApiToken, B as Balances, i as BlockchainBalance, C as Channel, j as ChannelClosingTransaction, l as ChannelFees, m as ChannelOpeningTransaction, o as ChannelSnapshot, p as ChannelStatus, q as ChannelToTransactionsConnection, r as ComplianceProvider, s as Connection, t as CreateApiTokenInput, u as CreateApiTokenOutput, v as CreateInvoiceInput, w as CreateInvoiceOutput, x as CreateLnurlInvoiceInput, y as CreateNodeWalletAddressInput, z as CreateNodeWalletAddressOutput, D as CreateTestModeInvoiceInput, E as CreateTestModeInvoiceOutput, F as CreateTestModePaymentInput, G as CreateTestModePaymentoutput, H as CreateUmaInvoiceInput, I as CurrencyAmount, J as CurrencyUnit, K as DeclineToSignMessagesInput, M as DeclineToSignMessagesOutput, N as DeleteApiTokenInput, O as DeleteApiTokenOutput, P as Deposit, R as Entity, S as FeeEstimate, T as FundNodeInput, U as FundNodeOutput, V as GraphNode, X as Hop, Z as HtlcAttemptFailureCode, _ as IdAndSignature, $ as IncomingPayment, a0 as IncomingPaymentAttempt, a2 as IncomingPaymentAttemptStatus, a3 as IncomingPaymentToAttemptsConnection, a4 as Invoice, a6 as InvoiceData, a7 as InvoiceType, a8 as LightningFeeEstimateForInvoiceInput, a9 as LightningFeeEstimateForNodeInput, aa as LightningFeeEstimateOutput, ab as LightningTransaction, ad as LightsparkNode, af as LightsparkNodeOwner, ah as LightsparkNodeStatus, ai as LightsparkNodeToChannelsConnection, aj as LightsparkNodeWithOSK, ak as LightsparkNodeWithRemoteSigning, al as Node, an as NodeAddress, ao as NodeAddressType, ap as NodeToAddressesConnection, aq as OnChainTransaction, as as OutgoingPayment, at as OutgoingPaymentAttempt, au as OutgoingPaymentAttemptStatus, av as OutgoingPaymentAttemptToHopsConnection, ay as OutgoingPaymentToAttemptsConnection, aw as OutgoingPaymentsForInvoiceQueryInput, ax as OutgoingPaymentsForInvoiceQueryOutput, az as PageInfo, aA as PayInvoiceInput, aB as PayInvoiceOutput, aI as PayUmaInvoiceInput, aC as PaymentDirection, aD as PaymentFailureReason, aE as PaymentRequest, aG as PaymentRequestData, aH as PaymentRequestStatus, aJ as Permission, aK as PostTransactionData, aL as RegisterPaymentInput, aM as RegisterPaymentOutput, aN as ReleaseChannelPerCommitmentSecretInput, aO as ReleaseChannelPerCommitmentSecretOutput, aP as ReleasePaymentPreimageInput, aQ as ReleasePaymentPreimageOutput, aR as RemoteSigningSubEventType, aS as RequestWithdrawalInput, aT as RequestWithdrawalOutput, aU as RichText, aV as RiskRating, aW as RoutingTransaction, aY as RoutingTransactionFailureReason, aZ as ScreenNodeInput, a_ as ScreenNodeOutput, a$ as Secret, b0 as SendPaymentInput, b1 as SendPaymentOutput, b2 as SetInvoicePaymentHashInput, b3 as SetInvoicePaymentHashOutput, b9 as SignInvoiceInput, ba as SignInvoiceOutput, bb as SignMessagesInput, bc as SignMessagesOutput, b4 as Signable, b6 as SignablePayload, b8 as SignablePayloadStatus, bd as SingleNodeDashboard, be as Transaction, bg as TransactionFailures, bh as TransactionStatus, bi as TransactionType, bj as TransactionUpdate, bk as UpdateChannelPerCommitmentPointInput, bl as UpdateChannelPerCommitmentPointOutput, bm as UpdateNodeSharedSecretInput, bn as UpdateNodeSharedSecretOutput, bo as Wallet, bp as WalletStatus, bq as WalletToPaymentRequestsConnection, br as WalletToTransactionsConnection, W as WebhookEventType, bs as Withdrawal, bu as WithdrawalMode, bv as WithdrawalRequest, bw as WithdrawalRequestStatus, bx as WithdrawalRequestToChannelClosingTransactionsConnection, by as WithdrawalRequestToChannelOpeningTransactionsConnection, h as getApiTokenQuery, k as getChannelClosingTransactionQuery, n as getChannelOpeningTransactionQuery, Q as getDepositQuery, Y as getHopQuery, a1 as getIncomingPaymentAttemptQuery, a5 as getInvoiceQuery, ac as getLightningTransactionQuery, ag as getLightsparkNodeOwnerQuery, ae as getLightsparkNodeQuery, am as getNodeQuery, ar as getOnChainTransactionQuery, aF as getPaymentRequestQuery, aX as getRoutingTransactionQuery, b7 as getSignablePayloadQuery, b5 as getSignableQuery, bf as getTransactionQuery, bt as getWithdrawalQuery } from '../index-f040db9f.js';
2
2
  export { B as BitcoinNetwork } from '../BitcoinNetwork-a816c0be.js';
3
3
  import '@lightsparkdev/core';
4
4
  import 'zen-observable';
@@ -13,9 +13,7 @@ import {
13
13
  LightsparkNodeStatus_default,
14
14
  LightsparkNodeWithOSK_default,
15
15
  LightsparkNodeWithRemoteSigning_default,
16
- LightsparkNode_default,
17
16
  NodeAddressType_default,
18
- Node_default,
19
17
  OutgoingPaymentAttemptStatus_default,
20
18
  OutgoingPaymentAttempt_default,
21
19
  OutgoingPayment_default,
@@ -44,6 +42,8 @@ import {
44
42
  getInvoiceQuery,
45
43
  getLightningTransactionQuery,
46
44
  getLightsparkNodeOwnerQuery,
45
+ getLightsparkNodeQuery,
46
+ getNodeQuery,
47
47
  getOnChainTransactionQuery,
48
48
  getPaymentRequestQuery,
49
49
  getRoutingTransactionQuery,
@@ -51,7 +51,7 @@ import {
51
51
  getSignableQuery,
52
52
  getTransactionQuery,
53
53
  getWithdrawalQuery
54
- } from "../chunk-7UT6YX37.js";
54
+ } from "../chunk-VTPDR6P4.js";
55
55
  import {
56
56
  BitcoinNetwork_default
57
57
  } from "../chunk-K6SAUSAX.js";
@@ -69,11 +69,9 @@ export {
69
69
  IncomingPayment_default as IncomingPayment,
70
70
  IncomingPaymentAttemptStatus_default as IncomingPaymentAttemptStatus,
71
71
  InvoiceType_default as InvoiceType,
72
- LightsparkNode_default as LightsparkNode,
73
72
  LightsparkNodeStatus_default as LightsparkNodeStatus,
74
73
  LightsparkNodeWithOSK_default as LightsparkNodeWithOSK,
75
74
  LightsparkNodeWithRemoteSigning_default as LightsparkNodeWithRemoteSigning,
76
- Node_default as Node,
77
75
  NodeAddressType_default as NodeAddressType,
78
76
  OutgoingPayment_default as OutgoingPayment,
79
77
  OutgoingPaymentAttempt_default as OutgoingPaymentAttempt,
@@ -103,6 +101,8 @@ export {
103
101
  getInvoiceQuery,
104
102
  getLightningTransactionQuery,
105
103
  getLightsparkNodeOwnerQuery,
104
+ getLightsparkNodeQuery,
105
+ getNodeQuery,
106
106
  getOnChainTransactionQuery,
107
107
  getPaymentRequestQuery,
108
108
  getRoutingTransactionQuery,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightsparkdev/lightspark-sdk",
3
- "version": "1.1.7",
3
+ "version": "1.2.0",
4
4
  "description": "Lightspark JS SDK",
5
5
  "author": "Lightspark Inc.",
6
6
  "keywords": [
@@ -109,7 +109,7 @@
109
109
  "eslint": "^8.3.0",
110
110
  "eslint-watch": "^8.0.0",
111
111
  "jest": "^29.6.2",
112
- "prettier": "3.0.2",
112
+ "prettier": "3.0.3",
113
113
  "prettier-plugin-organize-imports": "^3.2.2",
114
114
  "ts-jest": "^29.1.1",
115
115
  "tsc-absolute": "^1.0.1",
@@ -20,19 +20,20 @@ import type BlockchainBalance from "./BlockchainBalance.js";
20
20
  import { BlockchainBalanceFromJson } from "./BlockchainBalance.js";
21
21
  import type CurrencyAmount from "./CurrencyAmount.js";
22
22
  import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
23
+ import type Entity from "./Entity.js";
23
24
  import type LightsparkNodeOwner from "./LightsparkNodeOwner.js";
24
25
  import type TransactionFailures from "./TransactionFailures.js";
25
26
  import type TransactionStatus from "./TransactionStatus.js";
26
27
  import type TransactionType from "./TransactionType.js";
27
28
 
28
29
  /** This is an object representing the connected Lightspark account. You can retrieve this object to see your account information and objects tied to your account. **/
29
- class Account implements LightsparkNodeOwner {
30
+ class Account implements LightsparkNodeOwner, Entity {
30
31
  constructor(
31
32
  public readonly id: string,
32
33
  public readonly createdAt: string,
33
34
  public readonly updatedAt: string,
34
35
  public readonly typename: string,
35
- public readonly name?: string,
36
+ public readonly name?: string | undefined,
36
37
  ) {
37
38
  autoBind(this);
38
39
  }
@@ -1758,6 +1759,16 @@ ${FRAGMENT}
1758
1759
  constructObject: (data: any) => AccountFromJson(data.current_account),
1759
1760
  };
1760
1761
  }
1762
+
1763
+ public toJson() {
1764
+ return {
1765
+ __typename: "Account",
1766
+ account_id: this.id,
1767
+ account_created_at: this.createdAt,
1768
+ account_updated_at: this.updatedAt,
1769
+ account_name: this.name,
1770
+ };
1771
+ }
1761
1772
  }
1762
1773
 
1763
1774
  export const AccountFromJson = (obj: any): Account => {
@@ -1,12 +1,11 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
3
  import type ApiToken from "./ApiToken.js";
4
- import { ApiTokenFromJson } from "./ApiToken.js";
5
- import type Connection from "./Connection.js";
4
+ import { ApiTokenFromJson, ApiTokenToJson } from "./ApiToken.js";
6
5
  import type PageInfo from "./PageInfo.js";
7
- import { PageInfoFromJson } from "./PageInfo.js";
6
+ import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
8
7
 
9
- type AccountToApiTokensConnection = Connection & {
8
+ interface AccountToApiTokensConnection {
10
9
  /**
11
10
  * The total count of objects in this connection, using the current filters. It is different from the
12
11
  * number of objects returned in the current page (in the `entities` field).
@@ -21,7 +20,7 @@ type AccountToApiTokensConnection = Connection & {
21
20
 
22
21
  /** The typename of the object **/
23
22
  typename: string;
24
- };
23
+ }
25
24
 
26
25
  export const AccountToApiTokensConnectionFromJson = (
27
26
  obj: any,
@@ -37,6 +36,18 @@ export const AccountToApiTokensConnectionFromJson = (
37
36
  typename: "AccountToApiTokensConnection",
38
37
  } as AccountToApiTokensConnection;
39
38
  };
39
+ export const AccountToApiTokensConnectionToJson = (
40
+ obj: AccountToApiTokensConnection,
41
+ ): any => {
42
+ return {
43
+ __typename: "AccountToApiTokensConnection",
44
+ account_to_api_tokens_connection_count: obj.count,
45
+ account_to_api_tokens_connection_page_info: PageInfoToJson(obj.pageInfo),
46
+ account_to_api_tokens_connection_entities: obj.entities.map((e) =>
47
+ ApiTokenToJson(e),
48
+ ),
49
+ };
50
+ };
40
51
 
41
52
  export const FRAGMENT = `
42
53
  fragment AccountToApiTokensConnectionFragment on AccountToApiTokensConnection {
@@ -11,6 +11,15 @@ class AccountToChannelsConnection {
11
11
  ) {
12
12
  autoBind(this);
13
13
  }
14
+
15
+ public toJson() {
16
+ return {
17
+ account_to_channels_connection_count: this.count,
18
+ account_to_channels_connection_entities: this.entities.map((e) =>
19
+ e.toJson(),
20
+ ),
21
+ };
22
+ }
14
23
  }
15
24
 
16
25
  export const AccountToChannelsConnectionFromJson = (
@@ -1,13 +1,15 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import type Connection from "./Connection.js";
4
3
  import type LightsparkNode from "./LightsparkNode.js";
5
- import { LightsparkNodeFromJson } from "./LightsparkNode.js";
4
+ import {
5
+ LightsparkNodeFromJson,
6
+ LightsparkNodeToJson,
7
+ } from "./LightsparkNode.js";
6
8
  import type PageInfo from "./PageInfo.js";
7
- import { PageInfoFromJson } from "./PageInfo.js";
9
+ import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
8
10
 
9
11
  /** A connection between an account and the nodes it manages. **/
10
- type AccountToNodesConnection = Connection & {
12
+ interface AccountToNodesConnection {
11
13
  /**
12
14
  * The total count of objects in this connection, using the current filters. It is different from the
13
15
  * number of objects returned in the current page (in the `entities` field).
@@ -22,7 +24,7 @@ type AccountToNodesConnection = Connection & {
22
24
 
23
25
  /** The typename of the object **/
24
26
  typename: string;
25
- };
27
+ }
26
28
 
27
29
  export const AccountToNodesConnectionFromJson = (
28
30
  obj: any,
@@ -36,6 +38,18 @@ export const AccountToNodesConnectionFromJson = (
36
38
  typename: "AccountToNodesConnection",
37
39
  } as AccountToNodesConnection;
38
40
  };
41
+ export const AccountToNodesConnectionToJson = (
42
+ obj: AccountToNodesConnection,
43
+ ): any => {
44
+ return {
45
+ __typename: "AccountToNodesConnection",
46
+ account_to_nodes_connection_count: obj.count,
47
+ account_to_nodes_connection_page_info: PageInfoToJson(obj.pageInfo),
48
+ account_to_nodes_connection_entities: obj.entities.map((e) =>
49
+ LightsparkNodeToJson(e),
50
+ ),
51
+ };
52
+ };
39
53
 
40
54
  export const FRAGMENT = `
41
55
  fragment AccountToNodesConnectionFragment on AccountToNodesConnection {
@@ -1,12 +1,14 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import type Connection from "./Connection.js";
4
3
  import type PageInfo from "./PageInfo.js";
5
- import { PageInfoFromJson } from "./PageInfo.js";
4
+ import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
6
5
  import type PaymentRequest from "./PaymentRequest.js";
7
- import { PaymentRequestFromJson } from "./PaymentRequest.js";
6
+ import {
7
+ PaymentRequestFromJson,
8
+ PaymentRequestToJson,
9
+ } from "./PaymentRequest.js";
8
10
 
9
- type AccountToPaymentRequestsConnection = Connection & {
11
+ interface AccountToPaymentRequestsConnection {
10
12
  /**
11
13
  * The total count of objects in this connection, using the current filters. It is different from the
12
14
  * number of objects returned in the current page (in the `entities` field).
@@ -21,7 +23,7 @@ type AccountToPaymentRequestsConnection = Connection & {
21
23
 
22
24
  /** The typename of the object **/
23
25
  typename: string;
24
- };
26
+ }
25
27
 
26
28
  export const AccountToPaymentRequestsConnectionFromJson = (
27
29
  obj: any,
@@ -37,6 +39,20 @@ export const AccountToPaymentRequestsConnectionFromJson = (
37
39
  typename: "AccountToPaymentRequestsConnection",
38
40
  } as AccountToPaymentRequestsConnection;
39
41
  };
42
+ export const AccountToPaymentRequestsConnectionToJson = (
43
+ obj: AccountToPaymentRequestsConnection,
44
+ ): any => {
45
+ return {
46
+ __typename: "AccountToPaymentRequestsConnection",
47
+ account_to_payment_requests_connection_count: obj.count,
48
+ account_to_payment_requests_connection_page_info: PageInfoToJson(
49
+ obj.pageInfo,
50
+ ),
51
+ account_to_payment_requests_connection_entities: obj.entities.map((e) =>
52
+ PaymentRequestToJson(e),
53
+ ),
54
+ };
55
+ };
40
56
 
41
57
  export const FRAGMENT = `
42
58
  fragment AccountToPaymentRequestsConnectionFragment on AccountToPaymentRequestsConnection {
@@ -1,14 +1,16 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import type Connection from "./Connection.js";
4
3
  import type CurrencyAmount from "./CurrencyAmount.js";
5
- import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
4
+ import {
5
+ CurrencyAmountFromJson,
6
+ CurrencyAmountToJson,
7
+ } from "./CurrencyAmount.js";
6
8
  import type PageInfo from "./PageInfo.js";
7
- import { PageInfoFromJson } from "./PageInfo.js";
9
+ import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
8
10
  import type Transaction from "./Transaction.js";
9
- import { TransactionFromJson } from "./Transaction.js";
11
+ import { TransactionFromJson, TransactionToJson } from "./Transaction.js";
10
12
 
11
- type AccountToTransactionsConnection = Connection & {
13
+ interface AccountToTransactionsConnection {
12
14
  /**
13
15
  * The total count of objects in this connection, using the current filters. It is different from the
14
16
  * number of objects returned in the current page (in the `entities` field).
@@ -28,20 +30,20 @@ type AccountToTransactionsConnection = Connection & {
28
30
  * Profit (or loss) generated by the transactions in this connection, with the set of filters and
29
31
  * constraints provided.
30
32
  **/
31
- profitLoss?: CurrencyAmount;
33
+ profitLoss?: CurrencyAmount | undefined;
32
34
 
33
35
  /**
34
36
  * Average fee earned for the transactions in this connection, with the set of filters and constraints
35
37
  * provided.
36
38
  **/
37
- averageFeeEarned?: CurrencyAmount;
39
+ averageFeeEarned?: CurrencyAmount | undefined;
38
40
 
39
41
  /**
40
42
  * Total amount transacted by the transactions in this connection, with the set of filters and
41
43
  * constraints provided.
42
44
  **/
43
- totalAmountTransacted?: CurrencyAmount;
44
- };
45
+ totalAmountTransacted?: CurrencyAmount | undefined;
46
+ }
45
47
 
46
48
  export const AccountToTransactionsConnectionFromJson = (
47
49
  obj: any,
@@ -76,6 +78,28 @@ export const AccountToTransactionsConnectionFromJson = (
76
78
  : undefined,
77
79
  } as AccountToTransactionsConnection;
78
80
  };
81
+ export const AccountToTransactionsConnectionToJson = (
82
+ obj: AccountToTransactionsConnection,
83
+ ): any => {
84
+ return {
85
+ __typename: "AccountToTransactionsConnection",
86
+ account_to_transactions_connection_count: obj.count,
87
+ account_to_transactions_connection_page_info: PageInfoToJson(obj.pageInfo),
88
+ account_to_transactions_connection_profit_loss: obj.profitLoss
89
+ ? CurrencyAmountToJson(obj.profitLoss)
90
+ : undefined,
91
+ account_to_transactions_connection_average_fee_earned: obj.averageFeeEarned
92
+ ? CurrencyAmountToJson(obj.averageFeeEarned)
93
+ : undefined,
94
+ account_to_transactions_connection_total_amount_transacted:
95
+ obj.totalAmountTransacted
96
+ ? CurrencyAmountToJson(obj.totalAmountTransacted)
97
+ : undefined,
98
+ account_to_transactions_connection_entities: obj.entities.map((e) =>
99
+ TransactionToJson(e),
100
+ ),
101
+ };
102
+ };
79
103
 
80
104
  export const FRAGMENT = `
81
105
  fragment AccountToTransactionsConnectionFragment on AccountToTransactionsConnection {
@@ -1,12 +1,11 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- import type Connection from "./Connection.js";
4
3
  import type PageInfo from "./PageInfo.js";
5
- import { PageInfoFromJson } from "./PageInfo.js";
4
+ import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
6
5
  import type Wallet from "./Wallet.js";
7
6
  import { WalletFromJson } from "./Wallet.js";
8
7
 
9
- type AccountToWalletsConnection = Connection & {
8
+ interface AccountToWalletsConnection {
10
9
  /**
11
10
  * The total count of objects in this connection, using the current filters. It is different from the
12
11
  * number of objects returned in the current page (in the `entities` field).
@@ -21,7 +20,7 @@ type AccountToWalletsConnection = Connection & {
21
20
 
22
21
  /** The typename of the object **/
23
22
  typename: string;
24
- };
23
+ }
25
24
 
26
25
  export const AccountToWalletsConnectionFromJson = (
27
26
  obj: any,
@@ -35,6 +34,16 @@ export const AccountToWalletsConnectionFromJson = (
35
34
  typename: "AccountToWalletsConnection",
36
35
  } as AccountToWalletsConnection;
37
36
  };
37
+ export const AccountToWalletsConnectionToJson = (
38
+ obj: AccountToWalletsConnection,
39
+ ): any => {
40
+ return {
41
+ __typename: "AccountToWalletsConnection",
42
+ account_to_wallets_connection_count: obj.count,
43
+ account_to_wallets_connection_page_info: PageInfoToJson(obj.pageInfo),
44
+ account_to_wallets_connection_entities: obj.entities.map((e) => e.toJson()),
45
+ };
46
+ };
38
47
 
39
48
  export const FRAGMENT = `
40
49
  fragment AccountToWalletsConnectionFragment on AccountToWalletsConnection {
@@ -1,11 +1,10 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
3
  import { type Query } from "@lightsparkdev/core";
4
- import type Entity from "./Entity.js";
5
4
  import Permission from "./Permission.js";
6
5
 
7
6
  /** This is an object representing a Lightspark API token, that can be used to authenticate this account when making API calls or using our SDKs. See the “Authentication” section of our API docs for more details on its usage. **/
8
- type ApiToken = Entity & {
7
+ interface ApiToken {
9
8
  /**
10
9
  * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
11
10
  * string.
@@ -35,7 +34,7 @@ type ApiToken = Entity & {
35
34
 
36
35
  /** The typename of the object **/
37
36
  typename: string;
38
- };
37
+ }
39
38
 
40
39
  export const ApiTokenFromJson = (obj: any): ApiToken => {
41
40
  return {
@@ -48,6 +47,17 @@ export const ApiTokenFromJson = (obj: any): ApiToken => {
48
47
  typename: "ApiToken",
49
48
  } as ApiToken;
50
49
  };
50
+ export const ApiTokenToJson = (obj: ApiToken): any => {
51
+ return {
52
+ __typename: "ApiToken",
53
+ api_token_id: obj.id,
54
+ api_token_created_at: obj.createdAt,
55
+ api_token_updated_at: obj.updatedAt,
56
+ api_token_client_id: obj.clientId,
57
+ api_token_name: obj.name,
58
+ api_token_permissions: obj.permissions,
59
+ };
60
+ };
51
61
 
52
62
  export const FRAGMENT = `
53
63
  fragment ApiTokenFragment on ApiToken {
@@ -1,10 +1,13 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
3
  import type CurrencyAmount from "./CurrencyAmount.js";
4
- import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
4
+ import {
5
+ CurrencyAmountFromJson,
6
+ CurrencyAmountToJson,
7
+ } from "./CurrencyAmount.js";
5
8
 
6
9
  /** This is an object representing the balance associated with your Lightspark account. You can retrieve this object to see your balance, which can be broken down into several different categorizations. **/
7
- type Balances = {
10
+ interface Balances {
8
11
  /**
9
12
  * This represents the balance that should be displayed when asked "how much do I own right now?". It
10
13
  * represents the amount currently owned, including things that may not be owned soon (e.g. in-flight
@@ -27,7 +30,7 @@ type Balances = {
27
30
  * likely succeed and therefore likely make your withdrawal fail).
28
31
  **/
29
32
  availableToWithdrawBalance: CurrencyAmount;
30
- };
33
+ }
31
34
 
32
35
  export const BalancesFromJson = (obj: any): Balances => {
33
36
  return {
@@ -40,6 +43,17 @@ export const BalancesFromJson = (obj: any): Balances => {
40
43
  ),
41
44
  } as Balances;
42
45
  };
46
+ export const BalancesToJson = (obj: Balances): any => {
47
+ return {
48
+ balances_owned_balance: CurrencyAmountToJson(obj.ownedBalance),
49
+ balances_available_to_send_balance: CurrencyAmountToJson(
50
+ obj.availableToSendBalance,
51
+ ),
52
+ balances_available_to_withdraw_balance: CurrencyAmountToJson(
53
+ obj.availableToWithdrawBalance,
54
+ ),
55
+ };
56
+ };
43
57
 
44
58
  export const FRAGMENT = `
45
59
  fragment BalancesFragment on Balances {
@@ -1,28 +1,31 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
3
  import type CurrencyAmount from "./CurrencyAmount.js";
4
- import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
4
+ import {
5
+ CurrencyAmountFromJson,
6
+ CurrencyAmountToJson,
7
+ } from "./CurrencyAmount.js";
5
8
 
6
9
  /** This is an object representing a detailed breakdown of the balance for a Lightspark Node. **/
7
- type BlockchainBalance = {
10
+ interface BlockchainBalance {
8
11
  /** The total wallet balance, including unconfirmed UTXOs. **/
9
- totalBalance?: CurrencyAmount;
12
+ totalBalance?: CurrencyAmount | undefined;
10
13
 
11
14
  /** The balance of confirmed UTXOs in the wallet. **/
12
- confirmedBalance?: CurrencyAmount;
15
+ confirmedBalance?: CurrencyAmount | undefined;
13
16
 
14
17
  /** The balance of unconfirmed UTXOs in the wallet. **/
15
- unconfirmedBalance?: CurrencyAmount;
18
+ unconfirmedBalance?: CurrencyAmount | undefined;
16
19
 
17
20
  /** The balance that's locked by an on-chain transaction. **/
18
- lockedBalance?: CurrencyAmount;
21
+ lockedBalance?: CurrencyAmount | undefined;
19
22
 
20
23
  /** Funds required to be held in reserve for channel bumping. **/
21
- requiredReserve?: CurrencyAmount;
24
+ requiredReserve?: CurrencyAmount | undefined;
22
25
 
23
26
  /** Funds available for creating channels or withdrawing. **/
24
- availableBalance?: CurrencyAmount;
25
- };
27
+ availableBalance?: CurrencyAmount | undefined;
28
+ }
26
29
 
27
30
  export const BlockchainBalanceFromJson = (obj: any): BlockchainBalance => {
28
31
  return {
@@ -46,6 +49,28 @@ export const BlockchainBalanceFromJson = (obj: any): BlockchainBalance => {
46
49
  : undefined,
47
50
  } as BlockchainBalance;
48
51
  };
52
+ export const BlockchainBalanceToJson = (obj: BlockchainBalance): any => {
53
+ return {
54
+ blockchain_balance_total_balance: obj.totalBalance
55
+ ? CurrencyAmountToJson(obj.totalBalance)
56
+ : undefined,
57
+ blockchain_balance_confirmed_balance: obj.confirmedBalance
58
+ ? CurrencyAmountToJson(obj.confirmedBalance)
59
+ : undefined,
60
+ blockchain_balance_unconfirmed_balance: obj.unconfirmedBalance
61
+ ? CurrencyAmountToJson(obj.unconfirmedBalance)
62
+ : undefined,
63
+ blockchain_balance_locked_balance: obj.lockedBalance
64
+ ? CurrencyAmountToJson(obj.lockedBalance)
65
+ : undefined,
66
+ blockchain_balance_required_reserve: obj.requiredReserve
67
+ ? CurrencyAmountToJson(obj.requiredReserve)
68
+ : undefined,
69
+ blockchain_balance_available_balance: obj.availableBalance
70
+ ? CurrencyAmountToJson(obj.availableBalance)
71
+ : undefined,
72
+ };
73
+ };
49
74
 
50
75
  export const FRAGMENT = `
51
76
  fragment BlockchainBalanceFragment on BlockchainBalance {
@@ -4,12 +4,15 @@ import { type Query } from "@lightsparkdev/core";
4
4
  import autoBind from "auto-bind";
5
5
  import type LightsparkClient from "../client.js";
6
6
  import type ChannelFees from "./ChannelFees.js";
7
- import { ChannelFeesFromJson } from "./ChannelFees.js";
7
+ import { ChannelFeesFromJson, ChannelFeesToJson } from "./ChannelFees.js";
8
8
  import ChannelStatus from "./ChannelStatus.js";
9
9
  import type ChannelToTransactionsConnection from "./ChannelToTransactionsConnection.js";
10
10
  import { ChannelToTransactionsConnectionFromJson } from "./ChannelToTransactionsConnection.js";
11
11
  import type CurrencyAmount from "./CurrencyAmount.js";
12
- import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
12
+ import {
13
+ CurrencyAmountFromJson,
14
+ CurrencyAmountToJson,
15
+ } from "./CurrencyAmount.js";
13
16
  import type Entity from "./Entity.js";
14
17
  import type TransactionType from "./TransactionType.js";
15
18
 
@@ -21,20 +24,20 @@ class Channel implements Entity {
21
24
  public readonly updatedAt: string,
22
25
  public readonly localNodeId: string,
23
26
  public readonly typename: string,
24
- public readonly fundingTransactionId?: string,
25
- public readonly capacity?: CurrencyAmount,
26
- public readonly localBalance?: CurrencyAmount,
27
- public readonly localUnsettledBalance?: CurrencyAmount,
28
- public readonly remoteBalance?: CurrencyAmount,
29
- public readonly remoteUnsettledBalance?: CurrencyAmount,
30
- public readonly unsettledBalance?: CurrencyAmount,
31
- public readonly totalBalance?: CurrencyAmount,
32
- public readonly status?: ChannelStatus,
33
- public readonly estimatedForceClosureWaitMinutes?: number,
34
- public readonly commitFee?: CurrencyAmount,
35
- public readonly fees?: ChannelFees,
36
- public readonly remoteNodeId?: string,
37
- public readonly shortChannelId?: string,
27
+ public readonly fundingTransactionId?: string | undefined,
28
+ public readonly capacity?: CurrencyAmount | undefined,
29
+ public readonly localBalance?: CurrencyAmount | undefined,
30
+ public readonly localUnsettledBalance?: CurrencyAmount | undefined,
31
+ public readonly remoteBalance?: CurrencyAmount | undefined,
32
+ public readonly remoteUnsettledBalance?: CurrencyAmount | undefined,
33
+ public readonly unsettledBalance?: CurrencyAmount | undefined,
34
+ public readonly totalBalance?: CurrencyAmount | undefined,
35
+ public readonly status?: ChannelStatus | undefined,
36
+ public readonly estimatedForceClosureWaitMinutes?: number | undefined,
37
+ public readonly commitFee?: CurrencyAmount | undefined,
38
+ public readonly fees?: ChannelFees | undefined,
39
+ public readonly remoteNodeId?: string | undefined,
40
+ public readonly shortChannelId?: string | undefined,
38
41
  ) {
39
42
  autoBind(this);
40
43
  }
@@ -139,6 +142,48 @@ ${FRAGMENT}
139
142
  constructObject: (data: any) => ChannelFromJson(data.entity),
140
143
  };
141
144
  }
145
+
146
+ public toJson() {
147
+ return {
148
+ __typename: "Channel",
149
+ channel_id: this.id,
150
+ channel_created_at: this.createdAt,
151
+ channel_updated_at: this.updatedAt,
152
+ channel_funding_transaction:
153
+ { id: this.fundingTransactionId } ?? undefined,
154
+ channel_capacity: this.capacity
155
+ ? CurrencyAmountToJson(this.capacity)
156
+ : undefined,
157
+ channel_local_balance: this.localBalance
158
+ ? CurrencyAmountToJson(this.localBalance)
159
+ : undefined,
160
+ channel_local_unsettled_balance: this.localUnsettledBalance
161
+ ? CurrencyAmountToJson(this.localUnsettledBalance)
162
+ : undefined,
163
+ channel_remote_balance: this.remoteBalance
164
+ ? CurrencyAmountToJson(this.remoteBalance)
165
+ : undefined,
166
+ channel_remote_unsettled_balance: this.remoteUnsettledBalance
167
+ ? CurrencyAmountToJson(this.remoteUnsettledBalance)
168
+ : undefined,
169
+ channel_unsettled_balance: this.unsettledBalance
170
+ ? CurrencyAmountToJson(this.unsettledBalance)
171
+ : undefined,
172
+ channel_total_balance: this.totalBalance
173
+ ? CurrencyAmountToJson(this.totalBalance)
174
+ : undefined,
175
+ channel_status: this.status,
176
+ channel_estimated_force_closure_wait_minutes:
177
+ this.estimatedForceClosureWaitMinutes,
178
+ channel_commit_fee: this.commitFee
179
+ ? CurrencyAmountToJson(this.commitFee)
180
+ : undefined,
181
+ channel_fees: this.fees ? ChannelFeesToJson(this.fees) : undefined,
182
+ channel_remote_node: { id: this.remoteNodeId } ?? undefined,
183
+ channel_local_node: { id: this.localNodeId },
184
+ channel_short_channel_id: this.shortChannelId,
185
+ };
186
+ }
142
187
  }
143
188
 
144
189
  export const ChannelFromJson = (obj: any): Channel => {