@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
@@ -4,22 +4,30 @@ import { LightsparkException, type Query } from "@lightsparkdev/core";
4
4
  import type ChannelClosingTransaction from "./ChannelClosingTransaction.js";
5
5
  import type ChannelOpeningTransaction from "./ChannelOpeningTransaction.js";
6
6
  import type CurrencyAmount from "./CurrencyAmount.js";
7
- import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
7
+ import {
8
+ CurrencyAmountFromJson,
9
+ CurrencyAmountToJson,
10
+ } from "./CurrencyAmount.js";
8
11
  import type Deposit from "./Deposit.js";
9
- import type Entity from "./Entity.js";
10
12
  import IncomingPayment from "./IncomingPayment.js";
11
13
  import OutgoingPayment from "./OutgoingPayment.js";
12
14
  import PaymentFailureReason from "./PaymentFailureReason.js";
13
- import { PaymentRequestDataFromJson } from "./PaymentRequestData.js";
14
- import { PostTransactionDataFromJson } from "./PostTransactionData.js";
15
- import { RichTextFromJson } from "./RichText.js";
15
+ import {
16
+ PaymentRequestDataFromJson,
17
+ PaymentRequestDataToJson,
18
+ } from "./PaymentRequestData.js";
19
+ import {
20
+ PostTransactionDataFromJson,
21
+ PostTransactionDataToJson,
22
+ } from "./PostTransactionData.js";
23
+ import { RichTextFromJson, RichTextToJson } from "./RichText.js";
16
24
  import type RoutingTransaction from "./RoutingTransaction.js";
17
25
  import RoutingTransactionFailureReason from "./RoutingTransactionFailureReason.js";
18
26
  import TransactionStatus from "./TransactionStatus.js";
19
27
  import type Withdrawal from "./Withdrawal.js";
20
28
 
21
29
  /** This object represents a payment transaction. The transaction can occur either on a Bitcoin Network, or over the Lightning Network. You can retrieve this object to receive specific information about a particular transaction tied to your Lightspark Node. **/
22
- type Transaction = Entity & {
30
+ interface Transaction {
23
31
  /**
24
32
  * The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
25
33
  * string.
@@ -42,11 +50,11 @@ type Transaction = Entity & {
42
50
  typename: string;
43
51
 
44
52
  /** The date and time when this transaction was completed or failed. **/
45
- resolvedAt?: string;
53
+ resolvedAt?: string | undefined;
46
54
 
47
55
  /** The hash of this transaction, so it can be uniquely identified on the Lightning Network. **/
48
- transactionHash?: string;
49
- };
56
+ transactionHash?: string | undefined;
57
+ }
50
58
 
51
59
  export const TransactionFromJson = (obj: any): Transaction => {
52
60
  if (obj["__typename"] == "ChannelClosingTransaction") {
@@ -225,6 +233,195 @@ export const TransactionFromJson = (obj: any): Transaction => {
225
233
  `Couldn't find a concrete type for interface Transaction corresponding to the typename=${obj["__typename"]}`,
226
234
  );
227
235
  };
236
+ export const TransactionToJson = (obj: Transaction): any => {
237
+ if (obj.typename == "ChannelClosingTransaction") {
238
+ const channelClosingTransaction = obj as ChannelClosingTransaction;
239
+ return {
240
+ __typename: "ChannelClosingTransaction",
241
+ channel_closing_transaction_id: channelClosingTransaction.id,
242
+ channel_closing_transaction_created_at:
243
+ channelClosingTransaction.createdAt,
244
+ channel_closing_transaction_updated_at:
245
+ channelClosingTransaction.updatedAt,
246
+ channel_closing_transaction_status: channelClosingTransaction.status,
247
+ channel_closing_transaction_resolved_at:
248
+ channelClosingTransaction.resolvedAt,
249
+ channel_closing_transaction_amount: CurrencyAmountToJson(
250
+ channelClosingTransaction.amount,
251
+ ),
252
+ channel_closing_transaction_transaction_hash:
253
+ channelClosingTransaction.transactionHash,
254
+ channel_closing_transaction_fees: channelClosingTransaction.fees
255
+ ? CurrencyAmountToJson(channelClosingTransaction.fees)
256
+ : undefined,
257
+ channel_closing_transaction_block_hash:
258
+ channelClosingTransaction.blockHash,
259
+ channel_closing_transaction_block_height:
260
+ channelClosingTransaction.blockHeight,
261
+ channel_closing_transaction_destination_addresses:
262
+ channelClosingTransaction.destinationAddresses,
263
+ channel_closing_transaction_num_confirmations:
264
+ channelClosingTransaction.numConfirmations,
265
+ channel_closing_transaction_channel:
266
+ { id: channelClosingTransaction.channelId } ?? undefined,
267
+ };
268
+ }
269
+ if (obj.typename == "ChannelOpeningTransaction") {
270
+ const channelOpeningTransaction = obj as ChannelOpeningTransaction;
271
+ return {
272
+ __typename: "ChannelOpeningTransaction",
273
+ channel_opening_transaction_id: channelOpeningTransaction.id,
274
+ channel_opening_transaction_created_at:
275
+ channelOpeningTransaction.createdAt,
276
+ channel_opening_transaction_updated_at:
277
+ channelOpeningTransaction.updatedAt,
278
+ channel_opening_transaction_status: channelOpeningTransaction.status,
279
+ channel_opening_transaction_resolved_at:
280
+ channelOpeningTransaction.resolvedAt,
281
+ channel_opening_transaction_amount: CurrencyAmountToJson(
282
+ channelOpeningTransaction.amount,
283
+ ),
284
+ channel_opening_transaction_transaction_hash:
285
+ channelOpeningTransaction.transactionHash,
286
+ channel_opening_transaction_fees: channelOpeningTransaction.fees
287
+ ? CurrencyAmountToJson(channelOpeningTransaction.fees)
288
+ : undefined,
289
+ channel_opening_transaction_block_hash:
290
+ channelOpeningTransaction.blockHash,
291
+ channel_opening_transaction_block_height:
292
+ channelOpeningTransaction.blockHeight,
293
+ channel_opening_transaction_destination_addresses:
294
+ channelOpeningTransaction.destinationAddresses,
295
+ channel_opening_transaction_num_confirmations:
296
+ channelOpeningTransaction.numConfirmations,
297
+ channel_opening_transaction_channel:
298
+ { id: channelOpeningTransaction.channelId } ?? undefined,
299
+ };
300
+ }
301
+ if (obj.typename == "Deposit") {
302
+ const deposit = obj as Deposit;
303
+ return {
304
+ __typename: "Deposit",
305
+ deposit_id: deposit.id,
306
+ deposit_created_at: deposit.createdAt,
307
+ deposit_updated_at: deposit.updatedAt,
308
+ deposit_status: deposit.status,
309
+ deposit_resolved_at: deposit.resolvedAt,
310
+ deposit_amount: CurrencyAmountToJson(deposit.amount),
311
+ deposit_transaction_hash: deposit.transactionHash,
312
+ deposit_fees: deposit.fees
313
+ ? CurrencyAmountToJson(deposit.fees)
314
+ : undefined,
315
+ deposit_block_hash: deposit.blockHash,
316
+ deposit_block_height: deposit.blockHeight,
317
+ deposit_destination_addresses: deposit.destinationAddresses,
318
+ deposit_num_confirmations: deposit.numConfirmations,
319
+ deposit_destination: { id: deposit.destinationId },
320
+ };
321
+ }
322
+ if (obj.typename == "IncomingPayment") {
323
+ const incomingPayment = obj as IncomingPayment;
324
+ return {
325
+ __typename: "IncomingPayment",
326
+ incoming_payment_id: incomingPayment.id,
327
+ incoming_payment_created_at: incomingPayment.createdAt,
328
+ incoming_payment_updated_at: incomingPayment.updatedAt,
329
+ incoming_payment_status: incomingPayment.status,
330
+ incoming_payment_resolved_at: incomingPayment.resolvedAt,
331
+ incoming_payment_amount: CurrencyAmountToJson(incomingPayment.amount),
332
+ incoming_payment_transaction_hash: incomingPayment.transactionHash,
333
+ incoming_payment_destination: { id: incomingPayment.destinationId },
334
+ incoming_payment_payment_request:
335
+ { id: incomingPayment.paymentRequestId } ?? undefined,
336
+ incoming_payment_uma_post_transaction_data:
337
+ incomingPayment.umaPostTransactionData?.map((e) =>
338
+ PostTransactionDataToJson(e),
339
+ ),
340
+ };
341
+ }
342
+ if (obj.typename == "OutgoingPayment") {
343
+ const outgoingPayment = obj as OutgoingPayment;
344
+ return {
345
+ __typename: "OutgoingPayment",
346
+ outgoing_payment_id: outgoingPayment.id,
347
+ outgoing_payment_created_at: outgoingPayment.createdAt,
348
+ outgoing_payment_updated_at: outgoingPayment.updatedAt,
349
+ outgoing_payment_status: outgoingPayment.status,
350
+ outgoing_payment_resolved_at: outgoingPayment.resolvedAt,
351
+ outgoing_payment_amount: CurrencyAmountToJson(outgoingPayment.amount),
352
+ outgoing_payment_transaction_hash: outgoingPayment.transactionHash,
353
+ outgoing_payment_origin: { id: outgoingPayment.originId },
354
+ outgoing_payment_destination:
355
+ { id: outgoingPayment.destinationId } ?? undefined,
356
+ outgoing_payment_fees: outgoingPayment.fees
357
+ ? CurrencyAmountToJson(outgoingPayment.fees)
358
+ : undefined,
359
+ outgoing_payment_payment_request_data: outgoingPayment.paymentRequestData
360
+ ? PaymentRequestDataToJson(outgoingPayment.paymentRequestData)
361
+ : undefined,
362
+ outgoing_payment_failure_reason: outgoingPayment.failureReason,
363
+ outgoing_payment_failure_message: outgoingPayment.failureMessage
364
+ ? RichTextToJson(outgoingPayment.failureMessage)
365
+ : undefined,
366
+ outgoing_payment_uma_post_transaction_data:
367
+ outgoingPayment.umaPostTransactionData?.map((e) =>
368
+ PostTransactionDataToJson(e),
369
+ ),
370
+ outgoing_payment_payment_preimage: outgoingPayment.paymentPreimage,
371
+ };
372
+ }
373
+ if (obj.typename == "RoutingTransaction") {
374
+ const routingTransaction = obj as RoutingTransaction;
375
+ return {
376
+ __typename: "RoutingTransaction",
377
+ routing_transaction_id: routingTransaction.id,
378
+ routing_transaction_created_at: routingTransaction.createdAt,
379
+ routing_transaction_updated_at: routingTransaction.updatedAt,
380
+ routing_transaction_status: routingTransaction.status,
381
+ routing_transaction_resolved_at: routingTransaction.resolvedAt,
382
+ routing_transaction_amount: CurrencyAmountToJson(
383
+ routingTransaction.amount,
384
+ ),
385
+ routing_transaction_transaction_hash: routingTransaction.transactionHash,
386
+ routing_transaction_incoming_channel:
387
+ { id: routingTransaction.incomingChannelId } ?? undefined,
388
+ routing_transaction_outgoing_channel:
389
+ { id: routingTransaction.outgoingChannelId } ?? undefined,
390
+ routing_transaction_fees: routingTransaction.fees
391
+ ? CurrencyAmountToJson(routingTransaction.fees)
392
+ : undefined,
393
+ routing_transaction_failure_message: routingTransaction.failureMessage
394
+ ? RichTextToJson(routingTransaction.failureMessage)
395
+ : undefined,
396
+ routing_transaction_failure_reason: routingTransaction.failureReason,
397
+ };
398
+ }
399
+ if (obj.typename == "Withdrawal") {
400
+ const withdrawal = obj as Withdrawal;
401
+ return {
402
+ __typename: "Withdrawal",
403
+ withdrawal_id: withdrawal.id,
404
+ withdrawal_created_at: withdrawal.createdAt,
405
+ withdrawal_updated_at: withdrawal.updatedAt,
406
+ withdrawal_status: withdrawal.status,
407
+ withdrawal_resolved_at: withdrawal.resolvedAt,
408
+ withdrawal_amount: CurrencyAmountToJson(withdrawal.amount),
409
+ withdrawal_transaction_hash: withdrawal.transactionHash,
410
+ withdrawal_fees: withdrawal.fees
411
+ ? CurrencyAmountToJson(withdrawal.fees)
412
+ : undefined,
413
+ withdrawal_block_hash: withdrawal.blockHash,
414
+ withdrawal_block_height: withdrawal.blockHeight,
415
+ withdrawal_destination_addresses: withdrawal.destinationAddresses,
416
+ withdrawal_num_confirmations: withdrawal.numConfirmations,
417
+ withdrawal_origin: { id: withdrawal.originId },
418
+ };
419
+ }
420
+ throw new LightsparkException(
421
+ "DeserializationError",
422
+ `Couldn't find a concrete type for interface Transaction corresponding to the typename=${obj.typename}`,
423
+ );
424
+ };
228
425
 
229
426
  export const FRAGMENT = `
230
427
  fragment TransactionFragment on Transaction {
@@ -521,6 +718,33 @@ fragment TransactionFragment on Transaction {
521
718
  }
522
719
  }
523
720
  lightspark_node_with_o_s_k_uma_prescreening_utxos: uma_prescreening_utxos
721
+ lightspark_node_with_o_s_k_balances: balances {
722
+ __typename
723
+ balances_owned_balance: owned_balance {
724
+ __typename
725
+ currency_amount_original_value: original_value
726
+ currency_amount_original_unit: original_unit
727
+ currency_amount_preferred_currency_unit: preferred_currency_unit
728
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
729
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
730
+ }
731
+ balances_available_to_send_balance: available_to_send_balance {
732
+ __typename
733
+ currency_amount_original_value: original_value
734
+ currency_amount_original_unit: original_unit
735
+ currency_amount_preferred_currency_unit: preferred_currency_unit
736
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
737
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
738
+ }
739
+ balances_available_to_withdraw_balance: available_to_withdraw_balance {
740
+ __typename
741
+ currency_amount_original_value: original_value
742
+ currency_amount_original_unit: original_unit
743
+ currency_amount_preferred_currency_unit: preferred_currency_unit
744
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
745
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
746
+ }
747
+ }
524
748
  lightspark_node_with_o_s_k_encrypted_signing_private_key: encrypted_signing_private_key {
525
749
  __typename
526
750
  secret_encrypted_value: encrypted_value
@@ -626,6 +850,33 @@ fragment TransactionFragment on Transaction {
626
850
  }
627
851
  }
628
852
  lightspark_node_with_remote_signing_uma_prescreening_utxos: uma_prescreening_utxos
853
+ lightspark_node_with_remote_signing_balances: balances {
854
+ __typename
855
+ balances_owned_balance: owned_balance {
856
+ __typename
857
+ currency_amount_original_value: original_value
858
+ currency_amount_original_unit: original_unit
859
+ currency_amount_preferred_currency_unit: preferred_currency_unit
860
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
861
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
862
+ }
863
+ balances_available_to_send_balance: available_to_send_balance {
864
+ __typename
865
+ currency_amount_original_value: original_value
866
+ currency_amount_original_unit: original_unit
867
+ currency_amount_preferred_currency_unit: preferred_currency_unit
868
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
869
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
870
+ }
871
+ balances_available_to_withdraw_balance: available_to_withdraw_balance {
872
+ __typename
873
+ currency_amount_original_value: original_value
874
+ currency_amount_original_unit: original_unit
875
+ currency_amount_preferred_currency_unit: preferred_currency_unit
876
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
877
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
878
+ }
879
+ }
629
880
  }
630
881
  }
631
882
  }
@@ -4,11 +4,11 @@ import PaymentFailureReason from "./PaymentFailureReason.js";
4
4
  import RoutingTransactionFailureReason from "./RoutingTransactionFailureReason.js";
5
5
 
6
6
  /** This object represents payment failures associated with your Lightspark Node. **/
7
- type TransactionFailures = {
8
- paymentFailures?: PaymentFailureReason[];
7
+ interface TransactionFailures {
8
+ paymentFailures?: PaymentFailureReason[] | undefined;
9
9
 
10
- routingTransactionFailures?: RoutingTransactionFailureReason[];
11
- };
10
+ routingTransactionFailures?: RoutingTransactionFailureReason[] | undefined;
11
+ }
12
12
 
13
13
  export const TransactionFailuresFromJson = (obj: any): TransactionFailures => {
14
14
  return {
@@ -20,5 +20,12 @@ export const TransactionFailuresFromJson = (obj: any): TransactionFailures => {
20
20
  ]?.map((e) => RoutingTransactionFailureReason[e]),
21
21
  } as TransactionFailures;
22
22
  };
23
+ export const TransactionFailuresToJson = (obj: TransactionFailures): any => {
24
+ return {
25
+ transaction_failures_payment_failures: obj.paymentFailures,
26
+ transaction_failures_routing_transaction_failures:
27
+ obj.routingTransactionFailures,
28
+ };
29
+ };
23
30
 
24
31
  export default TransactionFailures;
@@ -1,12 +1,12 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- type UpdateChannelPerCommitmentPointInput = {
3
+ interface UpdateChannelPerCommitmentPointInput {
4
4
  channelId: string;
5
5
 
6
6
  perCommitmentPoint: string;
7
7
 
8
8
  perCommitmentPointIndex: number;
9
- };
9
+ }
10
10
 
11
11
  export const UpdateChannelPerCommitmentPointInputFromJson = (
12
12
  obj: any,
@@ -21,5 +21,16 @@ export const UpdateChannelPerCommitmentPointInputFromJson = (
21
21
  ],
22
22
  } as UpdateChannelPerCommitmentPointInput;
23
23
  };
24
+ export const UpdateChannelPerCommitmentPointInputToJson = (
25
+ obj: UpdateChannelPerCommitmentPointInput,
26
+ ): any => {
27
+ return {
28
+ update_channel_per_commitment_point_input_channel_id: obj.channelId,
29
+ update_channel_per_commitment_point_input_per_commitment_point:
30
+ obj.perCommitmentPoint,
31
+ update_channel_per_commitment_point_input_per_commitment_point_index:
32
+ obj.perCommitmentPointIndex,
33
+ };
34
+ };
24
35
 
25
36
  export default UpdateChannelPerCommitmentPointInput;
@@ -1,8 +1,8 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- type UpdateChannelPerCommitmentPointOutput = {
3
+ interface UpdateChannelPerCommitmentPointOutput {
4
4
  channelId: string;
5
- };
5
+ }
6
6
 
7
7
  export const UpdateChannelPerCommitmentPointOutputFromJson = (
8
8
  obj: any,
@@ -11,6 +11,13 @@ export const UpdateChannelPerCommitmentPointOutputFromJson = (
11
11
  channelId: obj["update_channel_per_commitment_point_output_channel"].id,
12
12
  } as UpdateChannelPerCommitmentPointOutput;
13
13
  };
14
+ export const UpdateChannelPerCommitmentPointOutputToJson = (
15
+ obj: UpdateChannelPerCommitmentPointOutput,
16
+ ): any => {
17
+ return {
18
+ update_channel_per_commitment_point_output_channel: { id: obj.channelId },
19
+ };
20
+ };
14
21
 
15
22
  export const FRAGMENT = `
16
23
  fragment UpdateChannelPerCommitmentPointOutputFragment on UpdateChannelPerCommitmentPointOutput {
@@ -1,10 +1,10 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- type UpdateNodeSharedSecretInput = {
3
+ interface UpdateNodeSharedSecretInput {
4
4
  nodeId: string;
5
5
 
6
6
  sharedSecret: string;
7
- };
7
+ }
8
8
 
9
9
  export const UpdateNodeSharedSecretInputFromJson = (
10
10
  obj: any,
@@ -14,5 +14,13 @@ export const UpdateNodeSharedSecretInputFromJson = (
14
14
  sharedSecret: obj["update_node_shared_secret_input_shared_secret"],
15
15
  } as UpdateNodeSharedSecretInput;
16
16
  };
17
+ export const UpdateNodeSharedSecretInputToJson = (
18
+ obj: UpdateNodeSharedSecretInput,
19
+ ): any => {
20
+ return {
21
+ update_node_shared_secret_input_node_id: obj.nodeId,
22
+ update_node_shared_secret_input_shared_secret: obj.sharedSecret,
23
+ };
24
+ };
17
25
 
18
26
  export default UpdateNodeSharedSecretInput;
@@ -1,8 +1,8 @@
1
1
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
2
2
 
3
- type UpdateNodeSharedSecretOutput = {
3
+ interface UpdateNodeSharedSecretOutput {
4
4
  nodeId: string;
5
- };
5
+ }
6
6
 
7
7
  export const UpdateNodeSharedSecretOutputFromJson = (
8
8
  obj: any,
@@ -11,6 +11,13 @@ export const UpdateNodeSharedSecretOutputFromJson = (
11
11
  nodeId: obj["update_node_shared_secret_output_node"].id,
12
12
  } as UpdateNodeSharedSecretOutput;
13
13
  };
14
+ export const UpdateNodeSharedSecretOutputToJson = (
15
+ obj: UpdateNodeSharedSecretOutput,
16
+ ): any => {
17
+ return {
18
+ update_node_shared_secret_output_node: { id: obj.nodeId },
19
+ };
20
+ };
14
21
 
15
22
  export const FRAGMENT = `
16
23
  fragment UpdateNodeSharedSecretOutputFragment on UpdateNodeSharedSecretOutput {
@@ -4,9 +4,10 @@ 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 Balances from "./Balances.js";
7
- import { BalancesFromJson } from "./Balances.js";
7
+ import { BalancesFromJson, BalancesToJson } from "./Balances.js";
8
8
  import type CurrencyAmount from "./CurrencyAmount.js";
9
9
  import { CurrencyAmountFromJson } from "./CurrencyAmount.js";
10
+ import type Entity from "./Entity.js";
10
11
  import type LightsparkNodeOwner from "./LightsparkNodeOwner.js";
11
12
  import type TransactionStatus from "./TransactionStatus.js";
12
13
  import type TransactionType from "./TransactionType.js";
@@ -17,7 +18,7 @@ import type WalletToTransactionsConnection from "./WalletToTransactionsConnectio
17
18
  import { WalletToTransactionsConnectionFromJson } from "./WalletToTransactionsConnection.js";
18
19
 
19
20
  /** This object represents a Lightspark Wallet, tied to your Lightspark account. Wallets can be used to send or receive funds over the Lightning Network. You can retrieve this object to receive information about a specific wallet tied to your Lightspark account. **/
20
- class Wallet implements LightsparkNodeOwner {
21
+ class Wallet implements LightsparkNodeOwner, Entity {
21
22
  constructor(
22
23
  public readonly id: string,
23
24
  public readonly createdAt: string,
@@ -25,9 +26,9 @@ class Wallet implements LightsparkNodeOwner {
25
26
  public readonly thirdPartyIdentifier: string,
26
27
  public readonly status: WalletStatus,
27
28
  public readonly typename: string,
28
- public readonly lastLoginAt?: string,
29
- public readonly balances?: Balances,
30
- public readonly accountId?: string,
29
+ public readonly lastLoginAt?: string | undefined,
30
+ public readonly balances?: Balances | undefined,
31
+ public readonly accountId?: string | undefined,
31
32
  ) {
32
33
  autoBind(this);
33
34
  }
@@ -350,6 +351,33 @@ query FetchWalletToTransactionsConnection($entity_id: ID!, $first: Int, $after:
350
351
  }
351
352
  }
352
353
  lightspark_node_with_o_s_k_uma_prescreening_utxos: uma_prescreening_utxos
354
+ lightspark_node_with_o_s_k_balances: balances {
355
+ __typename
356
+ balances_owned_balance: owned_balance {
357
+ __typename
358
+ currency_amount_original_value: original_value
359
+ currency_amount_original_unit: original_unit
360
+ currency_amount_preferred_currency_unit: preferred_currency_unit
361
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
362
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
363
+ }
364
+ balances_available_to_send_balance: available_to_send_balance {
365
+ __typename
366
+ currency_amount_original_value: original_value
367
+ currency_amount_original_unit: original_unit
368
+ currency_amount_preferred_currency_unit: preferred_currency_unit
369
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
370
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
371
+ }
372
+ balances_available_to_withdraw_balance: available_to_withdraw_balance {
373
+ __typename
374
+ currency_amount_original_value: original_value
375
+ currency_amount_original_unit: original_unit
376
+ currency_amount_preferred_currency_unit: preferred_currency_unit
377
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
378
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
379
+ }
380
+ }
353
381
  lightspark_node_with_o_s_k_encrypted_signing_private_key: encrypted_signing_private_key {
354
382
  __typename
355
383
  secret_encrypted_value: encrypted_value
@@ -455,6 +483,33 @@ query FetchWalletToTransactionsConnection($entity_id: ID!, $first: Int, $after:
455
483
  }
456
484
  }
457
485
  lightspark_node_with_remote_signing_uma_prescreening_utxos: uma_prescreening_utxos
486
+ lightspark_node_with_remote_signing_balances: balances {
487
+ __typename
488
+ balances_owned_balance: owned_balance {
489
+ __typename
490
+ currency_amount_original_value: original_value
491
+ currency_amount_original_unit: original_unit
492
+ currency_amount_preferred_currency_unit: preferred_currency_unit
493
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
494
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
495
+ }
496
+ balances_available_to_send_balance: available_to_send_balance {
497
+ __typename
498
+ currency_amount_original_value: original_value
499
+ currency_amount_original_unit: original_unit
500
+ currency_amount_preferred_currency_unit: preferred_currency_unit
501
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
502
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
503
+ }
504
+ balances_available_to_withdraw_balance: available_to_withdraw_balance {
505
+ __typename
506
+ currency_amount_original_value: original_value
507
+ currency_amount_original_unit: original_unit
508
+ currency_amount_preferred_currency_unit: preferred_currency_unit
509
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
510
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
511
+ }
512
+ }
458
513
  }
459
514
  }
460
515
  }
@@ -726,6 +781,33 @@ query FetchWalletToPaymentRequestsConnection($entity_id: ID!, $first: Int, $afte
726
781
  }
727
782
  }
728
783
  lightspark_node_with_o_s_k_uma_prescreening_utxos: uma_prescreening_utxos
784
+ lightspark_node_with_o_s_k_balances: balances {
785
+ __typename
786
+ balances_owned_balance: owned_balance {
787
+ __typename
788
+ currency_amount_original_value: original_value
789
+ currency_amount_original_unit: original_unit
790
+ currency_amount_preferred_currency_unit: preferred_currency_unit
791
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
792
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
793
+ }
794
+ balances_available_to_send_balance: available_to_send_balance {
795
+ __typename
796
+ currency_amount_original_value: original_value
797
+ currency_amount_original_unit: original_unit
798
+ currency_amount_preferred_currency_unit: preferred_currency_unit
799
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
800
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
801
+ }
802
+ balances_available_to_withdraw_balance: available_to_withdraw_balance {
803
+ __typename
804
+ currency_amount_original_value: original_value
805
+ currency_amount_original_unit: original_unit
806
+ currency_amount_preferred_currency_unit: preferred_currency_unit
807
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
808
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
809
+ }
810
+ }
729
811
  lightspark_node_with_o_s_k_encrypted_signing_private_key: encrypted_signing_private_key {
730
812
  __typename
731
813
  secret_encrypted_value: encrypted_value
@@ -831,6 +913,33 @@ query FetchWalletToPaymentRequestsConnection($entity_id: ID!, $first: Int, $afte
831
913
  }
832
914
  }
833
915
  lightspark_node_with_remote_signing_uma_prescreening_utxos: uma_prescreening_utxos
916
+ lightspark_node_with_remote_signing_balances: balances {
917
+ __typename
918
+ balances_owned_balance: owned_balance {
919
+ __typename
920
+ currency_amount_original_value: original_value
921
+ currency_amount_original_unit: original_unit
922
+ currency_amount_preferred_currency_unit: preferred_currency_unit
923
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
924
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
925
+ }
926
+ balances_available_to_send_balance: available_to_send_balance {
927
+ __typename
928
+ currency_amount_original_value: original_value
929
+ currency_amount_original_unit: original_unit
930
+ currency_amount_preferred_currency_unit: preferred_currency_unit
931
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
932
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
933
+ }
934
+ balances_available_to_withdraw_balance: available_to_withdraw_balance {
935
+ __typename
936
+ currency_amount_original_value: original_value
937
+ currency_amount_original_unit: original_unit
938
+ currency_amount_preferred_currency_unit: preferred_currency_unit
939
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
940
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
941
+ }
942
+ }
834
943
  }
835
944
  }
836
945
  }
@@ -949,6 +1058,22 @@ ${FRAGMENT}
949
1058
  constructObject: (data: any) => WalletFromJson(data.entity),
950
1059
  };
951
1060
  }
1061
+
1062
+ public toJson() {
1063
+ return {
1064
+ __typename: "Wallet",
1065
+ wallet_id: this.id,
1066
+ wallet_created_at: this.createdAt,
1067
+ wallet_updated_at: this.updatedAt,
1068
+ wallet_last_login_at: this.lastLoginAt,
1069
+ wallet_balances: this.balances
1070
+ ? BalancesToJson(this.balances)
1071
+ : undefined,
1072
+ wallet_third_party_identifier: this.thirdPartyIdentifier,
1073
+ wallet_account: { id: this.accountId } ?? undefined,
1074
+ wallet_status: this.status,
1075
+ };
1076
+ }
952
1077
  }
953
1078
 
954
1079
  export const WalletFromJson = (obj: any): Wallet => {