@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
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-K6SAUSAX.js";
4
4
 
5
5
  // src/objects/Account.ts
6
- import autoBind12 from "auto-bind";
6
+ import autoBind10 from "auto-bind";
7
7
 
8
8
  // src/objects/Permission.ts
9
9
  var Permission = /* @__PURE__ */ ((Permission2) => {
@@ -120,6 +120,15 @@ var CurrencyAmountFromJson = (obj) => {
120
120
  preferredCurrencyValueApprox: obj["currency_amount_preferred_currency_value_approx"]
121
121
  };
122
122
  };
123
+ var CurrencyAmountToJson = (obj) => {
124
+ return {
125
+ currency_amount_original_value: obj.originalValue,
126
+ currency_amount_original_unit: obj.originalUnit,
127
+ currency_amount_preferred_currency_unit: obj.preferredCurrencyUnit,
128
+ currency_amount_preferred_currency_value_rounded: obj.preferredCurrencyValueRounded,
129
+ currency_amount_preferred_currency_value_approx: obj.preferredCurrencyValueApprox
130
+ };
131
+ };
123
132
  var FRAGMENT2 = `
124
133
  fragment CurrencyAmountFragment on CurrencyAmount {
125
134
  __typename
@@ -137,6 +146,12 @@ var ChannelFeesFromJson = (obj) => {
137
146
  feeRatePerMil: obj["channel_fees_fee_rate_per_mil"]
138
147
  };
139
148
  };
149
+ var ChannelFeesToJson = (obj) => {
150
+ return {
151
+ channel_fees_base_fee: obj.baseFee ? CurrencyAmountToJson(obj.baseFee) : void 0,
152
+ channel_fees_fee_rate_per_mil: obj.feeRatePerMil
153
+ };
154
+ };
140
155
 
141
156
  // src/objects/ChannelStatus.ts
142
157
  var ChannelStatus = /* @__PURE__ */ ((ChannelStatus2) => {
@@ -281,6 +296,29 @@ ${FRAGMENT3}
281
296
  constructObject: (data) => ChannelFromJson(data.entity)
282
297
  };
283
298
  }
299
+ toJson() {
300
+ return {
301
+ __typename: "Channel",
302
+ channel_id: this.id,
303
+ channel_created_at: this.createdAt,
304
+ channel_updated_at: this.updatedAt,
305
+ channel_funding_transaction: { id: this.fundingTransactionId },
306
+ channel_capacity: this.capacity ? CurrencyAmountToJson(this.capacity) : void 0,
307
+ channel_local_balance: this.localBalance ? CurrencyAmountToJson(this.localBalance) : void 0,
308
+ channel_local_unsettled_balance: this.localUnsettledBalance ? CurrencyAmountToJson(this.localUnsettledBalance) : void 0,
309
+ channel_remote_balance: this.remoteBalance ? CurrencyAmountToJson(this.remoteBalance) : void 0,
310
+ channel_remote_unsettled_balance: this.remoteUnsettledBalance ? CurrencyAmountToJson(this.remoteUnsettledBalance) : void 0,
311
+ channel_unsettled_balance: this.unsettledBalance ? CurrencyAmountToJson(this.unsettledBalance) : void 0,
312
+ channel_total_balance: this.totalBalance ? CurrencyAmountToJson(this.totalBalance) : void 0,
313
+ channel_status: this.status,
314
+ channel_estimated_force_closure_wait_minutes: this.estimatedForceClosureWaitMinutes,
315
+ channel_commit_fee: this.commitFee ? CurrencyAmountToJson(this.commitFee) : void 0,
316
+ channel_fees: this.fees ? ChannelFeesToJson(this.fees) : void 0,
317
+ channel_remote_node: { id: this.remoteNodeId },
318
+ channel_local_node: { id: this.localNodeId },
319
+ channel_short_channel_id: this.shortChannelId
320
+ };
321
+ }
284
322
  };
285
323
  var ChannelFromJson = (obj) => {
286
324
  return new Channel(
@@ -409,6 +447,14 @@ var AccountToChannelsConnection = class {
409
447
  this.entities = entities;
410
448
  autoBind2(this);
411
449
  }
450
+ toJson() {
451
+ return {
452
+ account_to_channels_connection_count: this.count,
453
+ account_to_channels_connection_entities: this.entities.map(
454
+ (e) => e.toJson()
455
+ )
456
+ };
457
+ }
412
458
  };
413
459
  var AccountToChannelsConnectionFromJson = (obj) => {
414
460
  return new AccountToChannelsConnection(
@@ -422,7 +468,6 @@ var AccountToChannelsConnection_default = AccountToChannelsConnection;
422
468
 
423
469
  // src/objects/LightsparkNode.ts
424
470
  import { LightsparkException } from "@lightsparkdev/core";
425
- import autoBind5 from "auto-bind";
426
471
 
427
472
  // src/objects/Balances.ts
428
473
  var BalancesFromJson = (obj) => {
@@ -436,6 +481,17 @@ var BalancesFromJson = (obj) => {
436
481
  )
437
482
  };
438
483
  };
484
+ var BalancesToJson = (obj) => {
485
+ return {
486
+ balances_owned_balance: CurrencyAmountToJson(obj.ownedBalance),
487
+ balances_available_to_send_balance: CurrencyAmountToJson(
488
+ obj.availableToSendBalance
489
+ ),
490
+ balances_available_to_withdraw_balance: CurrencyAmountToJson(
491
+ obj.availableToWithdrawBalance
492
+ )
493
+ };
494
+ };
439
495
 
440
496
  // src/objects/BlockchainBalance.ts
441
497
  var BlockchainBalanceFromJson = (obj) => {
@@ -448,6 +504,16 @@ var BlockchainBalanceFromJson = (obj) => {
448
504
  availableBalance: !!obj["blockchain_balance_available_balance"] ? CurrencyAmountFromJson(obj["blockchain_balance_available_balance"]) : void 0
449
505
  };
450
506
  };
507
+ var BlockchainBalanceToJson = (obj) => {
508
+ return {
509
+ blockchain_balance_total_balance: obj.totalBalance ? CurrencyAmountToJson(obj.totalBalance) : void 0,
510
+ blockchain_balance_confirmed_balance: obj.confirmedBalance ? CurrencyAmountToJson(obj.confirmedBalance) : void 0,
511
+ blockchain_balance_unconfirmed_balance: obj.unconfirmedBalance ? CurrencyAmountToJson(obj.unconfirmedBalance) : void 0,
512
+ blockchain_balance_locked_balance: obj.lockedBalance ? CurrencyAmountToJson(obj.lockedBalance) : void 0,
513
+ blockchain_balance_required_reserve: obj.requiredReserve ? CurrencyAmountToJson(obj.requiredReserve) : void 0,
514
+ blockchain_balance_available_balance: obj.availableBalance ? CurrencyAmountToJson(obj.availableBalance) : void 0
515
+ };
516
+ };
451
517
 
452
518
  // src/objects/LightsparkNodeStatus.ts
453
519
  var LightsparkNodeStatus = /* @__PURE__ */ ((LightsparkNodeStatus2) => {
@@ -466,6 +532,9 @@ var LightsparkNodeStatus = /* @__PURE__ */ ((LightsparkNodeStatus2) => {
466
532
  })(LightsparkNodeStatus || {});
467
533
  var LightsparkNodeStatus_default = LightsparkNodeStatus;
468
534
 
535
+ // src/objects/LightsparkNodeWithOSK.ts
536
+ import autoBind3 from "auto-bind";
537
+
469
538
  // src/objects/LightsparkNodeToChannelsConnection.ts
470
539
  var LightsparkNodeToChannelsConnectionFromJson = (obj) => {
471
540
  return {
@@ -480,9 +549,6 @@ var LightsparkNodeToChannelsConnectionFromJson = (obj) => {
480
549
  };
481
550
  };
482
551
 
483
- // src/objects/LightsparkNodeWithOSK.ts
484
- import autoBind3 from "auto-bind";
485
-
486
552
  // src/objects/NodeAddressType.ts
487
553
  var NodeAddressType = /* @__PURE__ */ ((NodeAddressType2) => {
488
554
  NodeAddressType2["FUTURE_VALUE"] = "FUTURE_VALUE";
@@ -518,6 +584,12 @@ var SecretFromJson = (obj) => {
518
584
  cipher: obj["secret_cipher"]
519
585
  };
520
586
  };
587
+ var SecretToJson = (obj) => {
588
+ return {
589
+ secret_encrypted_value: obj.encryptedValue,
590
+ secret_cipher: obj.cipher
591
+ };
592
+ };
521
593
 
522
594
  // src/objects/LightsparkNodeWithOSK.ts
523
595
  var LightsparkNodeWithOSK = class {
@@ -714,6 +786,30 @@ ${FRAGMENT4}
714
786
  constructObject: (data) => LightsparkNodeWithOSKFromJson(data.entity)
715
787
  };
716
788
  }
789
+ toJson() {
790
+ return {
791
+ __typename: "LightsparkNodeWithOSK",
792
+ lightspark_node_with_o_s_k_id: this.id,
793
+ lightspark_node_with_o_s_k_created_at: this.createdAt,
794
+ lightspark_node_with_o_s_k_updated_at: this.updatedAt,
795
+ lightspark_node_with_o_s_k_alias: this.alias,
796
+ lightspark_node_with_o_s_k_bitcoin_network: this.bitcoinNetwork,
797
+ lightspark_node_with_o_s_k_color: this.color,
798
+ lightspark_node_with_o_s_k_conductivity: this.conductivity,
799
+ lightspark_node_with_o_s_k_display_name: this.displayName,
800
+ lightspark_node_with_o_s_k_public_key: this.publicKey,
801
+ lightspark_node_with_o_s_k_owner: { id: this.ownerId },
802
+ lightspark_node_with_o_s_k_status: this.status,
803
+ lightspark_node_with_o_s_k_total_balance: this.totalBalance ? CurrencyAmountToJson(this.totalBalance) : void 0,
804
+ lightspark_node_with_o_s_k_total_local_balance: this.totalLocalBalance ? CurrencyAmountToJson(this.totalLocalBalance) : void 0,
805
+ lightspark_node_with_o_s_k_local_balance: this.localBalance ? CurrencyAmountToJson(this.localBalance) : void 0,
806
+ lightspark_node_with_o_s_k_remote_balance: this.remoteBalance ? CurrencyAmountToJson(this.remoteBalance) : void 0,
807
+ lightspark_node_with_o_s_k_blockchain_balance: this.blockchainBalance ? BlockchainBalanceToJson(this.blockchainBalance) : void 0,
808
+ lightspark_node_with_o_s_k_uma_prescreening_utxos: this.umaPrescreeningUtxos,
809
+ lightspark_node_with_o_s_k_balances: this.balances ? BalancesToJson(this.balances) : void 0,
810
+ lightspark_node_with_o_s_k_encrypted_signing_private_key: this.encryptedSigningPrivateKey ? SecretToJson(this.encryptedSigningPrivateKey) : void 0
811
+ };
812
+ }
717
813
  };
718
814
  var LightsparkNodeWithOSKFromJson = (obj) => {
719
815
  return new LightsparkNodeWithOSK(
@@ -1075,6 +1171,29 @@ ${FRAGMENT5}
1075
1171
  constructObject: (data) => LightsparkNodeWithRemoteSigningFromJson(data.entity)
1076
1172
  };
1077
1173
  }
1174
+ toJson() {
1175
+ return {
1176
+ __typename: "LightsparkNodeWithRemoteSigning",
1177
+ lightspark_node_with_remote_signing_id: this.id,
1178
+ lightspark_node_with_remote_signing_created_at: this.createdAt,
1179
+ lightspark_node_with_remote_signing_updated_at: this.updatedAt,
1180
+ lightspark_node_with_remote_signing_alias: this.alias,
1181
+ lightspark_node_with_remote_signing_bitcoin_network: this.bitcoinNetwork,
1182
+ lightspark_node_with_remote_signing_color: this.color,
1183
+ lightspark_node_with_remote_signing_conductivity: this.conductivity,
1184
+ lightspark_node_with_remote_signing_display_name: this.displayName,
1185
+ lightspark_node_with_remote_signing_public_key: this.publicKey,
1186
+ lightspark_node_with_remote_signing_owner: { id: this.ownerId },
1187
+ lightspark_node_with_remote_signing_status: this.status,
1188
+ lightspark_node_with_remote_signing_total_balance: this.totalBalance ? CurrencyAmountToJson(this.totalBalance) : void 0,
1189
+ lightspark_node_with_remote_signing_total_local_balance: this.totalLocalBalance ? CurrencyAmountToJson(this.totalLocalBalance) : void 0,
1190
+ lightspark_node_with_remote_signing_local_balance: this.localBalance ? CurrencyAmountToJson(this.localBalance) : void 0,
1191
+ lightspark_node_with_remote_signing_remote_balance: this.remoteBalance ? CurrencyAmountToJson(this.remoteBalance) : void 0,
1192
+ lightspark_node_with_remote_signing_blockchain_balance: this.blockchainBalance ? BlockchainBalanceToJson(this.blockchainBalance) : void 0,
1193
+ lightspark_node_with_remote_signing_uma_prescreening_utxos: this.umaPrescreeningUtxos,
1194
+ lightspark_node_with_remote_signing_balances: this.balances ? BalancesToJson(this.balances) : void 0
1195
+ };
1196
+ }
1078
1197
  };
1079
1198
  var LightsparkNodeWithRemoteSigningFromJson = (obj) => {
1080
1199
  return new LightsparkNodeWithRemoteSigning(
@@ -1240,200 +1359,6 @@ fragment LightsparkNodeWithRemoteSigningFragment on LightsparkNodeWithRemoteSign
1240
1359
  var LightsparkNodeWithRemoteSigning_default = LightsparkNodeWithRemoteSigning;
1241
1360
 
1242
1361
  // src/objects/LightsparkNode.ts
1243
- var LightsparkNode = class {
1244
- constructor(id, createdAt, updatedAt, bitcoinNetwork, displayName, ownerId, umaPrescreeningUtxos, typename, alias, color, conductivity, publicKey, status, totalBalance, totalLocalBalance, localBalance, remoteBalance, blockchainBalance, balances) {
1245
- this.id = id;
1246
- this.createdAt = createdAt;
1247
- this.updatedAt = updatedAt;
1248
- this.bitcoinNetwork = bitcoinNetwork;
1249
- this.displayName = displayName;
1250
- this.ownerId = ownerId;
1251
- this.umaPrescreeningUtxos = umaPrescreeningUtxos;
1252
- this.typename = typename;
1253
- this.alias = alias;
1254
- this.color = color;
1255
- this.conductivity = conductivity;
1256
- this.publicKey = publicKey;
1257
- this.status = status;
1258
- this.totalBalance = totalBalance;
1259
- this.totalLocalBalance = totalLocalBalance;
1260
- this.localBalance = localBalance;
1261
- this.remoteBalance = remoteBalance;
1262
- this.blockchainBalance = blockchainBalance;
1263
- this.balances = balances;
1264
- autoBind5(this);
1265
- }
1266
- async getAddresses(client, first = void 0, types = void 0) {
1267
- return await client.executeRawQuery({
1268
- queryPayload: `
1269
- query FetchNodeToAddressesConnection($entity_id: ID!, $first: Int, $types: [NodeAddressType!]) {
1270
- entity(id: $entity_id) {
1271
- ... on LightsparkNode {
1272
- addresses(, first: $first, types: $types) {
1273
- __typename
1274
- node_to_addresses_connection_count: count
1275
- node_to_addresses_connection_entities: entities {
1276
- __typename
1277
- node_address_address: address
1278
- node_address_type: type
1279
- }
1280
- }
1281
- }
1282
- }
1283
- }
1284
- `,
1285
- variables: { entity_id: this.id, first, types },
1286
- constructObject: (json) => {
1287
- const connection = json["entity"]["addresses"];
1288
- return NodeToAddressesConnectionFromJson(connection);
1289
- }
1290
- });
1291
- }
1292
- async getChannels(client, first = void 0, statuses = void 0, after = void 0) {
1293
- return await client.executeRawQuery({
1294
- queryPayload: `
1295
- query FetchLightsparkNodeToChannelsConnection($entity_id: ID!, $first: Int, $statuses: [ChannelStatus!], $after: String) {
1296
- entity(id: $entity_id) {
1297
- ... on LightsparkNode {
1298
- channels(, first: $first, statuses: $statuses, after: $after) {
1299
- __typename
1300
- lightspark_node_to_channels_connection_count: count
1301
- lightspark_node_to_channels_connection_page_info: page_info {
1302
- __typename
1303
- page_info_has_next_page: has_next_page
1304
- page_info_has_previous_page: has_previous_page
1305
- page_info_start_cursor: start_cursor
1306
- page_info_end_cursor: end_cursor
1307
- }
1308
- lightspark_node_to_channels_connection_entities: entities {
1309
- __typename
1310
- channel_id: id
1311
- channel_created_at: created_at
1312
- channel_updated_at: updated_at
1313
- channel_funding_transaction: funding_transaction {
1314
- id
1315
- }
1316
- channel_capacity: capacity {
1317
- __typename
1318
- currency_amount_original_value: original_value
1319
- currency_amount_original_unit: original_unit
1320
- currency_amount_preferred_currency_unit: preferred_currency_unit
1321
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1322
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1323
- }
1324
- channel_local_balance: local_balance {
1325
- __typename
1326
- currency_amount_original_value: original_value
1327
- currency_amount_original_unit: original_unit
1328
- currency_amount_preferred_currency_unit: preferred_currency_unit
1329
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1330
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1331
- }
1332
- channel_local_unsettled_balance: local_unsettled_balance {
1333
- __typename
1334
- currency_amount_original_value: original_value
1335
- currency_amount_original_unit: original_unit
1336
- currency_amount_preferred_currency_unit: preferred_currency_unit
1337
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1338
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1339
- }
1340
- channel_remote_balance: remote_balance {
1341
- __typename
1342
- currency_amount_original_value: original_value
1343
- currency_amount_original_unit: original_unit
1344
- currency_amount_preferred_currency_unit: preferred_currency_unit
1345
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1346
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1347
- }
1348
- channel_remote_unsettled_balance: remote_unsettled_balance {
1349
- __typename
1350
- currency_amount_original_value: original_value
1351
- currency_amount_original_unit: original_unit
1352
- currency_amount_preferred_currency_unit: preferred_currency_unit
1353
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1354
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1355
- }
1356
- channel_unsettled_balance: unsettled_balance {
1357
- __typename
1358
- currency_amount_original_value: original_value
1359
- currency_amount_original_unit: original_unit
1360
- currency_amount_preferred_currency_unit: preferred_currency_unit
1361
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1362
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1363
- }
1364
- channel_total_balance: total_balance {
1365
- __typename
1366
- currency_amount_original_value: original_value
1367
- currency_amount_original_unit: original_unit
1368
- currency_amount_preferred_currency_unit: preferred_currency_unit
1369
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1370
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1371
- }
1372
- channel_status: status
1373
- channel_estimated_force_closure_wait_minutes: estimated_force_closure_wait_minutes
1374
- channel_commit_fee: commit_fee {
1375
- __typename
1376
- currency_amount_original_value: original_value
1377
- currency_amount_original_unit: original_unit
1378
- currency_amount_preferred_currency_unit: preferred_currency_unit
1379
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1380
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1381
- }
1382
- channel_fees: fees {
1383
- __typename
1384
- channel_fees_base_fee: base_fee {
1385
- __typename
1386
- currency_amount_original_value: original_value
1387
- currency_amount_original_unit: original_unit
1388
- currency_amount_preferred_currency_unit: preferred_currency_unit
1389
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
1390
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
1391
- }
1392
- channel_fees_fee_rate_per_mil: fee_rate_per_mil
1393
- }
1394
- channel_remote_node: remote_node {
1395
- id
1396
- }
1397
- channel_local_node: local_node {
1398
- id
1399
- }
1400
- channel_short_channel_id: short_channel_id
1401
- }
1402
- }
1403
- }
1404
- }
1405
- }
1406
- `,
1407
- variables: {
1408
- entity_id: this.id,
1409
- first,
1410
- statuses,
1411
- after
1412
- },
1413
- constructObject: (json) => {
1414
- const connection = json["entity"]["channels"];
1415
- return LightsparkNodeToChannelsConnectionFromJson(connection);
1416
- }
1417
- });
1418
- }
1419
- static getLightsparkNodeQuery(id) {
1420
- return {
1421
- queryPayload: `
1422
- query GetLightsparkNode($id: ID!) {
1423
- entity(id: $id) {
1424
- ... on LightsparkNode {
1425
- ...LightsparkNodeFragment
1426
- }
1427
- }
1428
- }
1429
-
1430
- ${FRAGMENT6}
1431
- `,
1432
- variables: { id },
1433
- constructObject: (data) => LightsparkNodeFromJson(data.entity)
1434
- };
1435
- }
1436
- };
1437
1362
  var LightsparkNodeFromJson = (obj) => {
1438
1363
  if (obj["__typename"] == "LightsparkNodeWithOSK") {
1439
1364
  return new LightsparkNodeWithOSK_default(
@@ -1772,7 +1697,23 @@ fragment LightsparkNodeFragment on LightsparkNode {
1772
1697
  }
1773
1698
  }
1774
1699
  }`;
1775
- var LightsparkNode_default = LightsparkNode;
1700
+ var getLightsparkNodeQuery = (id) => {
1701
+ return {
1702
+ queryPayload: `
1703
+ query GetLightsparkNode($id: ID!) {
1704
+ entity(id: $id) {
1705
+ ... on LightsparkNode {
1706
+ ...LightsparkNodeFragment
1707
+ }
1708
+ }
1709
+ }
1710
+
1711
+ ${FRAGMENT6}
1712
+ `,
1713
+ variables: { id },
1714
+ constructObject: (data) => LightsparkNodeFromJson(data.entity)
1715
+ };
1716
+ };
1776
1717
 
1777
1718
  // src/objects/AccountToNodesConnection.ts
1778
1719
  var AccountToNodesConnectionFromJson = (obj) => {
@@ -1791,10 +1732,9 @@ import { LightsparkException as LightsparkException3 } from "@lightsparkdev/core
1791
1732
 
1792
1733
  // src/objects/Node.ts
1793
1734
  import { LightsparkException as LightsparkException2 } from "@lightsparkdev/core";
1794
- import autoBind7 from "auto-bind";
1795
1735
 
1796
1736
  // src/objects/GraphNode.ts
1797
- import autoBind6 from "auto-bind";
1737
+ import autoBind5 from "auto-bind";
1798
1738
  var GraphNode = class {
1799
1739
  constructor(id, createdAt, updatedAt, bitcoinNetwork, displayName, typename, alias, color, conductivity, publicKey) {
1800
1740
  this.id = id;
@@ -1807,7 +1747,7 @@ var GraphNode = class {
1807
1747
  this.color = color;
1808
1748
  this.conductivity = conductivity;
1809
1749
  this.publicKey = publicKey;
1810
- autoBind6(this);
1750
+ autoBind5(this);
1811
1751
  }
1812
1752
  async getAddresses(client, first = void 0, types = void 0) {
1813
1753
  return await client.executeRawQuery({
@@ -1852,6 +1792,20 @@ ${FRAGMENT7}
1852
1792
  constructObject: (data) => GraphNodeFromJson(data.entity)
1853
1793
  };
1854
1794
  }
1795
+ toJson() {
1796
+ return {
1797
+ __typename: "GraphNode",
1798
+ graph_node_id: this.id,
1799
+ graph_node_created_at: this.createdAt,
1800
+ graph_node_updated_at: this.updatedAt,
1801
+ graph_node_alias: this.alias,
1802
+ graph_node_bitcoin_network: this.bitcoinNetwork,
1803
+ graph_node_color: this.color,
1804
+ graph_node_conductivity: this.conductivity,
1805
+ graph_node_display_name: this.displayName,
1806
+ graph_node_public_key: this.publicKey
1807
+ };
1808
+ }
1855
1809
  };
1856
1810
  var GraphNodeFromJson = (obj) => {
1857
1811
  return new GraphNode(
@@ -1883,64 +1837,6 @@ fragment GraphNodeFragment on GraphNode {
1883
1837
  var GraphNode_default = GraphNode;
1884
1838
 
1885
1839
  // src/objects/Node.ts
1886
- var Node = class {
1887
- constructor(id, createdAt, updatedAt, bitcoinNetwork, displayName, typename, alias, color, conductivity, publicKey) {
1888
- this.id = id;
1889
- this.createdAt = createdAt;
1890
- this.updatedAt = updatedAt;
1891
- this.bitcoinNetwork = bitcoinNetwork;
1892
- this.displayName = displayName;
1893
- this.typename = typename;
1894
- this.alias = alias;
1895
- this.color = color;
1896
- this.conductivity = conductivity;
1897
- this.publicKey = publicKey;
1898
- autoBind7(this);
1899
- }
1900
- async getAddresses(client, first = void 0, types = void 0) {
1901
- return await client.executeRawQuery({
1902
- queryPayload: `
1903
- query FetchNodeToAddressesConnection($entity_id: ID!, $first: Int, $types: [NodeAddressType!]) {
1904
- entity(id: $entity_id) {
1905
- ... on Node {
1906
- addresses(, first: $first, types: $types) {
1907
- __typename
1908
- node_to_addresses_connection_count: count
1909
- node_to_addresses_connection_entities: entities {
1910
- __typename
1911
- node_address_address: address
1912
- node_address_type: type
1913
- }
1914
- }
1915
- }
1916
- }
1917
- }
1918
- `,
1919
- variables: { entity_id: this.id, first, types },
1920
- constructObject: (json) => {
1921
- const connection = json["entity"]["addresses"];
1922
- return NodeToAddressesConnectionFromJson(connection);
1923
- }
1924
- });
1925
- }
1926
- static getNodeQuery(id) {
1927
- return {
1928
- queryPayload: `
1929
- query GetNode($id: ID!) {
1930
- entity(id: $id) {
1931
- ... on Node {
1932
- ...NodeFragment
1933
- }
1934
- }
1935
- }
1936
-
1937
- ${FRAGMENT8}
1938
- `,
1939
- variables: { id },
1940
- constructObject: (data) => NodeFromJson(data.entity)
1941
- };
1942
- }
1943
- };
1944
1840
  var NodeFromJson = (obj) => {
1945
1841
  if (obj["__typename"] == "GraphNode") {
1946
1842
  return new GraphNode_default(
@@ -2030,6 +1926,82 @@ var NodeFromJson = (obj) => {
2030
1926
  `Couldn't find a concrete type for interface Node corresponding to the typename=${obj["__typename"]}`
2031
1927
  );
2032
1928
  };
1929
+ var NodeToJson = (obj) => {
1930
+ if (obj.typename == "GraphNode") {
1931
+ const graphNode = obj;
1932
+ return {
1933
+ __typename: "GraphNode",
1934
+ graph_node_id: graphNode.id,
1935
+ graph_node_created_at: graphNode.createdAt,
1936
+ graph_node_updated_at: graphNode.updatedAt,
1937
+ graph_node_alias: graphNode.alias,
1938
+ graph_node_bitcoin_network: graphNode.bitcoinNetwork,
1939
+ graph_node_color: graphNode.color,
1940
+ graph_node_conductivity: graphNode.conductivity,
1941
+ graph_node_display_name: graphNode.displayName,
1942
+ graph_node_public_key: graphNode.publicKey
1943
+ };
1944
+ }
1945
+ if (obj.typename == "LightsparkNodeWithOSK") {
1946
+ const lightsparkNodeWithOSK = obj;
1947
+ return {
1948
+ __typename: "LightsparkNodeWithOSK",
1949
+ lightspark_node_with_o_s_k_id: lightsparkNodeWithOSK.id,
1950
+ lightspark_node_with_o_s_k_created_at: lightsparkNodeWithOSK.createdAt,
1951
+ lightspark_node_with_o_s_k_updated_at: lightsparkNodeWithOSK.updatedAt,
1952
+ lightspark_node_with_o_s_k_alias: lightsparkNodeWithOSK.alias,
1953
+ lightspark_node_with_o_s_k_bitcoin_network: lightsparkNodeWithOSK.bitcoinNetwork,
1954
+ lightspark_node_with_o_s_k_color: lightsparkNodeWithOSK.color,
1955
+ lightspark_node_with_o_s_k_conductivity: lightsparkNodeWithOSK.conductivity,
1956
+ lightspark_node_with_o_s_k_display_name: lightsparkNodeWithOSK.displayName,
1957
+ lightspark_node_with_o_s_k_public_key: lightsparkNodeWithOSK.publicKey,
1958
+ lightspark_node_with_o_s_k_owner: { id: lightsparkNodeWithOSK.ownerId },
1959
+ lightspark_node_with_o_s_k_status: lightsparkNodeWithOSK.status,
1960
+ lightspark_node_with_o_s_k_total_balance: lightsparkNodeWithOSK.totalBalance ? CurrencyAmountToJson(lightsparkNodeWithOSK.totalBalance) : void 0,
1961
+ lightspark_node_with_o_s_k_total_local_balance: lightsparkNodeWithOSK.totalLocalBalance ? CurrencyAmountToJson(lightsparkNodeWithOSK.totalLocalBalance) : void 0,
1962
+ lightspark_node_with_o_s_k_local_balance: lightsparkNodeWithOSK.localBalance ? CurrencyAmountToJson(lightsparkNodeWithOSK.localBalance) : void 0,
1963
+ lightspark_node_with_o_s_k_remote_balance: lightsparkNodeWithOSK.remoteBalance ? CurrencyAmountToJson(lightsparkNodeWithOSK.remoteBalance) : void 0,
1964
+ lightspark_node_with_o_s_k_blockchain_balance: lightsparkNodeWithOSK.blockchainBalance ? BlockchainBalanceToJson(lightsparkNodeWithOSK.blockchainBalance) : void 0,
1965
+ lightspark_node_with_o_s_k_uma_prescreening_utxos: lightsparkNodeWithOSK.umaPrescreeningUtxos,
1966
+ lightspark_node_with_o_s_k_balances: lightsparkNodeWithOSK.balances ? BalancesToJson(lightsparkNodeWithOSK.balances) : void 0,
1967
+ lightspark_node_with_o_s_k_encrypted_signing_private_key: lightsparkNodeWithOSK.encryptedSigningPrivateKey ? SecretToJson(lightsparkNodeWithOSK.encryptedSigningPrivateKey) : void 0
1968
+ };
1969
+ }
1970
+ if (obj.typename == "LightsparkNodeWithRemoteSigning") {
1971
+ const lightsparkNodeWithRemoteSigning = obj;
1972
+ return {
1973
+ __typename: "LightsparkNodeWithRemoteSigning",
1974
+ lightspark_node_with_remote_signing_id: lightsparkNodeWithRemoteSigning.id,
1975
+ lightspark_node_with_remote_signing_created_at: lightsparkNodeWithRemoteSigning.createdAt,
1976
+ lightspark_node_with_remote_signing_updated_at: lightsparkNodeWithRemoteSigning.updatedAt,
1977
+ lightspark_node_with_remote_signing_alias: lightsparkNodeWithRemoteSigning.alias,
1978
+ lightspark_node_with_remote_signing_bitcoin_network: lightsparkNodeWithRemoteSigning.bitcoinNetwork,
1979
+ lightspark_node_with_remote_signing_color: lightsparkNodeWithRemoteSigning.color,
1980
+ lightspark_node_with_remote_signing_conductivity: lightsparkNodeWithRemoteSigning.conductivity,
1981
+ lightspark_node_with_remote_signing_display_name: lightsparkNodeWithRemoteSigning.displayName,
1982
+ lightspark_node_with_remote_signing_public_key: lightsparkNodeWithRemoteSigning.publicKey,
1983
+ lightspark_node_with_remote_signing_owner: {
1984
+ id: lightsparkNodeWithRemoteSigning.ownerId
1985
+ },
1986
+ lightspark_node_with_remote_signing_status: lightsparkNodeWithRemoteSigning.status,
1987
+ lightspark_node_with_remote_signing_total_balance: lightsparkNodeWithRemoteSigning.totalBalance ? CurrencyAmountToJson(lightsparkNodeWithRemoteSigning.totalBalance) : void 0,
1988
+ lightspark_node_with_remote_signing_total_local_balance: lightsparkNodeWithRemoteSigning.totalLocalBalance ? CurrencyAmountToJson(
1989
+ lightsparkNodeWithRemoteSigning.totalLocalBalance
1990
+ ) : void 0,
1991
+ lightspark_node_with_remote_signing_local_balance: lightsparkNodeWithRemoteSigning.localBalance ? CurrencyAmountToJson(lightsparkNodeWithRemoteSigning.localBalance) : void 0,
1992
+ lightspark_node_with_remote_signing_remote_balance: lightsparkNodeWithRemoteSigning.remoteBalance ? CurrencyAmountToJson(lightsparkNodeWithRemoteSigning.remoteBalance) : void 0,
1993
+ lightspark_node_with_remote_signing_blockchain_balance: lightsparkNodeWithRemoteSigning.blockchainBalance ? BlockchainBalanceToJson(
1994
+ lightsparkNodeWithRemoteSigning.blockchainBalance
1995
+ ) : void 0,
1996
+ lightspark_node_with_remote_signing_uma_prescreening_utxos: lightsparkNodeWithRemoteSigning.umaPrescreeningUtxos,
1997
+ lightspark_node_with_remote_signing_balances: lightsparkNodeWithRemoteSigning.balances ? BalancesToJson(lightsparkNodeWithRemoteSigning.balances) : void 0
1998
+ };
1999
+ }
2000
+ throw new LightsparkException2(
2001
+ "DeserializationError",
2002
+ `Couldn't find a concrete type for interface Node corresponding to the typename=${obj.typename}`
2003
+ );
2004
+ };
2033
2005
  var FRAGMENT8 = `
2034
2006
  fragment NodeFragment on Node {
2035
2007
  __typename
@@ -2305,7 +2277,23 @@ fragment NodeFragment on Node {
2305
2277
  }
2306
2278
  }
2307
2279
  }`;
2308
- var Node_default = Node;
2280
+ var getNodeQuery = (id) => {
2281
+ return {
2282
+ queryPayload: `
2283
+ query GetNode($id: ID!) {
2284
+ entity(id: $id) {
2285
+ ... on Node {
2286
+ ...NodeFragment
2287
+ }
2288
+ }
2289
+ }
2290
+
2291
+ ${FRAGMENT8}
2292
+ `,
2293
+ variables: { id },
2294
+ constructObject: (data) => NodeFromJson(data.entity)
2295
+ };
2296
+ };
2309
2297
 
2310
2298
  // src/objects/InvoiceData.ts
2311
2299
  var InvoiceDataFromJson = (obj) => {
@@ -2987,7 +2975,7 @@ var AccountToPaymentRequestsConnectionFromJson = (obj) => {
2987
2975
  import { LightsparkException as LightsparkException5 } from "@lightsparkdev/core";
2988
2976
 
2989
2977
  // src/objects/IncomingPayment.ts
2990
- import autoBind8 from "auto-bind";
2978
+ import autoBind6 from "auto-bind";
2991
2979
 
2992
2980
  // src/objects/IncomingPaymentAttemptStatus.ts
2993
2981
  var IncomingPaymentAttemptStatus = /* @__PURE__ */ ((IncomingPaymentAttemptStatus2) => {
@@ -3072,6 +3060,12 @@ var PostTransactionDataFromJson = (obj) => {
3072
3060
  amount: CurrencyAmountFromJson(obj["post_transaction_data_amount"])
3073
3061
  };
3074
3062
  };
3063
+ var PostTransactionDataToJson = (obj) => {
3064
+ return {
3065
+ post_transaction_data_utxo: obj.utxo,
3066
+ post_transaction_data_amount: CurrencyAmountToJson(obj.amount)
3067
+ };
3068
+ };
3075
3069
 
3076
3070
  // src/objects/TransactionStatus.ts
3077
3071
  var TransactionStatus = /* @__PURE__ */ ((TransactionStatus2) => {
@@ -3100,7 +3094,7 @@ var IncomingPayment = class {
3100
3094
  this.transactionHash = transactionHash;
3101
3095
  this.paymentRequestId = paymentRequestId;
3102
3096
  this.umaPostTransactionData = umaPostTransactionData;
3103
- autoBind8(this);
3097
+ autoBind6(this);
3104
3098
  }
3105
3099
  async getAttempts(client, first = void 0, statuses = void 0, after = void 0) {
3106
3100
  return await client.executeRawQuery({
@@ -3171,6 +3165,21 @@ ${FRAGMENT12}
3171
3165
  constructObject: (data) => IncomingPaymentFromJson(data.entity)
3172
3166
  };
3173
3167
  }
3168
+ toJson() {
3169
+ return {
3170
+ __typename: "IncomingPayment",
3171
+ incoming_payment_id: this.id,
3172
+ incoming_payment_created_at: this.createdAt,
3173
+ incoming_payment_updated_at: this.updatedAt,
3174
+ incoming_payment_status: this.status,
3175
+ incoming_payment_resolved_at: this.resolvedAt,
3176
+ incoming_payment_amount: CurrencyAmountToJson(this.amount),
3177
+ incoming_payment_transaction_hash: this.transactionHash,
3178
+ incoming_payment_destination: { id: this.destinationId },
3179
+ incoming_payment_payment_request: { id: this.paymentRequestId },
3180
+ incoming_payment_uma_post_transaction_data: this.umaPostTransactionData?.map((e) => PostTransactionDataToJson(e))
3181
+ };
3182
+ }
3174
3183
  };
3175
3184
  var IncomingPaymentFromJson = (obj) => {
3176
3185
  return new IncomingPayment(
@@ -3228,10 +3237,10 @@ fragment IncomingPaymentFragment on IncomingPayment {
3228
3237
  var IncomingPayment_default = IncomingPayment;
3229
3238
 
3230
3239
  // src/objects/OutgoingPayment.ts
3231
- import autoBind10 from "auto-bind";
3240
+ import autoBind8 from "auto-bind";
3232
3241
 
3233
3242
  // src/objects/OutgoingPaymentAttempt.ts
3234
- import autoBind9 from "auto-bind";
3243
+ import autoBind7 from "auto-bind";
3235
3244
 
3236
3245
  // src/objects/ChannelSnapshot.ts
3237
3246
  var ChannelSnapshotFromJson = (obj) => {
@@ -3245,6 +3254,17 @@ var ChannelSnapshotFromJson = (obj) => {
3245
3254
  remoteUnsettledBalance: !!obj["channel_snapshot_remote_unsettled_balance"] ? CurrencyAmountFromJson(obj["channel_snapshot_remote_unsettled_balance"]) : void 0
3246
3255
  };
3247
3256
  };
3257
+ var ChannelSnapshotToJson = (obj) => {
3258
+ return {
3259
+ channel_snapshot_channel: { id: obj.channelId },
3260
+ channel_snapshot_timestamp: obj.timestamp,
3261
+ channel_snapshot_local_balance: obj.localBalance ? CurrencyAmountToJson(obj.localBalance) : void 0,
3262
+ channel_snapshot_local_unsettled_balance: obj.localUnsettledBalance ? CurrencyAmountToJson(obj.localUnsettledBalance) : void 0,
3263
+ channel_snapshot_local_channel_reserve: obj.localChannelReserve ? CurrencyAmountToJson(obj.localChannelReserve) : void 0,
3264
+ channel_snapshot_remote_balance: obj.remoteBalance ? CurrencyAmountToJson(obj.remoteBalance) : void 0,
3265
+ channel_snapshot_remote_unsettled_balance: obj.remoteUnsettledBalance ? CurrencyAmountToJson(obj.remoteUnsettledBalance) : void 0
3266
+ };
3267
+ };
3248
3268
 
3249
3269
  // src/objects/HtlcAttemptFailureCode.ts
3250
3270
  var HtlcAttemptFailureCode = /* @__PURE__ */ ((HtlcAttemptFailureCode2) => {
@@ -3382,7 +3402,7 @@ var OutgoingPaymentAttempt = class {
3382
3402
  this.amount = amount;
3383
3403
  this.fees = fees;
3384
3404
  this.channelSnapshot = channelSnapshot;
3385
- autoBind9(this);
3405
+ autoBind7(this);
3386
3406
  }
3387
3407
  async getHops(client, first = void 0, after = void 0) {
3388
3408
  return await client.executeRawQuery({
@@ -3457,6 +3477,22 @@ ${FRAGMENT14}
3457
3477
  constructObject: (data) => OutgoingPaymentAttemptFromJson(data.entity)
3458
3478
  };
3459
3479
  }
3480
+ toJson() {
3481
+ return {
3482
+ __typename: "OutgoingPaymentAttempt",
3483
+ outgoing_payment_attempt_id: this.id,
3484
+ outgoing_payment_attempt_created_at: this.createdAt,
3485
+ outgoing_payment_attempt_updated_at: this.updatedAt,
3486
+ outgoing_payment_attempt_status: this.status,
3487
+ outgoing_payment_attempt_failure_code: this.failureCode,
3488
+ outgoing_payment_attempt_failure_source_index: this.failureSourceIndex,
3489
+ outgoing_payment_attempt_resolved_at: this.resolvedAt,
3490
+ outgoing_payment_attempt_amount: this.amount ? CurrencyAmountToJson(this.amount) : void 0,
3491
+ outgoing_payment_attempt_fees: this.fees ? CurrencyAmountToJson(this.fees) : void 0,
3492
+ outgoing_payment_attempt_outgoing_payment: { id: this.outgoingPaymentId },
3493
+ outgoing_payment_attempt_channel_snapshot: this.channelSnapshot ? ChannelSnapshotToJson(this.channelSnapshot) : void 0
3494
+ };
3495
+ }
3460
3496
  };
3461
3497
  var OutgoingPaymentAttemptFromJson = (obj) => {
3462
3498
  return new OutgoingPaymentAttempt(
@@ -3607,6 +3643,26 @@ var PaymentRequestDataFromJson = (obj) => {
3607
3643
  `Couldn't find a concrete type for interface PaymentRequestData corresponding to the typename=${obj["__typename"]}`
3608
3644
  );
3609
3645
  };
3646
+ var PaymentRequestDataToJson = (obj) => {
3647
+ if (obj.typename == "InvoiceData") {
3648
+ const invoiceData = obj;
3649
+ return {
3650
+ __typename: "InvoiceData",
3651
+ invoice_data_encoded_payment_request: invoiceData.encodedPaymentRequest,
3652
+ invoice_data_bitcoin_network: invoiceData.bitcoinNetwork,
3653
+ invoice_data_payment_hash: invoiceData.paymentHash,
3654
+ invoice_data_amount: CurrencyAmountToJson(invoiceData.amount),
3655
+ invoice_data_created_at: invoiceData.createdAt,
3656
+ invoice_data_expires_at: invoiceData.expiresAt,
3657
+ invoice_data_memo: invoiceData.memo,
3658
+ invoice_data_destination: NodeToJson(invoiceData.destination)
3659
+ };
3660
+ }
3661
+ throw new LightsparkException4(
3662
+ "DeserializationError",
3663
+ `Couldn't find a concrete type for interface PaymentRequestData corresponding to the typename=${obj.typename}`
3664
+ );
3665
+ };
3610
3666
 
3611
3667
  // src/objects/RichText.ts
3612
3668
  var RichTextFromJson = (obj) => {
@@ -3614,6 +3670,11 @@ var RichTextFromJson = (obj) => {
3614
3670
  text: obj["rich_text_text"]
3615
3671
  };
3616
3672
  };
3673
+ var RichTextToJson = (obj) => {
3674
+ return {
3675
+ rich_text_text: obj.text
3676
+ };
3677
+ };
3617
3678
 
3618
3679
  // src/objects/OutgoingPayment.ts
3619
3680
  var OutgoingPayment = class {
@@ -3634,7 +3695,7 @@ var OutgoingPayment = class {
3634
3695
  this.failureMessage = failureMessage;
3635
3696
  this.umaPostTransactionData = umaPostTransactionData;
3636
3697
  this.paymentPreimage = paymentPreimage;
3637
- autoBind10(this);
3698
+ autoBind8(this);
3638
3699
  }
3639
3700
  async getAttempts(client, first = void 0, after = void 0) {
3640
3701
  return await client.executeRawQuery({
@@ -3757,6 +3818,26 @@ ${FRAGMENT15}
3757
3818
  constructObject: (data) => OutgoingPaymentFromJson(data.entity)
3758
3819
  };
3759
3820
  }
3821
+ toJson() {
3822
+ return {
3823
+ __typename: "OutgoingPayment",
3824
+ outgoing_payment_id: this.id,
3825
+ outgoing_payment_created_at: this.createdAt,
3826
+ outgoing_payment_updated_at: this.updatedAt,
3827
+ outgoing_payment_status: this.status,
3828
+ outgoing_payment_resolved_at: this.resolvedAt,
3829
+ outgoing_payment_amount: CurrencyAmountToJson(this.amount),
3830
+ outgoing_payment_transaction_hash: this.transactionHash,
3831
+ outgoing_payment_origin: { id: this.originId },
3832
+ outgoing_payment_destination: { id: this.destinationId },
3833
+ outgoing_payment_fees: this.fees ? CurrencyAmountToJson(this.fees) : void 0,
3834
+ outgoing_payment_payment_request_data: this.paymentRequestData ? PaymentRequestDataToJson(this.paymentRequestData) : void 0,
3835
+ outgoing_payment_failure_reason: this.failureReason,
3836
+ outgoing_payment_failure_message: this.failureMessage ? RichTextToJson(this.failureMessage) : void 0,
3837
+ outgoing_payment_uma_post_transaction_data: this.umaPostTransactionData?.map((e) => PostTransactionDataToJson(e)),
3838
+ outgoing_payment_payment_preimage: this.paymentPreimage
3839
+ };
3840
+ }
3760
3841
  };
3761
3842
  var OutgoingPaymentFromJson = (obj) => {
3762
3843
  return new OutgoingPayment(
@@ -4861,7 +4942,7 @@ var AccountToTransactionsConnectionFromJson = (obj) => {
4861
4942
  };
4862
4943
 
4863
4944
  // src/objects/Wallet.ts
4864
- import autoBind11 from "auto-bind";
4945
+ import autoBind9 from "auto-bind";
4865
4946
 
4866
4947
  // src/objects/WalletStatus.ts
4867
4948
  var WalletStatus = /* @__PURE__ */ ((WalletStatus2) => {
@@ -4919,7 +5000,7 @@ var Wallet = class {
4919
5000
  this.lastLoginAt = lastLoginAt;
4920
5001
  this.balances = balances;
4921
5002
  this.accountId = accountId;
4922
- autoBind11(this);
5003
+ autoBind9(this);
4923
5004
  }
4924
5005
  async getTransactions(client, first = void 0, after = void 0, createdAfterDate = void 0, createdBeforeDate = void 0, statuses = void 0, types = void 0) {
4925
5006
  return await client.executeRawQuery({
@@ -5920,6 +6001,19 @@ ${FRAGMENT17}
5920
6001
  constructObject: (data) => WalletFromJson(data.entity)
5921
6002
  };
5922
6003
  }
6004
+ toJson() {
6005
+ return {
6006
+ __typename: "Wallet",
6007
+ wallet_id: this.id,
6008
+ wallet_created_at: this.createdAt,
6009
+ wallet_updated_at: this.updatedAt,
6010
+ wallet_last_login_at: this.lastLoginAt,
6011
+ wallet_balances: this.balances ? BalancesToJson(this.balances) : void 0,
6012
+ wallet_third_party_identifier: this.thirdPartyIdentifier,
6013
+ wallet_account: { id: this.accountId },
6014
+ wallet_status: this.status
6015
+ };
6016
+ }
5923
6017
  };
5924
6018
  var WalletFromJson = (obj) => {
5925
6019
  return new Wallet(
@@ -5996,7 +6090,7 @@ var Account = class {
5996
6090
  this.updatedAt = updatedAt;
5997
6091
  this.typename = typename;
5998
6092
  this.name = name;
5999
- autoBind12(this);
6093
+ autoBind10(this);
6000
6094
  }
6001
6095
  async getApiTokens(client, first = void 0, after = void 0) {
6002
6096
  return await client.executeRawQuery({
@@ -7645,6 +7739,15 @@ ${FRAGMENT18}
7645
7739
  constructObject: (data) => AccountFromJson(data.current_account)
7646
7740
  };
7647
7741
  }
7742
+ toJson() {
7743
+ return {
7744
+ __typename: "Account",
7745
+ account_id: this.id,
7746
+ account_created_at: this.createdAt,
7747
+ account_updated_at: this.updatedAt,
7748
+ account_name: this.name
7749
+ };
7750
+ }
7648
7751
  };
7649
7752
  var AccountFromJson = (obj) => {
7650
7753
  return new Account(
@@ -9451,7 +9554,7 @@ ${FRAGMENT32}
9451
9554
  };
9452
9555
 
9453
9556
  // src/objects/WithdrawalRequest.ts
9454
- import autoBind13 from "auto-bind";
9557
+ import autoBind11 from "auto-bind";
9455
9558
 
9456
9559
  // src/objects/WithdrawalRequestStatus.ts
9457
9560
  var WithdrawalRequestStatus = /* @__PURE__ */ ((WithdrawalRequestStatus2) => {
@@ -9500,7 +9603,7 @@ var WithdrawalRequest = class {
9500
9603
  this.estimatedAmount = estimatedAmount;
9501
9604
  this.completedAt = completedAt;
9502
9605
  this.withdrawalId = withdrawalId;
9503
- autoBind13(this);
9606
+ autoBind11(this);
9504
9607
  }
9505
9608
  async getChannelClosingTransactions(client, first = void 0) {
9506
9609
  return await client.executeRawQuery({
@@ -9643,6 +9746,21 @@ ${FRAGMENT33}
9643
9746
  constructObject: (data) => WithdrawalRequestFromJson(data.entity)
9644
9747
  };
9645
9748
  }
9749
+ toJson() {
9750
+ return {
9751
+ __typename: "WithdrawalRequest",
9752
+ withdrawal_request_id: this.id,
9753
+ withdrawal_request_created_at: this.createdAt,
9754
+ withdrawal_request_updated_at: this.updatedAt,
9755
+ withdrawal_request_amount: CurrencyAmountToJson(this.amount),
9756
+ withdrawal_request_estimated_amount: this.estimatedAmount ? CurrencyAmountToJson(this.estimatedAmount) : void 0,
9757
+ withdrawal_request_bitcoin_address: this.bitcoinAddress,
9758
+ withdrawal_request_withdrawal_mode: this.withdrawalMode,
9759
+ withdrawal_request_status: this.status,
9760
+ withdrawal_request_completed_at: this.completedAt,
9761
+ withdrawal_request_withdrawal: { id: this.withdrawalId }
9762
+ };
9763
+ }
9646
9764
  };
9647
9765
  var WithdrawalRequestFromJson = (obj) => {
9648
9766
  return new WithdrawalRequest(
@@ -9708,7 +9826,7 @@ export {
9708
9826
  Channel_default,
9709
9827
  LightsparkNodeWithOSK_default,
9710
9828
  LightsparkNodeWithRemoteSigning_default,
9711
- Node_default,
9829
+ getNodeQuery,
9712
9830
  InvoiceDataFromJson,
9713
9831
  FRAGMENT9 as FRAGMENT4,
9714
9832
  PaymentRequestStatus_default,
@@ -9747,7 +9865,7 @@ export {
9747
9865
  TransactionUpdateFromJson,
9748
9866
  FRAGMENT31 as FRAGMENT12,
9749
9867
  AccountToChannelsConnection_default,
9750
- LightsparkNode_default,
9868
+ getLightsparkNodeQuery,
9751
9869
  WalletStatus_default,
9752
9870
  Wallet_default,
9753
9871
  Account_default,