@lightsparkdev/lightspark-sdk 1.2.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/{BitcoinNetwork-a816c0be.d.ts → BitcoinNetwork-972b1d01.d.ts} +4 -1
  3. package/dist/{chunk-GLL4KTUT.js → chunk-Y55D3PD4.js} +11 -11
  4. package/dist/env.d.cts +1 -1
  5. package/dist/env.d.ts +1 -1
  6. package/dist/{index-eb604025.d.ts → index-a5028d74.d.ts} +866 -451
  7. package/dist/index.cjs +622 -557
  8. package/dist/index.d.cts +3 -3
  9. package/dist/index.d.ts +3 -3
  10. package/dist/index.js +363 -298
  11. package/dist/objects/index.d.cts +2 -2
  12. package/dist/objects/index.d.ts +2 -2
  13. package/dist/objects/index.js +1 -1
  14. package/package.json +4 -4
  15. package/src/NodeKeyLoaderCache.ts +4 -3
  16. package/src/SigningKeyLoader.ts +12 -7
  17. package/src/client.ts +117 -65
  18. package/src/env.ts +3 -1
  19. package/src/graphql/CancelInvoice.ts +17 -0
  20. package/src/objects/Account.ts +7 -3
  21. package/src/objects/AccountToApiTokensConnection.ts +3 -2
  22. package/src/objects/AccountToChannelsConnection.ts +3 -2
  23. package/src/objects/AccountToNodesConnection.ts +3 -2
  24. package/src/objects/AccountToPaymentRequestsConnection.ts +3 -2
  25. package/src/objects/AccountToTransactionsConnection.ts +7 -6
  26. package/src/objects/AccountToWalletsConnection.ts +3 -2
  27. package/src/objects/ApiToken.ts +10 -5
  28. package/src/objects/Balances.ts +20 -12
  29. package/src/objects/BitcoinNetwork.ts +4 -1
  30. package/src/objects/CancelInvoiceInput.ts +18 -0
  31. package/src/objects/CancelInvoiceOutput.ts +26 -0
  32. package/src/objects/Channel.ts +26 -12
  33. package/src/objects/ChannelClosingTransaction.ts +7 -3
  34. package/src/objects/ChannelOpeningTransaction.ts +7 -3
  35. package/src/objects/ChannelStatus.ts +24 -5
  36. package/src/objects/ChannelToTransactionsConnection.ts +9 -8
  37. package/src/objects/Connection.ts +3 -2
  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 +2 -2
  43. package/src/objects/CurrencyUnit.ts +29 -6
  44. package/src/objects/Deposit.ts +8 -3
  45. package/src/objects/Entity.ts +8 -3
  46. package/src/objects/FeeEstimate.ts +5 -1
  47. package/src/objects/GraphNode.ts +20 -11
  48. package/src/objects/Hop.ts +8 -3
  49. package/src/objects/HtlcAttemptFailureCode.ts +4 -1
  50. package/src/objects/IncentivesIneligibilityReason.ts +16 -4
  51. package/src/objects/IncentivesStatus.ts +9 -2
  52. package/src/objects/IncomingPayment.ts +9 -5
  53. package/src/objects/IncomingPaymentAttempt.ts +7 -3
  54. package/src/objects/IncomingPaymentToAttemptsConnection.ts +3 -2
  55. package/src/objects/Invoice.ts +2 -2
  56. package/src/objects/InvoiceData.ts +7 -3
  57. package/src/objects/LightningFeeEstimateForInvoiceInput.ts +2 -2
  58. package/src/objects/LightningTransaction.ts +7 -3
  59. package/src/objects/LightsparkNode.ts +21 -12
  60. package/src/objects/LightsparkNodeOwner.ts +2 -2
  61. package/src/objects/LightsparkNodeToChannelsConnection.ts +3 -2
  62. package/src/objects/LightsparkNodeWithOSK.ts +20 -12
  63. package/src/objects/LightsparkNodeWithRemoteSigning.ts +16 -11
  64. package/src/objects/Node.ts +19 -11
  65. package/src/objects/NodeAddressType.ts +4 -1
  66. package/src/objects/NodeToAddressesConnection.ts +7 -3
  67. package/src/objects/OnChainTransaction.ts +8 -3
  68. package/src/objects/OutgoingPayment.ts +8 -3
  69. package/src/objects/OutgoingPaymentAttempt.ts +16 -9
  70. package/src/objects/OutgoingPaymentAttemptToHopsConnection.ts +7 -3
  71. package/src/objects/OutgoingPaymentToAttemptsConnection.ts +3 -2
  72. package/src/objects/PageInfo.ts +5 -1
  73. package/src/objects/PayInvoiceInput.ts +4 -1
  74. package/src/objects/PaymentFailureReason.ts +4 -1
  75. package/src/objects/PaymentRequest.ts +7 -3
  76. package/src/objects/PaymentRequestData.ts +5 -1
  77. package/src/objects/PaymentRequestStatus.ts +4 -1
  78. package/src/objects/Permission.ts +4 -1
  79. package/src/objects/RegisterPaymentInput.ts +8 -7
  80. package/src/objects/RequestWithdrawalInput.ts +2 -2
  81. package/src/objects/RiskRating.ts +5 -1
  82. package/src/objects/RoutingTransaction.ts +11 -5
  83. package/src/objects/RoutingTransactionFailureReason.ts +4 -1
  84. package/src/objects/ScreenNodeInput.ts +3 -2
  85. package/src/objects/SendPaymentInput.ts +4 -1
  86. package/src/objects/SetInvoicePaymentHashInput.ts +3 -2
  87. package/src/objects/Signable.ts +2 -2
  88. package/src/objects/SignablePayload.ts +6 -3
  89. package/src/objects/Transaction.ts +8 -3
  90. package/src/objects/TransactionStatus.ts +8 -2
  91. package/src/objects/TransactionType.ts +16 -4
  92. package/src/objects/TransactionUpdate.ts +6 -3
  93. package/src/objects/UmaInvitation.ts +2 -2
  94. package/src/objects/Wallet.ts +12 -4
  95. package/src/objects/WalletStatus.ts +18 -4
  96. package/src/objects/WalletToPaymentRequestsConnection.ts +3 -2
  97. package/src/objects/WalletToTransactionsConnection.ts +3 -2
  98. package/src/objects/WebhookEventType.ts +4 -1
  99. package/src/objects/Withdrawal.ts +7 -3
  100. package/src/objects/WithdrawalRequest.ts +10 -5
  101. package/src/objects/WithdrawalRequestToChannelClosingTransactionsConnection.ts +3 -2
  102. package/src/objects/WithdrawalRequestToChannelOpeningTransactionsConnection.ts +3 -2
  103. package/src/objects/index.ts +8 -6
  104. package/src/tests/integration/general-regtest.test.ts +15 -1
package/dist/index.js CHANGED
@@ -86,7 +86,7 @@ import {
86
86
  getTransactionQuery,
87
87
  getUmaInvitationQuery,
88
88
  getWithdrawalQuery
89
- } from "./chunk-GLL4KTUT.js";
89
+ } from "./chunk-Y55D3PD4.js";
90
90
  import {
91
91
  BitcoinNetwork_default
92
92
  } from "./chunk-K6SAUSAX.js";
@@ -129,22 +129,22 @@ var AccountTokenAuthProvider_default = AccountTokenAuthProvider;
129
129
  // src/client.ts
130
130
  import autoBind2 from "auto-bind";
131
131
  import {
132
- createSha256Hash,
133
132
  DefaultCrypto as DefaultCrypto2,
134
133
  LightsparkAuthException,
135
134
  LightsparkException,
136
135
  LightsparkSigningException as LightsparkSigningException3,
137
136
  NodeKeyCache,
138
- pollUntil,
139
137
  Requester,
140
138
  SigningKeyType as SigningKeyType2,
141
- StubAuthProvider
139
+ StubAuthProvider,
140
+ createSha256Hash,
141
+ pollUntil
142
142
  } from "@lightsparkdev/core";
143
143
 
144
144
  // package.json
145
145
  var package_default = {
146
146
  name: "@lightsparkdev/lightspark-sdk",
147
- version: "1.2.2",
147
+ version: "1.3.0",
148
148
  description: "Lightspark JS SDK",
149
149
  author: "Lightspark Inc.",
150
150
  keywords: [
@@ -213,7 +213,7 @@ var package_default = {
213
213
  ],
214
214
  scripts: {
215
215
  build: "yarn tsc && tsup",
216
- "build:watch": "yarn build --watch",
216
+ "build:watch": "yarn build --watch --clean=false",
217
217
  clean: "rm -rf .turbo && rm -rf dist",
218
218
  dev: "yarn build -- --watch",
219
219
  docs: "typedoc src",
@@ -232,7 +232,7 @@ var package_default = {
232
232
  },
233
233
  license: "Apache-2.0",
234
234
  dependencies: {
235
- "@lightsparkdev/core": "1.0.10",
235
+ "@lightsparkdev/core": "1.0.12",
236
236
  "@lightsparkdev/crypto-wasm": "0.1.2",
237
237
  "auto-bind": "^5.0.1",
238
238
  "crypto-browserify": "^3.12.0",
@@ -259,7 +259,192 @@ var package_default = {
259
259
  "tsc-absolute": "^1.0.1",
260
260
  tsup: "^7.2.0",
261
261
  typedoc: "^0.24.7",
262
- typescript: "^4.9.5"
262
+ typescript: "^5.0.0"
263
+ }
264
+ };
265
+
266
+ // src/NodeKeyLoaderCache.ts
267
+ import {
268
+ DefaultCrypto,
269
+ LightsparkSigningException as LightsparkSigningException2
270
+ } from "@lightsparkdev/core";
271
+
272
+ // src/SigningKeyLoader.ts
273
+ import {
274
+ LightsparkSigningException,
275
+ SigningKeyType,
276
+ b64encode as b64encode2,
277
+ isBrowser
278
+ } from "@lightsparkdev/core";
279
+
280
+ // src/graphql/RecoverNodeSigningKey.ts
281
+ var RecoverNodeSigningKey = `
282
+ query RecoverNodeSigningKey($nodeId: ID!) {
283
+ entity(id: $nodeId) {
284
+ __typename
285
+ ... on LightsparkNodeWithOSK {
286
+ encrypted_signing_private_key {
287
+ encrypted_value
288
+ cipher
289
+ }
290
+ }
291
+ }
292
+ }
293
+ `;
294
+
295
+ // src/SigningKeyLoader.ts
296
+ var SIGNING_KEY_PATH = "m/5";
297
+ function isNodeIdAndPasswordSigningKeyLoaderArgs(args) {
298
+ return args.password !== void 0;
299
+ }
300
+ function isMasterSeedSigningKeyLoaderArgs(args) {
301
+ return args.masterSeed !== void 0;
302
+ }
303
+ var NodeIdAndPasswordSigningKeyLoader = class {
304
+ nodeId;
305
+ password;
306
+ requester;
307
+ cryptoImpl;
308
+ constructor(args, requester, cryptoImpl) {
309
+ this.nodeId = args.nodeId;
310
+ this.password = args.password;
311
+ this.requester = requester;
312
+ this.cryptoImpl = cryptoImpl;
313
+ }
314
+ async loadSigningKey() {
315
+ const encryptedKey = await this.recoverNodeSigningKey();
316
+ if (!encryptedKey) {
317
+ console.warn("No encrypted key found for node " + this.nodeId);
318
+ return;
319
+ }
320
+ const signingPrivateKey = await this.cryptoImpl.decryptSecretWithNodePassword(
321
+ encryptedKey.cipher,
322
+ encryptedKey.encrypted_value,
323
+ this.password
324
+ );
325
+ if (!signingPrivateKey) {
326
+ throw new LightsparkSigningException(
327
+ "Unable to decrypt signing key with provided password. Please try again."
328
+ );
329
+ }
330
+ let signingPrivateKeyPEM = "";
331
+ if (new Uint8Array(signingPrivateKey)[0] === 48) {
332
+ signingPrivateKeyPEM = b64encode2(signingPrivateKey);
333
+ } else {
334
+ const dec = new TextDecoder();
335
+ signingPrivateKeyPEM = dec.decode(signingPrivateKey);
336
+ }
337
+ return { key: signingPrivateKeyPEM, type: SigningKeyType.RSASigningKey };
338
+ }
339
+ async recoverNodeSigningKey() {
340
+ const response = await this.requester.makeRawRequest(
341
+ RecoverNodeSigningKey,
342
+ { nodeId: this.nodeId }
343
+ );
344
+ const nodeEntity = response.entity;
345
+ if (nodeEntity?.__typename === "LightsparkNodeWithOSK") {
346
+ return nodeEntity.encrypted_signing_private_key;
347
+ }
348
+ return null;
349
+ }
350
+ };
351
+ var MasterSeedSigningKeyLoader = class {
352
+ masterSeed;
353
+ network;
354
+ constructor(args) {
355
+ this.masterSeed = args.masterSeed;
356
+ this.network = args.network;
357
+ }
358
+ async loadSigningKey() {
359
+ if (isBrowser) {
360
+ throw new LightsparkSigningException(
361
+ "Browser environments not supported for master seed signing key loader."
362
+ );
363
+ }
364
+ const { LightsparkSigner, Network } = await import("@lightsparkdev/crypto-wasm");
365
+ let cryptoLibNetwork;
366
+ switch (this.network) {
367
+ case BitcoinNetwork_default.MAINNET:
368
+ cryptoLibNetwork = Network.Bitcoin;
369
+ break;
370
+ case BitcoinNetwork_default.TESTNET:
371
+ cryptoLibNetwork = Network.Testnet;
372
+ break;
373
+ case BitcoinNetwork_default.REGTEST:
374
+ cryptoLibNetwork = Network.Regtest;
375
+ break;
376
+ default:
377
+ throw new Error(
378
+ `Unsupported lightspark_crypto network ${this.network}.`
379
+ );
380
+ }
381
+ const lightsparkSigner = LightsparkSigner.from_bytes(
382
+ this.masterSeed,
383
+ cryptoLibNetwork
384
+ );
385
+ const privateKey = lightsparkSigner.derive_private_key(SIGNING_KEY_PATH);
386
+ return { key: privateKey, type: SigningKeyType.Secp256k1SigningKey };
387
+ }
388
+ };
389
+
390
+ // src/NodeKeyLoaderCache.ts
391
+ var NodeKeyLoaderCache = class {
392
+ constructor(nodeKeyCache, cryptoImpl = DefaultCrypto) {
393
+ this.nodeKeyCache = nodeKeyCache;
394
+ this.cryptoImpl = cryptoImpl;
395
+ this.idToLoader = /* @__PURE__ */ new Map();
396
+ }
397
+ idToLoader;
398
+ /**
399
+ * Sets the signing key loader for a node.
400
+ * Instantiates a signing key loader based on the type of args passed in by
401
+ * the user.
402
+ *
403
+ * @param nodeId The ID of the node to get the key for
404
+ * @param loaderArgs Loader arguments for loading the key
405
+ * @param requester Requester used for loading the key
406
+ */
407
+ setLoader(nodeId, loaderArgs, requester) {
408
+ let loader;
409
+ if (isNodeIdAndPasswordSigningKeyLoaderArgs(loaderArgs)) {
410
+ loader = new NodeIdAndPasswordSigningKeyLoader(
411
+ { nodeId, ...loaderArgs },
412
+ requester,
413
+ this.cryptoImpl
414
+ );
415
+ } else if (isMasterSeedSigningKeyLoaderArgs(loaderArgs)) {
416
+ loader = new MasterSeedSigningKeyLoader({ ...loaderArgs });
417
+ } else {
418
+ throw new LightsparkSigningException2("Invalid signing key loader args");
419
+ }
420
+ this.idToLoader.set(nodeId, loader);
421
+ }
422
+ /**
423
+ * Gets the key for a node using the loader set by [setLoader]
424
+ *
425
+ * @param id The ID of the node to get the key for
426
+ * @returns The loaded key
427
+ */
428
+ async getKeyWithLoader(id) {
429
+ if (this.nodeKeyCache.hasKey(id)) {
430
+ return this.nodeKeyCache.getKey(id);
431
+ }
432
+ const loader = this.idToLoader.get(id);
433
+ if (!loader) {
434
+ throw new LightsparkSigningException2(
435
+ "No signing key loader found for node " + id
436
+ );
437
+ }
438
+ const loaderResult = await loader.loadSigningKey();
439
+ if (!loaderResult) {
440
+ return;
441
+ }
442
+ const key = await this.nodeKeyCache.loadKey(
443
+ id,
444
+ { key: loaderResult.key },
445
+ loaderResult.type
446
+ );
447
+ return key || void 0;
263
448
  }
264
449
  };
265
450
 
@@ -274,6 +459,21 @@ var BitcoinFeeEstimate = `
274
459
  ${FRAGMENT2}
275
460
  `;
276
461
 
462
+ // src/graphql/CancelInvoice.ts
463
+ var CancelInvoice = `
464
+ mutation CancelInvoice(
465
+ $invoice_id: ID!
466
+ ) {
467
+ cancel_invoice(input: { invoice_id: $invoice_id }) {
468
+ invoice {
469
+ ...InvoiceFragment
470
+ }
471
+ }
472
+ }
473
+
474
+ ${FRAGMENT4}
475
+ `;
476
+
277
477
  // src/graphql/ClaimUmaInvitation.ts
278
478
  var ClaimUmaInvitation = `
279
479
  mutation ClaimUmaInvitation(
@@ -290,7 +490,7 @@ var ClaimUmaInvitation = `
290
490
  }
291
491
  }
292
492
 
293
- ${FRAGMENT3}
493
+ ${FRAGMENT5}
294
494
  `;
295
495
 
296
496
  // src/graphql/ClaimUmaInvitationWithIncentives.ts
@@ -313,7 +513,7 @@ var ClaimUmaInvitationWithIncentives = `
313
513
  }
314
514
  }
315
515
 
316
- ${FRAGMENT3}
516
+ ${FRAGMENT5}
317
517
  `;
318
518
 
319
519
  // src/graphql/CreateApiToken.ts
@@ -333,7 +533,7 @@ var CreateApiToken = `
333
533
  }
334
534
  }
335
535
 
336
- ${FRAGMENT4}
536
+ ${FRAGMENT6}
337
537
  `;
338
538
 
339
539
  // src/graphql/CreateInvoice.ts
@@ -374,7 +574,7 @@ mutation CreateLnurlInvoice(
374
574
  }
375
575
  }
376
576
  }
377
- ${FRAGMENT6}
577
+ ${FRAGMENT4}
378
578
  `;
379
579
 
380
580
  // src/graphql/CreateNodeWalletAddress.ts
@@ -444,7 +644,7 @@ var CreateUmaInvitation = `
444
644
  }
445
645
  }
446
646
 
447
- ${FRAGMENT3}
647
+ ${FRAGMENT5}
448
648
  `;
449
649
 
450
650
  // src/graphql/CreateUmaInvitationWithIncentives.ts
@@ -465,7 +665,7 @@ var CreateUmaInvitationWithIncentives = `
465
665
  }
466
666
  }
467
667
 
468
- ${FRAGMENT3}
668
+ ${FRAGMENT5}
469
669
  `;
470
670
 
471
671
  // src/graphql/CreateUmaInvoice.ts
@@ -487,7 +687,7 @@ mutation CreateUmaInvoice(
487
687
  }
488
688
  }
489
689
  }
490
- ${FRAGMENT6}
690
+ ${FRAGMENT4}
491
691
  `;
492
692
 
493
693
  // src/graphql/DecodeInvoice.ts
@@ -501,7 +701,7 @@ var DecodeInvoice = `
501
701
  }
502
702
  }
503
703
 
504
- ${FRAGMENT5}
704
+ ${FRAGMENT3}
505
705
  `;
506
706
 
507
707
  // src/graphql/DeleteApiToken.ts
@@ -527,7 +727,7 @@ var FetchUmaInvitation = `
527
727
  }
528
728
  }
529
729
 
530
- ${FRAGMENT3}
730
+ ${FRAGMENT5}
531
731
  `;
532
732
 
533
733
  // src/graphql/FundNode.ts
@@ -686,6 +886,33 @@ var PayInvoice = `
686
886
  ${FRAGMENT9}
687
887
  `;
688
888
 
889
+ // src/graphql/PayUmaInvoice.ts
890
+ var PayUmaInvoice = `
891
+ mutation PayUmaInvoice(
892
+ $node_id: ID!
893
+ $encoded_invoice: String!
894
+ $timeout_secs: Int!
895
+ $maximum_fees_msats: Long!
896
+ $amount_msats: Long
897
+ ) {
898
+ pay_uma_invoice(
899
+ input: {
900
+ node_id: $node_id
901
+ encoded_invoice: $encoded_invoice
902
+ timeout_secs: $timeout_secs
903
+ maximum_fees_msats: $maximum_fees_msats
904
+ amount_msats: $amount_msats
905
+ }
906
+ ) {
907
+ payment {
908
+ ...OutgoingPaymentFragment
909
+ }
910
+ }
911
+ }
912
+
913
+ ${FRAGMENT9}
914
+ `;
915
+
689
916
  // src/graphql/PaymentRequestsForNode.ts
690
917
  var PaymentRequestsForNode = `
691
918
  query PaymentRequestsForNode(
@@ -717,33 +944,6 @@ query PaymentRequestsForNode(
717
944
  ${FRAGMENT10}
718
945
  `;
719
946
 
720
- // src/graphql/PayUmaInvoice.ts
721
- var PayUmaInvoice = `
722
- mutation PayUmaInvoice(
723
- $node_id: ID!
724
- $encoded_invoice: String!
725
- $timeout_secs: Int!
726
- $maximum_fees_msats: Long!
727
- $amount_msats: Long
728
- ) {
729
- pay_uma_invoice(
730
- input: {
731
- node_id: $node_id
732
- encoded_invoice: $encoded_invoice
733
- timeout_secs: $timeout_secs
734
- maximum_fees_msats: $maximum_fees_msats
735
- amount_msats: $amount_msats
736
- }
737
- ) {
738
- payment {
739
- ...OutgoingPaymentFragment
740
- }
741
- }
742
- }
743
-
744
- ${FRAGMENT9}
745
- `;
746
-
747
947
  // src/graphql/RequestWithdrawal.ts
748
948
  var RequestWithdrawal = `
749
949
  mutation RequestWithdrawal(
@@ -906,6 +1106,20 @@ ${FRAGMENT12}
906
1106
  ${FRAGMENT}
907
1107
  `;
908
1108
 
1109
+ // src/graphql/TransactionSubscription.ts
1110
+ var TransactionSubscription = `
1111
+ subscription TransactionSubscription(
1112
+ $nodeIds: [ID!]!
1113
+ ) {
1114
+ transactions(node_ids: $nodeIds) {
1115
+ ...TransactionUpdateFragment
1116
+ __typename
1117
+ }
1118
+ }
1119
+
1120
+ ${FRAGMENT13}
1121
+ `;
1122
+
909
1123
  // src/graphql/TransactionsForNode.ts
910
1124
  var TransactionsForNode = `
911
1125
  query TransactionsForNode(
@@ -945,204 +1159,6 @@ ${FRAGMENT12}
945
1159
  ${FRAGMENT}
946
1160
  `;
947
1161
 
948
- // src/graphql/TransactionSubscription.ts
949
- var TransactionSubscription = `
950
- subscription TransactionSubscription(
951
- $nodeIds: [ID!]!
952
- ) {
953
- transactions(node_ids: $nodeIds) {
954
- ...TransactionUpdateFragment
955
- __typename
956
- }
957
- }
958
-
959
- ${FRAGMENT13}
960
- `;
961
-
962
- // src/NodeKeyLoaderCache.ts
963
- import {
964
- DefaultCrypto,
965
- LightsparkSigningException as LightsparkSigningException2
966
- } from "@lightsparkdev/core";
967
-
968
- // src/SigningKeyLoader.ts
969
- import {
970
- b64encode as b64encode2,
971
- isBrowser,
972
- LightsparkSigningException,
973
- SigningKeyType
974
- } from "@lightsparkdev/core";
975
-
976
- // src/graphql/RecoverNodeSigningKey.ts
977
- var RecoverNodeSigningKey = `
978
- query RecoverNodeSigningKey($nodeId: ID!) {
979
- entity(id: $nodeId) {
980
- __typename
981
- ... on LightsparkNodeWithOSK {
982
- encrypted_signing_private_key {
983
- encrypted_value
984
- cipher
985
- }
986
- }
987
- }
988
- }
989
- `;
990
-
991
- // src/SigningKeyLoader.ts
992
- var SIGNING_KEY_PATH = "m/5";
993
- function isNodeIdAndPasswordSigningKeyLoaderArgs(args) {
994
- return args.password !== void 0;
995
- }
996
- function isMasterSeedSigningKeyLoaderArgs(args) {
997
- return args.masterSeed !== void 0;
998
- }
999
- var NodeIdAndPasswordSigningKeyLoader = class {
1000
- nodeId;
1001
- password;
1002
- requester;
1003
- cryptoImpl;
1004
- constructor(args, requester, cryptoImpl) {
1005
- this.nodeId = args.nodeId;
1006
- this.password = args.password;
1007
- this.requester = requester;
1008
- this.cryptoImpl = cryptoImpl;
1009
- }
1010
- async loadSigningKey() {
1011
- const encryptedKey = await this.recoverNodeSigningKey();
1012
- if (!encryptedKey) {
1013
- console.warn("No encrypted key found for node " + this.nodeId);
1014
- return;
1015
- }
1016
- const signingPrivateKey = await this.cryptoImpl.decryptSecretWithNodePassword(
1017
- encryptedKey.cipher,
1018
- encryptedKey.encrypted_value,
1019
- this.password
1020
- );
1021
- if (!signingPrivateKey) {
1022
- throw new LightsparkSigningException(
1023
- "Unable to decrypt signing key with provided password. Please try again."
1024
- );
1025
- }
1026
- let signingPrivateKeyPEM = "";
1027
- if (new Uint8Array(signingPrivateKey)[0] === 48) {
1028
- signingPrivateKeyPEM = b64encode2(signingPrivateKey);
1029
- } else {
1030
- const dec = new TextDecoder();
1031
- signingPrivateKeyPEM = dec.decode(signingPrivateKey);
1032
- }
1033
- return { key: signingPrivateKeyPEM, type: SigningKeyType.RSASigningKey };
1034
- }
1035
- async recoverNodeSigningKey() {
1036
- const response = await this.requester.makeRawRequest(
1037
- RecoverNodeSigningKey,
1038
- { nodeId: this.nodeId }
1039
- );
1040
- const nodeEntity = response.entity;
1041
- if (nodeEntity?.__typename === "LightsparkNodeWithOSK") {
1042
- return nodeEntity.encrypted_signing_private_key;
1043
- }
1044
- return null;
1045
- }
1046
- };
1047
- var MasterSeedSigningKeyLoader = class {
1048
- masterSeed;
1049
- network;
1050
- constructor(args) {
1051
- this.masterSeed = args.masterSeed;
1052
- this.network = args.network;
1053
- }
1054
- async loadSigningKey() {
1055
- if (isBrowser) {
1056
- throw new LightsparkSigningException(
1057
- "Browser environments not supported for master seed signing key loader."
1058
- );
1059
- }
1060
- const { LightsparkSigner, Network } = await import("@lightsparkdev/crypto-wasm");
1061
- let cryptoLibNetwork;
1062
- switch (this.network) {
1063
- case BitcoinNetwork_default.MAINNET:
1064
- cryptoLibNetwork = Network.Bitcoin;
1065
- break;
1066
- case BitcoinNetwork_default.TESTNET:
1067
- cryptoLibNetwork = Network.Testnet;
1068
- break;
1069
- case BitcoinNetwork_default.REGTEST:
1070
- cryptoLibNetwork = Network.Regtest;
1071
- break;
1072
- default:
1073
- throw new Error(
1074
- `Unsupported lightspark_crypto network ${this.network}.`
1075
- );
1076
- }
1077
- const lightsparkSigner = LightsparkSigner.from_bytes(
1078
- this.masterSeed,
1079
- cryptoLibNetwork
1080
- );
1081
- const privateKey = lightsparkSigner.derive_private_key(SIGNING_KEY_PATH);
1082
- return { key: privateKey, type: SigningKeyType.Secp256k1SigningKey };
1083
- }
1084
- };
1085
-
1086
- // src/NodeKeyLoaderCache.ts
1087
- var NodeKeyLoaderCache = class {
1088
- constructor(nodeKeyCache, cryptoImpl = DefaultCrypto) {
1089
- this.nodeKeyCache = nodeKeyCache;
1090
- this.cryptoImpl = cryptoImpl;
1091
- this.idToLoader = /* @__PURE__ */ new Map();
1092
- }
1093
- idToLoader;
1094
- /**
1095
- * Sets the signing key loader for a node.
1096
- * Instantiates a signing key loader based on the type of args passed in by the user.
1097
- *
1098
- * @param nodeId The ID of the node to get the key for
1099
- * @param loaderArgs Loader arguments for loading the key
1100
- * @param requester Requester used for loading the key
1101
- */
1102
- setLoader(nodeId, loaderArgs, requester) {
1103
- let loader;
1104
- if (isNodeIdAndPasswordSigningKeyLoaderArgs(loaderArgs)) {
1105
- loader = new NodeIdAndPasswordSigningKeyLoader(
1106
- { nodeId, ...loaderArgs },
1107
- requester,
1108
- this.cryptoImpl
1109
- );
1110
- } else if (isMasterSeedSigningKeyLoaderArgs(loaderArgs)) {
1111
- loader = new MasterSeedSigningKeyLoader({ ...loaderArgs });
1112
- } else {
1113
- throw new LightsparkSigningException2("Invalid signing key loader args");
1114
- }
1115
- this.idToLoader.set(nodeId, loader);
1116
- }
1117
- /**
1118
- * Gets the key for a node using the loader set by [setLoader]
1119
- *
1120
- * @param id The ID of the node to get the key for
1121
- * @returns The loaded key
1122
- */
1123
- async getKeyWithLoader(id) {
1124
- if (this.nodeKeyCache.hasKey(id)) {
1125
- return this.nodeKeyCache.getKey(id);
1126
- }
1127
- const loader = this.idToLoader.get(id);
1128
- if (!loader) {
1129
- throw new LightsparkSigningException2(
1130
- "No signing key loader found for node " + id
1131
- );
1132
- }
1133
- const loaderResult = await loader.loadSigningKey();
1134
- if (!loaderResult) {
1135
- return;
1136
- }
1137
- const key = await this.nodeKeyCache.loadKey(
1138
- id,
1139
- { key: loaderResult.key },
1140
- loaderResult.type
1141
- );
1142
- return key || void 0;
1143
- }
1144
- };
1145
-
1146
1162
  // src/client.ts
1147
1163
  var sdkVersion = package_default.version;
1148
1164
  var LightsparkClient = class {
@@ -1154,7 +1170,8 @@ var LightsparkClient = class {
1154
1170
  * use, you should use the `AccountTokenAuthProvider`.
1155
1171
  * @param serverUrl The base URL of the server to connect to. Defaults to lightspark production.
1156
1172
  * @param cryptoImpl The crypto implementation to use. Defaults to web and node compatible crypto.
1157
- * For React Native, you should use the `ReactNativeCrypto` implementation from `@lightsparkdev/react-native`.
1173
+ * For React Native, you should use the `ReactNativeCrypto`
1174
+ * implementation from `@lightsparkdev/react-native`.
1158
1175
  */
1159
1176
  constructor(authProvider = new StubAuthProvider(), serverUrl = "api.lightspark.com", cryptoImpl = DefaultCrypto2) {
1160
1177
  this.authProvider = authProvider;
@@ -1180,9 +1197,11 @@ var LightsparkClient = class {
1180
1197
  nodeKeyLoaderCache;
1181
1198
  LIGHTSPARK_SDK_ENDPOINT = process.env.LIGHTSPARK_SDK_ENDPOINT || "graphql/server/2023-09-13";
1182
1199
  /**
1183
- * Sets the key loader for a node. This unlocks client operations that require a private key.
1184
- * Passing in [NodeIdAndPasswordSigningKeyLoaderArgs] loads the RSA key for an OSK node.
1185
- * Passing in [MasterSeedSigningKeyLoaderArgs] loads the Secp256k1 key for a remote signing node.
1200
+ * Sets the key loader for a node. This unlocks client operations that
1201
+ * require a private key. Passing in [NodeIdAndPasswordSigningKeyLoaderArgs]
1202
+ * loads the RSA key for an OSK node.
1203
+ * Passing in [MasterSeedSigningKeyLoaderArgs] loads the Secp256k1 key for a
1204
+ * remote signing node.
1186
1205
  *
1187
1206
  * @param nodeId The ID of the node the key is for
1188
1207
  * @param loader The loader for the key
@@ -1193,7 +1212,8 @@ var LightsparkClient = class {
1193
1212
  return !!key;
1194
1213
  }
1195
1214
  /**
1196
- * Gets the signing key for a node. Must have previously called [loadNodeSigningKey].
1215
+ * Gets the signing key for a node. Must have previously called
1216
+ * [loadNodeSigningKey].
1197
1217
  *
1198
1218
  * @param nodeId The ID of the node the key is for
1199
1219
  * @returns The signing key for the node
@@ -1202,7 +1222,8 @@ var LightsparkClient = class {
1202
1222
  return await this.nodeKeyLoaderCache.getKeyWithLoader(nodeId);
1203
1223
  }
1204
1224
  /**
1205
- * Sets the auth provider for the client. This is useful for switching between auth providers if you are using
1225
+ * Sets the auth provider for the client.
1226
+ * This is useful for switching between auth providers if you are using
1206
1227
  * multiple accounts or waiting for the user to log in.
1207
1228
  *
1208
1229
  * @param authProvider
@@ -1281,7 +1302,8 @@ var LightsparkClient = class {
1281
1302
  ) ?? [];
1282
1303
  }
1283
1304
  /**
1284
- * Starts listening for new transactions or updates to existing transactions for a list of nodes.
1305
+ * Starts listening for new transactions or updates to existing transactions
1306
+ * for a list of nodes.
1285
1307
  *
1286
1308
  * @param nodeIds The node IDs for which to listen to transactions.
1287
1309
  * @returns A zen-observable that emits transaction updates for the given node IDs.
@@ -1298,8 +1320,8 @@ var LightsparkClient = class {
1298
1320
  );
1299
1321
  }
1300
1322
  /**
1301
- * Retrieves a dashboard of basic info for the authenticated account. See `AccountDashboard` for which info is
1302
- * included.
1323
+ * Retrieves a dashboard of basic info for the authenticated account.
1324
+ * See `AccountDashboard` for which info is included.
1303
1325
  *
1304
1326
  * @param nodeIds The node IDs to include in the dashboard. Defaults to undefined (all nodes).
1305
1327
  * @param bitcoinNetwork The bitcoin network to include in the dashboard. Defaults to MAINNET.
@@ -1366,8 +1388,8 @@ var LightsparkClient = class {
1366
1388
  };
1367
1389
  }
1368
1390
  /**
1369
- * Gets a basic dashboard for a single node, including recent transactions. See `SingleNodeDashboard` for which info is
1370
- * included.
1391
+ * Gets a basic dashboard for a single node, including recent transactions.
1392
+ * See `SingleNodeDashboard` for which info is included.
1371
1393
  *
1372
1394
  * @param nodeId The node ID for which to get a dashboard.
1373
1395
  * @param bitcoinNetwork The bitcoin network for which to get a dashboard. Defaults to MAINNET.
@@ -1438,7 +1460,8 @@ var LightsparkClient = class {
1438
1460
  /**
1439
1461
  * Creates an invoice for the given node.
1440
1462
  *
1441
- * Test mode note: You can simulate a payment of this invoice in test move using [createTestModePayment].
1463
+ * Test mode note: You can simulate a payment of this invoice in test move
1464
+ * using [createTestModePayment].
1442
1465
  *
1443
1466
  * @param nodeId The node ID for which to create an invoice.
1444
1467
  * @param amountMsats The amount of the invoice in msats. You can create a zero-amount invoice to accept any payment amount.
@@ -1466,11 +1489,13 @@ var LightsparkClient = class {
1466
1489
  return response.create_invoice?.invoice.data?.encoded_payment_request;
1467
1490
  }
1468
1491
  /**
1469
- * Generates a Lightning Invoice (follows the Bolt 11 specification) to request a payment
1470
- * from another Lightning Node. This should only be used for generating invoices for LNURLs,
1492
+ * Generates a Lightning Invoice (follows the Bolt 11 specification) to
1493
+ * request a payment from another Lightning Node.
1494
+ * This should only be used for generating invoices for LNURLs,
1471
1495
  * with [createInvoice] preferred in the general case.
1472
1496
  *
1473
- * Test mode note: You can simulate a payment of this invoice in test move using [createTestModePayment].
1497
+ * Test mode note: You can simulate a payment of this invoice in test move
1498
+ * using [createTestModePayment].
1474
1499
  *
1475
1500
  * @param nodeId The node ID for which to create an invoice.
1476
1501
  * @param amountMsats The amount of the invoice in msats. You can create a zero-amount invoice to accept any payment amount.
@@ -1501,10 +1526,12 @@ var LightsparkClient = class {
1501
1526
  return InvoiceFromJson(invoiceJson);
1502
1527
  }
1503
1528
  /**
1504
- * Creates a new invoice for the UMA protocol. The metadata is hashed and included in the invoice.
1505
- * This API generates a Lightning Invoice (follows the Bolt 11 specification) to request a payment
1506
- * from another Lightning Node. This should only be used for generating invoices for UMA, with `createInvoice`
1507
- * preferred in the general case.
1529
+ * Creates a new invoice for the UMA protocol.
1530
+ * The metadata is hashed and included in the invoice.
1531
+ * This API generates a Lightning Invoice (follows the Bolt 11 specification)
1532
+ * to request a payment from another Lightning Node.
1533
+ * This should only be used for generating invoices for UMA,
1534
+ * with `createInvoice` preferred in the general case.
1508
1535
  *
1509
1536
  * @param nodeId The node ID for which to create an invoice.
1510
1537
  * @param amountMsats The amount of the invoice in msats. You can create a zero-amount invoice to accept any payment amount.
@@ -1532,6 +1559,22 @@ var LightsparkClient = class {
1532
1559
  }
1533
1560
  return InvoiceFromJson(invoiceJson);
1534
1561
  }
1562
+ /**
1563
+ * Cancels an existing unpaid invoice and returns that invoice. Cancelled invoices cannot be paid.
1564
+ *
1565
+ * @param invoiceId The ID of the invoice to cancel.
1566
+ * @returns The cancelled invoice, or undefined if the invoice could not be cancelled.
1567
+ */
1568
+ async cancelInvoice(invoiceId) {
1569
+ const response = await this.requester.makeRawRequest(CancelInvoice, {
1570
+ invoice_id: invoiceId
1571
+ });
1572
+ const invoiceJson = response.cancel_invoice?.invoice;
1573
+ if (!invoiceJson) {
1574
+ return void 0;
1575
+ }
1576
+ return InvoiceFromJson(invoiceJson);
1577
+ }
1535
1578
  /**
1536
1579
  * Decodes an encoded lightning invoice string.
1537
1580
  *
@@ -1545,7 +1588,8 @@ var LightsparkClient = class {
1545
1588
  return InvoiceDataFromJson(response.decoded_payment_request);
1546
1589
  }
1547
1590
  /**
1548
- * Gets an estimate of the fee for sending a payment over the given bitcoin network.
1591
+ * Gets an estimate of the fee for sending a payment over the given bitcoin
1592
+ * network.
1549
1593
  *
1550
1594
  * @param bitcoinNetwork The bitcoin network for which to get a fee estimate. Defaults to MAINNET.
1551
1595
  * @returns A fee estimate for the given bitcoin network including a minimum fee rate, and a max-speed fee rate.
@@ -1582,7 +1626,8 @@ var LightsparkClient = class {
1582
1626
  );
1583
1627
  }
1584
1628
  /**
1585
- * Returns an estimate of the fees that will be paid to send a payment to another Lightning node.
1629
+ * Returns an estimate of the fees that will be paid to send a payment to
1630
+ * another Lightning node.
1586
1631
  *
1587
1632
  * @param nodeId The node from where you want to send the payment.
1588
1633
  * @param destinationNodePublicKey The public key of the node that you want to pay.
@@ -1618,17 +1663,20 @@ var LightsparkClient = class {
1618
1663
  /**
1619
1664
  * Sends a lightning payment for a given invoice.
1620
1665
  *
1621
- * Test mode note: For test mode, you can use the [createTestModeInvoice] function to create an invoice you can
1622
- * pay in test mode.
1666
+ * Test mode note: For test mode, you can use the [createTestModeInvoice]
1667
+ * function to create an invoice you can pay in test mode.
1623
1668
  *
1624
1669
  * @param payerNodeId The ID of the node that will pay the invoice.
1625
1670
  * @param encodedInvoice The encoded invoice to pay.
1626
1671
  * @param maximumFeesMsats Maximum fees (in msats) to pay for the payment. This parameter is required.
1627
- * As guidance, a maximum fee of 16 basis points should make almost all transactions succeed. For example,
1628
- * for a transaction between 10k sats and 100k sats, this would mean a fee limit of 16 to 160 sats.
1672
+ * As guidance, a maximum fee of 16 basis points should make almost all
1673
+ * transactions succeed. For example,
1674
+ * for a transaction between 10k sats and 100k sats,
1675
+ * this would mean a fee limit of 16 to 160 sats.
1629
1676
  * @param timeoutSecs A timeout for the payment in seconds. Defaults to 60 seconds.
1630
1677
  * @param amountMsats The amount to pay in msats for a zero-amount invoice. Defaults to the full amount of the
1631
- * invoice. NOTE: This parameter can only be passed for a zero-amount invoice. Otherwise, the call will fail.
1678
+ * invoice. NOTE: This parameter can only be passed for a zero-amount
1679
+ * invoice. Otherwise, the call will fail.
1632
1680
  * @returns An `OutgoingPayment` object if the payment was successful, or undefined if the payment failed.
1633
1681
  */
1634
1682
  async payInvoice(payerNodeId, encodedInvoice, maximumFeesMsats, timeoutSecs = 60, amountMsats = void 0) {
@@ -1658,18 +1706,23 @@ var LightsparkClient = class {
1658
1706
  return response.pay_invoice && OutgoingPaymentFromJson(response.pay_invoice.payment);
1659
1707
  }
1660
1708
  /**
1661
- * sends an UMA payment to a node on the Lightning Network, based on the invoice
1662
- * (as defined by the BOLT11 specification) that you provide.
1663
- * This should only be used for paying UMA invoices, with `payInvoice` preferred in the general case.
1709
+ * sends an UMA payment to a node on the Lightning Network,
1710
+ * based on the invoice (as defined by the BOLT11 specification) that you
1711
+ * provide.
1712
+ * This should only be used for paying UMA invoices,
1713
+ * with `payInvoice` preferred in the general case.
1664
1714
  *
1665
1715
  * @param payerNodeId The ID of the node that will pay the invoice.
1666
1716
  * @param encodedInvoice The encoded invoice to pay.
1667
1717
  * @param maximumFeesMsats Maximum fees (in msats) to pay for the payment. This parameter is required.
1668
- * As guidance, a maximum fee of 16 basis points should make almost all transactions succeed. For example,
1669
- * for a transaction between 10k sats and 100k sats, this would mean a fee limit of 16 to 160 sats.
1718
+ * As guidance, a maximum fee of 16 basis points should make almost all
1719
+ * transactions succeed. For example,
1720
+ * for a transaction between 10k sats and 100k sats,
1721
+ * this would mean a fee limit of 16 to 160 sats.
1670
1722
  * @param timeoutSecs A timeout for the payment in seconds. Defaults to 60 seconds.
1671
1723
  * @param amountMsats The amount to pay in msats for a zero-amount invoice. Defaults to the full amount of the
1672
- * invoice. NOTE: This parameter can only be passed for a zero-amount invoice. Otherwise, the call will fail.
1724
+ * invoice. NOTE: This parameter can only be passed for a zero-amount
1725
+ * invoice. Otherwise, the call will fail.
1673
1726
  * @returns An `OutgoingPayment` object if the payment was successful, or undefined if the payment failed.
1674
1727
  */
1675
1728
  async payUmaInvoice(payerNodeId, encodedInvoice, maximumFeesMsats, timeoutSecs = 60, amountMsats = void 0) {
@@ -1699,7 +1752,8 @@ var LightsparkClient = class {
1699
1752
  return response.pay_uma_invoice && OutgoingPaymentFromJson(response.pay_invoice.payment);
1700
1753
  }
1701
1754
  /**
1702
- * Waits for a transaction to have a completed status, and returns the transaction.
1755
+ * Waits for a transaction to have a completed status, and returns the
1756
+ * transaction.
1703
1757
  *
1704
1758
  * @param transactionId The ID of the transaction to wait for
1705
1759
  * @param pollTimeoutSecs The timeout in seconds that we will wait before throwing an exception
@@ -1736,15 +1790,18 @@ var LightsparkClient = class {
1736
1790
  return transaction;
1737
1791
  }
1738
1792
  /**
1739
- * Sends a payment directly to a node on the Lightning Network through the public key of the node without an invoice.
1793
+ * Sends a payment directly to a node on the Lightning Network through the
1794
+ * public key of the node without an invoice.
1740
1795
  *
1741
1796
  * @param payerNodeId The ID of the node that will send the payment.
1742
1797
  * @param destinationPublicKey The public key of the destination node.
1743
1798
  * @param timeoutSecs The timeout in seconds that we will try to make the payment.
1744
1799
  * @param amountMsats The amount to pay in msats.
1745
1800
  * @param maximumFeesMsats Maximum fees (in msats) to pay for the payment. This parameter is required.
1746
- * As guidance, a maximum fee of 15 basis points should make almost all transactions succeed. For example,
1747
- * for a transaction between 10k sats and 100k sats, this would mean a fee limit of 15 to 150 sats.
1801
+ * As guidance, a maximum fee of 15 basis points should make almost all
1802
+ * transactions succeed. For example,
1803
+ * for a transaction between 10k sats and 100k sats,
1804
+ * this would mean a fee limit of 15 to 150 sats.
1748
1805
  * @returns An `OutgoingPayment` object if the payment was successful, or undefined if the payment failed.
1749
1806
  */
1750
1807
  async sendPayment(payerNodeId, destinationPublicKey, timeoutSecs = 60, amountMsats, maximumFeesMsats) {
@@ -1771,7 +1828,8 @@ var LightsparkClient = class {
1771
1828
  return response.send_payment && OutgoingPaymentFromJson(response.send_payment.payment);
1772
1829
  }
1773
1830
  /**
1774
- * Creates an L1 Bitcoin wallet address for a given node which can be used to deposit or withdraw funds.
1831
+ * Creates an L1 Bitcoin wallet address for a given node which can be used to
1832
+ * deposit or withdraw funds.
1775
1833
  *
1776
1834
  * @param nodeId The ID of the node to create a wallet address for.
1777
1835
  * @returns A string containing the wallet address for the given node.
@@ -1784,12 +1842,15 @@ var LightsparkClient = class {
1784
1842
  return response.create_node_wallet_address.wallet_address;
1785
1843
  }
1786
1844
  /**
1787
- * Withdraws funds from the account and sends it to the requested bitcoin address.
1845
+ * Withdraws funds from the account and sends it to the requested bitcoin
1846
+ * address.
1788
1847
  *
1789
- * Depending on the chosen mode, it will first take the funds from the wallet, and if applicable, close channels
1790
- * appropriately to recover enough funds and reopen channels with the remaining funds.
1791
- * The process is asynchronous and may take up to a few minutes. You can check the progress by polling the
1792
- * `WithdrawalRequest` that is created, or by subscribing to a webhook.
1848
+ * Depending on the chosen mode, it will first take the funds from the
1849
+ * wallet, and if applicable, close channels appropriately to recover enough
1850
+ * funds and reopen channels with the remaining funds.
1851
+ * The process is asynchronous and may take up to a few minutes.
1852
+ * You can check the progress by polling the `WithdrawalRequest` that is
1853
+ * created, or by subscribing to a webhook.
1793
1854
  *
1794
1855
  * @param nodeId The ID of the node from which to withdraw funds.
1795
1856
  * @param amountSats The amount of funds to withdraw in satoshis.
@@ -1810,9 +1871,10 @@ var LightsparkClient = class {
1810
1871
  return WithdrawalRequestFromJson(response.request_withdrawal.request);
1811
1872
  }
1812
1873
  /**
1813
- * Adds funds to a Lightspark node on the REGTEST network. If the amount is not specified, 10,000,000 SATOSHI will be
1814
- * added. This API only functions for nodes created on the REGTEST network and will return an error when called for
1815
- * any non-REGTEST node.
1874
+ * Adds funds to a Lightspark node on the REGTEST network.
1875
+ * If the amount is not specified, 10,000,000 SATOSHI will be added.
1876
+ * This API only functions for nodes created on the REGTEST network and will
1877
+ * return an error when called for any non-REGTEST node.
1816
1878
  *
1817
1879
  * @param nodeId The ID of the node to fund. Must be a REGTEST node.
1818
1880
  * @param amountSats The amount of funds to add to the node in satoshis. Defaults to 10,000,000 SATOSHI.
@@ -1826,8 +1888,8 @@ var LightsparkClient = class {
1826
1888
  return CurrencyAmountFromJson(response.fund_node.amount);
1827
1889
  }
1828
1890
  /**
1829
- * Creates a new API token that can be used to authenticate requests for this account when using the Lightspark APIs
1830
- * and SDKs.
1891
+ * Creates a new API token that can be used to authenticate requests for this
1892
+ * account when using the Lightspark APIs and SDKs.
1831
1893
  *
1832
1894
  * @param name Creates a new API token that can be used to authenticate requests for this account when using the
1833
1895
  * Lightspark APIs and SDKs.
@@ -1864,8 +1926,9 @@ var LightsparkClient = class {
1864
1926
  await this.requester.makeRawRequest(DeleteApiToken, { api_token_id: id });
1865
1927
  }
1866
1928
  /**
1867
- * In test mode, generates a Lightning Invoice which can be paid by a local node.
1868
- * This call is only valid in test mode. You can then pay the invoice using [payInvoice].
1929
+ * In test mode, generates a Lightning Invoice which can be paid by a local
1930
+ * node. This call is only valid in test mode.
1931
+ * You can then pay the invoice using [payInvoice].
1869
1932
  *
1870
1933
  * @param localNodeId The ID of the node that will pay the invoice.
1871
1934
  * @param amountMsats The amount to pay in milli-satoshis.
@@ -1894,8 +1957,9 @@ var LightsparkClient = class {
1894
1957
  });
1895
1958
  }
1896
1959
  /**
1897
- * In test mode, simulates a payment of a Lightning Invoice from another node.
1898
- * This can only be used in test mode and should be used with invoices generated by [createInvoice].
1960
+ * In test mode, simulates a payment of a Lightning Invoice from another
1961
+ * node. This can only be used in test mode and should be used with invoices
1962
+ * generated by [createInvoice].
1899
1963
  *
1900
1964
  * @param localNodeId The ID of the node that will receive the payment.
1901
1965
  * @param encodedInvoice The encoded invoice to pay.
@@ -1918,8 +1982,8 @@ var LightsparkClient = class {
1918
1982
  });
1919
1983
  }
1920
1984
  /**
1921
- * Creates an UMA invitation. If you are part of the incentive program, you should use
1922
- * [createUmaInvitationWithIncentives].
1985
+ * Creates an UMA invitation. If you are part of the incentive program,
1986
+ * you should use [createUmaInvitationWithIncentives].
1923
1987
  *
1924
1988
  * @param inviterUma The UMA of the inviter.
1925
1989
  * @returns The invitation that was created.
@@ -1973,8 +2037,8 @@ var LightsparkClient = class {
1973
2037
  });
1974
2038
  }
1975
2039
  /**
1976
- * Claims an UMA invitation. If you are part of the incentive program, you should use
1977
- * [claimUmaInvitationWithIncentives].
2040
+ * Claims an UMA invitation. If you are part of the incentive program,
2041
+ * you should use [claimUmaInvitationWithIncentives].
1978
2042
  *
1979
2043
  * @param invitationCode The invitation code to claim.
1980
2044
  * @param inviteeUma The UMA of the invitee.
@@ -2065,7 +2129,8 @@ var LightsparkClient = class {
2065
2129
  /**
2066
2130
  * Executes a raw `Query` against the Lightspark API.
2067
2131
  *
2068
- * This generally should not be used directly, but is exposed for advanced use cases and for internal use to retrieve
2132
+ * This generally should not be used directly,
2133
+ * but is exposed for advanced use cases and for internal use to retrieve
2069
2134
  * complex fields from objects.
2070
2135
  *
2071
2136
  * @param query The `Query` to execute.