@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
@@ -2,70 +2,68 @@
2
2
 
3
3
  import { type Query } from "@lightsparkdev/core";
4
4
  import type CurrencyAmount from "./CurrencyAmount.js";
5
- import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
6
- import type Entity from "./Entity.js";
7
- import type OnChainTransaction from "./OnChainTransaction.js";
8
- import type Transaction from "./Transaction.js";
5
+ import {
6
+ CurrencyAmountFromJson,
7
+ CurrencyAmountToJson,
8
+ } from "./CurrencyAmount.js";
9
9
  import TransactionStatus from "./TransactionStatus.js";
10
10
 
11
11
  /** This is an object representing a transaction which closes a channel on the Lightning Network. This operation allocates balances back to the local and remote nodes. **/
12
- type ChannelClosingTransaction = OnChainTransaction &
13
- Transaction &
14
- Entity & {
15
- /**
16
- * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
17
- * string.
18
- **/
19
- id: string;
20
-
21
- /** The date and time when this transaction was initiated. **/
22
- createdAt: string;
23
-
24
- /** The date and time when the entity was last updated. **/
25
- updatedAt: string;
26
-
27
- /** The current status of this transaction. **/
28
- status: TransactionStatus;
29
-
30
- /** The amount of money involved in this transaction. **/
31
- amount: CurrencyAmount;
32
-
33
- /**
34
- * The height of the block that included this transaction. This will be zero for unconfirmed
35
- * transactions.
36
- **/
37
- blockHeight: number;
38
-
39
- /** The Bitcoin blockchain addresses this transaction was sent to. **/
40
- destinationAddresses: string[];
41
-
42
- /** The typename of the object **/
43
- typename: string;
44
-
45
- /** The date and time when this transaction was completed or failed. **/
46
- resolvedAt?: string;
47
-
48
- /** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
49
- transactionHash?: string;
50
-
51
- /**
52
- * The fees that were paid by the wallet sending the transaction to commit it to the Bitcoin
53
- * blockchain.
54
- **/
55
- fees?: CurrencyAmount;
56
-
57
- /**
58
- * The hash of the block that included this transaction. This will be null for unconfirmed
59
- * transactions.
60
- **/
61
- blockHash?: string;
62
-
63
- /** The number of blockchain confirmations for this transaction in real time. **/
64
- numConfirmations?: number;
65
-
66
- /** If known, the channel this transaction is closing. **/
67
- channelId?: string;
68
- };
12
+ interface ChannelClosingTransaction {
13
+ /**
14
+ * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
15
+ * string.
16
+ **/
17
+ id: string;
18
+
19
+ /** The date and time when this transaction was initiated. **/
20
+ createdAt: string;
21
+
22
+ /** The date and time when the entity was last updated. **/
23
+ updatedAt: string;
24
+
25
+ /** The current status of this transaction. **/
26
+ status: TransactionStatus;
27
+
28
+ /** The amount of money involved in this transaction. **/
29
+ amount: CurrencyAmount;
30
+
31
+ /**
32
+ * The height of the block that included this transaction. This will be zero for unconfirmed
33
+ * transactions.
34
+ **/
35
+ blockHeight: number;
36
+
37
+ /** The Bitcoin blockchain addresses this transaction was sent to. **/
38
+ destinationAddresses: string[];
39
+
40
+ /** The typename of the object **/
41
+ typename: string;
42
+
43
+ /** The date and time when this transaction was completed or failed. **/
44
+ resolvedAt?: string | undefined;
45
+
46
+ /** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
47
+ transactionHash?: string | undefined;
48
+
49
+ /**
50
+ * The fees that were paid by the wallet sending the transaction to commit it to the Bitcoin
51
+ * blockchain.
52
+ **/
53
+ fees?: CurrencyAmount | undefined;
54
+
55
+ /**
56
+ * The hash of the block that included this transaction. This will be null for unconfirmed
57
+ * transactions.
58
+ **/
59
+ blockHash?: string | undefined;
60
+
61
+ /** The number of blockchain confirmations for this transaction in real time. **/
62
+ numConfirmations?: number | undefined;
63
+
64
+ /** If known, the channel this transaction is closing. **/
65
+ channelId?: string | undefined;
66
+ }
69
67
 
70
68
  export const ChannelClosingTransactionFromJson = (
71
69
  obj: any,
@@ -92,6 +90,28 @@ export const ChannelClosingTransactionFromJson = (
92
90
  channelId: obj["channel_closing_transaction_channel"]?.id ?? undefined,
93
91
  } as ChannelClosingTransaction;
94
92
  };
93
+ export const ChannelClosingTransactionToJson = (
94
+ obj: ChannelClosingTransaction,
95
+ ): any => {
96
+ return {
97
+ __typename: "ChannelClosingTransaction",
98
+ channel_closing_transaction_id: obj.id,
99
+ channel_closing_transaction_created_at: obj.createdAt,
100
+ channel_closing_transaction_updated_at: obj.updatedAt,
101
+ channel_closing_transaction_status: obj.status,
102
+ channel_closing_transaction_resolved_at: obj.resolvedAt,
103
+ channel_closing_transaction_amount: CurrencyAmountToJson(obj.amount),
104
+ channel_closing_transaction_transaction_hash: obj.transactionHash,
105
+ channel_closing_transaction_fees: obj.fees
106
+ ? CurrencyAmountToJson(obj.fees)
107
+ : undefined,
108
+ channel_closing_transaction_block_hash: obj.blockHash,
109
+ channel_closing_transaction_block_height: obj.blockHeight,
110
+ channel_closing_transaction_destination_addresses: obj.destinationAddresses,
111
+ channel_closing_transaction_num_confirmations: obj.numConfirmations,
112
+ channel_closing_transaction_channel: { id: obj.channelId } ?? undefined,
113
+ };
114
+ };
95
115
 
96
116
  export const FRAGMENT = `
97
117
  fragment ChannelClosingTransactionFragment on ChannelClosingTransaction {
@@ -1,14 +1,17 @@
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 represents the fee policies set for a channel on the Lightning Network. **/
7
- type ChannelFees = {
8
- baseFee?: CurrencyAmount;
10
+ interface ChannelFees {
11
+ baseFee?: CurrencyAmount | undefined;
9
12
 
10
- feeRatePerMil?: number;
11
- };
13
+ feeRatePerMil?: number | undefined;
14
+ }
12
15
 
13
16
  export const ChannelFeesFromJson = (obj: any): ChannelFees => {
14
17
  return {
@@ -18,6 +21,14 @@ export const ChannelFeesFromJson = (obj: any): ChannelFees => {
18
21
  feeRatePerMil: obj["channel_fees_fee_rate_per_mil"],
19
22
  } as ChannelFees;
20
23
  };
24
+ export const ChannelFeesToJson = (obj: ChannelFees): any => {
25
+ return {
26
+ channel_fees_base_fee: obj.baseFee
27
+ ? CurrencyAmountToJson(obj.baseFee)
28
+ : undefined,
29
+ channel_fees_fee_rate_per_mil: obj.feeRatePerMil,
30
+ };
31
+ };
21
32
 
22
33
  export const FRAGMENT = `
23
34
  fragment ChannelFeesFragment on ChannelFees {
@@ -2,70 +2,68 @@
2
2
 
3
3
  import { type Query } from "@lightsparkdev/core";
4
4
  import type CurrencyAmount from "./CurrencyAmount.js";
5
- import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
6
- import type Entity from "./Entity.js";
7
- import type OnChainTransaction from "./OnChainTransaction.js";
8
- import type Transaction from "./Transaction.js";
5
+ import {
6
+ CurrencyAmountFromJson,
7
+ CurrencyAmountToJson,
8
+ } from "./CurrencyAmount.js";
9
9
  import TransactionStatus from "./TransactionStatus.js";
10
10
 
11
11
  /** This is an object representing a transaction which opens a channel on the Lightning Network. This object occurs only for channels funded by the local Lightspark node. **/
12
- type ChannelOpeningTransaction = OnChainTransaction &
13
- Transaction &
14
- Entity & {
15
- /**
16
- * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
17
- * string.
18
- **/
19
- id: string;
20
-
21
- /** The date and time when this transaction was initiated. **/
22
- createdAt: string;
23
-
24
- /** The date and time when the entity was last updated. **/
25
- updatedAt: string;
26
-
27
- /** The current status of this transaction. **/
28
- status: TransactionStatus;
29
-
30
- /** The amount of money involved in this transaction. **/
31
- amount: CurrencyAmount;
32
-
33
- /**
34
- * The height of the block that included this transaction. This will be zero for unconfirmed
35
- * transactions.
36
- **/
37
- blockHeight: number;
38
-
39
- /** The Bitcoin blockchain addresses this transaction was sent to. **/
40
- destinationAddresses: string[];
41
-
42
- /** The typename of the object **/
43
- typename: string;
44
-
45
- /** The date and time when this transaction was completed or failed. **/
46
- resolvedAt?: string;
47
-
48
- /** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
49
- transactionHash?: string;
50
-
51
- /**
52
- * The fees that were paid by the wallet sending the transaction to commit it to the Bitcoin
53
- * blockchain.
54
- **/
55
- fees?: CurrencyAmount;
56
-
57
- /**
58
- * The hash of the block that included this transaction. This will be null for unconfirmed
59
- * transactions.
60
- **/
61
- blockHash?: string;
62
-
63
- /** The number of blockchain confirmations for this transaction in real time. **/
64
- numConfirmations?: number;
65
-
66
- /** If known, the channel this transaction is opening. **/
67
- channelId?: string;
68
- };
12
+ interface ChannelOpeningTransaction {
13
+ /**
14
+ * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
15
+ * string.
16
+ **/
17
+ id: string;
18
+
19
+ /** The date and time when this transaction was initiated. **/
20
+ createdAt: string;
21
+
22
+ /** The date and time when the entity was last updated. **/
23
+ updatedAt: string;
24
+
25
+ /** The current status of this transaction. **/
26
+ status: TransactionStatus;
27
+
28
+ /** The amount of money involved in this transaction. **/
29
+ amount: CurrencyAmount;
30
+
31
+ /**
32
+ * The height of the block that included this transaction. This will be zero for unconfirmed
33
+ * transactions.
34
+ **/
35
+ blockHeight: number;
36
+
37
+ /** The Bitcoin blockchain addresses this transaction was sent to. **/
38
+ destinationAddresses: string[];
39
+
40
+ /** The typename of the object **/
41
+ typename: string;
42
+
43
+ /** The date and time when this transaction was completed or failed. **/
44
+ resolvedAt?: string | undefined;
45
+
46
+ /** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
47
+ transactionHash?: string | undefined;
48
+
49
+ /**
50
+ * The fees that were paid by the wallet sending the transaction to commit it to the Bitcoin
51
+ * blockchain.
52
+ **/
53
+ fees?: CurrencyAmount | undefined;
54
+
55
+ /**
56
+ * The hash of the block that included this transaction. This will be null for unconfirmed
57
+ * transactions.
58
+ **/
59
+ blockHash?: string | undefined;
60
+
61
+ /** The number of blockchain confirmations for this transaction in real time. **/
62
+ numConfirmations?: number | undefined;
63
+
64
+ /** If known, the channel this transaction is opening. **/
65
+ channelId?: string | undefined;
66
+ }
69
67
 
70
68
  export const ChannelOpeningTransactionFromJson = (
71
69
  obj: any,
@@ -92,6 +90,28 @@ export const ChannelOpeningTransactionFromJson = (
92
90
  channelId: obj["channel_opening_transaction_channel"]?.id ?? undefined,
93
91
  } as ChannelOpeningTransaction;
94
92
  };
93
+ export const ChannelOpeningTransactionToJson = (
94
+ obj: ChannelOpeningTransaction,
95
+ ): any => {
96
+ return {
97
+ __typename: "ChannelOpeningTransaction",
98
+ channel_opening_transaction_id: obj.id,
99
+ channel_opening_transaction_created_at: obj.createdAt,
100
+ channel_opening_transaction_updated_at: obj.updatedAt,
101
+ channel_opening_transaction_status: obj.status,
102
+ channel_opening_transaction_resolved_at: obj.resolvedAt,
103
+ channel_opening_transaction_amount: CurrencyAmountToJson(obj.amount),
104
+ channel_opening_transaction_transaction_hash: obj.transactionHash,
105
+ channel_opening_transaction_fees: obj.fees
106
+ ? CurrencyAmountToJson(obj.fees)
107
+ : undefined,
108
+ channel_opening_transaction_block_hash: obj.blockHash,
109
+ channel_opening_transaction_block_height: obj.blockHeight,
110
+ channel_opening_transaction_destination_addresses: obj.destinationAddresses,
111
+ channel_opening_transaction_num_confirmations: obj.numConfirmations,
112
+ channel_opening_transaction_channel: { id: obj.channelId } ?? undefined,
113
+ };
114
+ };
95
115
 
96
116
  export const FRAGMENT = `
97
117
  fragment ChannelOpeningTransactionFragment on ChannelOpeningTransaction {
@@ -1,23 +1,26 @@
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
- type ChannelSnapshot = {
9
+ interface ChannelSnapshot {
7
10
  channelId: string;
8
11
 
9
12
  timestamp: string;
10
13
 
11
- localBalance?: CurrencyAmount;
14
+ localBalance?: CurrencyAmount | undefined;
12
15
 
13
- localUnsettledBalance?: CurrencyAmount;
16
+ localUnsettledBalance?: CurrencyAmount | undefined;
14
17
 
15
- localChannelReserve?: CurrencyAmount;
18
+ localChannelReserve?: CurrencyAmount | undefined;
16
19
 
17
- remoteBalance?: CurrencyAmount;
20
+ remoteBalance?: CurrencyAmount | undefined;
18
21
 
19
- remoteUnsettledBalance?: CurrencyAmount;
20
- };
22
+ remoteUnsettledBalance?: CurrencyAmount | undefined;
23
+ }
21
24
 
22
25
  export const ChannelSnapshotFromJson = (obj: any): ChannelSnapshot => {
23
26
  return {
@@ -40,6 +43,27 @@ export const ChannelSnapshotFromJson = (obj: any): ChannelSnapshot => {
40
43
  : undefined,
41
44
  } as ChannelSnapshot;
42
45
  };
46
+ export const ChannelSnapshotToJson = (obj: ChannelSnapshot): any => {
47
+ return {
48
+ channel_snapshot_channel: { id: obj.channelId },
49
+ channel_snapshot_timestamp: obj.timestamp,
50
+ channel_snapshot_local_balance: obj.localBalance
51
+ ? CurrencyAmountToJson(obj.localBalance)
52
+ : undefined,
53
+ channel_snapshot_local_unsettled_balance: obj.localUnsettledBalance
54
+ ? CurrencyAmountToJson(obj.localUnsettledBalance)
55
+ : undefined,
56
+ channel_snapshot_local_channel_reserve: obj.localChannelReserve
57
+ ? CurrencyAmountToJson(obj.localChannelReserve)
58
+ : undefined,
59
+ channel_snapshot_remote_balance: obj.remoteBalance
60
+ ? CurrencyAmountToJson(obj.remoteBalance)
61
+ : undefined,
62
+ channel_snapshot_remote_unsettled_balance: obj.remoteUnsettledBalance
63
+ ? CurrencyAmountToJson(obj.remoteUnsettledBalance)
64
+ : undefined,
65
+ };
66
+ };
43
67
 
44
68
  export const FRAGMENT = `
45
69
  fragment ChannelSnapshotFragment on ChannelSnapshot {
@@ -1,9 +1,12 @@
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
- type ChannelToTransactionsConnection = {
9
+ interface ChannelToTransactionsConnection {
7
10
  /**
8
11
  * The total count of objects in this connection, using the current filters. It is different from the
9
12
  * number of objects returned in the current page (in the `entities` field).
@@ -14,20 +17,20 @@ type ChannelToTransactionsConnection = {
14
17
  * The average fee for the transactions that transited through this channel, according to the filters
15
18
  * and constraints of the connection.
16
19
  **/
17
- averageFee?: CurrencyAmount;
20
+ averageFee?: CurrencyAmount | undefined;
18
21
 
19
22
  /**
20
23
  * The total amount transacted for the transactions that transited through this channel, according to
21
24
  * the filters and constraints of the connection.
22
25
  **/
23
- totalAmountTransacted?: CurrencyAmount;
26
+ totalAmountTransacted?: CurrencyAmount | undefined;
24
27
 
25
28
  /**
26
29
  * The total amount of fees for the transactions that transited through this channel, according to the
27
30
  * filters and constraints of the connection.
28
31
  **/
29
- totalFees?: CurrencyAmount;
30
- };
32
+ totalFees?: CurrencyAmount | undefined;
33
+ }
31
34
 
32
35
  export const ChannelToTransactionsConnectionFromJson = (
33
36
  obj: any,
@@ -53,6 +56,23 @@ export const ChannelToTransactionsConnectionFromJson = (
53
56
  : undefined,
54
57
  } as ChannelToTransactionsConnection;
55
58
  };
59
+ export const ChannelToTransactionsConnectionToJson = (
60
+ obj: ChannelToTransactionsConnection,
61
+ ): any => {
62
+ return {
63
+ channel_to_transactions_connection_count: obj.count,
64
+ channel_to_transactions_connection_average_fee: obj.averageFee
65
+ ? CurrencyAmountToJson(obj.averageFee)
66
+ : undefined,
67
+ channel_to_transactions_connection_total_amount_transacted:
68
+ obj.totalAmountTransacted
69
+ ? CurrencyAmountToJson(obj.totalAmountTransacted)
70
+ : undefined,
71
+ channel_to_transactions_connection_total_fees: obj.totalFees
72
+ ? CurrencyAmountToJson(obj.totalFees)
73
+ : undefined,
74
+ };
75
+ };
56
76
 
57
77
  export const FRAGMENT = `
58
78
  fragment ChannelToTransactionsConnectionFragment on ChannelToTransactionsConnection {