@lightsparkdev/lightspark-sdk 1.1.7 → 1.2.1

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 (136) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/{chunk-5RDIWPBE.js → chunk-D32EWIPX.js} +3 -1
  3. package/dist/{chunk-7UT6YX37.js → chunk-VTPDR6P4.js} +393 -275
  4. package/dist/env.cjs +3 -1
  5. package/dist/env.d.cts +17 -0
  6. package/dist/env.js +2 -2
  7. package/dist/{index-d31f4469.d.ts → index-5acc6526.d.ts} +1403 -408
  8. package/dist/index.cjs +424 -296
  9. package/dist/index.d.cts +41 -0
  10. package/dist/index.d.ts +3 -3
  11. package/dist/index.js +32 -27
  12. package/dist/objects/index.cjs +395 -277
  13. package/dist/objects/index.d.cts +4 -0
  14. package/dist/objects/index.d.ts +1 -1
  15. package/dist/objects/index.js +6 -6
  16. package/dist/{text-encoding-MDIPJAHL.js → text-encoding-26SMKBAQ.js} +3 -1
  17. package/package.json +5 -5
  18. package/src/auth/AccountTokenAuthProvider.ts +15 -11
  19. package/src/client.ts +7 -6
  20. package/src/helpers.ts +3 -1
  21. package/src/objects/Account.ts +21 -2
  22. package/src/objects/AccountToApiTokensConnection.ts +16 -5
  23. package/src/objects/AccountToChannelsConnection.ts +14 -0
  24. package/src/objects/AccountToNodesConnection.ts +19 -5
  25. package/src/objects/AccountToPaymentRequestsConnection.ts +21 -5
  26. package/src/objects/AccountToTransactionsConnection.ts +33 -9
  27. package/src/objects/AccountToWalletsConnection.ts +13 -4
  28. package/src/objects/ApiToken.ts +13 -3
  29. package/src/objects/Balances.ts +17 -3
  30. package/src/objects/BlockchainBalance.ts +34 -9
  31. package/src/objects/Channel.ts +92 -16
  32. package/src/objects/ChannelClosingTransaction.ts +81 -61
  33. package/src/objects/ChannelFees.ts +16 -5
  34. package/src/objects/ChannelOpeningTransaction.ts +81 -61
  35. package/src/objects/ChannelSnapshot.ts +32 -8
  36. package/src/objects/ChannelToTransactionsConnection.ts +26 -6
  37. package/src/objects/Connection.ts +205 -10
  38. package/src/objects/CreateApiTokenInput.ts +8 -2
  39. package/src/objects/CreateApiTokenOutput.ts +9 -3
  40. package/src/objects/CreateInvoiceInput.ts +14 -5
  41. package/src/objects/CreateInvoiceOutput.ts +7 -2
  42. package/src/objects/CreateLnurlInvoiceInput.ts +13 -3
  43. package/src/objects/CreateNodeWalletAddressInput.ts +9 -2
  44. package/src/objects/CreateNodeWalletAddressOutput.ts +10 -2
  45. package/src/objects/CreateTestModeInvoiceInput.ts +14 -4
  46. package/src/objects/CreateTestModeInvoiceOutput.ts +10 -2
  47. package/src/objects/CreateTestModePaymentInput.ts +12 -3
  48. package/src/objects/CreateTestModePaymentoutput.ts +12 -2
  49. package/src/objects/CreateUmaInvoiceInput.ts +13 -3
  50. package/src/objects/CurrencyAmount.ts +13 -2
  51. package/src/objects/DeclineToSignMessagesInput.ts +9 -2
  52. package/src/objects/DeclineToSignMessagesOutput.ts +15 -3
  53. package/src/objects/DeleteApiTokenInput.ts +7 -2
  54. package/src/objects/DeleteApiTokenOutput.ts +7 -2
  55. package/src/objects/Deposit.ts +77 -61
  56. package/src/objects/Entity.ts +2 -2
  57. package/src/objects/FeeEstimate.ts +12 -3
  58. package/src/objects/FundNodeInput.ts +9 -3
  59. package/src/objects/FundNodeOutput.ts +11 -3
  60. package/src/objects/GraphNode.ts +49 -5
  61. package/src/objects/Hop.ts +27 -9
  62. package/src/objects/IdAndSignature.ts +8 -2
  63. package/src/objects/IncomingPayment.ts +50 -7
  64. package/src/objects/IncomingPaymentAttempt.ts +21 -5
  65. package/src/objects/IncomingPaymentToAttemptsConnection.ts +21 -5
  66. package/src/objects/Invoice.ts +37 -24
  67. package/src/objects/InvoiceData.ts +21 -6
  68. package/src/objects/LightningFeeEstimateForInvoiceInput.ts +13 -3
  69. package/src/objects/LightningFeeEstimateForNodeInput.ts +12 -2
  70. package/src/objects/LightningFeeEstimateOutput.ts +15 -3
  71. package/src/objects/LightningTransaction.ts +117 -28
  72. package/src/objects/LightsparkNode.ts +250 -210
  73. package/src/objects/LightsparkNodeOwner.ts +35 -4
  74. package/src/objects/LightsparkNodeToChannelsConnection.ts +17 -4
  75. package/src/objects/LightsparkNodeWithOSK.ts +127 -17
  76. package/src/objects/LightsparkNodeWithRemoteSigning.ts +122 -15
  77. package/src/objects/Node.ts +209 -68
  78. package/src/objects/NodeAddress.ts +8 -2
  79. package/src/objects/NodeToAddressesConnection.ts +13 -3
  80. package/src/objects/OnChainTransaction.ts +156 -44
  81. package/src/objects/OutgoingPayment.ts +72 -14
  82. package/src/objects/OutgoingPaymentAttempt.ts +63 -8
  83. package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +18 -5
  84. package/src/objects/OutgoingPaymentToAttemptsConnection.ts +17 -4
  85. package/src/objects/OutgoingPaymentsForInvoiceQueryInput.ts +12 -3
  86. package/src/objects/OutgoingPaymentsForInvoiceQueryOutput.ts +11 -2
  87. package/src/objects/PageInfo.ts +14 -6
  88. package/src/objects/PayInvoiceInput.ts +12 -3
  89. package/src/objects/PayInvoiceOutput.ts +7 -2
  90. package/src/objects/PayUmaInvoiceInput.ts +12 -3
  91. package/src/objects/PaymentRequest.ts +27 -5
  92. package/src/objects/PaymentRequestData.ts +27 -4
  93. package/src/objects/PostTransactionData.ts +12 -3
  94. package/src/objects/RegisterPaymentInput.ts +10 -2
  95. package/src/objects/RegisterPaymentOutput.ts +9 -2
  96. package/src/objects/ReleaseChannelPerCommitmentSecretInput.ts +13 -2
  97. package/src/objects/ReleaseChannelPerCommitmentSecretOutput.ts +9 -2
  98. package/src/objects/ReleasePaymentPreimageInput.ts +10 -2
  99. package/src/objects/ReleasePaymentPreimageOutput.ts +9 -2
  100. package/src/objects/RequestWithdrawalInput.ts +12 -2
  101. package/src/objects/RequestWithdrawalOutput.ts +9 -2
  102. package/src/objects/RichText.ts +7 -2
  103. package/src/objects/RoutingTransaction.ts +62 -41
  104. package/src/objects/ScreenNodeInput.ts +8 -2
  105. package/src/objects/ScreenNodeOutput.ts +7 -2
  106. package/src/objects/Secret.ts +8 -2
  107. package/src/objects/SendPaymentInput.ts +11 -2
  108. package/src/objects/SendPaymentOutput.ts +7 -2
  109. package/src/objects/SetInvoicePaymentHashInput.ts +12 -3
  110. package/src/objects/SetInvoicePaymentHashOutput.ts +9 -2
  111. package/src/objects/SignInvoiceInput.ts +9 -2
  112. package/src/objects/SignInvoiceOutput.ts +7 -2
  113. package/src/objects/SignMessagesInput.ts +13 -3
  114. package/src/objects/SignMessagesOutput.ts +13 -3
  115. package/src/objects/Signable.ts +10 -3
  116. package/src/objects/SignablePayload.ts +18 -5
  117. package/src/objects/Transaction.ts +206 -9
  118. package/src/objects/TransactionFailures.ts +11 -4
  119. package/src/objects/UpdateChannelPerCommitmentPointInput.ts +13 -2
  120. package/src/objects/UpdateChannelPerCommitmentPointOutput.ts +9 -2
  121. package/src/objects/UpdateNodeSharedSecretInput.ts +10 -2
  122. package/src/objects/UpdateNodeSharedSecretOutput.ts +9 -2
  123. package/src/objects/Wallet.ts +34 -5
  124. package/src/objects/WalletToPaymentRequestsConnection.ts +21 -5
  125. package/src/objects/WalletToTransactionsConnection.ts +16 -5
  126. package/src/objects/Withdrawal.ts +77 -61
  127. package/src/objects/WithdrawalRequest.ts +42 -4
  128. package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +19 -4
  129. package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +19 -4
  130. package/src/objects/index.ts +5 -2
  131. package/src/tests/integration/constants.ts +13 -0
  132. package/src/tests/integration/general-regtest.test.ts +652 -0
  133. package/src/tests/serialization.test.ts +21 -0
  134. package/src/webhooks.ts +1 -1
  135. package/src/tests/integration/client.test.ts +0 -207
  136. /package/dist/{chunk-NIMBE7W3.js → chunk-BMTV3EA2.js} +0 -0
package/dist/index.cjs CHANGED
@@ -33,6 +33,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
33
33
  // ../../node_modules/text-encoding/lib/encoding-indexes.js
34
34
  var require_encoding_indexes = __commonJS({
35
35
  "../../node_modules/text-encoding/lib/encoding-indexes.js"(exports, module2) {
36
+ "use strict";
36
37
  (function(global) {
37
38
  "use strict";
38
39
  if (typeof module2 !== "undefined" && module2.exports) {
@@ -80,6 +81,7 @@ var require_encoding_indexes = __commonJS({
80
81
  // ../../node_modules/text-encoding/lib/encoding.js
81
82
  var require_encoding = __commonJS({
82
83
  "../../node_modules/text-encoding/lib/encoding.js"(exports, module2) {
84
+ "use strict";
83
85
  (function(global) {
84
86
  "use strict";
85
87
  if (typeof module2 !== "undefined" && module2.exports && !global["encoding-indexes"]) {
@@ -1826,6 +1828,7 @@ var require_encoding = __commonJS({
1826
1828
  // ../../node_modules/text-encoding/index.js
1827
1829
  var require_text_encoding = __commonJS({
1828
1830
  "../../node_modules/text-encoding/index.js"(exports, module2) {
1831
+ "use strict";
1829
1832
  var encoding = require_encoding();
1830
1833
  module2.exports = {
1831
1834
  TextEncoder: encoding.TextEncoder,
@@ -1851,11 +1854,9 @@ __export(src_exports, {
1851
1854
  IncomingPaymentAttemptStatus: () => IncomingPaymentAttemptStatus_default,
1852
1855
  InvoiceType: () => InvoiceType_default,
1853
1856
  LightsparkClient: () => client_default,
1854
- LightsparkNode: () => LightsparkNode_default,
1855
1857
  LightsparkNodeStatus: () => LightsparkNodeStatus_default,
1856
1858
  LightsparkNodeWithOSK: () => LightsparkNodeWithOSK_default,
1857
1859
  LightsparkNodeWithRemoteSigning: () => LightsparkNodeWithRemoteSigning_default,
1858
- Node: () => Node_default,
1859
1860
  NodeAddressType: () => NodeAddressType_default,
1860
1861
  OutgoingPayment: () => OutgoingPayment_default,
1861
1862
  OutgoingPaymentAttempt: () => OutgoingPaymentAttempt_default,
@@ -1889,6 +1890,8 @@ __export(src_exports, {
1889
1890
  getInvoiceQuery: () => getInvoiceQuery,
1890
1891
  getLightningTransactionQuery: () => getLightningTransactionQuery,
1891
1892
  getLightsparkNodeOwnerQuery: () => getLightsparkNodeOwnerQuery,
1893
+ getLightsparkNodeQuery: () => getLightsparkNodeQuery,
1894
+ getNodeQuery: () => getNodeQuery,
1892
1895
  getOnChainTransactionQuery: () => getOnChainTransactionQuery,
1893
1896
  getPaymentRequestQuery: () => getPaymentRequestQuery,
1894
1897
  getRoutingTransactionQuery: () => getRoutingTransactionQuery,
@@ -1914,31 +1917,35 @@ var AccountTokenAuthProvider = class {
1914
1917
  (0, import_auto_bind.default)(this);
1915
1918
  }
1916
1919
  utf8AuthBytes;
1917
- async addWsConnectionParams(params) {
1918
- return Object.assign({}, params, {
1919
- client_id: this.apiTokenClientId,
1920
- client_secret: this.apiTokenClientSecret
1921
- });
1920
+ addWsConnectionParams(params) {
1921
+ return Promise.resolve(
1922
+ Object.assign({}, params, {
1923
+ client_id: this.apiTokenClientId,
1924
+ client_secret: this.apiTokenClientSecret
1925
+ })
1926
+ );
1922
1927
  }
1923
- async addAuthHeaders(headers) {
1924
- return Object.assign({}, headers, {
1925
- authorization: `Basic ${(0, import_core.b64encode)(this.utf8AuthBytes)}`
1926
- });
1928
+ addAuthHeaders(headers) {
1929
+ return Promise.resolve(
1930
+ Object.assign({}, headers, {
1931
+ authorization: `Basic ${(0, import_core.b64encode)(this.utf8AuthBytes)}`
1932
+ })
1933
+ );
1927
1934
  }
1928
- async isAuthorized() {
1929
- return true;
1935
+ isAuthorized() {
1936
+ return Promise.resolve(true);
1930
1937
  }
1931
1938
  };
1932
1939
  var AccountTokenAuthProvider_default = AccountTokenAuthProvider;
1933
1940
 
1934
1941
  // src/client.ts
1935
- var import_auto_bind15 = __toESM(require("auto-bind"), 1);
1942
+ var import_auto_bind13 = __toESM(require("auto-bind"), 1);
1936
1943
  var import_core9 = require("@lightsparkdev/core");
1937
1944
 
1938
1945
  // package.json
1939
1946
  var package_default = {
1940
1947
  name: "@lightsparkdev/lightspark-sdk",
1941
- version: "1.1.7",
1948
+ version: "1.2.1",
1942
1949
  description: "Lightspark JS SDK",
1943
1950
  author: "Lightspark Inc.",
1944
1951
  keywords: [
@@ -2026,7 +2033,7 @@ var package_default = {
2026
2033
  },
2027
2034
  license: "Apache-2.0",
2028
2035
  dependencies: {
2029
- "@lightsparkdev/core": "1.0.9",
2036
+ "@lightsparkdev/core": "1.0.10",
2030
2037
  "@lightsparkdev/crypto-wasm": "0.1.2",
2031
2038
  "auto-bind": "^5.0.1",
2032
2039
  "crypto-browserify": "^3.12.0",
@@ -2047,11 +2054,11 @@ var package_default = {
2047
2054
  eslint: "^8.3.0",
2048
2055
  "eslint-watch": "^8.0.0",
2049
2056
  jest: "^29.6.2",
2050
- prettier: "3.0.2",
2051
- "prettier-plugin-organize-imports": "^3.2.2",
2057
+ prettier: "3.0.3",
2058
+ "prettier-plugin-organize-imports": "^3.2.4",
2052
2059
  "ts-jest": "^29.1.1",
2053
2060
  "tsc-absolute": "^1.0.1",
2054
- tsup: "^6.7.0",
2061
+ tsup: "^7.2.0",
2055
2062
  typedoc: "^0.24.7",
2056
2063
  typescript: "^4.9.5"
2057
2064
  }
@@ -2081,6 +2088,15 @@ var CurrencyAmountFromJson = (obj) => {
2081
2088
  preferredCurrencyValueApprox: obj["currency_amount_preferred_currency_value_approx"]
2082
2089
  };
2083
2090
  };
2091
+ var CurrencyAmountToJson = (obj) => {
2092
+ return {
2093
+ currency_amount_original_value: obj.originalValue,
2094
+ currency_amount_original_unit: obj.originalUnit,
2095
+ currency_amount_preferred_currency_unit: obj.preferredCurrencyUnit,
2096
+ currency_amount_preferred_currency_value_rounded: obj.preferredCurrencyValueRounded,
2097
+ currency_amount_preferred_currency_value_approx: obj.preferredCurrencyValueApprox
2098
+ };
2099
+ };
2084
2100
  var FRAGMENT = `
2085
2101
  fragment CurrencyAmountFragment on CurrencyAmount {
2086
2102
  __typename
@@ -2243,7 +2259,6 @@ var BitcoinNetwork_default = BitcoinNetwork;
2243
2259
 
2244
2260
  // src/objects/Node.ts
2245
2261
  var import_core2 = require("@lightsparkdev/core");
2246
- var import_auto_bind6 = __toESM(require("auto-bind"), 1);
2247
2262
 
2248
2263
  // src/objects/Balances.ts
2249
2264
  var BalancesFromJson = (obj) => {
@@ -2257,6 +2272,17 @@ var BalancesFromJson = (obj) => {
2257
2272
  )
2258
2273
  };
2259
2274
  };
2275
+ var BalancesToJson = (obj) => {
2276
+ return {
2277
+ balances_owned_balance: CurrencyAmountToJson(obj.ownedBalance),
2278
+ balances_available_to_send_balance: CurrencyAmountToJson(
2279
+ obj.availableToSendBalance
2280
+ ),
2281
+ balances_available_to_withdraw_balance: CurrencyAmountToJson(
2282
+ obj.availableToWithdrawBalance
2283
+ )
2284
+ };
2285
+ };
2260
2286
 
2261
2287
  // src/objects/BlockchainBalance.ts
2262
2288
  var BlockchainBalanceFromJson = (obj) => {
@@ -2269,6 +2295,16 @@ var BlockchainBalanceFromJson = (obj) => {
2269
2295
  availableBalance: !!obj["blockchain_balance_available_balance"] ? CurrencyAmountFromJson(obj["blockchain_balance_available_balance"]) : void 0
2270
2296
  };
2271
2297
  };
2298
+ var BlockchainBalanceToJson = (obj) => {
2299
+ return {
2300
+ blockchain_balance_total_balance: obj.totalBalance ? CurrencyAmountToJson(obj.totalBalance) : void 0,
2301
+ blockchain_balance_confirmed_balance: obj.confirmedBalance ? CurrencyAmountToJson(obj.confirmedBalance) : void 0,
2302
+ blockchain_balance_unconfirmed_balance: obj.unconfirmedBalance ? CurrencyAmountToJson(obj.unconfirmedBalance) : void 0,
2303
+ blockchain_balance_locked_balance: obj.lockedBalance ? CurrencyAmountToJson(obj.lockedBalance) : void 0,
2304
+ blockchain_balance_required_reserve: obj.requiredReserve ? CurrencyAmountToJson(obj.requiredReserve) : void 0,
2305
+ blockchain_balance_available_balance: obj.availableBalance ? CurrencyAmountToJson(obj.availableBalance) : void 0
2306
+ };
2307
+ };
2272
2308
 
2273
2309
  // src/objects/GraphNode.ts
2274
2310
  var import_auto_bind2 = __toESM(require("auto-bind"), 1);
@@ -2359,6 +2395,20 @@ ${FRAGMENT4}
2359
2395
  constructObject: (data) => GraphNodeFromJson(data.entity)
2360
2396
  };
2361
2397
  }
2398
+ toJson() {
2399
+ return {
2400
+ __typename: "GraphNode",
2401
+ graph_node_id: this.id,
2402
+ graph_node_created_at: this.createdAt,
2403
+ graph_node_updated_at: this.updatedAt,
2404
+ graph_node_alias: this.alias,
2405
+ graph_node_bitcoin_network: this.bitcoinNetwork,
2406
+ graph_node_color: this.color,
2407
+ graph_node_conductivity: this.conductivity,
2408
+ graph_node_display_name: this.displayName,
2409
+ graph_node_public_key: this.publicKey
2410
+ };
2411
+ }
2362
2412
  };
2363
2413
  var GraphNodeFromJson = (obj) => {
2364
2414
  return new GraphNode(
@@ -2419,6 +2469,12 @@ var ChannelFeesFromJson = (obj) => {
2419
2469
  feeRatePerMil: obj["channel_fees_fee_rate_per_mil"]
2420
2470
  };
2421
2471
  };
2472
+ var ChannelFeesToJson = (obj) => {
2473
+ return {
2474
+ channel_fees_base_fee: obj.baseFee ? CurrencyAmountToJson(obj.baseFee) : void 0,
2475
+ channel_fees_fee_rate_per_mil: obj.feeRatePerMil
2476
+ };
2477
+ };
2422
2478
 
2423
2479
  // src/objects/ChannelStatus.ts
2424
2480
  var ChannelStatus = /* @__PURE__ */ ((ChannelStatus2) => {
@@ -2563,6 +2619,29 @@ ${FRAGMENT5}
2563
2619
  constructObject: (data) => ChannelFromJson(data.entity)
2564
2620
  };
2565
2621
  }
2622
+ toJson() {
2623
+ return {
2624
+ __typename: "Channel",
2625
+ channel_id: this.id,
2626
+ channel_created_at: this.createdAt,
2627
+ channel_updated_at: this.updatedAt,
2628
+ channel_funding_transaction: { id: this.fundingTransactionId },
2629
+ channel_capacity: this.capacity ? CurrencyAmountToJson(this.capacity) : void 0,
2630
+ channel_local_balance: this.localBalance ? CurrencyAmountToJson(this.localBalance) : void 0,
2631
+ channel_local_unsettled_balance: this.localUnsettledBalance ? CurrencyAmountToJson(this.localUnsettledBalance) : void 0,
2632
+ channel_remote_balance: this.remoteBalance ? CurrencyAmountToJson(this.remoteBalance) : void 0,
2633
+ channel_remote_unsettled_balance: this.remoteUnsettledBalance ? CurrencyAmountToJson(this.remoteUnsettledBalance) : void 0,
2634
+ channel_unsettled_balance: this.unsettledBalance ? CurrencyAmountToJson(this.unsettledBalance) : void 0,
2635
+ channel_total_balance: this.totalBalance ? CurrencyAmountToJson(this.totalBalance) : void 0,
2636
+ channel_status: this.status,
2637
+ channel_estimated_force_closure_wait_minutes: this.estimatedForceClosureWaitMinutes,
2638
+ channel_commit_fee: this.commitFee ? CurrencyAmountToJson(this.commitFee) : void 0,
2639
+ channel_fees: this.fees ? ChannelFeesToJson(this.fees) : void 0,
2640
+ channel_remote_node: { id: this.remoteNodeId },
2641
+ channel_local_node: { id: this.localNodeId },
2642
+ channel_short_channel_id: this.shortChannelId
2643
+ };
2644
+ }
2566
2645
  };
2567
2646
  var ChannelFromJson = (obj) => {
2568
2647
  return new Channel(
@@ -2715,6 +2794,12 @@ var SecretFromJson = (obj) => {
2715
2794
  cipher: obj["secret_cipher"]
2716
2795
  };
2717
2796
  };
2797
+ var SecretToJson = (obj) => {
2798
+ return {
2799
+ secret_encrypted_value: obj.encryptedValue,
2800
+ secret_cipher: obj.cipher
2801
+ };
2802
+ };
2718
2803
 
2719
2804
  // src/objects/LightsparkNodeWithOSK.ts
2720
2805
  var LightsparkNodeWithOSK = class {
@@ -2911,6 +2996,30 @@ ${FRAGMENT6}
2911
2996
  constructObject: (data) => LightsparkNodeWithOSKFromJson(data.entity)
2912
2997
  };
2913
2998
  }
2999
+ toJson() {
3000
+ return {
3001
+ __typename: "LightsparkNodeWithOSK",
3002
+ lightspark_node_with_o_s_k_id: this.id,
3003
+ lightspark_node_with_o_s_k_created_at: this.createdAt,
3004
+ lightspark_node_with_o_s_k_updated_at: this.updatedAt,
3005
+ lightspark_node_with_o_s_k_alias: this.alias,
3006
+ lightspark_node_with_o_s_k_bitcoin_network: this.bitcoinNetwork,
3007
+ lightspark_node_with_o_s_k_color: this.color,
3008
+ lightspark_node_with_o_s_k_conductivity: this.conductivity,
3009
+ lightspark_node_with_o_s_k_display_name: this.displayName,
3010
+ lightspark_node_with_o_s_k_public_key: this.publicKey,
3011
+ lightspark_node_with_o_s_k_owner: { id: this.ownerId },
3012
+ lightspark_node_with_o_s_k_status: this.status,
3013
+ lightspark_node_with_o_s_k_total_balance: this.totalBalance ? CurrencyAmountToJson(this.totalBalance) : void 0,
3014
+ lightspark_node_with_o_s_k_total_local_balance: this.totalLocalBalance ? CurrencyAmountToJson(this.totalLocalBalance) : void 0,
3015
+ lightspark_node_with_o_s_k_local_balance: this.localBalance ? CurrencyAmountToJson(this.localBalance) : void 0,
3016
+ lightspark_node_with_o_s_k_remote_balance: this.remoteBalance ? CurrencyAmountToJson(this.remoteBalance) : void 0,
3017
+ lightspark_node_with_o_s_k_blockchain_balance: this.blockchainBalance ? BlockchainBalanceToJson(this.blockchainBalance) : void 0,
3018
+ lightspark_node_with_o_s_k_uma_prescreening_utxos: this.umaPrescreeningUtxos,
3019
+ lightspark_node_with_o_s_k_balances: this.balances ? BalancesToJson(this.balances) : void 0,
3020
+ lightspark_node_with_o_s_k_encrypted_signing_private_key: this.encryptedSigningPrivateKey ? SecretToJson(this.encryptedSigningPrivateKey) : void 0
3021
+ };
3022
+ }
2914
3023
  };
2915
3024
  var LightsparkNodeWithOSKFromJson = (obj) => {
2916
3025
  return new LightsparkNodeWithOSK(
@@ -3272,6 +3381,29 @@ ${FRAGMENT7}
3272
3381
  constructObject: (data) => LightsparkNodeWithRemoteSigningFromJson(data.entity)
3273
3382
  };
3274
3383
  }
3384
+ toJson() {
3385
+ return {
3386
+ __typename: "LightsparkNodeWithRemoteSigning",
3387
+ lightspark_node_with_remote_signing_id: this.id,
3388
+ lightspark_node_with_remote_signing_created_at: this.createdAt,
3389
+ lightspark_node_with_remote_signing_updated_at: this.updatedAt,
3390
+ lightspark_node_with_remote_signing_alias: this.alias,
3391
+ lightspark_node_with_remote_signing_bitcoin_network: this.bitcoinNetwork,
3392
+ lightspark_node_with_remote_signing_color: this.color,
3393
+ lightspark_node_with_remote_signing_conductivity: this.conductivity,
3394
+ lightspark_node_with_remote_signing_display_name: this.displayName,
3395
+ lightspark_node_with_remote_signing_public_key: this.publicKey,
3396
+ lightspark_node_with_remote_signing_owner: { id: this.ownerId },
3397
+ lightspark_node_with_remote_signing_status: this.status,
3398
+ lightspark_node_with_remote_signing_total_balance: this.totalBalance ? CurrencyAmountToJson(this.totalBalance) : void 0,
3399
+ lightspark_node_with_remote_signing_total_local_balance: this.totalLocalBalance ? CurrencyAmountToJson(this.totalLocalBalance) : void 0,
3400
+ lightspark_node_with_remote_signing_local_balance: this.localBalance ? CurrencyAmountToJson(this.localBalance) : void 0,
3401
+ lightspark_node_with_remote_signing_remote_balance: this.remoteBalance ? CurrencyAmountToJson(this.remoteBalance) : void 0,
3402
+ lightspark_node_with_remote_signing_blockchain_balance: this.blockchainBalance ? BlockchainBalanceToJson(this.blockchainBalance) : void 0,
3403
+ lightspark_node_with_remote_signing_uma_prescreening_utxos: this.umaPrescreeningUtxos,
3404
+ lightspark_node_with_remote_signing_balances: this.balances ? BalancesToJson(this.balances) : void 0
3405
+ };
3406
+ }
3275
3407
  };
3276
3408
  var LightsparkNodeWithRemoteSigningFromJson = (obj) => {
3277
3409
  return new LightsparkNodeWithRemoteSigning(
@@ -3437,64 +3569,6 @@ fragment LightsparkNodeWithRemoteSigningFragment on LightsparkNodeWithRemoteSign
3437
3569
  var LightsparkNodeWithRemoteSigning_default = LightsparkNodeWithRemoteSigning;
3438
3570
 
3439
3571
  // 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
3572
  var NodeFromJson = (obj) => {
3499
3573
  if (obj["__typename"] == "GraphNode") {
3500
3574
  return new GraphNode_default(
@@ -3584,6 +3658,82 @@ var NodeFromJson = (obj) => {
3584
3658
  `Couldn't find a concrete type for interface Node corresponding to the typename=${obj["__typename"]}`
3585
3659
  );
3586
3660
  };
3661
+ var NodeToJson = (obj) => {
3662
+ if (obj.typename == "GraphNode") {
3663
+ const graphNode = obj;
3664
+ return {
3665
+ __typename: "GraphNode",
3666
+ graph_node_id: graphNode.id,
3667
+ graph_node_created_at: graphNode.createdAt,
3668
+ graph_node_updated_at: graphNode.updatedAt,
3669
+ graph_node_alias: graphNode.alias,
3670
+ graph_node_bitcoin_network: graphNode.bitcoinNetwork,
3671
+ graph_node_color: graphNode.color,
3672
+ graph_node_conductivity: graphNode.conductivity,
3673
+ graph_node_display_name: graphNode.displayName,
3674
+ graph_node_public_key: graphNode.publicKey
3675
+ };
3676
+ }
3677
+ if (obj.typename == "LightsparkNodeWithOSK") {
3678
+ const lightsparkNodeWithOSK = obj;
3679
+ return {
3680
+ __typename: "LightsparkNodeWithOSK",
3681
+ lightspark_node_with_o_s_k_id: lightsparkNodeWithOSK.id,
3682
+ lightspark_node_with_o_s_k_created_at: lightsparkNodeWithOSK.createdAt,
3683
+ lightspark_node_with_o_s_k_updated_at: lightsparkNodeWithOSK.updatedAt,
3684
+ lightspark_node_with_o_s_k_alias: lightsparkNodeWithOSK.alias,
3685
+ lightspark_node_with_o_s_k_bitcoin_network: lightsparkNodeWithOSK.bitcoinNetwork,
3686
+ lightspark_node_with_o_s_k_color: lightsparkNodeWithOSK.color,
3687
+ lightspark_node_with_o_s_k_conductivity: lightsparkNodeWithOSK.conductivity,
3688
+ lightspark_node_with_o_s_k_display_name: lightsparkNodeWithOSK.displayName,
3689
+ lightspark_node_with_o_s_k_public_key: lightsparkNodeWithOSK.publicKey,
3690
+ lightspark_node_with_o_s_k_owner: { id: lightsparkNodeWithOSK.ownerId },
3691
+ lightspark_node_with_o_s_k_status: lightsparkNodeWithOSK.status,
3692
+ lightspark_node_with_o_s_k_total_balance: lightsparkNodeWithOSK.totalBalance ? CurrencyAmountToJson(lightsparkNodeWithOSK.totalBalance) : void 0,
3693
+ lightspark_node_with_o_s_k_total_local_balance: lightsparkNodeWithOSK.totalLocalBalance ? CurrencyAmountToJson(lightsparkNodeWithOSK.totalLocalBalance) : void 0,
3694
+ lightspark_node_with_o_s_k_local_balance: lightsparkNodeWithOSK.localBalance ? CurrencyAmountToJson(lightsparkNodeWithOSK.localBalance) : void 0,
3695
+ lightspark_node_with_o_s_k_remote_balance: lightsparkNodeWithOSK.remoteBalance ? CurrencyAmountToJson(lightsparkNodeWithOSK.remoteBalance) : void 0,
3696
+ lightspark_node_with_o_s_k_blockchain_balance: lightsparkNodeWithOSK.blockchainBalance ? BlockchainBalanceToJson(lightsparkNodeWithOSK.blockchainBalance) : void 0,
3697
+ lightspark_node_with_o_s_k_uma_prescreening_utxos: lightsparkNodeWithOSK.umaPrescreeningUtxos,
3698
+ lightspark_node_with_o_s_k_balances: lightsparkNodeWithOSK.balances ? BalancesToJson(lightsparkNodeWithOSK.balances) : void 0,
3699
+ lightspark_node_with_o_s_k_encrypted_signing_private_key: lightsparkNodeWithOSK.encryptedSigningPrivateKey ? SecretToJson(lightsparkNodeWithOSK.encryptedSigningPrivateKey) : void 0
3700
+ };
3701
+ }
3702
+ if (obj.typename == "LightsparkNodeWithRemoteSigning") {
3703
+ const lightsparkNodeWithRemoteSigning = obj;
3704
+ return {
3705
+ __typename: "LightsparkNodeWithRemoteSigning",
3706
+ lightspark_node_with_remote_signing_id: lightsparkNodeWithRemoteSigning.id,
3707
+ lightspark_node_with_remote_signing_created_at: lightsparkNodeWithRemoteSigning.createdAt,
3708
+ lightspark_node_with_remote_signing_updated_at: lightsparkNodeWithRemoteSigning.updatedAt,
3709
+ lightspark_node_with_remote_signing_alias: lightsparkNodeWithRemoteSigning.alias,
3710
+ lightspark_node_with_remote_signing_bitcoin_network: lightsparkNodeWithRemoteSigning.bitcoinNetwork,
3711
+ lightspark_node_with_remote_signing_color: lightsparkNodeWithRemoteSigning.color,
3712
+ lightspark_node_with_remote_signing_conductivity: lightsparkNodeWithRemoteSigning.conductivity,
3713
+ lightspark_node_with_remote_signing_display_name: lightsparkNodeWithRemoteSigning.displayName,
3714
+ lightspark_node_with_remote_signing_public_key: lightsparkNodeWithRemoteSigning.publicKey,
3715
+ lightspark_node_with_remote_signing_owner: {
3716
+ id: lightsparkNodeWithRemoteSigning.ownerId
3717
+ },
3718
+ lightspark_node_with_remote_signing_status: lightsparkNodeWithRemoteSigning.status,
3719
+ lightspark_node_with_remote_signing_total_balance: lightsparkNodeWithRemoteSigning.totalBalance ? CurrencyAmountToJson(lightsparkNodeWithRemoteSigning.totalBalance) : void 0,
3720
+ lightspark_node_with_remote_signing_total_local_balance: lightsparkNodeWithRemoteSigning.totalLocalBalance ? CurrencyAmountToJson(
3721
+ lightsparkNodeWithRemoteSigning.totalLocalBalance
3722
+ ) : void 0,
3723
+ lightspark_node_with_remote_signing_local_balance: lightsparkNodeWithRemoteSigning.localBalance ? CurrencyAmountToJson(lightsparkNodeWithRemoteSigning.localBalance) : void 0,
3724
+ lightspark_node_with_remote_signing_remote_balance: lightsparkNodeWithRemoteSigning.remoteBalance ? CurrencyAmountToJson(lightsparkNodeWithRemoteSigning.remoteBalance) : void 0,
3725
+ lightspark_node_with_remote_signing_blockchain_balance: lightsparkNodeWithRemoteSigning.blockchainBalance ? BlockchainBalanceToJson(
3726
+ lightsparkNodeWithRemoteSigning.blockchainBalance
3727
+ ) : void 0,
3728
+ lightspark_node_with_remote_signing_uma_prescreening_utxos: lightsparkNodeWithRemoteSigning.umaPrescreeningUtxos,
3729
+ lightspark_node_with_remote_signing_balances: lightsparkNodeWithRemoteSigning.balances ? BalancesToJson(lightsparkNodeWithRemoteSigning.balances) : void 0
3730
+ };
3731
+ }
3732
+ throw new import_core2.LightsparkException(
3733
+ "DeserializationError",
3734
+ `Couldn't find a concrete type for interface Node corresponding to the typename=${obj.typename}`
3735
+ );
3736
+ };
3587
3737
  var FRAGMENT8 = `
3588
3738
  fragment NodeFragment on Node {
3589
3739
  __typename
@@ -3859,7 +4009,23 @@ fragment NodeFragment on Node {
3859
4009
  }
3860
4010
  }
3861
4011
  }`;
3862
- var Node_default = Node;
4012
+ var getNodeQuery = (id) => {
4013
+ return {
4014
+ queryPayload: `
4015
+ query GetNode($id: ID!) {
4016
+ entity(id: $id) {
4017
+ ... on Node {
4018
+ ...NodeFragment
4019
+ }
4020
+ }
4021
+ }
4022
+
4023
+ ${FRAGMENT8}
4024
+ `,
4025
+ variables: { id },
4026
+ constructObject: (data) => NodeFromJson(data.entity)
4027
+ };
4028
+ };
3863
4029
 
3864
4030
  // src/objects/InvoiceData.ts
3865
4031
  var InvoiceDataFromJson = (obj) => {
@@ -4569,7 +4735,7 @@ mutation CreateTestModeInvoice(
4569
4735
  `;
4570
4736
 
4571
4737
  // src/objects/IncomingPayment.ts
4572
- var import_auto_bind7 = __toESM(require("auto-bind"), 1);
4738
+ var import_auto_bind6 = __toESM(require("auto-bind"), 1);
4573
4739
 
4574
4740
  // src/objects/IncomingPaymentAttemptStatus.ts
4575
4741
  var IncomingPaymentAttemptStatus = /* @__PURE__ */ ((IncomingPaymentAttemptStatus2) => {
@@ -4654,6 +4820,12 @@ var PostTransactionDataFromJson = (obj) => {
4654
4820
  amount: CurrencyAmountFromJson(obj["post_transaction_data_amount"])
4655
4821
  };
4656
4822
  };
4823
+ var PostTransactionDataToJson = (obj) => {
4824
+ return {
4825
+ post_transaction_data_utxo: obj.utxo,
4826
+ post_transaction_data_amount: CurrencyAmountToJson(obj.amount)
4827
+ };
4828
+ };
4657
4829
 
4658
4830
  // src/objects/TransactionStatus.ts
4659
4831
  var TransactionStatus = /* @__PURE__ */ ((TransactionStatus2) => {
@@ -4682,7 +4854,7 @@ var IncomingPayment = class {
4682
4854
  this.transactionHash = transactionHash;
4683
4855
  this.paymentRequestId = paymentRequestId;
4684
4856
  this.umaPostTransactionData = umaPostTransactionData;
4685
- (0, import_auto_bind7.default)(this);
4857
+ (0, import_auto_bind6.default)(this);
4686
4858
  }
4687
4859
  async getAttempts(client, first = void 0, statuses = void 0, after = void 0) {
4688
4860
  return await client.executeRawQuery({
@@ -4753,6 +4925,21 @@ ${FRAGMENT12}
4753
4925
  constructObject: (data) => IncomingPaymentFromJson(data.entity)
4754
4926
  };
4755
4927
  }
4928
+ toJson() {
4929
+ return {
4930
+ __typename: "IncomingPayment",
4931
+ incoming_payment_id: this.id,
4932
+ incoming_payment_created_at: this.createdAt,
4933
+ incoming_payment_updated_at: this.updatedAt,
4934
+ incoming_payment_status: this.status,
4935
+ incoming_payment_resolved_at: this.resolvedAt,
4936
+ incoming_payment_amount: CurrencyAmountToJson(this.amount),
4937
+ incoming_payment_transaction_hash: this.transactionHash,
4938
+ incoming_payment_destination: { id: this.destinationId },
4939
+ incoming_payment_payment_request: { id: this.paymentRequestId },
4940
+ incoming_payment_uma_post_transaction_data: this.umaPostTransactionData?.map((e) => PostTransactionDataToJson(e))
4941
+ };
4942
+ }
4756
4943
  };
4757
4944
  var IncomingPaymentFromJson = (obj) => {
4758
4945
  return new IncomingPayment(
@@ -5023,10 +5210,10 @@ var MultiNodeDashboard = `
5023
5210
  `;
5024
5211
 
5025
5212
  // src/objects/OutgoingPayment.ts
5026
- var import_auto_bind9 = __toESM(require("auto-bind"), 1);
5213
+ var import_auto_bind8 = __toESM(require("auto-bind"), 1);
5027
5214
 
5028
5215
  // src/objects/OutgoingPaymentAttempt.ts
5029
- var import_auto_bind8 = __toESM(require("auto-bind"), 1);
5216
+ var import_auto_bind7 = __toESM(require("auto-bind"), 1);
5030
5217
 
5031
5218
  // src/objects/ChannelSnapshot.ts
5032
5219
  var ChannelSnapshotFromJson = (obj) => {
@@ -5040,6 +5227,17 @@ var ChannelSnapshotFromJson = (obj) => {
5040
5227
  remoteUnsettledBalance: !!obj["channel_snapshot_remote_unsettled_balance"] ? CurrencyAmountFromJson(obj["channel_snapshot_remote_unsettled_balance"]) : void 0
5041
5228
  };
5042
5229
  };
5230
+ var ChannelSnapshotToJson = (obj) => {
5231
+ return {
5232
+ channel_snapshot_channel: { id: obj.channelId },
5233
+ channel_snapshot_timestamp: obj.timestamp,
5234
+ channel_snapshot_local_balance: obj.localBalance ? CurrencyAmountToJson(obj.localBalance) : void 0,
5235
+ channel_snapshot_local_unsettled_balance: obj.localUnsettledBalance ? CurrencyAmountToJson(obj.localUnsettledBalance) : void 0,
5236
+ channel_snapshot_local_channel_reserve: obj.localChannelReserve ? CurrencyAmountToJson(obj.localChannelReserve) : void 0,
5237
+ channel_snapshot_remote_balance: obj.remoteBalance ? CurrencyAmountToJson(obj.remoteBalance) : void 0,
5238
+ channel_snapshot_remote_unsettled_balance: obj.remoteUnsettledBalance ? CurrencyAmountToJson(obj.remoteUnsettledBalance) : void 0
5239
+ };
5240
+ };
5043
5241
 
5044
5242
  // src/objects/HtlcAttemptFailureCode.ts
5045
5243
  var HtlcAttemptFailureCode = /* @__PURE__ */ ((HtlcAttemptFailureCode2) => {
@@ -5177,7 +5375,7 @@ var OutgoingPaymentAttempt = class {
5177
5375
  this.amount = amount;
5178
5376
  this.fees = fees;
5179
5377
  this.channelSnapshot = channelSnapshot;
5180
- (0, import_auto_bind8.default)(this);
5378
+ (0, import_auto_bind7.default)(this);
5181
5379
  }
5182
5380
  async getHops(client, first = void 0, after = void 0) {
5183
5381
  return await client.executeRawQuery({
@@ -5252,6 +5450,22 @@ ${FRAGMENT15}
5252
5450
  constructObject: (data) => OutgoingPaymentAttemptFromJson(data.entity)
5253
5451
  };
5254
5452
  }
5453
+ toJson() {
5454
+ return {
5455
+ __typename: "OutgoingPaymentAttempt",
5456
+ outgoing_payment_attempt_id: this.id,
5457
+ outgoing_payment_attempt_created_at: this.createdAt,
5458
+ outgoing_payment_attempt_updated_at: this.updatedAt,
5459
+ outgoing_payment_attempt_status: this.status,
5460
+ outgoing_payment_attempt_failure_code: this.failureCode,
5461
+ outgoing_payment_attempt_failure_source_index: this.failureSourceIndex,
5462
+ outgoing_payment_attempt_resolved_at: this.resolvedAt,
5463
+ outgoing_payment_attempt_amount: this.amount ? CurrencyAmountToJson(this.amount) : void 0,
5464
+ outgoing_payment_attempt_fees: this.fees ? CurrencyAmountToJson(this.fees) : void 0,
5465
+ outgoing_payment_attempt_outgoing_payment: { id: this.outgoingPaymentId },
5466
+ outgoing_payment_attempt_channel_snapshot: this.channelSnapshot ? ChannelSnapshotToJson(this.channelSnapshot) : void 0
5467
+ };
5468
+ }
5255
5469
  };
5256
5470
  var OutgoingPaymentAttemptFromJson = (obj) => {
5257
5471
  return new OutgoingPaymentAttempt(
@@ -5402,6 +5616,26 @@ var PaymentRequestDataFromJson = (obj) => {
5402
5616
  `Couldn't find a concrete type for interface PaymentRequestData corresponding to the typename=${obj["__typename"]}`
5403
5617
  );
5404
5618
  };
5619
+ var PaymentRequestDataToJson = (obj) => {
5620
+ if (obj.typename == "InvoiceData") {
5621
+ const invoiceData = obj;
5622
+ return {
5623
+ __typename: "InvoiceData",
5624
+ invoice_data_encoded_payment_request: invoiceData.encodedPaymentRequest,
5625
+ invoice_data_bitcoin_network: invoiceData.bitcoinNetwork,
5626
+ invoice_data_payment_hash: invoiceData.paymentHash,
5627
+ invoice_data_amount: CurrencyAmountToJson(invoiceData.amount),
5628
+ invoice_data_created_at: invoiceData.createdAt,
5629
+ invoice_data_expires_at: invoiceData.expiresAt,
5630
+ invoice_data_memo: invoiceData.memo,
5631
+ invoice_data_destination: NodeToJson(invoiceData.destination)
5632
+ };
5633
+ }
5634
+ throw new import_core3.LightsparkException(
5635
+ "DeserializationError",
5636
+ `Couldn't find a concrete type for interface PaymentRequestData corresponding to the typename=${obj.typename}`
5637
+ );
5638
+ };
5405
5639
 
5406
5640
  // src/objects/RichText.ts
5407
5641
  var RichTextFromJson = (obj) => {
@@ -5409,6 +5643,11 @@ var RichTextFromJson = (obj) => {
5409
5643
  text: obj["rich_text_text"]
5410
5644
  };
5411
5645
  };
5646
+ var RichTextToJson = (obj) => {
5647
+ return {
5648
+ rich_text_text: obj.text
5649
+ };
5650
+ };
5412
5651
 
5413
5652
  // src/objects/OutgoingPayment.ts
5414
5653
  var OutgoingPayment = class {
@@ -5429,7 +5668,7 @@ var OutgoingPayment = class {
5429
5668
  this.failureMessage = failureMessage;
5430
5669
  this.umaPostTransactionData = umaPostTransactionData;
5431
5670
  this.paymentPreimage = paymentPreimage;
5432
- (0, import_auto_bind9.default)(this);
5671
+ (0, import_auto_bind8.default)(this);
5433
5672
  }
5434
5673
  async getAttempts(client, first = void 0, after = void 0) {
5435
5674
  return await client.executeRawQuery({
@@ -5552,6 +5791,26 @@ ${FRAGMENT16}
5552
5791
  constructObject: (data) => OutgoingPaymentFromJson(data.entity)
5553
5792
  };
5554
5793
  }
5794
+ toJson() {
5795
+ return {
5796
+ __typename: "OutgoingPayment",
5797
+ outgoing_payment_id: this.id,
5798
+ outgoing_payment_created_at: this.createdAt,
5799
+ outgoing_payment_updated_at: this.updatedAt,
5800
+ outgoing_payment_status: this.status,
5801
+ outgoing_payment_resolved_at: this.resolvedAt,
5802
+ outgoing_payment_amount: CurrencyAmountToJson(this.amount),
5803
+ outgoing_payment_transaction_hash: this.transactionHash,
5804
+ outgoing_payment_origin: { id: this.originId },
5805
+ outgoing_payment_destination: { id: this.destinationId },
5806
+ outgoing_payment_fees: this.fees ? CurrencyAmountToJson(this.fees) : void 0,
5807
+ outgoing_payment_payment_request_data: this.paymentRequestData ? PaymentRequestDataToJson(this.paymentRequestData) : void 0,
5808
+ outgoing_payment_failure_reason: this.failureReason,
5809
+ outgoing_payment_failure_message: this.failureMessage ? RichTextToJson(this.failureMessage) : void 0,
5810
+ outgoing_payment_uma_post_transaction_data: this.umaPostTransactionData?.map((e) => PostTransactionDataToJson(e)),
5811
+ outgoing_payment_payment_preimage: this.paymentPreimage
5812
+ };
5813
+ }
5555
5814
  };
5556
5815
  var OutgoingPaymentFromJson = (obj) => {
5557
5816
  return new OutgoingPayment(
@@ -6354,7 +6613,7 @@ var PayUmaInvoice = `
6354
6613
  `;
6355
6614
 
6356
6615
  // src/objects/WithdrawalRequest.ts
6357
- var import_auto_bind10 = __toESM(require("auto-bind"), 1);
6616
+ var import_auto_bind9 = __toESM(require("auto-bind"), 1);
6358
6617
 
6359
6618
  // src/objects/WithdrawalMode.ts
6360
6619
  var WithdrawalMode = /* @__PURE__ */ ((WithdrawalMode2) => {
@@ -6552,7 +6811,7 @@ var WithdrawalRequest = class {
6552
6811
  this.estimatedAmount = estimatedAmount;
6553
6812
  this.completedAt = completedAt;
6554
6813
  this.withdrawalId = withdrawalId;
6555
- (0, import_auto_bind10.default)(this);
6814
+ (0, import_auto_bind9.default)(this);
6556
6815
  }
6557
6816
  async getChannelClosingTransactions(client, first = void 0) {
6558
6817
  return await client.executeRawQuery({
@@ -6695,6 +6954,21 @@ ${FRAGMENT20}
6695
6954
  constructObject: (data) => WithdrawalRequestFromJson(data.entity)
6696
6955
  };
6697
6956
  }
6957
+ toJson() {
6958
+ return {
6959
+ __typename: "WithdrawalRequest",
6960
+ withdrawal_request_id: this.id,
6961
+ withdrawal_request_created_at: this.createdAt,
6962
+ withdrawal_request_updated_at: this.updatedAt,
6963
+ withdrawal_request_amount: CurrencyAmountToJson(this.amount),
6964
+ withdrawal_request_estimated_amount: this.estimatedAmount ? CurrencyAmountToJson(this.estimatedAmount) : void 0,
6965
+ withdrawal_request_bitcoin_address: this.bitcoinAddress,
6966
+ withdrawal_request_withdrawal_mode: this.withdrawalMode,
6967
+ withdrawal_request_status: this.status,
6968
+ withdrawal_request_completed_at: this.completedAt,
6969
+ withdrawal_request_withdrawal: { id: this.withdrawalId }
6970
+ };
6971
+ }
6698
6972
  };
6699
6973
  var WithdrawalRequestFromJson = (obj) => {
6700
6974
  return new WithdrawalRequest(
@@ -7881,7 +8155,7 @@ var NodeKeyLoaderCache = class {
7881
8155
  };
7882
8156
 
7883
8157
  // src/objects/Account.ts
7884
- var import_auto_bind14 = __toESM(require("auto-bind"), 1);
8158
+ var import_auto_bind12 = __toESM(require("auto-bind"), 1);
7885
8159
 
7886
8160
  // src/objects/AccountToApiTokensConnection.ts
7887
8161
  var AccountToApiTokensConnectionFromJson = (obj) => {
@@ -7898,12 +8172,20 @@ var AccountToApiTokensConnectionFromJson = (obj) => {
7898
8172
  };
7899
8173
 
7900
8174
  // src/objects/AccountToChannelsConnection.ts
7901
- var import_auto_bind11 = __toESM(require("auto-bind"), 1);
8175
+ var import_auto_bind10 = __toESM(require("auto-bind"), 1);
7902
8176
  var AccountToChannelsConnection = class {
7903
8177
  constructor(count, entities) {
7904
8178
  this.count = count;
7905
8179
  this.entities = entities;
7906
- (0, import_auto_bind11.default)(this);
8180
+ (0, import_auto_bind10.default)(this);
8181
+ }
8182
+ toJson() {
8183
+ return {
8184
+ account_to_channels_connection_count: this.count,
8185
+ account_to_channels_connection_entities: this.entities.map(
8186
+ (e) => e.toJson()
8187
+ )
8188
+ };
7907
8189
  }
7908
8190
  };
7909
8191
  var AccountToChannelsConnectionFromJson = (obj) => {
@@ -7918,201 +8200,6 @@ var AccountToChannelsConnection_default = AccountToChannelsConnection;
7918
8200
 
7919
8201
  // src/objects/LightsparkNode.ts
7920
8202
  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
8203
  var LightsparkNodeFromJson = (obj) => {
8117
8204
  if (obj["__typename"] == "LightsparkNodeWithOSK") {
8118
8205
  return new LightsparkNodeWithOSK_default(
@@ -8451,7 +8538,23 @@ fragment LightsparkNodeFragment on LightsparkNode {
8451
8538
  }
8452
8539
  }
8453
8540
  }`;
8454
- var LightsparkNode_default = LightsparkNode;
8541
+ var getLightsparkNodeQuery = (id) => {
8542
+ return {
8543
+ queryPayload: `
8544
+ query GetLightsparkNode($id: ID!) {
8545
+ entity(id: $id) {
8546
+ ... on LightsparkNode {
8547
+ ...LightsparkNodeFragment
8548
+ }
8549
+ }
8550
+ }
8551
+
8552
+ ${FRAGMENT23}
8553
+ `,
8554
+ variables: { id },
8555
+ constructObject: (data) => LightsparkNodeFromJson(data.entity)
8556
+ };
8557
+ };
8455
8558
 
8456
8559
  // src/objects/AccountToNodesConnection.ts
8457
8560
  var AccountToNodesConnectionFromJson = (obj) => {
@@ -8503,7 +8606,7 @@ var AccountToTransactionsConnectionFromJson = (obj) => {
8503
8606
  };
8504
8607
 
8505
8608
  // src/objects/Wallet.ts
8506
- var import_auto_bind13 = __toESM(require("auto-bind"), 1);
8609
+ var import_auto_bind11 = __toESM(require("auto-bind"), 1);
8507
8610
 
8508
8611
  // src/objects/WalletStatus.ts
8509
8612
  var WalletStatus = /* @__PURE__ */ ((WalletStatus2) => {
@@ -8561,7 +8664,7 @@ var Wallet = class {
8561
8664
  this.lastLoginAt = lastLoginAt;
8562
8665
  this.balances = balances;
8563
8666
  this.accountId = accountId;
8564
- (0, import_auto_bind13.default)(this);
8667
+ (0, import_auto_bind11.default)(this);
8565
8668
  }
8566
8669
  async getTransactions(client, first = void 0, after = void 0, createdAfterDate = void 0, createdBeforeDate = void 0, statuses = void 0, types = void 0) {
8567
8670
  return await client.executeRawQuery({
@@ -9562,6 +9665,19 @@ ${FRAGMENT24}
9562
9665
  constructObject: (data) => WalletFromJson(data.entity)
9563
9666
  };
9564
9667
  }
9668
+ toJson() {
9669
+ return {
9670
+ __typename: "Wallet",
9671
+ wallet_id: this.id,
9672
+ wallet_created_at: this.createdAt,
9673
+ wallet_updated_at: this.updatedAt,
9674
+ wallet_last_login_at: this.lastLoginAt,
9675
+ wallet_balances: this.balances ? BalancesToJson(this.balances) : void 0,
9676
+ wallet_third_party_identifier: this.thirdPartyIdentifier,
9677
+ wallet_account: { id: this.accountId },
9678
+ wallet_status: this.status
9679
+ };
9680
+ }
9565
9681
  };
9566
9682
  var WalletFromJson = (obj) => {
9567
9683
  return new Wallet(
@@ -9638,7 +9754,7 @@ var Account = class {
9638
9754
  this.updatedAt = updatedAt;
9639
9755
  this.typename = typename;
9640
9756
  this.name = name;
9641
- (0, import_auto_bind14.default)(this);
9757
+ (0, import_auto_bind12.default)(this);
9642
9758
  }
9643
9759
  async getApiTokens(client, first = void 0, after = void 0) {
9644
9760
  return await client.executeRawQuery({
@@ -11287,6 +11403,15 @@ ${FRAGMENT25}
11287
11403
  constructObject: (data) => AccountFromJson(data.current_account)
11288
11404
  };
11289
11405
  }
11406
+ toJson() {
11407
+ return {
11408
+ __typename: "Account",
11409
+ account_id: this.id,
11410
+ account_created_at: this.createdAt,
11411
+ account_updated_at: this.updatedAt,
11412
+ account_name: this.name
11413
+ };
11414
+ }
11290
11415
  };
11291
11416
  var AccountFromJson = (obj) => {
11292
11417
  return new Account(
@@ -11322,7 +11447,8 @@ var LightsparkClient = class {
11322
11447
  /**
11323
11448
  * Constructs a new LightsparkClient.
11324
11449
  *
11325
- * @param authProvider The auth provider to use for authentication. Defaults to a stub auth provider. For server-side
11450
+ * @param authProvider The auth provider to use for authentication. Defaults to a stub auth provider.
11451
+ * For server-side
11326
11452
  * use, you should use the `AccountTokenAuthProvider`.
11327
11453
  * @param serverUrl The base URL of the server to connect to. Defaults to lightspark production.
11328
11454
  * @param cryptoImpl The crypto implementation to use. Defaults to web and node compatible crypto.
@@ -11345,7 +11471,7 @@ var LightsparkClient = class {
11345
11471
  serverUrl,
11346
11472
  this.cryptoImpl
11347
11473
  );
11348
- (0, import_auto_bind15.default)(this);
11474
+ (0, import_auto_bind13.default)(this);
11349
11475
  }
11350
11476
  requester;
11351
11477
  nodeKeyCache;
@@ -11379,7 +11505,7 @@ var LightsparkClient = class {
11379
11505
  *
11380
11506
  * @param authProvider
11381
11507
  */
11382
- async setAuthProvider(authProvider) {
11508
+ setAuthProvider(authProvider) {
11383
11509
  this.requester = new import_core9.Requester(
11384
11510
  this.nodeKeyCache,
11385
11511
  this.LIGHTSPARK_SDK_ENDPOINT,
@@ -12117,7 +12243,9 @@ var isBitcoinNetwork = (bitcoinNetwork) => {
12117
12243
  var assertValidBitcoinNetwork = (bitcoinNetwork) => {
12118
12244
  if (!isBitcoinNetwork(bitcoinNetwork)) {
12119
12245
  throw new Error(
12120
- `Invalid bitcoin network ${bitcoinNetwork}. Valid networks: ${BITCOIN_NETWORKS}`
12246
+ `Invalid bitcoin network ${bitcoinNetwork}. Valid networks: ${BITCOIN_NETWORKS.join(
12247
+ ", "
12248
+ )}`
12121
12249
  );
12122
12250
  }
12123
12251
  };
@@ -13387,7 +13515,7 @@ var RemoteSigningWebhookHandler = class {
13387
13515
  this.validator
13388
13516
  );
13389
13517
  const variables = JSON.parse(response.variables);
13390
- this.client.executeRawQuery({
13518
+ return this.client.executeRawQuery({
13391
13519
  queryPayload: response.query,
13392
13520
  variables,
13393
13521
  constructObject: (rawData) => rawData
@@ -13410,11 +13538,9 @@ var RemoteSigningWebhookHandler = class {
13410
13538
  IncomingPaymentAttemptStatus,
13411
13539
  InvoiceType,
13412
13540
  LightsparkClient,
13413
- LightsparkNode,
13414
13541
  LightsparkNodeStatus,
13415
13542
  LightsparkNodeWithOSK,
13416
13543
  LightsparkNodeWithRemoteSigning,
13417
- Node,
13418
13544
  NodeAddressType,
13419
13545
  OutgoingPayment,
13420
13546
  OutgoingPaymentAttempt,
@@ -13448,6 +13574,8 @@ var RemoteSigningWebhookHandler = class {
13448
13574
  getInvoiceQuery,
13449
13575
  getLightningTransactionQuery,
13450
13576
  getLightsparkNodeOwnerQuery,
13577
+ getLightsparkNodeQuery,
13578
+ getNodeQuery,
13451
13579
  getOnChainTransactionQuery,
13452
13580
  getPaymentRequestQuery,
13453
13581
  getRoutingTransactionQuery,