@lightsparkdev/lightspark-sdk 1.1.6 → 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 (123) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/{chunk-7UNNCH5S.js → chunk-VTPDR6P4.js} +1270 -342
  3. package/dist/{index-5235e43b.d.ts → index-f040db9f.d.ts} +707 -407
  4. package/dist/index.cjs +1247 -319
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.js +7 -7
  7. package/dist/objects/index.cjs +1180 -306
  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 +175 -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 +66 -6
  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 +184 -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/HtlcAttemptFailureCode.ts +2 -0
  53. package/src/objects/IdAndSignature.ts +8 -2
  54. package/src/objects/IncomingPayment.ts +33 -7
  55. package/src/objects/IncomingPaymentAttempt.ts +21 -5
  56. package/src/objects/IncomingPaymentToAttemptsConnection.ts +21 -5
  57. package/src/objects/Invoice.ts +91 -24
  58. package/src/objects/InvoiceData.ts +75 -6
  59. package/src/objects/LightningFeeEstimateForInvoiceInput.ts +13 -3
  60. package/src/objects/LightningFeeEstimateForNodeInput.ts +12 -2
  61. package/src/objects/LightningFeeEstimateOutput.ts +15 -3
  62. package/src/objects/LightningTransaction.ts +171 -28
  63. package/src/objects/LightsparkNode.ts +311 -208
  64. package/src/objects/LightsparkNodeOwner.ts +35 -4
  65. package/src/objects/LightsparkNodeToChannelsConnection.ts +17 -4
  66. package/src/objects/LightsparkNodeWithOSK.ts +97 -15
  67. package/src/objects/LightsparkNodeWithRemoteSigning.ts +93 -13
  68. package/src/objects/Node.ts +269 -67
  69. package/src/objects/NodeAddress.ts +8 -2
  70. package/src/objects/NodeToAddressesConnection.ts +13 -3
  71. package/src/objects/OnChainTransaction.ts +156 -44
  72. package/src/objects/OutgoingPayment.ts +127 -14
  73. package/src/objects/OutgoingPaymentAttempt.ts +57 -8
  74. package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +18 -5
  75. package/src/objects/OutgoingPaymentToAttemptsConnection.ts +17 -4
  76. package/src/objects/OutgoingPaymentsForInvoiceQueryInput.ts +12 -3
  77. package/src/objects/OutgoingPaymentsForInvoiceQueryOutput.ts +11 -2
  78. package/src/objects/PageInfo.ts +14 -6
  79. package/src/objects/PayInvoiceInput.ts +12 -3
  80. package/src/objects/PayInvoiceOutput.ts +7 -2
  81. package/src/objects/PayUmaInvoiceInput.ts +12 -3
  82. package/src/objects/PaymentRequest.ts +81 -5
  83. package/src/objects/PaymentRequestData.ts +81 -4
  84. package/src/objects/PostTransactionData.ts +12 -3
  85. package/src/objects/RegisterPaymentInput.ts +10 -2
  86. package/src/objects/RegisterPaymentOutput.ts +9 -2
  87. package/src/objects/ReleaseChannelPerCommitmentSecretInput.ts +13 -2
  88. package/src/objects/ReleaseChannelPerCommitmentSecretOutput.ts +9 -2
  89. package/src/objects/ReleasePaymentPreimageInput.ts +10 -2
  90. package/src/objects/ReleasePaymentPreimageOutput.ts +9 -2
  91. package/src/objects/RequestWithdrawalInput.ts +12 -2
  92. package/src/objects/RequestWithdrawalOutput.ts +9 -2
  93. package/src/objects/RichText.ts +7 -2
  94. package/src/objects/RoutingTransaction.ts +62 -41
  95. package/src/objects/ScreenNodeInput.ts +8 -2
  96. package/src/objects/ScreenNodeOutput.ts +7 -2
  97. package/src/objects/Secret.ts +8 -2
  98. package/src/objects/SendPaymentInput.ts +11 -2
  99. package/src/objects/SendPaymentOutput.ts +7 -2
  100. package/src/objects/SetInvoicePaymentHashInput.ts +12 -3
  101. package/src/objects/SetInvoicePaymentHashOutput.ts +9 -2
  102. package/src/objects/SignInvoiceInput.ts +9 -2
  103. package/src/objects/SignInvoiceOutput.ts +7 -2
  104. package/src/objects/SignMessagesInput.ts +13 -3
  105. package/src/objects/SignMessagesOutput.ts +13 -3
  106. package/src/objects/Signable.ts +10 -3
  107. package/src/objects/SignablePayload.ts +18 -5
  108. package/src/objects/Transaction.ts +260 -9
  109. package/src/objects/TransactionFailures.ts +11 -4
  110. package/src/objects/UpdateChannelPerCommitmentPointInput.ts +13 -2
  111. package/src/objects/UpdateChannelPerCommitmentPointOutput.ts +9 -2
  112. package/src/objects/UpdateNodeSharedSecretInput.ts +10 -2
  113. package/src/objects/UpdateNodeSharedSecretOutput.ts +9 -2
  114. package/src/objects/Wallet.ts +130 -5
  115. package/src/objects/WalletToPaymentRequestsConnection.ts +21 -5
  116. package/src/objects/WalletToTransactionsConnection.ts +16 -5
  117. package/src/objects/Withdrawal.ts +77 -61
  118. package/src/objects/WithdrawalRequest.ts +25 -4
  119. package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +19 -4
  120. package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +19 -4
  121. package/src/objects/index.ts +5 -2
  122. package/src/tests/integration/client.test.ts +46 -7
  123. package/src/tests/serialization.test.ts +18 -0
@@ -2,40 +2,40 @@
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";
5
+ import {
6
+ CurrencyAmountFromJson,
7
+ CurrencyAmountToJson,
8
+ } from "./CurrencyAmount.js";
7
9
  import type InvoiceData from "./InvoiceData.js";
8
- import { InvoiceDataFromJson } from "./InvoiceData.js";
9
- import type PaymentRequest from "./PaymentRequest.js";
10
+ import { InvoiceDataFromJson, InvoiceDataToJson } from "./InvoiceData.js";
10
11
  import PaymentRequestStatus from "./PaymentRequestStatus.js";
11
12
 
12
13
  /** This object represents a BOLT #11 invoice (https://github.com/lightning/bolts/blob/master/11-payment-encoding.md) created by a Lightspark Node. You can retrieve this object to receive relevant payment information for a specific invoice generated by a Lightspark node. **/
13
- type Invoice = PaymentRequest &
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;
14
+ interface Invoice {
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
20
 
21
- /** The date and time when the entity was first created. **/
22
- createdAt: string;
21
+ /** The date and time when the entity was first created. **/
22
+ createdAt: string;
23
23
 
24
- /** The date and time when the entity was last updated. **/
25
- updatedAt: string;
24
+ /** The date and time when the entity was last updated. **/
25
+ updatedAt: string;
26
26
 
27
- /** The details of the invoice. **/
28
- data: InvoiceData;
27
+ /** The details of the invoice. **/
28
+ data: InvoiceData;
29
29
 
30
- /** The status of the payment request. **/
31
- status: PaymentRequestStatus;
30
+ /** The status of the payment request. **/
31
+ status: PaymentRequestStatus;
32
32
 
33
- /** The typename of the object **/
34
- typename: string;
33
+ /** The typename of the object **/
34
+ typename: string;
35
35
 
36
- /** The total amount that has been paid to this invoice. **/
37
- amountPaid?: CurrencyAmount;
38
- };
36
+ /** The total amount that has been paid to this invoice. **/
37
+ amountPaid?: CurrencyAmount | undefined;
38
+ }
39
39
 
40
40
  export const InvoiceFromJson = (obj: any): Invoice => {
41
41
  return {
@@ -52,6 +52,19 @@ export const InvoiceFromJson = (obj: any): Invoice => {
52
52
  : undefined,
53
53
  } as Invoice;
54
54
  };
55
+ export const InvoiceToJson = (obj: Invoice): any => {
56
+ return {
57
+ __typename: "Invoice",
58
+ invoice_id: obj.id,
59
+ invoice_created_at: obj.createdAt,
60
+ invoice_updated_at: obj.updatedAt,
61
+ invoice_data: InvoiceDataToJson(obj.data),
62
+ invoice_status: obj.status,
63
+ invoice_amount_paid: obj.amountPaid
64
+ ? CurrencyAmountToJson(obj.amountPaid)
65
+ : undefined,
66
+ };
67
+ };
55
68
 
56
69
  export const FRAGMENT = `
57
70
  fragment InvoiceFragment on Invoice {
@@ -188,6 +201,33 @@ fragment InvoiceFragment on Invoice {
188
201
  }
189
202
  }
190
203
  lightspark_node_with_o_s_k_uma_prescreening_utxos: uma_prescreening_utxos
204
+ lightspark_node_with_o_s_k_balances: balances {
205
+ __typename
206
+ balances_owned_balance: owned_balance {
207
+ __typename
208
+ currency_amount_original_value: original_value
209
+ currency_amount_original_unit: original_unit
210
+ currency_amount_preferred_currency_unit: preferred_currency_unit
211
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
212
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
213
+ }
214
+ balances_available_to_send_balance: available_to_send_balance {
215
+ __typename
216
+ currency_amount_original_value: original_value
217
+ currency_amount_original_unit: original_unit
218
+ currency_amount_preferred_currency_unit: preferred_currency_unit
219
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
220
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
221
+ }
222
+ balances_available_to_withdraw_balance: available_to_withdraw_balance {
223
+ __typename
224
+ currency_amount_original_value: original_value
225
+ currency_amount_original_unit: original_unit
226
+ currency_amount_preferred_currency_unit: preferred_currency_unit
227
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
228
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
229
+ }
230
+ }
191
231
  lightspark_node_with_o_s_k_encrypted_signing_private_key: encrypted_signing_private_key {
192
232
  __typename
193
233
  secret_encrypted_value: encrypted_value
@@ -293,6 +333,33 @@ fragment InvoiceFragment on Invoice {
293
333
  }
294
334
  }
295
335
  lightspark_node_with_remote_signing_uma_prescreening_utxos: uma_prescreening_utxos
336
+ lightspark_node_with_remote_signing_balances: balances {
337
+ __typename
338
+ balances_owned_balance: owned_balance {
339
+ __typename
340
+ currency_amount_original_value: original_value
341
+ currency_amount_original_unit: original_unit
342
+ currency_amount_preferred_currency_unit: preferred_currency_unit
343
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
344
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
345
+ }
346
+ balances_available_to_send_balance: available_to_send_balance {
347
+ __typename
348
+ currency_amount_original_value: original_value
349
+ currency_amount_original_unit: original_unit
350
+ currency_amount_preferred_currency_unit: preferred_currency_unit
351
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
352
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
353
+ }
354
+ balances_available_to_withdraw_balance: available_to_withdraw_balance {
355
+ __typename
356
+ currency_amount_original_value: original_value
357
+ currency_amount_original_unit: original_unit
358
+ currency_amount_preferred_currency_unit: preferred_currency_unit
359
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
360
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
361
+ }
362
+ }
296
363
  }
297
364
  }
298
365
  }
@@ -2,13 +2,15 @@
2
2
 
3
3
  import BitcoinNetwork from "./BitcoinNetwork.js";
4
4
  import type CurrencyAmount from "./CurrencyAmount.js";
5
- import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
5
+ import {
6
+ CurrencyAmountFromJson,
7
+ CurrencyAmountToJson,
8
+ } from "./CurrencyAmount.js";
6
9
  import type Node from "./Node.js";
7
- import { NodeFromJson } from "./Node.js";
8
- import type PaymentRequestData from "./PaymentRequestData.js";
10
+ import { NodeFromJson, NodeToJson } from "./Node.js";
9
11
 
10
12
  /** This object represents the data associated with a BOLT #11 invoice. You can retrieve this object to receive the relevant data associated with a specific invoice. **/
11
- type InvoiceData = PaymentRequestData & {
13
+ interface InvoiceData {
12
14
  encodedPaymentRequest: string;
13
15
 
14
16
  bitcoinNetwork: BitcoinNetwork;
@@ -35,8 +37,8 @@ type InvoiceData = PaymentRequestData & {
35
37
  typename: string;
36
38
 
37
39
  /** A short, UTF-8 encoded, description of the purpose of this invoice. **/
38
- memo?: string;
39
- };
40
+ memo?: string | undefined;
41
+ }
40
42
 
41
43
  export const InvoiceDataFromJson = (obj: any): InvoiceData => {
42
44
  return {
@@ -53,6 +55,19 @@ export const InvoiceDataFromJson = (obj: any): InvoiceData => {
53
55
  memo: obj["invoice_data_memo"],
54
56
  } as InvoiceData;
55
57
  };
58
+ export const InvoiceDataToJson = (obj: InvoiceData): any => {
59
+ return {
60
+ __typename: "InvoiceData",
61
+ invoice_data_encoded_payment_request: obj.encodedPaymentRequest,
62
+ invoice_data_bitcoin_network: obj.bitcoinNetwork,
63
+ invoice_data_payment_hash: obj.paymentHash,
64
+ invoice_data_amount: CurrencyAmountToJson(obj.amount),
65
+ invoice_data_created_at: obj.createdAt,
66
+ invoice_data_expires_at: obj.expiresAt,
67
+ invoice_data_memo: obj.memo,
68
+ invoice_data_destination: NodeToJson(obj.destination),
69
+ };
70
+ };
56
71
 
57
72
  export const FRAGMENT = `
58
73
  fragment InvoiceDataFragment on InvoiceData {
@@ -184,6 +199,33 @@ fragment InvoiceDataFragment on InvoiceData {
184
199
  }
185
200
  }
186
201
  lightspark_node_with_o_s_k_uma_prescreening_utxos: uma_prescreening_utxos
202
+ lightspark_node_with_o_s_k_balances: balances {
203
+ __typename
204
+ balances_owned_balance: owned_balance {
205
+ __typename
206
+ currency_amount_original_value: original_value
207
+ currency_amount_original_unit: original_unit
208
+ currency_amount_preferred_currency_unit: preferred_currency_unit
209
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
210
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
211
+ }
212
+ balances_available_to_send_balance: available_to_send_balance {
213
+ __typename
214
+ currency_amount_original_value: original_value
215
+ currency_amount_original_unit: original_unit
216
+ currency_amount_preferred_currency_unit: preferred_currency_unit
217
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
218
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
219
+ }
220
+ balances_available_to_withdraw_balance: available_to_withdraw_balance {
221
+ __typename
222
+ currency_amount_original_value: original_value
223
+ currency_amount_original_unit: original_unit
224
+ currency_amount_preferred_currency_unit: preferred_currency_unit
225
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
226
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
227
+ }
228
+ }
187
229
  lightspark_node_with_o_s_k_encrypted_signing_private_key: encrypted_signing_private_key {
188
230
  __typename
189
231
  secret_encrypted_value: encrypted_value
@@ -289,6 +331,33 @@ fragment InvoiceDataFragment on InvoiceData {
289
331
  }
290
332
  }
291
333
  lightspark_node_with_remote_signing_uma_prescreening_utxos: uma_prescreening_utxos
334
+ lightspark_node_with_remote_signing_balances: balances {
335
+ __typename
336
+ balances_owned_balance: owned_balance {
337
+ __typename
338
+ currency_amount_original_value: original_value
339
+ currency_amount_original_unit: original_unit
340
+ currency_amount_preferred_currency_unit: preferred_currency_unit
341
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
342
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
343
+ }
344
+ balances_available_to_send_balance: available_to_send_balance {
345
+ __typename
346
+ currency_amount_original_value: original_value
347
+ currency_amount_original_unit: original_unit
348
+ currency_amount_preferred_currency_unit: preferred_currency_unit
349
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
350
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
351
+ }
352
+ balances_available_to_withdraw_balance: available_to_withdraw_balance {
353
+ __typename
354
+ currency_amount_original_value: original_value
355
+ currency_amount_original_unit: original_unit
356
+ currency_amount_preferred_currency_unit: preferred_currency_unit
357
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
358
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
359
+ }
360
+ }
292
361
  }
293
362
  }
294
363
  }`;
@@ -1,6 +1,6 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- type LightningFeeEstimateForInvoiceInput = {
3
+ interface LightningFeeEstimateForInvoiceInput {
4
4
  /** The node from where you want to send the payment. **/
5
5
  nodeId: string;
6
6
 
@@ -11,8 +11,8 @@ type LightningFeeEstimateForInvoiceInput = {
11
11
  * If the invoice does not specify a payment amount, then the amount that you wish to pay, expressed
12
12
  * in msats.
13
13
  **/
14
- amountMsats?: number;
15
- };
14
+ amountMsats?: number | undefined;
15
+ }
16
16
 
17
17
  export const LightningFeeEstimateForInvoiceInputFromJson = (
18
18
  obj: any,
@@ -24,5 +24,15 @@ export const LightningFeeEstimateForInvoiceInputFromJson = (
24
24
  amountMsats: obj["lightning_fee_estimate_for_invoice_input_amount_msats"],
25
25
  } as LightningFeeEstimateForInvoiceInput;
26
26
  };
27
+ export const LightningFeeEstimateForInvoiceInputToJson = (
28
+ obj: LightningFeeEstimateForInvoiceInput,
29
+ ): any => {
30
+ return {
31
+ lightning_fee_estimate_for_invoice_input_node_id: obj.nodeId,
32
+ lightning_fee_estimate_for_invoice_input_encoded_payment_request:
33
+ obj.encodedPaymentRequest,
34
+ lightning_fee_estimate_for_invoice_input_amount_msats: obj.amountMsats,
35
+ };
36
+ };
27
37
 
28
38
  export default LightningFeeEstimateForInvoiceInput;
@@ -1,6 +1,6 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- type LightningFeeEstimateForNodeInput = {
3
+ interface LightningFeeEstimateForNodeInput {
4
4
  /** The node from where you want to send the payment. **/
5
5
  nodeId: string;
6
6
 
@@ -9,7 +9,7 @@ type LightningFeeEstimateForNodeInput = {
9
9
 
10
10
  /** The payment amount expressed in msats. **/
11
11
  amountMsats: number;
12
- };
12
+ }
13
13
 
14
14
  export const LightningFeeEstimateForNodeInputFromJson = (
15
15
  obj: any,
@@ -21,5 +21,15 @@ export const LightningFeeEstimateForNodeInputFromJson = (
21
21
  amountMsats: obj["lightning_fee_estimate_for_node_input_amount_msats"],
22
22
  } as LightningFeeEstimateForNodeInput;
23
23
  };
24
+ export const LightningFeeEstimateForNodeInputToJson = (
25
+ obj: LightningFeeEstimateForNodeInput,
26
+ ): any => {
27
+ return {
28
+ lightning_fee_estimate_for_node_input_node_id: obj.nodeId,
29
+ lightning_fee_estimate_for_node_input_destination_node_public_key:
30
+ obj.destinationNodePublicKey,
31
+ lightning_fee_estimate_for_node_input_amount_msats: obj.amountMsats,
32
+ };
33
+ };
24
34
 
25
35
  export default LightningFeeEstimateForNodeInput;
@@ -1,12 +1,15 @@
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 LightningFeeEstimateOutput = {
9
+ interface LightningFeeEstimateOutput {
7
10
  /** The estimated fees for the payment. **/
8
11
  feeEstimate: CurrencyAmount;
9
- };
12
+ }
10
13
 
11
14
  export const LightningFeeEstimateOutputFromJson = (
12
15
  obj: any,
@@ -17,6 +20,15 @@ export const LightningFeeEstimateOutputFromJson = (
17
20
  ),
18
21
  } as LightningFeeEstimateOutput;
19
22
  };
23
+ export const LightningFeeEstimateOutputToJson = (
24
+ obj: LightningFeeEstimateOutput,
25
+ ): any => {
26
+ return {
27
+ lightning_fee_estimate_output_fee_estimate: CurrencyAmountToJson(
28
+ obj.feeEstimate,
29
+ ),
30
+ };
31
+ };
20
32
 
21
33
  export const FRAGMENT = `
22
34
  fragment LightningFeeEstimateOutputFragment on LightningFeeEstimateOutput {
@@ -2,49 +2,55 @@
2
2
 
3
3
  import { LightsparkException, 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";
5
+ import {
6
+ CurrencyAmountFromJson,
7
+ CurrencyAmountToJson,
8
+ } from "./CurrencyAmount.js";
7
9
  import IncomingPayment from "./IncomingPayment.js";
8
10
  import OutgoingPayment from "./OutgoingPayment.js";
9
11
  import PaymentFailureReason from "./PaymentFailureReason.js";
10
- import { PaymentRequestDataFromJson } from "./PaymentRequestData.js";
11
- import { PostTransactionDataFromJson } from "./PostTransactionData.js";
12
- import { RichTextFromJson } from "./RichText.js";
12
+ import {
13
+ PaymentRequestDataFromJson,
14
+ PaymentRequestDataToJson,
15
+ } from "./PaymentRequestData.js";
16
+ import {
17
+ PostTransactionDataFromJson,
18
+ PostTransactionDataToJson,
19
+ } from "./PostTransactionData.js";
20
+ import { RichTextFromJson, RichTextToJson } from "./RichText.js";
13
21
  import type RoutingTransaction from "./RoutingTransaction.js";
14
22
  import RoutingTransactionFailureReason from "./RoutingTransactionFailureReason.js";
15
- import type Transaction from "./Transaction.js";
16
23
  import TransactionStatus from "./TransactionStatus.js";
17
24
 
18
25
  /** This is an object representing a transaction made over the Lightning Network. You can retrieve this object to receive information about a specific transaction made over Lightning for a Lightspark node. **/
19
- type LightningTransaction = Transaction &
20
- Entity & {
21
- /**
22
- * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
23
- * string.
24
- **/
25
- id: string;
26
+ interface LightningTransaction {
27
+ /**
28
+ * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
29
+ * string.
30
+ **/
31
+ id: string;
26
32
 
27
- /** The date and time when this transaction was initiated. **/
28
- createdAt: string;
33
+ /** The date and time when this transaction was initiated. **/
34
+ createdAt: string;
29
35
 
30
- /** The date and time when the entity was last updated. **/
31
- updatedAt: string;
36
+ /** The date and time when the entity was last updated. **/
37
+ updatedAt: string;
32
38
 
33
- /** The current status of this transaction. **/
34
- status: TransactionStatus;
39
+ /** The current status of this transaction. **/
40
+ status: TransactionStatus;
35
41
 
36
- /** The amount of money involved in this transaction. **/
37
- amount: CurrencyAmount;
42
+ /** The amount of money involved in this transaction. **/
43
+ amount: CurrencyAmount;
38
44
 
39
- /** The typename of the object **/
40
- typename: string;
45
+ /** The typename of the object **/
46
+ typename: string;
41
47
 
42
- /** The date and time when this transaction was completed or failed. **/
43
- resolvedAt?: string;
48
+ /** The date and time when this transaction was completed or failed. **/
49
+ resolvedAt?: string | undefined;
44
50
 
45
- /** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
46
- transactionHash?: string;
47
- };
51
+ /** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
52
+ transactionHash?: string | undefined;
53
+ }
48
54
 
49
55
  export const LightningTransactionFromJson = (
50
56
  obj: any,
@@ -135,6 +141,89 @@ export const LightningTransactionFromJson = (
135
141
  `Couldn't find a concrete type for interface LightningTransaction corresponding to the typename=${obj["__typename"]}`,
136
142
  );
137
143
  };
144
+ export const LightningTransactionToJson = (obj: LightningTransaction): any => {
145
+ if (obj.typename == "IncomingPayment") {
146
+ const incomingPayment = obj as IncomingPayment;
147
+ return {
148
+ __typename: "IncomingPayment",
149
+ incoming_payment_id: incomingPayment.id,
150
+ incoming_payment_created_at: incomingPayment.createdAt,
151
+ incoming_payment_updated_at: incomingPayment.updatedAt,
152
+ incoming_payment_status: incomingPayment.status,
153
+ incoming_payment_resolved_at: incomingPayment.resolvedAt,
154
+ incoming_payment_amount: CurrencyAmountToJson(incomingPayment.amount),
155
+ incoming_payment_transaction_hash: incomingPayment.transactionHash,
156
+ incoming_payment_destination: { id: incomingPayment.destinationId },
157
+ incoming_payment_payment_request:
158
+ { id: incomingPayment.paymentRequestId } ?? undefined,
159
+ incoming_payment_uma_post_transaction_data:
160
+ incomingPayment.umaPostTransactionData?.map((e) =>
161
+ PostTransactionDataToJson(e),
162
+ ),
163
+ };
164
+ }
165
+ if (obj.typename == "OutgoingPayment") {
166
+ const outgoingPayment = obj as OutgoingPayment;
167
+ return {
168
+ __typename: "OutgoingPayment",
169
+ outgoing_payment_id: outgoingPayment.id,
170
+ outgoing_payment_created_at: outgoingPayment.createdAt,
171
+ outgoing_payment_updated_at: outgoingPayment.updatedAt,
172
+ outgoing_payment_status: outgoingPayment.status,
173
+ outgoing_payment_resolved_at: outgoingPayment.resolvedAt,
174
+ outgoing_payment_amount: CurrencyAmountToJson(outgoingPayment.amount),
175
+ outgoing_payment_transaction_hash: outgoingPayment.transactionHash,
176
+ outgoing_payment_origin: { id: outgoingPayment.originId },
177
+ outgoing_payment_destination:
178
+ { id: outgoingPayment.destinationId } ?? undefined,
179
+ outgoing_payment_fees: outgoingPayment.fees
180
+ ? CurrencyAmountToJson(outgoingPayment.fees)
181
+ : undefined,
182
+ outgoing_payment_payment_request_data: outgoingPayment.paymentRequestData
183
+ ? PaymentRequestDataToJson(outgoingPayment.paymentRequestData)
184
+ : undefined,
185
+ outgoing_payment_failure_reason: outgoingPayment.failureReason,
186
+ outgoing_payment_failure_message: outgoingPayment.failureMessage
187
+ ? RichTextToJson(outgoingPayment.failureMessage)
188
+ : undefined,
189
+ outgoing_payment_uma_post_transaction_data:
190
+ outgoingPayment.umaPostTransactionData?.map((e) =>
191
+ PostTransactionDataToJson(e),
192
+ ),
193
+ outgoing_payment_payment_preimage: outgoingPayment.paymentPreimage,
194
+ };
195
+ }
196
+ if (obj.typename == "RoutingTransaction") {
197
+ const routingTransaction = obj as RoutingTransaction;
198
+ return {
199
+ __typename: "RoutingTransaction",
200
+ routing_transaction_id: routingTransaction.id,
201
+ routing_transaction_created_at: routingTransaction.createdAt,
202
+ routing_transaction_updated_at: routingTransaction.updatedAt,
203
+ routing_transaction_status: routingTransaction.status,
204
+ routing_transaction_resolved_at: routingTransaction.resolvedAt,
205
+ routing_transaction_amount: CurrencyAmountToJson(
206
+ routingTransaction.amount,
207
+ ),
208
+ routing_transaction_transaction_hash: routingTransaction.transactionHash,
209
+ routing_transaction_incoming_channel:
210
+ { id: routingTransaction.incomingChannelId } ?? undefined,
211
+ routing_transaction_outgoing_channel:
212
+ { id: routingTransaction.outgoingChannelId } ?? undefined,
213
+ routing_transaction_fees: routingTransaction.fees
214
+ ? CurrencyAmountToJson(routingTransaction.fees)
215
+ : undefined,
216
+ routing_transaction_failure_message: routingTransaction.failureMessage
217
+ ? RichTextToJson(routingTransaction.failureMessage)
218
+ : undefined,
219
+ routing_transaction_failure_reason: routingTransaction.failureReason,
220
+ };
221
+ }
222
+ throw new LightsparkException(
223
+ "DeserializationError",
224
+ `Couldn't find a concrete type for interface LightningTransaction corresponding to the typename=${obj.typename}`,
225
+ );
226
+ };
138
227
 
139
228
  export const FRAGMENT = `
140
229
  fragment LightningTransactionFragment on LightningTransaction {
@@ -335,6 +424,33 @@ fragment LightningTransactionFragment on LightningTransaction {
335
424
  }
336
425
  }
337
426
  lightspark_node_with_o_s_k_uma_prescreening_utxos: uma_prescreening_utxos
427
+ lightspark_node_with_o_s_k_balances: balances {
428
+ __typename
429
+ balances_owned_balance: owned_balance {
430
+ __typename
431
+ currency_amount_original_value: original_value
432
+ currency_amount_original_unit: original_unit
433
+ currency_amount_preferred_currency_unit: preferred_currency_unit
434
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
435
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
436
+ }
437
+ balances_available_to_send_balance: available_to_send_balance {
438
+ __typename
439
+ currency_amount_original_value: original_value
440
+ currency_amount_original_unit: original_unit
441
+ currency_amount_preferred_currency_unit: preferred_currency_unit
442
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
443
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
444
+ }
445
+ balances_available_to_withdraw_balance: available_to_withdraw_balance {
446
+ __typename
447
+ currency_amount_original_value: original_value
448
+ currency_amount_original_unit: original_unit
449
+ currency_amount_preferred_currency_unit: preferred_currency_unit
450
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
451
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
452
+ }
453
+ }
338
454
  lightspark_node_with_o_s_k_encrypted_signing_private_key: encrypted_signing_private_key {
339
455
  __typename
340
456
  secret_encrypted_value: encrypted_value
@@ -440,6 +556,33 @@ fragment LightningTransactionFragment on LightningTransaction {
440
556
  }
441
557
  }
442
558
  lightspark_node_with_remote_signing_uma_prescreening_utxos: uma_prescreening_utxos
559
+ lightspark_node_with_remote_signing_balances: balances {
560
+ __typename
561
+ balances_owned_balance: owned_balance {
562
+ __typename
563
+ currency_amount_original_value: original_value
564
+ currency_amount_original_unit: original_unit
565
+ currency_amount_preferred_currency_unit: preferred_currency_unit
566
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
567
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
568
+ }
569
+ balances_available_to_send_balance: available_to_send_balance {
570
+ __typename
571
+ currency_amount_original_value: original_value
572
+ currency_amount_original_unit: original_unit
573
+ currency_amount_preferred_currency_unit: preferred_currency_unit
574
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
575
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
576
+ }
577
+ balances_available_to_withdraw_balance: available_to_withdraw_balance {
578
+ __typename
579
+ currency_amount_original_value: original_value
580
+ currency_amount_original_unit: original_unit
581
+ currency_amount_preferred_currency_unit: preferred_currency_unit
582
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
583
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
584
+ }
585
+ }
443
586
  }
444
587
  }
445
588
  }