@lightsparkdev/lightspark-sdk 1.2.2 → 1.2.3

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 (117) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/{BitcoinNetwork-a816c0be.d.ts → BitcoinNetwork-37e9f091.d.ts} +8 -3
  3. package/dist/env.d.cts +1 -1
  4. package/dist/env.d.ts +1 -1
  5. package/dist/{index-eb604025.d.ts → index-449c9f58.d.ts} +1461 -675
  6. package/dist/index.cjs +341 -307
  7. package/dist/index.d.cts +3 -3
  8. package/dist/index.d.ts +3 -3
  9. package/dist/index.js +323 -289
  10. package/dist/objects/index.d.cts +2 -2
  11. package/dist/objects/index.d.ts +2 -2
  12. package/dist/objects/index.js +1 -1
  13. package/package.json +4 -4
  14. package/src/NodeKeyLoaderCache.ts +4 -3
  15. package/src/SigningKeyLoader.ts +12 -7
  16. package/src/client.ts +99 -65
  17. package/src/env.ts +3 -1
  18. package/src/objects/Account.ts +7 -3
  19. package/src/objects/AccountToApiTokensConnection.ts +7 -3
  20. package/src/objects/AccountToChannelsConnection.ts +3 -2
  21. package/src/objects/AccountToNodesConnection.ts +7 -3
  22. package/src/objects/AccountToPaymentRequestsConnection.ts +7 -3
  23. package/src/objects/AccountToTransactionsConnection.ts +13 -9
  24. package/src/objects/AccountToWalletsConnection.ts +7 -3
  25. package/src/objects/ApiToken.ts +13 -7
  26. package/src/objects/Balances.ts +22 -12
  27. package/src/objects/BitcoinNetwork.ts +8 -3
  28. package/src/objects/BlockchainBalance.ts +4 -1
  29. package/src/objects/Channel.ts +37 -14
  30. package/src/objects/ChannelClosingTransaction.ts +22 -11
  31. package/src/objects/ChannelFees.ts +4 -1
  32. package/src/objects/ChannelOpeningTransaction.ts +22 -11
  33. package/src/objects/ChannelStatus.ts +33 -8
  34. package/src/objects/ChannelToTransactionsConnection.ts +9 -8
  35. package/src/objects/ComplianceProvider.ts +3 -2
  36. package/src/objects/Connection.ts +7 -3
  37. package/src/objects/CreateApiTokenInput.ts +4 -1
  38. package/src/objects/CreateApiTokenOutput.ts +3 -3
  39. package/src/objects/CreateLnurlInvoiceInput.ts +3 -2
  40. package/src/objects/CreateTestModePaymentInput.ts +2 -2
  41. package/src/objects/CreateTestModePaymentoutput.ts +5 -1
  42. package/src/objects/CurrencyAmount.ts +6 -4
  43. package/src/objects/CurrencyUnit.ts +36 -9
  44. package/src/objects/Deposit.ts +22 -11
  45. package/src/objects/Entity.ts +8 -3
  46. package/src/objects/FeeEstimate.ts +5 -1
  47. package/src/objects/GraphNode.ts +30 -14
  48. package/src/objects/Hop.ts +12 -4
  49. package/src/objects/HtlcAttemptFailureCode.ts +7 -3
  50. package/src/objects/IncentivesIneligibilityReason.ts +33 -9
  51. package/src/objects/IncentivesStatus.ts +14 -4
  52. package/src/objects/IncomingPayment.ts +18 -7
  53. package/src/objects/IncomingPaymentAttempt.ts +8 -3
  54. package/src/objects/IncomingPaymentAttemptStatus.ts +7 -3
  55. package/src/objects/IncomingPaymentToAttemptsConnection.ts +7 -3
  56. package/src/objects/Invoice.ts +2 -2
  57. package/src/objects/InvoiceData.ts +7 -3
  58. package/src/objects/InvoiceType.ts +3 -2
  59. package/src/objects/LightningFeeEstimateForInvoiceInput.ts +2 -2
  60. package/src/objects/LightningTransaction.ts +12 -4
  61. package/src/objects/LightsparkNode.ts +33 -18
  62. package/src/objects/LightsparkNodeOwner.ts +2 -2
  63. package/src/objects/LightsparkNodeStatus.ts +3 -2
  64. package/src/objects/LightsparkNodeToChannelsConnection.ts +7 -3
  65. package/src/objects/LightsparkNodeWithOSK.ts +35 -19
  66. package/src/objects/LightsparkNodeWithRemoteSigning.ts +31 -18
  67. package/src/objects/Node.ts +28 -14
  68. package/src/objects/NodeAddressType.ts +7 -3
  69. package/src/objects/NodeToAddressesConnection.ts +7 -3
  70. package/src/objects/OnChainTransaction.ts +23 -11
  71. package/src/objects/OutgoingPayment.ts +24 -7
  72. package/src/objects/OutgoingPaymentAttempt.ts +28 -13
  73. package/src/objects/OutgoingPaymentAttemptStatus.ts +7 -3
  74. package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +12 -4
  75. package/src/objects/OutgoingPaymentToAttemptsConnection.ts +7 -3
  76. package/src/objects/PageInfo.ts +6 -1
  77. package/src/objects/PayInvoiceInput.ts +6 -3
  78. package/src/objects/PaymentDirection.ts +3 -2
  79. package/src/objects/PaymentFailureReason.ts +7 -3
  80. package/src/objects/PaymentRequest.ts +8 -3
  81. package/src/objects/PaymentRequestData.ts +5 -1
  82. package/src/objects/PaymentRequestStatus.ts +7 -3
  83. package/src/objects/Permission.ts +7 -3
  84. package/src/objects/PostTransactionData.ts +6 -3
  85. package/src/objects/RegionCode.ts +43 -12
  86. package/src/objects/RegisterPaymentInput.ts +12 -7
  87. package/src/objects/RemoteSigningSubEventType.ts +7 -3
  88. package/src/objects/RequestWithdrawalInput.ts +2 -2
  89. package/src/objects/RiskRating.ts +8 -3
  90. package/src/objects/RoutingTransaction.ts +20 -7
  91. package/src/objects/RoutingTransactionFailureReason.ts +8 -3
  92. package/src/objects/ScreenNodeInput.ts +3 -2
  93. package/src/objects/SendPaymentInput.ts +4 -1
  94. package/src/objects/SetInvoicePaymentHashInput.ts +3 -2
  95. package/src/objects/Signable.ts +2 -2
  96. package/src/objects/SignablePayload.ts +6 -3
  97. package/src/objects/SignablePayloadStatus.ts +3 -2
  98. package/src/objects/Transaction.ts +14 -4
  99. package/src/objects/TransactionFailures.ts +4 -1
  100. package/src/objects/TransactionStatus.ts +16 -5
  101. package/src/objects/TransactionType.ts +30 -8
  102. package/src/objects/TransactionUpdate.ts +6 -3
  103. package/src/objects/UmaInvitation.ts +10 -4
  104. package/src/objects/Wallet.ts +13 -4
  105. package/src/objects/WalletStatus.ts +36 -9
  106. package/src/objects/WalletToPaymentRequestsConnection.ts +7 -3
  107. package/src/objects/WalletToTransactionsConnection.ts +7 -3
  108. package/src/objects/WebhookEventType.ts +7 -3
  109. package/src/objects/Withdrawal.ts +22 -11
  110. package/src/objects/WithdrawalMode.ts +7 -3
  111. package/src/objects/WithdrawalRequest.ts +15 -6
  112. package/src/objects/WithdrawalRequestStatus.ts +3 -2
  113. package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +11 -4
  114. package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +11 -4
  115. package/src/objects/index.ts +6 -6
  116. package/src/tests/integration/general-regtest.test.ts +1 -1
  117. /package/dist/{chunk-GLL4KTUT.js → chunk-NCPWHRFO.js} +0 -0
package/dist/index.cjs CHANGED
@@ -1949,7 +1949,7 @@ var import_core9 = require("@lightsparkdev/core");
1949
1949
  // package.json
1950
1950
  var package_default = {
1951
1951
  name: "@lightsparkdev/lightspark-sdk",
1952
- version: "1.2.2",
1952
+ version: "1.2.3",
1953
1953
  description: "Lightspark JS SDK",
1954
1954
  author: "Lightspark Inc.",
1955
1955
  keywords: [
@@ -2018,7 +2018,7 @@ var package_default = {
2018
2018
  ],
2019
2019
  scripts: {
2020
2020
  build: "yarn tsc && tsup",
2021
- "build:watch": "yarn build --watch",
2021
+ "build:watch": "yarn build --watch --clean=false",
2022
2022
  clean: "rm -rf .turbo && rm -rf dist",
2023
2023
  dev: "yarn build -- --watch",
2024
2024
  docs: "typedoc src",
@@ -2037,7 +2037,7 @@ var package_default = {
2037
2037
  },
2038
2038
  license: "Apache-2.0",
2039
2039
  dependencies: {
2040
- "@lightsparkdev/core": "1.0.10",
2040
+ "@lightsparkdev/core": "1.0.11",
2041
2041
  "@lightsparkdev/crypto-wasm": "0.1.2",
2042
2042
  "auto-bind": "^5.0.1",
2043
2043
  "crypto-browserify": "^3.12.0",
@@ -2064,7 +2064,184 @@ var package_default = {
2064
2064
  "tsc-absolute": "^1.0.1",
2065
2065
  tsup: "^7.2.0",
2066
2066
  typedoc: "^0.24.7",
2067
- typescript: "^4.9.5"
2067
+ typescript: "^5.0.0"
2068
+ }
2069
+ };
2070
+
2071
+ // src/NodeKeyLoaderCache.ts
2072
+ var import_core3 = require("@lightsparkdev/core");
2073
+
2074
+ // src/SigningKeyLoader.ts
2075
+ var import_core2 = require("@lightsparkdev/core");
2076
+
2077
+ // src/graphql/RecoverNodeSigningKey.ts
2078
+ var RecoverNodeSigningKey = `
2079
+ query RecoverNodeSigningKey($nodeId: ID!) {
2080
+ entity(id: $nodeId) {
2081
+ __typename
2082
+ ... on LightsparkNodeWithOSK {
2083
+ encrypted_signing_private_key {
2084
+ encrypted_value
2085
+ cipher
2086
+ }
2087
+ }
2088
+ }
2089
+ }
2090
+ `;
2091
+
2092
+ // src/SigningKeyLoader.ts
2093
+ var SIGNING_KEY_PATH = "m/5";
2094
+ function isNodeIdAndPasswordSigningKeyLoaderArgs(args) {
2095
+ return args.password !== void 0;
2096
+ }
2097
+ function isMasterSeedSigningKeyLoaderArgs(args) {
2098
+ return args.masterSeed !== void 0;
2099
+ }
2100
+ var NodeIdAndPasswordSigningKeyLoader = class {
2101
+ nodeId;
2102
+ password;
2103
+ requester;
2104
+ cryptoImpl;
2105
+ constructor(args, requester, cryptoImpl) {
2106
+ this.nodeId = args.nodeId;
2107
+ this.password = args.password;
2108
+ this.requester = requester;
2109
+ this.cryptoImpl = cryptoImpl;
2110
+ }
2111
+ async loadSigningKey() {
2112
+ const encryptedKey = await this.recoverNodeSigningKey();
2113
+ if (!encryptedKey) {
2114
+ console.warn("No encrypted key found for node " + this.nodeId);
2115
+ return;
2116
+ }
2117
+ const signingPrivateKey = await this.cryptoImpl.decryptSecretWithNodePassword(
2118
+ encryptedKey.cipher,
2119
+ encryptedKey.encrypted_value,
2120
+ this.password
2121
+ );
2122
+ if (!signingPrivateKey) {
2123
+ throw new import_core2.LightsparkSigningException(
2124
+ "Unable to decrypt signing key with provided password. Please try again."
2125
+ );
2126
+ }
2127
+ let signingPrivateKeyPEM = "";
2128
+ if (new Uint8Array(signingPrivateKey)[0] === 48) {
2129
+ signingPrivateKeyPEM = (0, import_core2.b64encode)(signingPrivateKey);
2130
+ } else {
2131
+ const dec = new TextDecoder();
2132
+ signingPrivateKeyPEM = dec.decode(signingPrivateKey);
2133
+ }
2134
+ return { key: signingPrivateKeyPEM, type: import_core2.SigningKeyType.RSASigningKey };
2135
+ }
2136
+ async recoverNodeSigningKey() {
2137
+ const response = await this.requester.makeRawRequest(
2138
+ RecoverNodeSigningKey,
2139
+ { nodeId: this.nodeId }
2140
+ );
2141
+ const nodeEntity = response.entity;
2142
+ if (nodeEntity?.__typename === "LightsparkNodeWithOSK") {
2143
+ return nodeEntity.encrypted_signing_private_key;
2144
+ }
2145
+ return null;
2146
+ }
2147
+ };
2148
+ var MasterSeedSigningKeyLoader = class {
2149
+ masterSeed;
2150
+ network;
2151
+ constructor(args) {
2152
+ this.masterSeed = args.masterSeed;
2153
+ this.network = args.network;
2154
+ }
2155
+ async loadSigningKey() {
2156
+ if (import_core2.isBrowser) {
2157
+ throw new import_core2.LightsparkSigningException(
2158
+ "Browser environments not supported for master seed signing key loader."
2159
+ );
2160
+ }
2161
+ const { LightsparkSigner, Network } = await import("@lightsparkdev/crypto-wasm");
2162
+ let cryptoLibNetwork;
2163
+ switch (this.network) {
2164
+ case BitcoinNetwork_default.MAINNET:
2165
+ cryptoLibNetwork = Network.Bitcoin;
2166
+ break;
2167
+ case BitcoinNetwork_default.TESTNET:
2168
+ cryptoLibNetwork = Network.Testnet;
2169
+ break;
2170
+ case BitcoinNetwork_default.REGTEST:
2171
+ cryptoLibNetwork = Network.Regtest;
2172
+ break;
2173
+ default:
2174
+ throw new Error(
2175
+ `Unsupported lightspark_crypto network ${this.network}.`
2176
+ );
2177
+ }
2178
+ const lightsparkSigner = LightsparkSigner.from_bytes(
2179
+ this.masterSeed,
2180
+ cryptoLibNetwork
2181
+ );
2182
+ const privateKey = lightsparkSigner.derive_private_key(SIGNING_KEY_PATH);
2183
+ return { key: privateKey, type: import_core2.SigningKeyType.Secp256k1SigningKey };
2184
+ }
2185
+ };
2186
+
2187
+ // src/NodeKeyLoaderCache.ts
2188
+ var NodeKeyLoaderCache = class {
2189
+ constructor(nodeKeyCache, cryptoImpl = import_core3.DefaultCrypto) {
2190
+ this.nodeKeyCache = nodeKeyCache;
2191
+ this.cryptoImpl = cryptoImpl;
2192
+ this.idToLoader = /* @__PURE__ */ new Map();
2193
+ }
2194
+ idToLoader;
2195
+ /**
2196
+ * Sets the signing key loader for a node.
2197
+ * Instantiates a signing key loader based on the type of args passed in by
2198
+ * the user.
2199
+ *
2200
+ * @param nodeId The ID of the node to get the key for
2201
+ * @param loaderArgs Loader arguments for loading the key
2202
+ * @param requester Requester used for loading the key
2203
+ */
2204
+ setLoader(nodeId, loaderArgs, requester) {
2205
+ let loader;
2206
+ if (isNodeIdAndPasswordSigningKeyLoaderArgs(loaderArgs)) {
2207
+ loader = new NodeIdAndPasswordSigningKeyLoader(
2208
+ { nodeId, ...loaderArgs },
2209
+ requester,
2210
+ this.cryptoImpl
2211
+ );
2212
+ } else if (isMasterSeedSigningKeyLoaderArgs(loaderArgs)) {
2213
+ loader = new MasterSeedSigningKeyLoader({ ...loaderArgs });
2214
+ } else {
2215
+ throw new import_core3.LightsparkSigningException("Invalid signing key loader args");
2216
+ }
2217
+ this.idToLoader.set(nodeId, loader);
2218
+ }
2219
+ /**
2220
+ * Gets the key for a node using the loader set by [setLoader]
2221
+ *
2222
+ * @param id The ID of the node to get the key for
2223
+ * @returns The loaded key
2224
+ */
2225
+ async getKeyWithLoader(id) {
2226
+ if (this.nodeKeyCache.hasKey(id)) {
2227
+ return this.nodeKeyCache.getKey(id);
2228
+ }
2229
+ const loader = this.idToLoader.get(id);
2230
+ if (!loader) {
2231
+ throw new import_core3.LightsparkSigningException(
2232
+ "No signing key loader found for node " + id
2233
+ );
2234
+ }
2235
+ const loaderResult = await loader.loadSigningKey();
2236
+ if (!loaderResult) {
2237
+ return;
2238
+ }
2239
+ const key = await this.nodeKeyCache.loadKey(
2240
+ id,
2241
+ { key: loaderResult.key },
2242
+ loaderResult.type
2243
+ );
2244
+ return key || void 0;
2068
2245
  }
2069
2246
  };
2070
2247
 
@@ -2373,7 +2550,7 @@ var BitcoinNetwork = /* @__PURE__ */ ((BitcoinNetwork2) => {
2373
2550
  var BitcoinNetwork_default = BitcoinNetwork;
2374
2551
 
2375
2552
  // src/objects/Node.ts
2376
- var import_core2 = require("@lightsparkdev/core");
2553
+ var import_core4 = require("@lightsparkdev/core");
2377
2554
 
2378
2555
  // src/objects/Balances.ts
2379
2556
  var BalancesFromJson = (obj) => {
@@ -3768,7 +3945,7 @@ var NodeFromJson = (obj) => {
3768
3945
  !!obj["lightspark_node_with_remote_signing_balances"] ? BalancesFromJson(obj["lightspark_node_with_remote_signing_balances"]) : void 0
3769
3946
  );
3770
3947
  }
3771
- throw new import_core2.LightsparkException(
3948
+ throw new import_core4.LightsparkException(
3772
3949
  "DeserializationError",
3773
3950
  `Couldn't find a concrete type for interface Node corresponding to the typename=${obj["__typename"]}`
3774
3951
  );
@@ -3844,7 +4021,7 @@ var NodeToJson = (obj) => {
3844
4021
  lightspark_node_with_remote_signing_balances: lightsparkNodeWithRemoteSigning.balances ? BalancesToJson(lightsparkNodeWithRemoteSigning.balances) : void 0
3845
4022
  };
3846
4023
  }
3847
- throw new import_core2.LightsparkException(
4024
+ throw new import_core4.LightsparkException(
3848
4025
  "DeserializationError",
3849
4026
  `Couldn't find a concrete type for interface Node corresponding to the typename=${obj.typename}`
3850
4027
  );
@@ -5766,7 +5943,7 @@ var PaymentFailureReason = /* @__PURE__ */ ((PaymentFailureReason2) => {
5766
5943
  var PaymentFailureReason_default = PaymentFailureReason;
5767
5944
 
5768
5945
  // src/objects/PaymentRequestData.ts
5769
- var import_core3 = require("@lightsparkdev/core");
5946
+ var import_core5 = require("@lightsparkdev/core");
5770
5947
  var PaymentRequestDataFromJson = (obj) => {
5771
5948
  if (obj["__typename"] == "InvoiceData") {
5772
5949
  return {
@@ -5781,7 +5958,7 @@ var PaymentRequestDataFromJson = (obj) => {
5781
5958
  memo: obj["invoice_data_memo"]
5782
5959
  };
5783
5960
  }
5784
- throw new import_core3.LightsparkException(
5961
+ throw new import_core5.LightsparkException(
5785
5962
  "DeserializationError",
5786
5963
  `Couldn't find a concrete type for interface PaymentRequestData corresponding to the typename=${obj["__typename"]}`
5787
5964
  );
@@ -5801,7 +5978,7 @@ var PaymentRequestDataToJson = (obj) => {
5801
5978
  invoice_data_destination: NodeToJson(invoiceData.destination)
5802
5979
  };
5803
5980
  }
5804
- throw new import_core3.LightsparkException(
5981
+ throw new import_core5.LightsparkException(
5805
5982
  "DeserializationError",
5806
5983
  `Couldn't find a concrete type for interface PaymentRequestData corresponding to the typename=${obj.typename}`
5807
5984
  );
@@ -6378,8 +6555,35 @@ var PayInvoice = `
6378
6555
  ${FRAGMENT17}
6379
6556
  `;
6380
6557
 
6558
+ // src/graphql/PayUmaInvoice.ts
6559
+ var PayUmaInvoice = `
6560
+ mutation PayUmaInvoice(
6561
+ $node_id: ID!
6562
+ $encoded_invoice: String!
6563
+ $timeout_secs: Int!
6564
+ $maximum_fees_msats: Long!
6565
+ $amount_msats: Long
6566
+ ) {
6567
+ pay_uma_invoice(
6568
+ input: {
6569
+ node_id: $node_id
6570
+ encoded_invoice: $encoded_invoice
6571
+ timeout_secs: $timeout_secs
6572
+ maximum_fees_msats: $maximum_fees_msats
6573
+ amount_msats: $amount_msats
6574
+ }
6575
+ ) {
6576
+ payment {
6577
+ ...OutgoingPaymentFragment
6578
+ }
6579
+ }
6580
+ }
6581
+
6582
+ ${FRAGMENT17}
6583
+ `;
6584
+
6381
6585
  // src/objects/PaymentRequest.ts
6382
- var import_core4 = require("@lightsparkdev/core");
6586
+ var import_core6 = require("@lightsparkdev/core");
6383
6587
  var PaymentRequestFromJson = (obj) => {
6384
6588
  if (obj["__typename"] == "Invoice") {
6385
6589
  return {
@@ -6392,7 +6596,7 @@ var PaymentRequestFromJson = (obj) => {
6392
6596
  amountPaid: !!obj["invoice_amount_paid"] ? CurrencyAmountFromJson(obj["invoice_amount_paid"]) : void 0
6393
6597
  };
6394
6598
  }
6395
- throw new import_core4.LightsparkException(
6599
+ throw new import_core6.LightsparkException(
6396
6600
  "DeserializationError",
6397
6601
  `Couldn't find a concrete type for interface PaymentRequest corresponding to the typename=${obj["__typename"]}`
6398
6602
  );
@@ -6756,33 +6960,6 @@ query PaymentRequestsForNode(
6756
6960
  ${FRAGMENT18}
6757
6961
  `;
6758
6962
 
6759
- // src/graphql/PayUmaInvoice.ts
6760
- var PayUmaInvoice = `
6761
- mutation PayUmaInvoice(
6762
- $node_id: ID!
6763
- $encoded_invoice: String!
6764
- $timeout_secs: Int!
6765
- $maximum_fees_msats: Long!
6766
- $amount_msats: Long
6767
- ) {
6768
- pay_uma_invoice(
6769
- input: {
6770
- node_id: $node_id
6771
- encoded_invoice: $encoded_invoice
6772
- timeout_secs: $timeout_secs
6773
- maximum_fees_msats: $maximum_fees_msats
6774
- amount_msats: $amount_msats
6775
- }
6776
- ) {
6777
- payment {
6778
- ...OutgoingPaymentFragment
6779
- }
6780
- }
6781
- }
6782
-
6783
- ${FRAGMENT17}
6784
- `;
6785
-
6786
6963
  // src/objects/WithdrawalRequest.ts
6787
6964
  var import_auto_bind9 = __toESM(require("auto-bind"), 1);
6788
6965
 
@@ -7239,7 +7416,7 @@ var SendPayment = `
7239
7416
  `;
7240
7417
 
7241
7418
  // src/objects/Transaction.ts
7242
- var import_core5 = require("@lightsparkdev/core");
7419
+ var import_core7 = require("@lightsparkdev/core");
7243
7420
 
7244
7421
  // src/objects/RoutingTransactionFailureReason.ts
7245
7422
  var RoutingTransactionFailureReason = /* @__PURE__ */ ((RoutingTransactionFailureReason2) => {
@@ -7383,7 +7560,7 @@ var TransactionFromJson = (obj) => {
7383
7560
  numConfirmations: obj["withdrawal_num_confirmations"]
7384
7561
  };
7385
7562
  }
7386
- throw new import_core5.LightsparkException(
7563
+ throw new import_core7.LightsparkException(
7387
7564
  "DeserializationError",
7388
7565
  `Couldn't find a concrete type for interface Transaction corresponding to the typename=${obj["__typename"]}`
7389
7566
  );
@@ -8064,45 +8241,6 @@ ${FRAGMENT22}
8064
8241
  ${FRAGMENT}
8065
8242
  `;
8066
8243
 
8067
- // src/graphql/TransactionsForNode.ts
8068
- var TransactionsForNode = `
8069
- query TransactionsForNode(
8070
- $network: BitcoinNetwork!,
8071
- $nodeId: ID!,
8072
- $numTransactions: Int,
8073
- $afterDate: DateTime,
8074
- $transactionTypes: [TransactionType!] = [PAYMENT, PAYMENT_REQUEST, ROUTE, L1_WITHDRAW, L1_DEPOSIT]
8075
- $transaction_statuses: [TransactionStatus!] = null
8076
- ) {
8077
- current_account {
8078
- id
8079
- name
8080
- recent_transactions: transactions(
8081
- first: $numTransactions
8082
- types: $transactionTypes
8083
- bitcoin_network: $network
8084
- lightning_node_id: $nodeId
8085
- statuses: $transaction_statuses
8086
- after_date: $afterDate
8087
- ) {
8088
- count
8089
- total_amount_transacted {
8090
- ...CurrencyAmountFragment
8091
- }
8092
- entities {
8093
- ...TransactionFragment
8094
- __typename
8095
- }
8096
- __typename
8097
- }
8098
- __typename
8099
- }
8100
- }
8101
-
8102
- ${FRAGMENT22}
8103
- ${FRAGMENT}
8104
- `;
8105
-
8106
8244
  // src/objects/TransactionUpdate.ts
8107
8245
  var TransactionUpdateFromJson = (obj) => {
8108
8246
  return {
@@ -8149,181 +8287,44 @@ subscription TransactionSubscription(
8149
8287
  ${FRAGMENT23}
8150
8288
  `;
8151
8289
 
8152
- // src/NodeKeyLoaderCache.ts
8153
- var import_core7 = require("@lightsparkdev/core");
8154
-
8155
- // src/SigningKeyLoader.ts
8156
- var import_core6 = require("@lightsparkdev/core");
8157
-
8158
- // src/graphql/RecoverNodeSigningKey.ts
8159
- var RecoverNodeSigningKey = `
8160
- query RecoverNodeSigningKey($nodeId: ID!) {
8161
- entity(id: $nodeId) {
8162
- __typename
8163
- ... on LightsparkNodeWithOSK {
8164
- encrypted_signing_private_key {
8165
- encrypted_value
8166
- cipher
8290
+ // src/graphql/TransactionsForNode.ts
8291
+ var TransactionsForNode = `
8292
+ query TransactionsForNode(
8293
+ $network: BitcoinNetwork!,
8294
+ $nodeId: ID!,
8295
+ $numTransactions: Int,
8296
+ $afterDate: DateTime,
8297
+ $transactionTypes: [TransactionType!] = [PAYMENT, PAYMENT_REQUEST, ROUTE, L1_WITHDRAW, L1_DEPOSIT]
8298
+ $transaction_statuses: [TransactionStatus!] = null
8299
+ ) {
8300
+ current_account {
8301
+ id
8302
+ name
8303
+ recent_transactions: transactions(
8304
+ first: $numTransactions
8305
+ types: $transactionTypes
8306
+ bitcoin_network: $network
8307
+ lightning_node_id: $nodeId
8308
+ statuses: $transaction_statuses
8309
+ after_date: $afterDate
8310
+ ) {
8311
+ count
8312
+ total_amount_transacted {
8313
+ ...CurrencyAmountFragment
8314
+ }
8315
+ entities {
8316
+ ...TransactionFragment
8317
+ __typename
8318
+ }
8319
+ __typename
8167
8320
  }
8168
- }
8321
+ __typename
8169
8322
  }
8170
- }
8171
- `;
8172
-
8173
- // src/SigningKeyLoader.ts
8174
- var SIGNING_KEY_PATH = "m/5";
8175
- function isNodeIdAndPasswordSigningKeyLoaderArgs(args) {
8176
- return args.password !== void 0;
8177
- }
8178
- function isMasterSeedSigningKeyLoaderArgs(args) {
8179
- return args.masterSeed !== void 0;
8180
8323
  }
8181
- var NodeIdAndPasswordSigningKeyLoader = class {
8182
- nodeId;
8183
- password;
8184
- requester;
8185
- cryptoImpl;
8186
- constructor(args, requester, cryptoImpl) {
8187
- this.nodeId = args.nodeId;
8188
- this.password = args.password;
8189
- this.requester = requester;
8190
- this.cryptoImpl = cryptoImpl;
8191
- }
8192
- async loadSigningKey() {
8193
- const encryptedKey = await this.recoverNodeSigningKey();
8194
- if (!encryptedKey) {
8195
- console.warn("No encrypted key found for node " + this.nodeId);
8196
- return;
8197
- }
8198
- const signingPrivateKey = await this.cryptoImpl.decryptSecretWithNodePassword(
8199
- encryptedKey.cipher,
8200
- encryptedKey.encrypted_value,
8201
- this.password
8202
- );
8203
- if (!signingPrivateKey) {
8204
- throw new import_core6.LightsparkSigningException(
8205
- "Unable to decrypt signing key with provided password. Please try again."
8206
- );
8207
- }
8208
- let signingPrivateKeyPEM = "";
8209
- if (new Uint8Array(signingPrivateKey)[0] === 48) {
8210
- signingPrivateKeyPEM = (0, import_core6.b64encode)(signingPrivateKey);
8211
- } else {
8212
- const dec = new TextDecoder();
8213
- signingPrivateKeyPEM = dec.decode(signingPrivateKey);
8214
- }
8215
- return { key: signingPrivateKeyPEM, type: import_core6.SigningKeyType.RSASigningKey };
8216
- }
8217
- async recoverNodeSigningKey() {
8218
- const response = await this.requester.makeRawRequest(
8219
- RecoverNodeSigningKey,
8220
- { nodeId: this.nodeId }
8221
- );
8222
- const nodeEntity = response.entity;
8223
- if (nodeEntity?.__typename === "LightsparkNodeWithOSK") {
8224
- return nodeEntity.encrypted_signing_private_key;
8225
- }
8226
- return null;
8227
- }
8228
- };
8229
- var MasterSeedSigningKeyLoader = class {
8230
- masterSeed;
8231
- network;
8232
- constructor(args) {
8233
- this.masterSeed = args.masterSeed;
8234
- this.network = args.network;
8235
- }
8236
- async loadSigningKey() {
8237
- if (import_core6.isBrowser) {
8238
- throw new import_core6.LightsparkSigningException(
8239
- "Browser environments not supported for master seed signing key loader."
8240
- );
8241
- }
8242
- const { LightsparkSigner, Network } = await import("@lightsparkdev/crypto-wasm");
8243
- let cryptoLibNetwork;
8244
- switch (this.network) {
8245
- case BitcoinNetwork_default.MAINNET:
8246
- cryptoLibNetwork = Network.Bitcoin;
8247
- break;
8248
- case BitcoinNetwork_default.TESTNET:
8249
- cryptoLibNetwork = Network.Testnet;
8250
- break;
8251
- case BitcoinNetwork_default.REGTEST:
8252
- cryptoLibNetwork = Network.Regtest;
8253
- break;
8254
- default:
8255
- throw new Error(
8256
- `Unsupported lightspark_crypto network ${this.network}.`
8257
- );
8258
- }
8259
- const lightsparkSigner = LightsparkSigner.from_bytes(
8260
- this.masterSeed,
8261
- cryptoLibNetwork
8262
- );
8263
- const privateKey = lightsparkSigner.derive_private_key(SIGNING_KEY_PATH);
8264
- return { key: privateKey, type: import_core6.SigningKeyType.Secp256k1SigningKey };
8265
- }
8266
- };
8267
8324
 
8268
- // src/NodeKeyLoaderCache.ts
8269
- var NodeKeyLoaderCache = class {
8270
- constructor(nodeKeyCache, cryptoImpl = import_core7.DefaultCrypto) {
8271
- this.nodeKeyCache = nodeKeyCache;
8272
- this.cryptoImpl = cryptoImpl;
8273
- this.idToLoader = /* @__PURE__ */ new Map();
8274
- }
8275
- idToLoader;
8276
- /**
8277
- * Sets the signing key loader for a node.
8278
- * Instantiates a signing key loader based on the type of args passed in by the user.
8279
- *
8280
- * @param nodeId The ID of the node to get the key for
8281
- * @param loaderArgs Loader arguments for loading the key
8282
- * @param requester Requester used for loading the key
8283
- */
8284
- setLoader(nodeId, loaderArgs, requester) {
8285
- let loader;
8286
- if (isNodeIdAndPasswordSigningKeyLoaderArgs(loaderArgs)) {
8287
- loader = new NodeIdAndPasswordSigningKeyLoader(
8288
- { nodeId, ...loaderArgs },
8289
- requester,
8290
- this.cryptoImpl
8291
- );
8292
- } else if (isMasterSeedSigningKeyLoaderArgs(loaderArgs)) {
8293
- loader = new MasterSeedSigningKeyLoader({ ...loaderArgs });
8294
- } else {
8295
- throw new import_core7.LightsparkSigningException("Invalid signing key loader args");
8296
- }
8297
- this.idToLoader.set(nodeId, loader);
8298
- }
8299
- /**
8300
- * Gets the key for a node using the loader set by [setLoader]
8301
- *
8302
- * @param id The ID of the node to get the key for
8303
- * @returns The loaded key
8304
- */
8305
- async getKeyWithLoader(id) {
8306
- if (this.nodeKeyCache.hasKey(id)) {
8307
- return this.nodeKeyCache.getKey(id);
8308
- }
8309
- const loader = this.idToLoader.get(id);
8310
- if (!loader) {
8311
- throw new import_core7.LightsparkSigningException(
8312
- "No signing key loader found for node " + id
8313
- );
8314
- }
8315
- const loaderResult = await loader.loadSigningKey();
8316
- if (!loaderResult) {
8317
- return;
8318
- }
8319
- const key = await this.nodeKeyCache.loadKey(
8320
- id,
8321
- { key: loaderResult.key },
8322
- loaderResult.type
8323
- );
8324
- return key || void 0;
8325
- }
8326
- };
8325
+ ${FRAGMENT22}
8326
+ ${FRAGMENT}
8327
+ `;
8327
8328
 
8328
8329
  // src/objects/Account.ts
8329
8330
  var import_auto_bind12 = __toESM(require("auto-bind"), 1);
@@ -11623,7 +11624,8 @@ var LightsparkClient = class {
11623
11624
  * use, you should use the `AccountTokenAuthProvider`.
11624
11625
  * @param serverUrl The base URL of the server to connect to. Defaults to lightspark production.
11625
11626
  * @param cryptoImpl The crypto implementation to use. Defaults to web and node compatible crypto.
11626
- * For React Native, you should use the `ReactNativeCrypto` implementation from `@lightsparkdev/react-native`.
11627
+ * For React Native, you should use the `ReactNativeCrypto`
11628
+ * implementation from `@lightsparkdev/react-native`.
11627
11629
  */
11628
11630
  constructor(authProvider = new import_core9.StubAuthProvider(), serverUrl = "api.lightspark.com", cryptoImpl = import_core9.DefaultCrypto) {
11629
11631
  this.authProvider = authProvider;
@@ -11649,9 +11651,11 @@ var LightsparkClient = class {
11649
11651
  nodeKeyLoaderCache;
11650
11652
  LIGHTSPARK_SDK_ENDPOINT = process.env.LIGHTSPARK_SDK_ENDPOINT || "graphql/server/2023-09-13";
11651
11653
  /**
11652
- * Sets the key loader for a node. This unlocks client operations that require a private key.
11653
- * Passing in [NodeIdAndPasswordSigningKeyLoaderArgs] loads the RSA key for an OSK node.
11654
- * Passing in [MasterSeedSigningKeyLoaderArgs] loads the Secp256k1 key for a remote signing node.
11654
+ * Sets the key loader for a node. This unlocks client operations that
11655
+ * require a private key. Passing in [NodeIdAndPasswordSigningKeyLoaderArgs]
11656
+ * loads the RSA key for an OSK node.
11657
+ * Passing in [MasterSeedSigningKeyLoaderArgs] loads the Secp256k1 key for a
11658
+ * remote signing node.
11655
11659
  *
11656
11660
  * @param nodeId The ID of the node the key is for
11657
11661
  * @param loader The loader for the key
@@ -11662,7 +11666,8 @@ var LightsparkClient = class {
11662
11666
  return !!key;
11663
11667
  }
11664
11668
  /**
11665
- * Gets the signing key for a node. Must have previously called [loadNodeSigningKey].
11669
+ * Gets the signing key for a node. Must have previously called
11670
+ * [loadNodeSigningKey].
11666
11671
  *
11667
11672
  * @param nodeId The ID of the node the key is for
11668
11673
  * @returns The signing key for the node
@@ -11671,7 +11676,8 @@ var LightsparkClient = class {
11671
11676
  return await this.nodeKeyLoaderCache.getKeyWithLoader(nodeId);
11672
11677
  }
11673
11678
  /**
11674
- * Sets the auth provider for the client. This is useful for switching between auth providers if you are using
11679
+ * Sets the auth provider for the client.
11680
+ * This is useful for switching between auth providers if you are using
11675
11681
  * multiple accounts or waiting for the user to log in.
11676
11682
  *
11677
11683
  * @param authProvider
@@ -11750,7 +11756,8 @@ var LightsparkClient = class {
11750
11756
  ) ?? [];
11751
11757
  }
11752
11758
  /**
11753
- * Starts listening for new transactions or updates to existing transactions for a list of nodes.
11759
+ * Starts listening for new transactions or updates to existing transactions
11760
+ * for a list of nodes.
11754
11761
  *
11755
11762
  * @param nodeIds The node IDs for which to listen to transactions.
11756
11763
  * @returns A zen-observable that emits transaction updates for the given node IDs.
@@ -11767,8 +11774,8 @@ var LightsparkClient = class {
11767
11774
  );
11768
11775
  }
11769
11776
  /**
11770
- * Retrieves a dashboard of basic info for the authenticated account. See `AccountDashboard` for which info is
11771
- * included.
11777
+ * Retrieves a dashboard of basic info for the authenticated account.
11778
+ * See `AccountDashboard` for which info is included.
11772
11779
  *
11773
11780
  * @param nodeIds The node IDs to include in the dashboard. Defaults to undefined (all nodes).
11774
11781
  * @param bitcoinNetwork The bitcoin network to include in the dashboard. Defaults to MAINNET.
@@ -11835,8 +11842,8 @@ var LightsparkClient = class {
11835
11842
  };
11836
11843
  }
11837
11844
  /**
11838
- * Gets a basic dashboard for a single node, including recent transactions. See `SingleNodeDashboard` for which info is
11839
- * included.
11845
+ * Gets a basic dashboard for a single node, including recent transactions.
11846
+ * See `SingleNodeDashboard` for which info is included.
11840
11847
  *
11841
11848
  * @param nodeId The node ID for which to get a dashboard.
11842
11849
  * @param bitcoinNetwork The bitcoin network for which to get a dashboard. Defaults to MAINNET.
@@ -11907,7 +11914,8 @@ var LightsparkClient = class {
11907
11914
  /**
11908
11915
  * Creates an invoice for the given node.
11909
11916
  *
11910
- * Test mode note: You can simulate a payment of this invoice in test move using [createTestModePayment].
11917
+ * Test mode note: You can simulate a payment of this invoice in test move
11918
+ * using [createTestModePayment].
11911
11919
  *
11912
11920
  * @param nodeId The node ID for which to create an invoice.
11913
11921
  * @param amountMsats The amount of the invoice in msats. You can create a zero-amount invoice to accept any payment amount.
@@ -11935,11 +11943,13 @@ var LightsparkClient = class {
11935
11943
  return response.create_invoice?.invoice.data?.encoded_payment_request;
11936
11944
  }
11937
11945
  /**
11938
- * Generates a Lightning Invoice (follows the Bolt 11 specification) to request a payment
11939
- * from another Lightning Node. This should only be used for generating invoices for LNURLs,
11946
+ * Generates a Lightning Invoice (follows the Bolt 11 specification) to
11947
+ * request a payment from another Lightning Node.
11948
+ * This should only be used for generating invoices for LNURLs,
11940
11949
  * with [createInvoice] preferred in the general case.
11941
11950
  *
11942
- * Test mode note: You can simulate a payment of this invoice in test move using [createTestModePayment].
11951
+ * Test mode note: You can simulate a payment of this invoice in test move
11952
+ * using [createTestModePayment].
11943
11953
  *
11944
11954
  * @param nodeId The node ID for which to create an invoice.
11945
11955
  * @param amountMsats The amount of the invoice in msats. You can create a zero-amount invoice to accept any payment amount.
@@ -11970,10 +11980,12 @@ var LightsparkClient = class {
11970
11980
  return InvoiceFromJson(invoiceJson);
11971
11981
  }
11972
11982
  /**
11973
- * Creates a new invoice for the UMA protocol. The metadata is hashed and included in the invoice.
11974
- * This API generates a Lightning Invoice (follows the Bolt 11 specification) to request a payment
11975
- * from another Lightning Node. This should only be used for generating invoices for UMA, with `createInvoice`
11976
- * preferred in the general case.
11983
+ * Creates a new invoice for the UMA protocol.
11984
+ * The metadata is hashed and included in the invoice.
11985
+ * This API generates a Lightning Invoice (follows the Bolt 11 specification)
11986
+ * to request a payment from another Lightning Node.
11987
+ * This should only be used for generating invoices for UMA,
11988
+ * with `createInvoice` preferred in the general case.
11977
11989
  *
11978
11990
  * @param nodeId The node ID for which to create an invoice.
11979
11991
  * @param amountMsats The amount of the invoice in msats. You can create a zero-amount invoice to accept any payment amount.
@@ -12014,7 +12026,8 @@ var LightsparkClient = class {
12014
12026
  return InvoiceDataFromJson(response.decoded_payment_request);
12015
12027
  }
12016
12028
  /**
12017
- * Gets an estimate of the fee for sending a payment over the given bitcoin network.
12029
+ * Gets an estimate of the fee for sending a payment over the given bitcoin
12030
+ * network.
12018
12031
  *
12019
12032
  * @param bitcoinNetwork The bitcoin network for which to get a fee estimate. Defaults to MAINNET.
12020
12033
  * @returns A fee estimate for the given bitcoin network including a minimum fee rate, and a max-speed fee rate.
@@ -12051,7 +12064,8 @@ var LightsparkClient = class {
12051
12064
  );
12052
12065
  }
12053
12066
  /**
12054
- * Returns an estimate of the fees that will be paid to send a payment to another Lightning node.
12067
+ * Returns an estimate of the fees that will be paid to send a payment to
12068
+ * another Lightning node.
12055
12069
  *
12056
12070
  * @param nodeId The node from where you want to send the payment.
12057
12071
  * @param destinationNodePublicKey The public key of the node that you want to pay.
@@ -12087,17 +12101,20 @@ var LightsparkClient = class {
12087
12101
  /**
12088
12102
  * Sends a lightning payment for a given invoice.
12089
12103
  *
12090
- * Test mode note: For test mode, you can use the [createTestModeInvoice] function to create an invoice you can
12091
- * pay in test mode.
12104
+ * Test mode note: For test mode, you can use the [createTestModeInvoice]
12105
+ * function to create an invoice you can pay in test mode.
12092
12106
  *
12093
12107
  * @param payerNodeId The ID of the node that will pay the invoice.
12094
12108
  * @param encodedInvoice The encoded invoice to pay.
12095
12109
  * @param maximumFeesMsats Maximum fees (in msats) to pay for the payment. This parameter is required.
12096
- * As guidance, a maximum fee of 16 basis points should make almost all transactions succeed. For example,
12097
- * for a transaction between 10k sats and 100k sats, this would mean a fee limit of 16 to 160 sats.
12110
+ * As guidance, a maximum fee of 16 basis points should make almost all
12111
+ * transactions succeed. For example,
12112
+ * for a transaction between 10k sats and 100k sats,
12113
+ * this would mean a fee limit of 16 to 160 sats.
12098
12114
  * @param timeoutSecs A timeout for the payment in seconds. Defaults to 60 seconds.
12099
12115
  * @param amountMsats The amount to pay in msats for a zero-amount invoice. Defaults to the full amount of the
12100
- * invoice. NOTE: This parameter can only be passed for a zero-amount invoice. Otherwise, the call will fail.
12116
+ * invoice. NOTE: This parameter can only be passed for a zero-amount
12117
+ * invoice. Otherwise, the call will fail.
12101
12118
  * @returns An `OutgoingPayment` object if the payment was successful, or undefined if the payment failed.
12102
12119
  */
12103
12120
  async payInvoice(payerNodeId, encodedInvoice, maximumFeesMsats, timeoutSecs = 60, amountMsats = void 0) {
@@ -12127,18 +12144,23 @@ var LightsparkClient = class {
12127
12144
  return response.pay_invoice && OutgoingPaymentFromJson(response.pay_invoice.payment);
12128
12145
  }
12129
12146
  /**
12130
- * sends an UMA payment to a node on the Lightning Network, based on the invoice
12131
- * (as defined by the BOLT11 specification) that you provide.
12132
- * This should only be used for paying UMA invoices, with `payInvoice` preferred in the general case.
12147
+ * sends an UMA payment to a node on the Lightning Network,
12148
+ * based on the invoice (as defined by the BOLT11 specification) that you
12149
+ * provide.
12150
+ * This should only be used for paying UMA invoices,
12151
+ * with `payInvoice` preferred in the general case.
12133
12152
  *
12134
12153
  * @param payerNodeId The ID of the node that will pay the invoice.
12135
12154
  * @param encodedInvoice The encoded invoice to pay.
12136
12155
  * @param maximumFeesMsats Maximum fees (in msats) to pay for the payment. This parameter is required.
12137
- * As guidance, a maximum fee of 16 basis points should make almost all transactions succeed. For example,
12138
- * for a transaction between 10k sats and 100k sats, this would mean a fee limit of 16 to 160 sats.
12156
+ * As guidance, a maximum fee of 16 basis points should make almost all
12157
+ * transactions succeed. For example,
12158
+ * for a transaction between 10k sats and 100k sats,
12159
+ * this would mean a fee limit of 16 to 160 sats.
12139
12160
  * @param timeoutSecs A timeout for the payment in seconds. Defaults to 60 seconds.
12140
12161
  * @param amountMsats The amount to pay in msats for a zero-amount invoice. Defaults to the full amount of the
12141
- * invoice. NOTE: This parameter can only be passed for a zero-amount invoice. Otherwise, the call will fail.
12162
+ * invoice. NOTE: This parameter can only be passed for a zero-amount
12163
+ * invoice. Otherwise, the call will fail.
12142
12164
  * @returns An `OutgoingPayment` object if the payment was successful, or undefined if the payment failed.
12143
12165
  */
12144
12166
  async payUmaInvoice(payerNodeId, encodedInvoice, maximumFeesMsats, timeoutSecs = 60, amountMsats = void 0) {
@@ -12168,7 +12190,8 @@ var LightsparkClient = class {
12168
12190
  return response.pay_uma_invoice && OutgoingPaymentFromJson(response.pay_invoice.payment);
12169
12191
  }
12170
12192
  /**
12171
- * Waits for a transaction to have a completed status, and returns the transaction.
12193
+ * Waits for a transaction to have a completed status, and returns the
12194
+ * transaction.
12172
12195
  *
12173
12196
  * @param transactionId The ID of the transaction to wait for
12174
12197
  * @param pollTimeoutSecs The timeout in seconds that we will wait before throwing an exception
@@ -12205,15 +12228,18 @@ var LightsparkClient = class {
12205
12228
  return transaction;
12206
12229
  }
12207
12230
  /**
12208
- * Sends a payment directly to a node on the Lightning Network through the public key of the node without an invoice.
12231
+ * Sends a payment directly to a node on the Lightning Network through the
12232
+ * public key of the node without an invoice.
12209
12233
  *
12210
12234
  * @param payerNodeId The ID of the node that will send the payment.
12211
12235
  * @param destinationPublicKey The public key of the destination node.
12212
12236
  * @param timeoutSecs The timeout in seconds that we will try to make the payment.
12213
12237
  * @param amountMsats The amount to pay in msats.
12214
12238
  * @param maximumFeesMsats Maximum fees (in msats) to pay for the payment. This parameter is required.
12215
- * As guidance, a maximum fee of 15 basis points should make almost all transactions succeed. For example,
12216
- * for a transaction between 10k sats and 100k sats, this would mean a fee limit of 15 to 150 sats.
12239
+ * As guidance, a maximum fee of 15 basis points should make almost all
12240
+ * transactions succeed. For example,
12241
+ * for a transaction between 10k sats and 100k sats,
12242
+ * this would mean a fee limit of 15 to 150 sats.
12217
12243
  * @returns An `OutgoingPayment` object if the payment was successful, or undefined if the payment failed.
12218
12244
  */
12219
12245
  async sendPayment(payerNodeId, destinationPublicKey, timeoutSecs = 60, amountMsats, maximumFeesMsats) {
@@ -12240,7 +12266,8 @@ var LightsparkClient = class {
12240
12266
  return response.send_payment && OutgoingPaymentFromJson(response.send_payment.payment);
12241
12267
  }
12242
12268
  /**
12243
- * Creates an L1 Bitcoin wallet address for a given node which can be used to deposit or withdraw funds.
12269
+ * Creates an L1 Bitcoin wallet address for a given node which can be used to
12270
+ * deposit or withdraw funds.
12244
12271
  *
12245
12272
  * @param nodeId The ID of the node to create a wallet address for.
12246
12273
  * @returns A string containing the wallet address for the given node.
@@ -12253,12 +12280,15 @@ var LightsparkClient = class {
12253
12280
  return response.create_node_wallet_address.wallet_address;
12254
12281
  }
12255
12282
  /**
12256
- * Withdraws funds from the account and sends it to the requested bitcoin address.
12283
+ * Withdraws funds from the account and sends it to the requested bitcoin
12284
+ * address.
12257
12285
  *
12258
- * Depending on the chosen mode, it will first take the funds from the wallet, and if applicable, close channels
12259
- * appropriately to recover enough funds and reopen channels with the remaining funds.
12260
- * The process is asynchronous and may take up to a few minutes. You can check the progress by polling the
12261
- * `WithdrawalRequest` that is created, or by subscribing to a webhook.
12286
+ * Depending on the chosen mode, it will first take the funds from the
12287
+ * wallet, and if applicable, close channels appropriately to recover enough
12288
+ * funds and reopen channels with the remaining funds.
12289
+ * The process is asynchronous and may take up to a few minutes.
12290
+ * You can check the progress by polling the `WithdrawalRequest` that is
12291
+ * created, or by subscribing to a webhook.
12262
12292
  *
12263
12293
  * @param nodeId The ID of the node from which to withdraw funds.
12264
12294
  * @param amountSats The amount of funds to withdraw in satoshis.
@@ -12279,9 +12309,10 @@ var LightsparkClient = class {
12279
12309
  return WithdrawalRequestFromJson(response.request_withdrawal.request);
12280
12310
  }
12281
12311
  /**
12282
- * Adds funds to a Lightspark node on the REGTEST network. If the amount is not specified, 10,000,000 SATOSHI will be
12283
- * added. This API only functions for nodes created on the REGTEST network and will return an error when called for
12284
- * any non-REGTEST node.
12312
+ * Adds funds to a Lightspark node on the REGTEST network.
12313
+ * If the amount is not specified, 10,000,000 SATOSHI will be added.
12314
+ * This API only functions for nodes created on the REGTEST network and will
12315
+ * return an error when called for any non-REGTEST node.
12285
12316
  *
12286
12317
  * @param nodeId The ID of the node to fund. Must be a REGTEST node.
12287
12318
  * @param amountSats The amount of funds to add to the node in satoshis. Defaults to 10,000,000 SATOSHI.
@@ -12295,8 +12326,8 @@ var LightsparkClient = class {
12295
12326
  return CurrencyAmountFromJson(response.fund_node.amount);
12296
12327
  }
12297
12328
  /**
12298
- * Creates a new API token that can be used to authenticate requests for this account when using the Lightspark APIs
12299
- * and SDKs.
12329
+ * Creates a new API token that can be used to authenticate requests for this
12330
+ * account when using the Lightspark APIs and SDKs.
12300
12331
  *
12301
12332
  * @param name Creates a new API token that can be used to authenticate requests for this account when using the
12302
12333
  * Lightspark APIs and SDKs.
@@ -12333,8 +12364,9 @@ var LightsparkClient = class {
12333
12364
  await this.requester.makeRawRequest(DeleteApiToken, { api_token_id: id });
12334
12365
  }
12335
12366
  /**
12336
- * In test mode, generates a Lightning Invoice which can be paid by a local node.
12337
- * This call is only valid in test mode. You can then pay the invoice using [payInvoice].
12367
+ * In test mode, generates a Lightning Invoice which can be paid by a local
12368
+ * node. This call is only valid in test mode.
12369
+ * You can then pay the invoice using [payInvoice].
12338
12370
  *
12339
12371
  * @param localNodeId The ID of the node that will pay the invoice.
12340
12372
  * @param amountMsats The amount to pay in milli-satoshis.
@@ -12363,8 +12395,9 @@ var LightsparkClient = class {
12363
12395
  });
12364
12396
  }
12365
12397
  /**
12366
- * In test mode, simulates a payment of a Lightning Invoice from another node.
12367
- * This can only be used in test mode and should be used with invoices generated by [createInvoice].
12398
+ * In test mode, simulates a payment of a Lightning Invoice from another
12399
+ * node. This can only be used in test mode and should be used with invoices
12400
+ * generated by [createInvoice].
12368
12401
  *
12369
12402
  * @param localNodeId The ID of the node that will receive the payment.
12370
12403
  * @param encodedInvoice The encoded invoice to pay.
@@ -12387,8 +12420,8 @@ var LightsparkClient = class {
12387
12420
  });
12388
12421
  }
12389
12422
  /**
12390
- * Creates an UMA invitation. If you are part of the incentive program, you should use
12391
- * [createUmaInvitationWithIncentives].
12423
+ * Creates an UMA invitation. If you are part of the incentive program,
12424
+ * you should use [createUmaInvitationWithIncentives].
12392
12425
  *
12393
12426
  * @param inviterUma The UMA of the inviter.
12394
12427
  * @returns The invitation that was created.
@@ -12442,8 +12475,8 @@ var LightsparkClient = class {
12442
12475
  });
12443
12476
  }
12444
12477
  /**
12445
- * Claims an UMA invitation. If you are part of the incentive program, you should use
12446
- * [claimUmaInvitationWithIncentives].
12478
+ * Claims an UMA invitation. If you are part of the incentive program,
12479
+ * you should use [claimUmaInvitationWithIncentives].
12447
12480
  *
12448
12481
  * @param invitationCode The invitation code to claim.
12449
12482
  * @param inviteeUma The UMA of the invitee.
@@ -12534,7 +12567,8 @@ var LightsparkClient = class {
12534
12567
  /**
12535
12568
  * Executes a raw `Query` against the Lightspark API.
12536
12569
  *
12537
- * This generally should not be used directly, but is exposed for advanced use cases and for internal use to retrieve
12570
+ * This generally should not be used directly,
12571
+ * but is exposed for advanced use cases and for internal use to retrieve
12538
12572
  * complex fields from objects.
12539
12573
  *
12540
12574
  * @param query The `Query` to execute.