@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
package/dist/index.cjs CHANGED
@@ -1851,11 +1851,9 @@ __export(src_exports, {
1851
1851
  IncomingPaymentAttemptStatus: () => IncomingPaymentAttemptStatus_default,
1852
1852
  InvoiceType: () => InvoiceType_default,
1853
1853
  LightsparkClient: () => client_default,
1854
- LightsparkNode: () => LightsparkNode_default,
1855
1854
  LightsparkNodeStatus: () => LightsparkNodeStatus_default,
1856
1855
  LightsparkNodeWithOSK: () => LightsparkNodeWithOSK_default,
1857
1856
  LightsparkNodeWithRemoteSigning: () => LightsparkNodeWithRemoteSigning_default,
1858
- Node: () => Node_default,
1859
1857
  NodeAddressType: () => NodeAddressType_default,
1860
1858
  OutgoingPayment: () => OutgoingPayment_default,
1861
1859
  OutgoingPaymentAttempt: () => OutgoingPaymentAttempt_default,
@@ -1889,6 +1887,8 @@ __export(src_exports, {
1889
1887
  getInvoiceQuery: () => getInvoiceQuery,
1890
1888
  getLightningTransactionQuery: () => getLightningTransactionQuery,
1891
1889
  getLightsparkNodeOwnerQuery: () => getLightsparkNodeOwnerQuery,
1890
+ getLightsparkNodeQuery: () => getLightsparkNodeQuery,
1891
+ getNodeQuery: () => getNodeQuery,
1892
1892
  getOnChainTransactionQuery: () => getOnChainTransactionQuery,
1893
1893
  getPaymentRequestQuery: () => getPaymentRequestQuery,
1894
1894
  getRoutingTransactionQuery: () => getRoutingTransactionQuery,
@@ -1932,13 +1932,13 @@ var AccountTokenAuthProvider = class {
1932
1932
  var AccountTokenAuthProvider_default = AccountTokenAuthProvider;
1933
1933
 
1934
1934
  // src/client.ts
1935
- var import_auto_bind15 = __toESM(require("auto-bind"), 1);
1935
+ var import_auto_bind13 = __toESM(require("auto-bind"), 1);
1936
1936
  var import_core9 = require("@lightsparkdev/core");
1937
1937
 
1938
1938
  // package.json
1939
1939
  var package_default = {
1940
1940
  name: "@lightsparkdev/lightspark-sdk",
1941
- version: "1.1.7",
1941
+ version: "1.2.0",
1942
1942
  description: "Lightspark JS SDK",
1943
1943
  author: "Lightspark Inc.",
1944
1944
  keywords: [
@@ -2047,7 +2047,7 @@ var package_default = {
2047
2047
  eslint: "^8.3.0",
2048
2048
  "eslint-watch": "^8.0.0",
2049
2049
  jest: "^29.6.2",
2050
- prettier: "3.0.2",
2050
+ prettier: "3.0.3",
2051
2051
  "prettier-plugin-organize-imports": "^3.2.2",
2052
2052
  "ts-jest": "^29.1.1",
2053
2053
  "tsc-absolute": "^1.0.1",
@@ -2081,6 +2081,15 @@ var CurrencyAmountFromJson = (obj) => {
2081
2081
  preferredCurrencyValueApprox: obj["currency_amount_preferred_currency_value_approx"]
2082
2082
  };
2083
2083
  };
2084
+ var CurrencyAmountToJson = (obj) => {
2085
+ return {
2086
+ currency_amount_original_value: obj.originalValue,
2087
+ currency_amount_original_unit: obj.originalUnit,
2088
+ currency_amount_preferred_currency_unit: obj.preferredCurrencyUnit,
2089
+ currency_amount_preferred_currency_value_rounded: obj.preferredCurrencyValueRounded,
2090
+ currency_amount_preferred_currency_value_approx: obj.preferredCurrencyValueApprox
2091
+ };
2092
+ };
2084
2093
  var FRAGMENT = `
2085
2094
  fragment CurrencyAmountFragment on CurrencyAmount {
2086
2095
  __typename
@@ -2243,7 +2252,6 @@ var BitcoinNetwork_default = BitcoinNetwork;
2243
2252
 
2244
2253
  // src/objects/Node.ts
2245
2254
  var import_core2 = require("@lightsparkdev/core");
2246
- var import_auto_bind6 = __toESM(require("auto-bind"), 1);
2247
2255
 
2248
2256
  // src/objects/Balances.ts
2249
2257
  var BalancesFromJson = (obj) => {
@@ -2257,6 +2265,17 @@ var BalancesFromJson = (obj) => {
2257
2265
  )
2258
2266
  };
2259
2267
  };
2268
+ var BalancesToJson = (obj) => {
2269
+ return {
2270
+ balances_owned_balance: CurrencyAmountToJson(obj.ownedBalance),
2271
+ balances_available_to_send_balance: CurrencyAmountToJson(
2272
+ obj.availableToSendBalance
2273
+ ),
2274
+ balances_available_to_withdraw_balance: CurrencyAmountToJson(
2275
+ obj.availableToWithdrawBalance
2276
+ )
2277
+ };
2278
+ };
2260
2279
 
2261
2280
  // src/objects/BlockchainBalance.ts
2262
2281
  var BlockchainBalanceFromJson = (obj) => {
@@ -2269,6 +2288,16 @@ var BlockchainBalanceFromJson = (obj) => {
2269
2288
  availableBalance: !!obj["blockchain_balance_available_balance"] ? CurrencyAmountFromJson(obj["blockchain_balance_available_balance"]) : void 0
2270
2289
  };
2271
2290
  };
2291
+ var BlockchainBalanceToJson = (obj) => {
2292
+ return {
2293
+ blockchain_balance_total_balance: obj.totalBalance ? CurrencyAmountToJson(obj.totalBalance) : void 0,
2294
+ blockchain_balance_confirmed_balance: obj.confirmedBalance ? CurrencyAmountToJson(obj.confirmedBalance) : void 0,
2295
+ blockchain_balance_unconfirmed_balance: obj.unconfirmedBalance ? CurrencyAmountToJson(obj.unconfirmedBalance) : void 0,
2296
+ blockchain_balance_locked_balance: obj.lockedBalance ? CurrencyAmountToJson(obj.lockedBalance) : void 0,
2297
+ blockchain_balance_required_reserve: obj.requiredReserve ? CurrencyAmountToJson(obj.requiredReserve) : void 0,
2298
+ blockchain_balance_available_balance: obj.availableBalance ? CurrencyAmountToJson(obj.availableBalance) : void 0
2299
+ };
2300
+ };
2272
2301
 
2273
2302
  // src/objects/GraphNode.ts
2274
2303
  var import_auto_bind2 = __toESM(require("auto-bind"), 1);
@@ -2359,6 +2388,20 @@ ${FRAGMENT4}
2359
2388
  constructObject: (data) => GraphNodeFromJson(data.entity)
2360
2389
  };
2361
2390
  }
2391
+ toJson() {
2392
+ return {
2393
+ __typename: "GraphNode",
2394
+ graph_node_id: this.id,
2395
+ graph_node_created_at: this.createdAt,
2396
+ graph_node_updated_at: this.updatedAt,
2397
+ graph_node_alias: this.alias,
2398
+ graph_node_bitcoin_network: this.bitcoinNetwork,
2399
+ graph_node_color: this.color,
2400
+ graph_node_conductivity: this.conductivity,
2401
+ graph_node_display_name: this.displayName,
2402
+ graph_node_public_key: this.publicKey
2403
+ };
2404
+ }
2362
2405
  };
2363
2406
  var GraphNodeFromJson = (obj) => {
2364
2407
  return new GraphNode(
@@ -2419,6 +2462,12 @@ var ChannelFeesFromJson = (obj) => {
2419
2462
  feeRatePerMil: obj["channel_fees_fee_rate_per_mil"]
2420
2463
  };
2421
2464
  };
2465
+ var ChannelFeesToJson = (obj) => {
2466
+ return {
2467
+ channel_fees_base_fee: obj.baseFee ? CurrencyAmountToJson(obj.baseFee) : void 0,
2468
+ channel_fees_fee_rate_per_mil: obj.feeRatePerMil
2469
+ };
2470
+ };
2422
2471
 
2423
2472
  // src/objects/ChannelStatus.ts
2424
2473
  var ChannelStatus = /* @__PURE__ */ ((ChannelStatus2) => {
@@ -2563,6 +2612,29 @@ ${FRAGMENT5}
2563
2612
  constructObject: (data) => ChannelFromJson(data.entity)
2564
2613
  };
2565
2614
  }
2615
+ toJson() {
2616
+ return {
2617
+ __typename: "Channel",
2618
+ channel_id: this.id,
2619
+ channel_created_at: this.createdAt,
2620
+ channel_updated_at: this.updatedAt,
2621
+ channel_funding_transaction: { id: this.fundingTransactionId },
2622
+ channel_capacity: this.capacity ? CurrencyAmountToJson(this.capacity) : void 0,
2623
+ channel_local_balance: this.localBalance ? CurrencyAmountToJson(this.localBalance) : void 0,
2624
+ channel_local_unsettled_balance: this.localUnsettledBalance ? CurrencyAmountToJson(this.localUnsettledBalance) : void 0,
2625
+ channel_remote_balance: this.remoteBalance ? CurrencyAmountToJson(this.remoteBalance) : void 0,
2626
+ channel_remote_unsettled_balance: this.remoteUnsettledBalance ? CurrencyAmountToJson(this.remoteUnsettledBalance) : void 0,
2627
+ channel_unsettled_balance: this.unsettledBalance ? CurrencyAmountToJson(this.unsettledBalance) : void 0,
2628
+ channel_total_balance: this.totalBalance ? CurrencyAmountToJson(this.totalBalance) : void 0,
2629
+ channel_status: this.status,
2630
+ channel_estimated_force_closure_wait_minutes: this.estimatedForceClosureWaitMinutes,
2631
+ channel_commit_fee: this.commitFee ? CurrencyAmountToJson(this.commitFee) : void 0,
2632
+ channel_fees: this.fees ? ChannelFeesToJson(this.fees) : void 0,
2633
+ channel_remote_node: { id: this.remoteNodeId },
2634
+ channel_local_node: { id: this.localNodeId },
2635
+ channel_short_channel_id: this.shortChannelId
2636
+ };
2637
+ }
2566
2638
  };
2567
2639
  var ChannelFromJson = (obj) => {
2568
2640
  return new Channel(
@@ -2715,6 +2787,12 @@ var SecretFromJson = (obj) => {
2715
2787
  cipher: obj["secret_cipher"]
2716
2788
  };
2717
2789
  };
2790
+ var SecretToJson = (obj) => {
2791
+ return {
2792
+ secret_encrypted_value: obj.encryptedValue,
2793
+ secret_cipher: obj.cipher
2794
+ };
2795
+ };
2718
2796
 
2719
2797
  // src/objects/LightsparkNodeWithOSK.ts
2720
2798
  var LightsparkNodeWithOSK = class {
@@ -2911,6 +2989,30 @@ ${FRAGMENT6}
2911
2989
  constructObject: (data) => LightsparkNodeWithOSKFromJson(data.entity)
2912
2990
  };
2913
2991
  }
2992
+ toJson() {
2993
+ return {
2994
+ __typename: "LightsparkNodeWithOSK",
2995
+ lightspark_node_with_o_s_k_id: this.id,
2996
+ lightspark_node_with_o_s_k_created_at: this.createdAt,
2997
+ lightspark_node_with_o_s_k_updated_at: this.updatedAt,
2998
+ lightspark_node_with_o_s_k_alias: this.alias,
2999
+ lightspark_node_with_o_s_k_bitcoin_network: this.bitcoinNetwork,
3000
+ lightspark_node_with_o_s_k_color: this.color,
3001
+ lightspark_node_with_o_s_k_conductivity: this.conductivity,
3002
+ lightspark_node_with_o_s_k_display_name: this.displayName,
3003
+ lightspark_node_with_o_s_k_public_key: this.publicKey,
3004
+ lightspark_node_with_o_s_k_owner: { id: this.ownerId },
3005
+ lightspark_node_with_o_s_k_status: this.status,
3006
+ lightspark_node_with_o_s_k_total_balance: this.totalBalance ? CurrencyAmountToJson(this.totalBalance) : void 0,
3007
+ lightspark_node_with_o_s_k_total_local_balance: this.totalLocalBalance ? CurrencyAmountToJson(this.totalLocalBalance) : void 0,
3008
+ lightspark_node_with_o_s_k_local_balance: this.localBalance ? CurrencyAmountToJson(this.localBalance) : void 0,
3009
+ lightspark_node_with_o_s_k_remote_balance: this.remoteBalance ? CurrencyAmountToJson(this.remoteBalance) : void 0,
3010
+ lightspark_node_with_o_s_k_blockchain_balance: this.blockchainBalance ? BlockchainBalanceToJson(this.blockchainBalance) : void 0,
3011
+ lightspark_node_with_o_s_k_uma_prescreening_utxos: this.umaPrescreeningUtxos,
3012
+ lightspark_node_with_o_s_k_balances: this.balances ? BalancesToJson(this.balances) : void 0,
3013
+ lightspark_node_with_o_s_k_encrypted_signing_private_key: this.encryptedSigningPrivateKey ? SecretToJson(this.encryptedSigningPrivateKey) : void 0
3014
+ };
3015
+ }
2914
3016
  };
2915
3017
  var LightsparkNodeWithOSKFromJson = (obj) => {
2916
3018
  return new LightsparkNodeWithOSK(
@@ -3272,6 +3374,29 @@ ${FRAGMENT7}
3272
3374
  constructObject: (data) => LightsparkNodeWithRemoteSigningFromJson(data.entity)
3273
3375
  };
3274
3376
  }
3377
+ toJson() {
3378
+ return {
3379
+ __typename: "LightsparkNodeWithRemoteSigning",
3380
+ lightspark_node_with_remote_signing_id: this.id,
3381
+ lightspark_node_with_remote_signing_created_at: this.createdAt,
3382
+ lightspark_node_with_remote_signing_updated_at: this.updatedAt,
3383
+ lightspark_node_with_remote_signing_alias: this.alias,
3384
+ lightspark_node_with_remote_signing_bitcoin_network: this.bitcoinNetwork,
3385
+ lightspark_node_with_remote_signing_color: this.color,
3386
+ lightspark_node_with_remote_signing_conductivity: this.conductivity,
3387
+ lightspark_node_with_remote_signing_display_name: this.displayName,
3388
+ lightspark_node_with_remote_signing_public_key: this.publicKey,
3389
+ lightspark_node_with_remote_signing_owner: { id: this.ownerId },
3390
+ lightspark_node_with_remote_signing_status: this.status,
3391
+ lightspark_node_with_remote_signing_total_balance: this.totalBalance ? CurrencyAmountToJson(this.totalBalance) : void 0,
3392
+ lightspark_node_with_remote_signing_total_local_balance: this.totalLocalBalance ? CurrencyAmountToJson(this.totalLocalBalance) : void 0,
3393
+ lightspark_node_with_remote_signing_local_balance: this.localBalance ? CurrencyAmountToJson(this.localBalance) : void 0,
3394
+ lightspark_node_with_remote_signing_remote_balance: this.remoteBalance ? CurrencyAmountToJson(this.remoteBalance) : void 0,
3395
+ lightspark_node_with_remote_signing_blockchain_balance: this.blockchainBalance ? BlockchainBalanceToJson(this.blockchainBalance) : void 0,
3396
+ lightspark_node_with_remote_signing_uma_prescreening_utxos: this.umaPrescreeningUtxos,
3397
+ lightspark_node_with_remote_signing_balances: this.balances ? BalancesToJson(this.balances) : void 0
3398
+ };
3399
+ }
3275
3400
  };
3276
3401
  var LightsparkNodeWithRemoteSigningFromJson = (obj) => {
3277
3402
  return new LightsparkNodeWithRemoteSigning(
@@ -3437,64 +3562,6 @@ fragment LightsparkNodeWithRemoteSigningFragment on LightsparkNodeWithRemoteSign
3437
3562
  var LightsparkNodeWithRemoteSigning_default = LightsparkNodeWithRemoteSigning;
3438
3563
 
3439
3564
  // src/objects/Node.ts
3440
- var Node = class {
3441
- constructor(id, createdAt, updatedAt, bitcoinNetwork, displayName, typename, alias, color, conductivity, publicKey) {
3442
- this.id = id;
3443
- this.createdAt = createdAt;
3444
- this.updatedAt = updatedAt;
3445
- this.bitcoinNetwork = bitcoinNetwork;
3446
- this.displayName = displayName;
3447
- this.typename = typename;
3448
- this.alias = alias;
3449
- this.color = color;
3450
- this.conductivity = conductivity;
3451
- this.publicKey = publicKey;
3452
- (0, import_auto_bind6.default)(this);
3453
- }
3454
- async getAddresses(client, first = void 0, types = void 0) {
3455
- return await client.executeRawQuery({
3456
- queryPayload: `
3457
- query FetchNodeToAddressesConnection($entity_id: ID!, $first: Int, $types: [NodeAddressType!]) {
3458
- entity(id: $entity_id) {
3459
- ... on Node {
3460
- addresses(, first: $first, types: $types) {
3461
- __typename
3462
- node_to_addresses_connection_count: count
3463
- node_to_addresses_connection_entities: entities {
3464
- __typename
3465
- node_address_address: address
3466
- node_address_type: type
3467
- }
3468
- }
3469
- }
3470
- }
3471
- }
3472
- `,
3473
- variables: { entity_id: this.id, first, types },
3474
- constructObject: (json) => {
3475
- const connection = json["entity"]["addresses"];
3476
- return NodeToAddressesConnectionFromJson(connection);
3477
- }
3478
- });
3479
- }
3480
- static getNodeQuery(id) {
3481
- return {
3482
- queryPayload: `
3483
- query GetNode($id: ID!) {
3484
- entity(id: $id) {
3485
- ... on Node {
3486
- ...NodeFragment
3487
- }
3488
- }
3489
- }
3490
-
3491
- ${FRAGMENT8}
3492
- `,
3493
- variables: { id },
3494
- constructObject: (data) => NodeFromJson(data.entity)
3495
- };
3496
- }
3497
- };
3498
3565
  var NodeFromJson = (obj) => {
3499
3566
  if (obj["__typename"] == "GraphNode") {
3500
3567
  return new GraphNode_default(
@@ -3584,6 +3651,82 @@ var NodeFromJson = (obj) => {
3584
3651
  `Couldn't find a concrete type for interface Node corresponding to the typename=${obj["__typename"]}`
3585
3652
  );
3586
3653
  };
3654
+ var NodeToJson = (obj) => {
3655
+ if (obj.typename == "GraphNode") {
3656
+ const graphNode = obj;
3657
+ return {
3658
+ __typename: "GraphNode",
3659
+ graph_node_id: graphNode.id,
3660
+ graph_node_created_at: graphNode.createdAt,
3661
+ graph_node_updated_at: graphNode.updatedAt,
3662
+ graph_node_alias: graphNode.alias,
3663
+ graph_node_bitcoin_network: graphNode.bitcoinNetwork,
3664
+ graph_node_color: graphNode.color,
3665
+ graph_node_conductivity: graphNode.conductivity,
3666
+ graph_node_display_name: graphNode.displayName,
3667
+ graph_node_public_key: graphNode.publicKey
3668
+ };
3669
+ }
3670
+ if (obj.typename == "LightsparkNodeWithOSK") {
3671
+ const lightsparkNodeWithOSK = obj;
3672
+ return {
3673
+ __typename: "LightsparkNodeWithOSK",
3674
+ lightspark_node_with_o_s_k_id: lightsparkNodeWithOSK.id,
3675
+ lightspark_node_with_o_s_k_created_at: lightsparkNodeWithOSK.createdAt,
3676
+ lightspark_node_with_o_s_k_updated_at: lightsparkNodeWithOSK.updatedAt,
3677
+ lightspark_node_with_o_s_k_alias: lightsparkNodeWithOSK.alias,
3678
+ lightspark_node_with_o_s_k_bitcoin_network: lightsparkNodeWithOSK.bitcoinNetwork,
3679
+ lightspark_node_with_o_s_k_color: lightsparkNodeWithOSK.color,
3680
+ lightspark_node_with_o_s_k_conductivity: lightsparkNodeWithOSK.conductivity,
3681
+ lightspark_node_with_o_s_k_display_name: lightsparkNodeWithOSK.displayName,
3682
+ lightspark_node_with_o_s_k_public_key: lightsparkNodeWithOSK.publicKey,
3683
+ lightspark_node_with_o_s_k_owner: { id: lightsparkNodeWithOSK.ownerId },
3684
+ lightspark_node_with_o_s_k_status: lightsparkNodeWithOSK.status,
3685
+ lightspark_node_with_o_s_k_total_balance: lightsparkNodeWithOSK.totalBalance ? CurrencyAmountToJson(lightsparkNodeWithOSK.totalBalance) : void 0,
3686
+ lightspark_node_with_o_s_k_total_local_balance: lightsparkNodeWithOSK.totalLocalBalance ? CurrencyAmountToJson(lightsparkNodeWithOSK.totalLocalBalance) : void 0,
3687
+ lightspark_node_with_o_s_k_local_balance: lightsparkNodeWithOSK.localBalance ? CurrencyAmountToJson(lightsparkNodeWithOSK.localBalance) : void 0,
3688
+ lightspark_node_with_o_s_k_remote_balance: lightsparkNodeWithOSK.remoteBalance ? CurrencyAmountToJson(lightsparkNodeWithOSK.remoteBalance) : void 0,
3689
+ lightspark_node_with_o_s_k_blockchain_balance: lightsparkNodeWithOSK.blockchainBalance ? BlockchainBalanceToJson(lightsparkNodeWithOSK.blockchainBalance) : void 0,
3690
+ lightspark_node_with_o_s_k_uma_prescreening_utxos: lightsparkNodeWithOSK.umaPrescreeningUtxos,
3691
+ lightspark_node_with_o_s_k_balances: lightsparkNodeWithOSK.balances ? BalancesToJson(lightsparkNodeWithOSK.balances) : void 0,
3692
+ lightspark_node_with_o_s_k_encrypted_signing_private_key: lightsparkNodeWithOSK.encryptedSigningPrivateKey ? SecretToJson(lightsparkNodeWithOSK.encryptedSigningPrivateKey) : void 0
3693
+ };
3694
+ }
3695
+ if (obj.typename == "LightsparkNodeWithRemoteSigning") {
3696
+ const lightsparkNodeWithRemoteSigning = obj;
3697
+ return {
3698
+ __typename: "LightsparkNodeWithRemoteSigning",
3699
+ lightspark_node_with_remote_signing_id: lightsparkNodeWithRemoteSigning.id,
3700
+ lightspark_node_with_remote_signing_created_at: lightsparkNodeWithRemoteSigning.createdAt,
3701
+ lightspark_node_with_remote_signing_updated_at: lightsparkNodeWithRemoteSigning.updatedAt,
3702
+ lightspark_node_with_remote_signing_alias: lightsparkNodeWithRemoteSigning.alias,
3703
+ lightspark_node_with_remote_signing_bitcoin_network: lightsparkNodeWithRemoteSigning.bitcoinNetwork,
3704
+ lightspark_node_with_remote_signing_color: lightsparkNodeWithRemoteSigning.color,
3705
+ lightspark_node_with_remote_signing_conductivity: lightsparkNodeWithRemoteSigning.conductivity,
3706
+ lightspark_node_with_remote_signing_display_name: lightsparkNodeWithRemoteSigning.displayName,
3707
+ lightspark_node_with_remote_signing_public_key: lightsparkNodeWithRemoteSigning.publicKey,
3708
+ lightspark_node_with_remote_signing_owner: {
3709
+ id: lightsparkNodeWithRemoteSigning.ownerId
3710
+ },
3711
+ lightspark_node_with_remote_signing_status: lightsparkNodeWithRemoteSigning.status,
3712
+ lightspark_node_with_remote_signing_total_balance: lightsparkNodeWithRemoteSigning.totalBalance ? CurrencyAmountToJson(lightsparkNodeWithRemoteSigning.totalBalance) : void 0,
3713
+ lightspark_node_with_remote_signing_total_local_balance: lightsparkNodeWithRemoteSigning.totalLocalBalance ? CurrencyAmountToJson(
3714
+ lightsparkNodeWithRemoteSigning.totalLocalBalance
3715
+ ) : void 0,
3716
+ lightspark_node_with_remote_signing_local_balance: lightsparkNodeWithRemoteSigning.localBalance ? CurrencyAmountToJson(lightsparkNodeWithRemoteSigning.localBalance) : void 0,
3717
+ lightspark_node_with_remote_signing_remote_balance: lightsparkNodeWithRemoteSigning.remoteBalance ? CurrencyAmountToJson(lightsparkNodeWithRemoteSigning.remoteBalance) : void 0,
3718
+ lightspark_node_with_remote_signing_blockchain_balance: lightsparkNodeWithRemoteSigning.blockchainBalance ? BlockchainBalanceToJson(
3719
+ lightsparkNodeWithRemoteSigning.blockchainBalance
3720
+ ) : void 0,
3721
+ lightspark_node_with_remote_signing_uma_prescreening_utxos: lightsparkNodeWithRemoteSigning.umaPrescreeningUtxos,
3722
+ lightspark_node_with_remote_signing_balances: lightsparkNodeWithRemoteSigning.balances ? BalancesToJson(lightsparkNodeWithRemoteSigning.balances) : void 0
3723
+ };
3724
+ }
3725
+ throw new import_core2.LightsparkException(
3726
+ "DeserializationError",
3727
+ `Couldn't find a concrete type for interface Node corresponding to the typename=${obj.typename}`
3728
+ );
3729
+ };
3587
3730
  var FRAGMENT8 = `
3588
3731
  fragment NodeFragment on Node {
3589
3732
  __typename
@@ -3859,7 +4002,23 @@ fragment NodeFragment on Node {
3859
4002
  }
3860
4003
  }
3861
4004
  }`;
3862
- var Node_default = Node;
4005
+ var getNodeQuery = (id) => {
4006
+ return {
4007
+ queryPayload: `
4008
+ query GetNode($id: ID!) {
4009
+ entity(id: $id) {
4010
+ ... on Node {
4011
+ ...NodeFragment
4012
+ }
4013
+ }
4014
+ }
4015
+
4016
+ ${FRAGMENT8}
4017
+ `,
4018
+ variables: { id },
4019
+ constructObject: (data) => NodeFromJson(data.entity)
4020
+ };
4021
+ };
3863
4022
 
3864
4023
  // src/objects/InvoiceData.ts
3865
4024
  var InvoiceDataFromJson = (obj) => {
@@ -4569,7 +4728,7 @@ mutation CreateTestModeInvoice(
4569
4728
  `;
4570
4729
 
4571
4730
  // src/objects/IncomingPayment.ts
4572
- var import_auto_bind7 = __toESM(require("auto-bind"), 1);
4731
+ var import_auto_bind6 = __toESM(require("auto-bind"), 1);
4573
4732
 
4574
4733
  // src/objects/IncomingPaymentAttemptStatus.ts
4575
4734
  var IncomingPaymentAttemptStatus = /* @__PURE__ */ ((IncomingPaymentAttemptStatus2) => {
@@ -4654,6 +4813,12 @@ var PostTransactionDataFromJson = (obj) => {
4654
4813
  amount: CurrencyAmountFromJson(obj["post_transaction_data_amount"])
4655
4814
  };
4656
4815
  };
4816
+ var PostTransactionDataToJson = (obj) => {
4817
+ return {
4818
+ post_transaction_data_utxo: obj.utxo,
4819
+ post_transaction_data_amount: CurrencyAmountToJson(obj.amount)
4820
+ };
4821
+ };
4657
4822
 
4658
4823
  // src/objects/TransactionStatus.ts
4659
4824
  var TransactionStatus = /* @__PURE__ */ ((TransactionStatus2) => {
@@ -4682,7 +4847,7 @@ var IncomingPayment = class {
4682
4847
  this.transactionHash = transactionHash;
4683
4848
  this.paymentRequestId = paymentRequestId;
4684
4849
  this.umaPostTransactionData = umaPostTransactionData;
4685
- (0, import_auto_bind7.default)(this);
4850
+ (0, import_auto_bind6.default)(this);
4686
4851
  }
4687
4852
  async getAttempts(client, first = void 0, statuses = void 0, after = void 0) {
4688
4853
  return await client.executeRawQuery({
@@ -4753,6 +4918,21 @@ ${FRAGMENT12}
4753
4918
  constructObject: (data) => IncomingPaymentFromJson(data.entity)
4754
4919
  };
4755
4920
  }
4921
+ toJson() {
4922
+ return {
4923
+ __typename: "IncomingPayment",
4924
+ incoming_payment_id: this.id,
4925
+ incoming_payment_created_at: this.createdAt,
4926
+ incoming_payment_updated_at: this.updatedAt,
4927
+ incoming_payment_status: this.status,
4928
+ incoming_payment_resolved_at: this.resolvedAt,
4929
+ incoming_payment_amount: CurrencyAmountToJson(this.amount),
4930
+ incoming_payment_transaction_hash: this.transactionHash,
4931
+ incoming_payment_destination: { id: this.destinationId },
4932
+ incoming_payment_payment_request: { id: this.paymentRequestId },
4933
+ incoming_payment_uma_post_transaction_data: this.umaPostTransactionData?.map((e) => PostTransactionDataToJson(e))
4934
+ };
4935
+ }
4756
4936
  };
4757
4937
  var IncomingPaymentFromJson = (obj) => {
4758
4938
  return new IncomingPayment(
@@ -5023,10 +5203,10 @@ var MultiNodeDashboard = `
5023
5203
  `;
5024
5204
 
5025
5205
  // src/objects/OutgoingPayment.ts
5026
- var import_auto_bind9 = __toESM(require("auto-bind"), 1);
5206
+ var import_auto_bind8 = __toESM(require("auto-bind"), 1);
5027
5207
 
5028
5208
  // src/objects/OutgoingPaymentAttempt.ts
5029
- var import_auto_bind8 = __toESM(require("auto-bind"), 1);
5209
+ var import_auto_bind7 = __toESM(require("auto-bind"), 1);
5030
5210
 
5031
5211
  // src/objects/ChannelSnapshot.ts
5032
5212
  var ChannelSnapshotFromJson = (obj) => {
@@ -5040,6 +5220,17 @@ var ChannelSnapshotFromJson = (obj) => {
5040
5220
  remoteUnsettledBalance: !!obj["channel_snapshot_remote_unsettled_balance"] ? CurrencyAmountFromJson(obj["channel_snapshot_remote_unsettled_balance"]) : void 0
5041
5221
  };
5042
5222
  };
5223
+ var ChannelSnapshotToJson = (obj) => {
5224
+ return {
5225
+ channel_snapshot_channel: { id: obj.channelId },
5226
+ channel_snapshot_timestamp: obj.timestamp,
5227
+ channel_snapshot_local_balance: obj.localBalance ? CurrencyAmountToJson(obj.localBalance) : void 0,
5228
+ channel_snapshot_local_unsettled_balance: obj.localUnsettledBalance ? CurrencyAmountToJson(obj.localUnsettledBalance) : void 0,
5229
+ channel_snapshot_local_channel_reserve: obj.localChannelReserve ? CurrencyAmountToJson(obj.localChannelReserve) : void 0,
5230
+ channel_snapshot_remote_balance: obj.remoteBalance ? CurrencyAmountToJson(obj.remoteBalance) : void 0,
5231
+ channel_snapshot_remote_unsettled_balance: obj.remoteUnsettledBalance ? CurrencyAmountToJson(obj.remoteUnsettledBalance) : void 0
5232
+ };
5233
+ };
5043
5234
 
5044
5235
  // src/objects/HtlcAttemptFailureCode.ts
5045
5236
  var HtlcAttemptFailureCode = /* @__PURE__ */ ((HtlcAttemptFailureCode2) => {
@@ -5177,7 +5368,7 @@ var OutgoingPaymentAttempt = class {
5177
5368
  this.amount = amount;
5178
5369
  this.fees = fees;
5179
5370
  this.channelSnapshot = channelSnapshot;
5180
- (0, import_auto_bind8.default)(this);
5371
+ (0, import_auto_bind7.default)(this);
5181
5372
  }
5182
5373
  async getHops(client, first = void 0, after = void 0) {
5183
5374
  return await client.executeRawQuery({
@@ -5252,6 +5443,22 @@ ${FRAGMENT15}
5252
5443
  constructObject: (data) => OutgoingPaymentAttemptFromJson(data.entity)
5253
5444
  };
5254
5445
  }
5446
+ toJson() {
5447
+ return {
5448
+ __typename: "OutgoingPaymentAttempt",
5449
+ outgoing_payment_attempt_id: this.id,
5450
+ outgoing_payment_attempt_created_at: this.createdAt,
5451
+ outgoing_payment_attempt_updated_at: this.updatedAt,
5452
+ outgoing_payment_attempt_status: this.status,
5453
+ outgoing_payment_attempt_failure_code: this.failureCode,
5454
+ outgoing_payment_attempt_failure_source_index: this.failureSourceIndex,
5455
+ outgoing_payment_attempt_resolved_at: this.resolvedAt,
5456
+ outgoing_payment_attempt_amount: this.amount ? CurrencyAmountToJson(this.amount) : void 0,
5457
+ outgoing_payment_attempt_fees: this.fees ? CurrencyAmountToJson(this.fees) : void 0,
5458
+ outgoing_payment_attempt_outgoing_payment: { id: this.outgoingPaymentId },
5459
+ outgoing_payment_attempt_channel_snapshot: this.channelSnapshot ? ChannelSnapshotToJson(this.channelSnapshot) : void 0
5460
+ };
5461
+ }
5255
5462
  };
5256
5463
  var OutgoingPaymentAttemptFromJson = (obj) => {
5257
5464
  return new OutgoingPaymentAttempt(
@@ -5402,6 +5609,26 @@ var PaymentRequestDataFromJson = (obj) => {
5402
5609
  `Couldn't find a concrete type for interface PaymentRequestData corresponding to the typename=${obj["__typename"]}`
5403
5610
  );
5404
5611
  };
5612
+ var PaymentRequestDataToJson = (obj) => {
5613
+ if (obj.typename == "InvoiceData") {
5614
+ const invoiceData = obj;
5615
+ return {
5616
+ __typename: "InvoiceData",
5617
+ invoice_data_encoded_payment_request: invoiceData.encodedPaymentRequest,
5618
+ invoice_data_bitcoin_network: invoiceData.bitcoinNetwork,
5619
+ invoice_data_payment_hash: invoiceData.paymentHash,
5620
+ invoice_data_amount: CurrencyAmountToJson(invoiceData.amount),
5621
+ invoice_data_created_at: invoiceData.createdAt,
5622
+ invoice_data_expires_at: invoiceData.expiresAt,
5623
+ invoice_data_memo: invoiceData.memo,
5624
+ invoice_data_destination: NodeToJson(invoiceData.destination)
5625
+ };
5626
+ }
5627
+ throw new import_core3.LightsparkException(
5628
+ "DeserializationError",
5629
+ `Couldn't find a concrete type for interface PaymentRequestData corresponding to the typename=${obj.typename}`
5630
+ );
5631
+ };
5405
5632
 
5406
5633
  // src/objects/RichText.ts
5407
5634
  var RichTextFromJson = (obj) => {
@@ -5409,6 +5636,11 @@ var RichTextFromJson = (obj) => {
5409
5636
  text: obj["rich_text_text"]
5410
5637
  };
5411
5638
  };
5639
+ var RichTextToJson = (obj) => {
5640
+ return {
5641
+ rich_text_text: obj.text
5642
+ };
5643
+ };
5412
5644
 
5413
5645
  // src/objects/OutgoingPayment.ts
5414
5646
  var OutgoingPayment = class {
@@ -5429,7 +5661,7 @@ var OutgoingPayment = class {
5429
5661
  this.failureMessage = failureMessage;
5430
5662
  this.umaPostTransactionData = umaPostTransactionData;
5431
5663
  this.paymentPreimage = paymentPreimage;
5432
- (0, import_auto_bind9.default)(this);
5664
+ (0, import_auto_bind8.default)(this);
5433
5665
  }
5434
5666
  async getAttempts(client, first = void 0, after = void 0) {
5435
5667
  return await client.executeRawQuery({
@@ -5552,6 +5784,26 @@ ${FRAGMENT16}
5552
5784
  constructObject: (data) => OutgoingPaymentFromJson(data.entity)
5553
5785
  };
5554
5786
  }
5787
+ toJson() {
5788
+ return {
5789
+ __typename: "OutgoingPayment",
5790
+ outgoing_payment_id: this.id,
5791
+ outgoing_payment_created_at: this.createdAt,
5792
+ outgoing_payment_updated_at: this.updatedAt,
5793
+ outgoing_payment_status: this.status,
5794
+ outgoing_payment_resolved_at: this.resolvedAt,
5795
+ outgoing_payment_amount: CurrencyAmountToJson(this.amount),
5796
+ outgoing_payment_transaction_hash: this.transactionHash,
5797
+ outgoing_payment_origin: { id: this.originId },
5798
+ outgoing_payment_destination: { id: this.destinationId },
5799
+ outgoing_payment_fees: this.fees ? CurrencyAmountToJson(this.fees) : void 0,
5800
+ outgoing_payment_payment_request_data: this.paymentRequestData ? PaymentRequestDataToJson(this.paymentRequestData) : void 0,
5801
+ outgoing_payment_failure_reason: this.failureReason,
5802
+ outgoing_payment_failure_message: this.failureMessage ? RichTextToJson(this.failureMessage) : void 0,
5803
+ outgoing_payment_uma_post_transaction_data: this.umaPostTransactionData?.map((e) => PostTransactionDataToJson(e)),
5804
+ outgoing_payment_payment_preimage: this.paymentPreimage
5805
+ };
5806
+ }
5555
5807
  };
5556
5808
  var OutgoingPaymentFromJson = (obj) => {
5557
5809
  return new OutgoingPayment(
@@ -6354,7 +6606,7 @@ var PayUmaInvoice = `
6354
6606
  `;
6355
6607
 
6356
6608
  // src/objects/WithdrawalRequest.ts
6357
- var import_auto_bind10 = __toESM(require("auto-bind"), 1);
6609
+ var import_auto_bind9 = __toESM(require("auto-bind"), 1);
6358
6610
 
6359
6611
  // src/objects/WithdrawalMode.ts
6360
6612
  var WithdrawalMode = /* @__PURE__ */ ((WithdrawalMode2) => {
@@ -6552,7 +6804,7 @@ var WithdrawalRequest = class {
6552
6804
  this.estimatedAmount = estimatedAmount;
6553
6805
  this.completedAt = completedAt;
6554
6806
  this.withdrawalId = withdrawalId;
6555
- (0, import_auto_bind10.default)(this);
6807
+ (0, import_auto_bind9.default)(this);
6556
6808
  }
6557
6809
  async getChannelClosingTransactions(client, first = void 0) {
6558
6810
  return await client.executeRawQuery({
@@ -6695,6 +6947,21 @@ ${FRAGMENT20}
6695
6947
  constructObject: (data) => WithdrawalRequestFromJson(data.entity)
6696
6948
  };
6697
6949
  }
6950
+ toJson() {
6951
+ return {
6952
+ __typename: "WithdrawalRequest",
6953
+ withdrawal_request_id: this.id,
6954
+ withdrawal_request_created_at: this.createdAt,
6955
+ withdrawal_request_updated_at: this.updatedAt,
6956
+ withdrawal_request_amount: CurrencyAmountToJson(this.amount),
6957
+ withdrawal_request_estimated_amount: this.estimatedAmount ? CurrencyAmountToJson(this.estimatedAmount) : void 0,
6958
+ withdrawal_request_bitcoin_address: this.bitcoinAddress,
6959
+ withdrawal_request_withdrawal_mode: this.withdrawalMode,
6960
+ withdrawal_request_status: this.status,
6961
+ withdrawal_request_completed_at: this.completedAt,
6962
+ withdrawal_request_withdrawal: { id: this.withdrawalId }
6963
+ };
6964
+ }
6698
6965
  };
6699
6966
  var WithdrawalRequestFromJson = (obj) => {
6700
6967
  return new WithdrawalRequest(
@@ -7881,7 +8148,7 @@ var NodeKeyLoaderCache = class {
7881
8148
  };
7882
8149
 
7883
8150
  // src/objects/Account.ts
7884
- var import_auto_bind14 = __toESM(require("auto-bind"), 1);
8151
+ var import_auto_bind12 = __toESM(require("auto-bind"), 1);
7885
8152
 
7886
8153
  // src/objects/AccountToApiTokensConnection.ts
7887
8154
  var AccountToApiTokensConnectionFromJson = (obj) => {
@@ -7898,12 +8165,20 @@ var AccountToApiTokensConnectionFromJson = (obj) => {
7898
8165
  };
7899
8166
 
7900
8167
  // src/objects/AccountToChannelsConnection.ts
7901
- var import_auto_bind11 = __toESM(require("auto-bind"), 1);
8168
+ var import_auto_bind10 = __toESM(require("auto-bind"), 1);
7902
8169
  var AccountToChannelsConnection = class {
7903
8170
  constructor(count, entities) {
7904
8171
  this.count = count;
7905
8172
  this.entities = entities;
7906
- (0, import_auto_bind11.default)(this);
8173
+ (0, import_auto_bind10.default)(this);
8174
+ }
8175
+ toJson() {
8176
+ return {
8177
+ account_to_channels_connection_count: this.count,
8178
+ account_to_channels_connection_entities: this.entities.map(
8179
+ (e) => e.toJson()
8180
+ )
8181
+ };
7907
8182
  }
7908
8183
  };
7909
8184
  var AccountToChannelsConnectionFromJson = (obj) => {
@@ -7918,201 +8193,6 @@ var AccountToChannelsConnection_default = AccountToChannelsConnection;
7918
8193
 
7919
8194
  // src/objects/LightsparkNode.ts
7920
8195
  var import_core8 = require("@lightsparkdev/core");
7921
- var import_auto_bind12 = __toESM(require("auto-bind"), 1);
7922
- var LightsparkNode = class {
7923
- constructor(id, createdAt, updatedAt, bitcoinNetwork, displayName, ownerId, umaPrescreeningUtxos, typename, alias, color, conductivity, publicKey, status, totalBalance, totalLocalBalance, localBalance, remoteBalance, blockchainBalance, balances) {
7924
- this.id = id;
7925
- this.createdAt = createdAt;
7926
- this.updatedAt = updatedAt;
7927
- this.bitcoinNetwork = bitcoinNetwork;
7928
- this.displayName = displayName;
7929
- this.ownerId = ownerId;
7930
- this.umaPrescreeningUtxos = umaPrescreeningUtxos;
7931
- this.typename = typename;
7932
- this.alias = alias;
7933
- this.color = color;
7934
- this.conductivity = conductivity;
7935
- this.publicKey = publicKey;
7936
- this.status = status;
7937
- this.totalBalance = totalBalance;
7938
- this.totalLocalBalance = totalLocalBalance;
7939
- this.localBalance = localBalance;
7940
- this.remoteBalance = remoteBalance;
7941
- this.blockchainBalance = blockchainBalance;
7942
- this.balances = balances;
7943
- (0, import_auto_bind12.default)(this);
7944
- }
7945
- async getAddresses(client, first = void 0, types = void 0) {
7946
- return await client.executeRawQuery({
7947
- queryPayload: `
7948
- query FetchNodeToAddressesConnection($entity_id: ID!, $first: Int, $types: [NodeAddressType!]) {
7949
- entity(id: $entity_id) {
7950
- ... on LightsparkNode {
7951
- addresses(, first: $first, types: $types) {
7952
- __typename
7953
- node_to_addresses_connection_count: count
7954
- node_to_addresses_connection_entities: entities {
7955
- __typename
7956
- node_address_address: address
7957
- node_address_type: type
7958
- }
7959
- }
7960
- }
7961
- }
7962
- }
7963
- `,
7964
- variables: { entity_id: this.id, first, types },
7965
- constructObject: (json) => {
7966
- const connection = json["entity"]["addresses"];
7967
- return NodeToAddressesConnectionFromJson(connection);
7968
- }
7969
- });
7970
- }
7971
- async getChannels(client, first = void 0, statuses = void 0, after = void 0) {
7972
- return await client.executeRawQuery({
7973
- queryPayload: `
7974
- query FetchLightsparkNodeToChannelsConnection($entity_id: ID!, $first: Int, $statuses: [ChannelStatus!], $after: String) {
7975
- entity(id: $entity_id) {
7976
- ... on LightsparkNode {
7977
- channels(, first: $first, statuses: $statuses, after: $after) {
7978
- __typename
7979
- lightspark_node_to_channels_connection_count: count
7980
- lightspark_node_to_channels_connection_page_info: page_info {
7981
- __typename
7982
- page_info_has_next_page: has_next_page
7983
- page_info_has_previous_page: has_previous_page
7984
- page_info_start_cursor: start_cursor
7985
- page_info_end_cursor: end_cursor
7986
- }
7987
- lightspark_node_to_channels_connection_entities: entities {
7988
- __typename
7989
- channel_id: id
7990
- channel_created_at: created_at
7991
- channel_updated_at: updated_at
7992
- channel_funding_transaction: funding_transaction {
7993
- id
7994
- }
7995
- channel_capacity: capacity {
7996
- __typename
7997
- currency_amount_original_value: original_value
7998
- currency_amount_original_unit: original_unit
7999
- currency_amount_preferred_currency_unit: preferred_currency_unit
8000
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
8001
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
8002
- }
8003
- channel_local_balance: local_balance {
8004
- __typename
8005
- currency_amount_original_value: original_value
8006
- currency_amount_original_unit: original_unit
8007
- currency_amount_preferred_currency_unit: preferred_currency_unit
8008
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
8009
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
8010
- }
8011
- channel_local_unsettled_balance: local_unsettled_balance {
8012
- __typename
8013
- currency_amount_original_value: original_value
8014
- currency_amount_original_unit: original_unit
8015
- currency_amount_preferred_currency_unit: preferred_currency_unit
8016
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
8017
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
8018
- }
8019
- channel_remote_balance: remote_balance {
8020
- __typename
8021
- currency_amount_original_value: original_value
8022
- currency_amount_original_unit: original_unit
8023
- currency_amount_preferred_currency_unit: preferred_currency_unit
8024
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
8025
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
8026
- }
8027
- channel_remote_unsettled_balance: remote_unsettled_balance {
8028
- __typename
8029
- currency_amount_original_value: original_value
8030
- currency_amount_original_unit: original_unit
8031
- currency_amount_preferred_currency_unit: preferred_currency_unit
8032
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
8033
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
8034
- }
8035
- channel_unsettled_balance: unsettled_balance {
8036
- __typename
8037
- currency_amount_original_value: original_value
8038
- currency_amount_original_unit: original_unit
8039
- currency_amount_preferred_currency_unit: preferred_currency_unit
8040
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
8041
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
8042
- }
8043
- channel_total_balance: total_balance {
8044
- __typename
8045
- currency_amount_original_value: original_value
8046
- currency_amount_original_unit: original_unit
8047
- currency_amount_preferred_currency_unit: preferred_currency_unit
8048
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
8049
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
8050
- }
8051
- channel_status: status
8052
- channel_estimated_force_closure_wait_minutes: estimated_force_closure_wait_minutes
8053
- channel_commit_fee: commit_fee {
8054
- __typename
8055
- currency_amount_original_value: original_value
8056
- currency_amount_original_unit: original_unit
8057
- currency_amount_preferred_currency_unit: preferred_currency_unit
8058
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
8059
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
8060
- }
8061
- channel_fees: fees {
8062
- __typename
8063
- channel_fees_base_fee: base_fee {
8064
- __typename
8065
- currency_amount_original_value: original_value
8066
- currency_amount_original_unit: original_unit
8067
- currency_amount_preferred_currency_unit: preferred_currency_unit
8068
- currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
8069
- currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
8070
- }
8071
- channel_fees_fee_rate_per_mil: fee_rate_per_mil
8072
- }
8073
- channel_remote_node: remote_node {
8074
- id
8075
- }
8076
- channel_local_node: local_node {
8077
- id
8078
- }
8079
- channel_short_channel_id: short_channel_id
8080
- }
8081
- }
8082
- }
8083
- }
8084
- }
8085
- `,
8086
- variables: {
8087
- entity_id: this.id,
8088
- first,
8089
- statuses,
8090
- after
8091
- },
8092
- constructObject: (json) => {
8093
- const connection = json["entity"]["channels"];
8094
- return LightsparkNodeToChannelsConnectionFromJson(connection);
8095
- }
8096
- });
8097
- }
8098
- static getLightsparkNodeQuery(id) {
8099
- return {
8100
- queryPayload: `
8101
- query GetLightsparkNode($id: ID!) {
8102
- entity(id: $id) {
8103
- ... on LightsparkNode {
8104
- ...LightsparkNodeFragment
8105
- }
8106
- }
8107
- }
8108
-
8109
- ${FRAGMENT23}
8110
- `,
8111
- variables: { id },
8112
- constructObject: (data) => LightsparkNodeFromJson(data.entity)
8113
- };
8114
- }
8115
- };
8116
8196
  var LightsparkNodeFromJson = (obj) => {
8117
8197
  if (obj["__typename"] == "LightsparkNodeWithOSK") {
8118
8198
  return new LightsparkNodeWithOSK_default(
@@ -8451,7 +8531,23 @@ fragment LightsparkNodeFragment on LightsparkNode {
8451
8531
  }
8452
8532
  }
8453
8533
  }`;
8454
- var LightsparkNode_default = LightsparkNode;
8534
+ var getLightsparkNodeQuery = (id) => {
8535
+ return {
8536
+ queryPayload: `
8537
+ query GetLightsparkNode($id: ID!) {
8538
+ entity(id: $id) {
8539
+ ... on LightsparkNode {
8540
+ ...LightsparkNodeFragment
8541
+ }
8542
+ }
8543
+ }
8544
+
8545
+ ${FRAGMENT23}
8546
+ `,
8547
+ variables: { id },
8548
+ constructObject: (data) => LightsparkNodeFromJson(data.entity)
8549
+ };
8550
+ };
8455
8551
 
8456
8552
  // src/objects/AccountToNodesConnection.ts
8457
8553
  var AccountToNodesConnectionFromJson = (obj) => {
@@ -8503,7 +8599,7 @@ var AccountToTransactionsConnectionFromJson = (obj) => {
8503
8599
  };
8504
8600
 
8505
8601
  // src/objects/Wallet.ts
8506
- var import_auto_bind13 = __toESM(require("auto-bind"), 1);
8602
+ var import_auto_bind11 = __toESM(require("auto-bind"), 1);
8507
8603
 
8508
8604
  // src/objects/WalletStatus.ts
8509
8605
  var WalletStatus = /* @__PURE__ */ ((WalletStatus2) => {
@@ -8561,7 +8657,7 @@ var Wallet = class {
8561
8657
  this.lastLoginAt = lastLoginAt;
8562
8658
  this.balances = balances;
8563
8659
  this.accountId = accountId;
8564
- (0, import_auto_bind13.default)(this);
8660
+ (0, import_auto_bind11.default)(this);
8565
8661
  }
8566
8662
  async getTransactions(client, first = void 0, after = void 0, createdAfterDate = void 0, createdBeforeDate = void 0, statuses = void 0, types = void 0) {
8567
8663
  return await client.executeRawQuery({
@@ -9562,6 +9658,19 @@ ${FRAGMENT24}
9562
9658
  constructObject: (data) => WalletFromJson(data.entity)
9563
9659
  };
9564
9660
  }
9661
+ toJson() {
9662
+ return {
9663
+ __typename: "Wallet",
9664
+ wallet_id: this.id,
9665
+ wallet_created_at: this.createdAt,
9666
+ wallet_updated_at: this.updatedAt,
9667
+ wallet_last_login_at: this.lastLoginAt,
9668
+ wallet_balances: this.balances ? BalancesToJson(this.balances) : void 0,
9669
+ wallet_third_party_identifier: this.thirdPartyIdentifier,
9670
+ wallet_account: { id: this.accountId },
9671
+ wallet_status: this.status
9672
+ };
9673
+ }
9565
9674
  };
9566
9675
  var WalletFromJson = (obj) => {
9567
9676
  return new Wallet(
@@ -9638,7 +9747,7 @@ var Account = class {
9638
9747
  this.updatedAt = updatedAt;
9639
9748
  this.typename = typename;
9640
9749
  this.name = name;
9641
- (0, import_auto_bind14.default)(this);
9750
+ (0, import_auto_bind12.default)(this);
9642
9751
  }
9643
9752
  async getApiTokens(client, first = void 0, after = void 0) {
9644
9753
  return await client.executeRawQuery({
@@ -11287,6 +11396,15 @@ ${FRAGMENT25}
11287
11396
  constructObject: (data) => AccountFromJson(data.current_account)
11288
11397
  };
11289
11398
  }
11399
+ toJson() {
11400
+ return {
11401
+ __typename: "Account",
11402
+ account_id: this.id,
11403
+ account_created_at: this.createdAt,
11404
+ account_updated_at: this.updatedAt,
11405
+ account_name: this.name
11406
+ };
11407
+ }
11290
11408
  };
11291
11409
  var AccountFromJson = (obj) => {
11292
11410
  return new Account(
@@ -11345,7 +11463,7 @@ var LightsparkClient = class {
11345
11463
  serverUrl,
11346
11464
  this.cryptoImpl
11347
11465
  );
11348
- (0, import_auto_bind15.default)(this);
11466
+ (0, import_auto_bind13.default)(this);
11349
11467
  }
11350
11468
  requester;
11351
11469
  nodeKeyCache;
@@ -13410,11 +13528,9 @@ var RemoteSigningWebhookHandler = class {
13410
13528
  IncomingPaymentAttemptStatus,
13411
13529
  InvoiceType,
13412
13530
  LightsparkClient,
13413
- LightsparkNode,
13414
13531
  LightsparkNodeStatus,
13415
13532
  LightsparkNodeWithOSK,
13416
13533
  LightsparkNodeWithRemoteSigning,
13417
- Node,
13418
13534
  NodeAddressType,
13419
13535
  OutgoingPayment,
13420
13536
  OutgoingPaymentAttempt,
@@ -13448,6 +13564,8 @@ var RemoteSigningWebhookHandler = class {
13448
13564
  getInvoiceQuery,
13449
13565
  getLightningTransactionQuery,
13450
13566
  getLightsparkNodeOwnerQuery,
13567
+ getLightsparkNodeQuery,
13568
+ getNodeQuery,
13451
13569
  getOnChainTransactionQuery,
13452
13570
  getPaymentRequestQuery,
13453
13571
  getRoutingTransactionQuery,