@buildonspark/spark-sdk 0.1.35 → 0.1.37

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 (110) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/{RequestLightningSendInput-BtR12ZlP.d.cts → RequestLightningSendInput-39_zGri6.d.cts} +1 -1
  3. package/dist/{RequestLightningSendInput-Dfx7JYWT.d.ts → RequestLightningSendInput-B4JdzclX.d.ts} +1 -1
  4. package/dist/address/index.cjs +7 -2
  5. package/dist/address/index.d.cts +2 -2
  6. package/dist/address/index.d.ts +2 -2
  7. package/dist/address/index.js +3 -3
  8. package/dist/{chunk-5IXRSN47.js → chunk-2CDJZQN4.js} +1 -1
  9. package/dist/{chunk-YQBZR7YC.js → chunk-A74XSEW3.js} +1 -1
  10. package/dist/{chunk-PZRENZXV.js → chunk-C5LTJBI7.js} +215 -6
  11. package/dist/{chunk-B2CHXWG6.js → chunk-FWQPAPXK.js} +2 -2
  12. package/dist/{chunk-EVTP3LXL.js → chunk-I4JI6TYN.js} +2 -2
  13. package/dist/{chunk-74S7NOHT.js → chunk-MVRQ5US7.js} +7 -2
  14. package/dist/{chunk-UDT7KKB6.js → chunk-NS4UZRQ7.js} +1 -1
  15. package/dist/{chunk-W7N2ABBH.js → chunk-RAPBVYJY.js} +7 -12
  16. package/dist/{chunk-7TM6XZIQ.js → chunk-RULOY5WX.js} +2 -2
  17. package/dist/{chunk-3FT662ZE.js → chunk-RZDD6X5A.js} +143 -68
  18. package/dist/{chunk-C4URKX6J.js → chunk-YWFZ5ECA.js} +1 -1
  19. package/dist/graphql/objects/index.cjs +7 -2
  20. package/dist/graphql/objects/index.d.cts +4 -4
  21. package/dist/graphql/objects/index.d.ts +4 -4
  22. package/dist/graphql/objects/index.js +1 -1
  23. package/dist/{index-BBzdQhqB.d.ts → index-CxAi2L8y.d.ts} +10 -8
  24. package/dist/{index-D-We3A27.d.cts → index-Dm17Ggfe.d.cts} +10 -8
  25. package/dist/index.cjs +365 -85
  26. package/dist/index.d.cts +6 -6
  27. package/dist/index.d.ts +6 -6
  28. package/dist/index.js +11 -11
  29. package/dist/index.node.cjs +365 -85
  30. package/dist/index.node.d.cts +7 -7
  31. package/dist/index.node.d.ts +7 -7
  32. package/dist/index.node.js +11 -11
  33. package/dist/native/chunk-C3WN3D4O.js +19 -0
  34. package/dist/native/index.cjs +365 -85
  35. package/dist/native/index.d.cts +16 -4
  36. package/dist/native/index.d.ts +16 -4
  37. package/dist/native/index.js +363 -88
  38. package/dist/native/{wasm-A6KGFTNV.js → wasm-PZWVEGEE.js} +1 -1
  39. package/dist/native/{xhr-transport-TERT4PBA.js → xhr-transport-WHMS3FGG.js} +1 -1
  40. package/dist/{network-Bc-W9qLR.d.ts → network-DobHpaV6.d.ts} +1 -1
  41. package/dist/{network-Dbxfi7Tp.d.cts → network-GFGEHkS4.d.cts} +1 -1
  42. package/dist/proto/lrc20.cjs +7 -2
  43. package/dist/proto/lrc20.d.cts +1 -1
  44. package/dist/proto/lrc20.d.ts +1 -1
  45. package/dist/proto/lrc20.js +3 -3
  46. package/dist/proto/spark.cjs +221 -7
  47. package/dist/proto/spark.d.cts +1 -1
  48. package/dist/proto/spark.d.ts +1 -1
  49. package/dist/proto/spark.js +6 -2
  50. package/dist/{sdk-types-BZhxaXMN.d.ts → sdk-types-BeI6DM_M.d.ts} +1 -1
  51. package/dist/{sdk-types-BPwagWYa.d.cts → sdk-types-BuVMn2rX.d.cts} +1 -1
  52. package/dist/services/config.cjs +17 -17
  53. package/dist/services/config.d.cts +4 -4
  54. package/dist/services/config.d.ts +4 -4
  55. package/dist/services/config.js +4 -4
  56. package/dist/services/connection.cjs +217 -7
  57. package/dist/services/connection.d.cts +4 -4
  58. package/dist/services/connection.d.ts +4 -4
  59. package/dist/services/connection.js +3 -3
  60. package/dist/services/index.cjs +227 -22
  61. package/dist/services/index.d.cts +4 -4
  62. package/dist/services/index.d.ts +4 -4
  63. package/dist/services/index.js +7 -7
  64. package/dist/services/lrc-connection.cjs +7 -2
  65. package/dist/services/lrc-connection.d.cts +4 -4
  66. package/dist/services/lrc-connection.d.ts +4 -4
  67. package/dist/services/lrc-connection.js +4 -4
  68. package/dist/services/token-transactions.cjs +7 -2
  69. package/dist/services/token-transactions.d.cts +4 -4
  70. package/dist/services/token-transactions.d.ts +4 -4
  71. package/dist/services/token-transactions.js +4 -4
  72. package/dist/services/wallet-config.cjs +7 -2
  73. package/dist/services/wallet-config.d.cts +4 -4
  74. package/dist/services/wallet-config.d.ts +4 -4
  75. package/dist/services/wallet-config.js +1 -1
  76. package/dist/signer/signer.cjs +11 -11
  77. package/dist/signer/signer.d.cts +2 -2
  78. package/dist/signer/signer.d.ts +2 -2
  79. package/dist/signer/signer.js +2 -2
  80. package/dist/{signer-DQfFgVNA.d.cts → signer-C1t40Wus.d.cts} +1 -1
  81. package/dist/{signer-Db_TjQFj.d.ts → signer-DFGw9RRp.d.ts} +1 -1
  82. package/dist/{spark-FHwyinrG.d.cts → spark-DXYE9gMM.d.cts} +29 -3
  83. package/dist/{spark-FHwyinrG.d.ts → spark-DXYE9gMM.d.ts} +29 -3
  84. package/dist/types/index.cjs +219 -7
  85. package/dist/types/index.d.cts +4 -4
  86. package/dist/types/index.d.ts +4 -4
  87. package/dist/types/index.js +3 -3
  88. package/dist/utils/index.cjs +7 -2
  89. package/dist/utils/index.d.cts +5 -5
  90. package/dist/utils/index.d.ts +5 -5
  91. package/dist/utils/index.js +3 -3
  92. package/dist/{wasm-W3WBILBX.js → wasm-7OWFHDMS.js} +1 -1
  93. package/dist/{xhr-transport-DSTXEBFS.js → xhr-transport-RH6LDRXS.js} +1 -1
  94. package/package.json +3 -4
  95. package/src/proto/common.ts +1 -1
  96. package/src/proto/google/protobuf/descriptor.ts +1 -1
  97. package/src/proto/google/protobuf/duration.ts +1 -1
  98. package/src/proto/google/protobuf/empty.ts +1 -1
  99. package/src/proto/google/protobuf/timestamp.ts +1 -1
  100. package/src/proto/mock.ts +2 -2
  101. package/src/proto/spark.ts +271 -8
  102. package/src/proto/spark_authn.ts +2 -2
  103. package/src/proto/validate/validate.ts +1 -1
  104. package/src/services/transfer.ts +1 -0
  105. package/src/signer/signer.ts +6 -11
  106. package/src/spark-wallet/spark-wallet.ts +177 -73
  107. package/src/tests/integration/deposit.test.ts +5 -0
  108. package/src/tests/integration/ssp/static_deposit.test.ts +4 -0
  109. package/src/tests/spark-wallet/queryNodes.test.ts +89 -0
  110. package/dist/native/chunk-OVEXKBAZ.js +0 -14
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Lrc20ConnectionManager
3
- } from "./chunk-B2CHXWG6.js";
3
+ } from "./chunk-FWQPAPXK.js";
4
4
  import {
5
5
  computeTaprootKeyNoScript,
6
6
  createRefundTx,
@@ -20,7 +20,7 @@ import {
20
20
  import {
21
21
  mapTransferToWalletTransfer,
22
22
  mapTreeNodeToWalletLeaf
23
- } from "./chunk-YQBZR7YC.js";
23
+ } from "./chunk-A74XSEW3.js";
24
24
  import {
25
25
  ClaimStaticDepositRequestType_default,
26
26
  CoopExitRequestFromJson,
@@ -37,17 +37,17 @@ import {
37
37
  } from "./chunk-S7KD6DDL.js";
38
38
  import {
39
39
  TokenTransactionService
40
- } from "./chunk-7TM6XZIQ.js";
40
+ } from "./chunk-RULOY5WX.js";
41
41
  import {
42
42
  calculateAvailableTokenAmount
43
43
  } from "./chunk-57XLH3ZR.js";
44
44
  import {
45
45
  decodeSparkAddress,
46
46
  encodeSparkAddress
47
- } from "./chunk-5IXRSN47.js";
47
+ } from "./chunk-2CDJZQN4.js";
48
48
  import {
49
49
  WalletConfigService
50
- } from "./chunk-C4URKX6J.js";
50
+ } from "./chunk-YWFZ5ECA.js";
51
51
  import {
52
52
  LRC_WALLET_NETWORK,
53
53
  LRC_WALLET_NETWORK_TYPE,
@@ -73,7 +73,7 @@ import {
73
73
  } from "./chunk-HMLOC6TE.js";
74
74
  import {
75
75
  ConnectionManager
76
- } from "./chunk-EVTP3LXL.js";
76
+ } from "./chunk-I4JI6TYN.js";
77
77
  import {
78
78
  isReactNative
79
79
  } from "./chunk-HKAKEKCE.js";
@@ -87,10 +87,10 @@ import {
87
87
  import {
88
88
  SendLeafKeyTweaks,
89
89
  networkToJSON
90
- } from "./chunk-PZRENZXV.js";
90
+ } from "./chunk-C5LTJBI7.js";
91
91
  import {
92
92
  Buffer
93
- } from "./chunk-74S7NOHT.js";
93
+ } from "./chunk-MVRQ5US7.js";
94
94
 
95
95
  // src/spark-wallet/spark-wallet.ts
96
96
  import { isNode, mapCurrencyAmount } from "@lightsparkdev/core";
@@ -1402,7 +1402,8 @@ var TransferService = class extends BaseTransferService {
1402
1402
  types: [
1403
1403
  2 /* TRANSFER */,
1404
1404
  0 /* PREIMAGE_SWAP */,
1405
- 1 /* COOPERATIVE_EXIT */
1405
+ 1 /* COOPERATIVE_EXIT */,
1406
+ 3 /* UTXO_SWAP */
1406
1407
  ],
1407
1408
  network: NetworkToProto[this.config.getNetwork()]
1408
1409
  });
@@ -3908,7 +3909,11 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
3908
3909
  if (event?.$case === "transfer" && event.transfer.transfer && event.transfer.transfer.type !== 40 /* COUNTER_SWAP */) {
3909
3910
  const { senderIdentityPublicKey, receiverIdentityPublicKey } = event.transfer.transfer;
3910
3911
  if (event.transfer.transfer && !equalBytes3(senderIdentityPublicKey, receiverIdentityPublicKey)) {
3911
- await this.claimTransfer(event.transfer.transfer, true);
3912
+ await this.claimTransfer({
3913
+ transfer: event.transfer.transfer,
3914
+ emit: true,
3915
+ optimize: true
3916
+ });
3912
3917
  }
3913
3918
  } else if (event?.$case === "deposit" && event.deposit.deposit) {
3914
3919
  const deposit = event.deposit.deposit;
@@ -4034,10 +4039,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
4034
4039
  }
4035
4040
  }
4036
4041
  async getLeaves(isBalanceCheck = false) {
4037
- const sparkClient = await this.connectionManager.createSparkClient(
4038
- this.config.getCoordinatorAddress()
4039
- );
4040
- const leaves = await sparkClient.query_nodes({
4042
+ const leaves = await this.queryNodes({
4041
4043
  source: {
4042
4044
  $case: "ownerIdentityPubkey",
4043
4045
  ownerIdentityPubkey: await this.config.signer.getIdentityPublicKey()
@@ -4051,17 +4053,17 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
4051
4053
  this.config.getSigningOperators()
4052
4054
  )) {
4053
4055
  if (id !== this.config.getCoordinatorIdentifier()) {
4054
- const client = await this.connectionManager.createSparkClient(
4056
+ const operatorLeaves = await this.queryNodes(
4057
+ {
4058
+ source: {
4059
+ $case: "ownerIdentityPubkey",
4060
+ ownerIdentityPubkey: await this.config.signer.getIdentityPublicKey()
4061
+ },
4062
+ includeParents: false,
4063
+ network: NetworkToProto[this.config.getNetwork()]
4064
+ },
4055
4065
  operator.address
4056
4066
  );
4057
- const operatorLeaves = await client.query_nodes({
4058
- source: {
4059
- $case: "ownerIdentityPubkey",
4060
- ownerIdentityPubkey: await this.config.signer.getIdentityPublicKey()
4061
- },
4062
- includeParents: false,
4063
- network: NetworkToProto[this.config.getNetwork()]
4064
- });
4065
4067
  for (const [nodeId, leaf] of Object.entries(leaves.nodes)) {
4066
4068
  const operatorLeaf = operatorLeaves.nodes[nodeId];
4067
4069
  if (!operatorLeaf) {
@@ -4190,10 +4192,11 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
4190
4192
  }
4191
4193
  async syncWallet() {
4192
4194
  await this.syncTokenOutputs();
4193
- this.leaves = await this.getLeaves();
4194
- await this.config.signer.restoreSigningKeysFromLeafs(this.leaves);
4195
- await this.checkRefreshTimelockNodes();
4196
- await this.checkExtendTimeLockNodes();
4195
+ let leaves = await this.getLeaves();
4196
+ await this.config.signer.restoreSigningKeysFromLeafs(leaves);
4197
+ leaves = await this.checkRefreshTimelockNodes(leaves);
4198
+ leaves = await this.checkExtendTimeLockNodes(leaves);
4199
+ this.leaves = leaves;
4197
4200
  this.optimizeLeaves().catch((e) => {
4198
4201
  console.error("Failed to optimize leaves", e);
4199
4202
  });
@@ -4337,11 +4340,6 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
4337
4340
  expected: "smaller or equal to " + Number.MAX_SAFE_INTEGER
4338
4341
  });
4339
4342
  }
4340
- try {
4341
- await this.claimTransfers();
4342
- } catch (e) {
4343
- console.warn("Unabled to claim transfers.");
4344
- }
4345
4343
  let leavesToSwap;
4346
4344
  if (targetAmount && leaves && leaves.length > 0) {
4347
4345
  if (targetAmount < leaves.reduce((acc, leaf) => acc + leaf.value, 0)) {
@@ -4440,10 +4438,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
4440
4438
  if (!request) {
4441
4439
  throw new Error("Failed to request leaves swap. No response returned.");
4442
4440
  }
4443
- const sparkClient = await this.connectionManager.createSparkClient(
4444
- this.config.getCoordinatorAddress()
4445
- );
4446
- const nodes = await sparkClient.query_nodes({
4441
+ const nodes = await this.queryNodes({
4447
4442
  source: {
4448
4443
  $case: "nodeIds",
4449
4444
  nodeIds: {
@@ -4614,7 +4609,20 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
4614
4609
  * @returns {Promise<string>} A Bitcoin address for depositing funds
4615
4610
  */
4616
4611
  async getStaticDepositAddress() {
4617
- return await this.generateDepositAddress(true);
4612
+ try {
4613
+ return await this.generateDepositAddress(true);
4614
+ } catch (error) {
4615
+ if (error.message?.includes("static deposit address already exists")) {
4616
+ const existingAddresses = await this.queryStaticDepositAddresses();
4617
+ if (existingAddresses.length > 0 && existingAddresses[0]) {
4618
+ return existingAddresses[0];
4619
+ } else {
4620
+ throw error;
4621
+ }
4622
+ } else {
4623
+ throw error;
4624
+ }
4625
+ }
4618
4626
  }
4619
4627
  /**
4620
4628
  * Generates a deposit address for receiving funds.
@@ -5197,7 +5205,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5197
5205
  const pendingTransfer = await this.transferService.queryTransfer(
5198
5206
  transfer.id
5199
5207
  );
5200
- const resultNodes = !pendingTransfer ? [] : await this.claimTransfer(pendingTransfer);
5208
+ const resultNodes = !pendingTransfer ? [] : await this.claimTransfer({ transfer: pendingTransfer });
5201
5209
  const leavesToRemove = new Set(leaves.map((leaf) => leaf.id));
5202
5210
  this.leaves = [
5203
5211
  ...this.leaves.filter((leaf) => !leavesToRemove.has(leaf.id)),
@@ -5247,7 +5255,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5247
5255
  );
5248
5256
  return await this.withLeaves(async () => {
5249
5257
  let leavesToSend = await this.selectLeaves(amountSats);
5250
- await this.checkRefreshTimelockNodes(leavesToSend);
5258
+ leavesToSend = await this.checkRefreshTimelockNodes(leavesToSend);
5251
5259
  leavesToSend = await this.checkExtendTimeLockNodes(leavesToSend);
5252
5260
  const leafKeyTweaks = await Promise.all(
5253
5261
  leavesToSend.map(async (leaf) => ({
@@ -5268,7 +5276,10 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5268
5276
  const transactionId = transfer.id;
5269
5277
  const pendingTransfer = await this.transferService.queryTransfer(transactionId);
5270
5278
  if (pendingTransfer) {
5271
- await this.claimTransfer(pendingTransfer);
5279
+ await this.claimTransfer({
5280
+ transfer: pendingTransfer,
5281
+ optimize: true
5282
+ });
5272
5283
  }
5273
5284
  }
5274
5285
  return mapTransferToWalletTransfer(
@@ -5278,11 +5289,10 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5278
5289
  });
5279
5290
  }
5280
5291
  async checkExtendTimeLockNodes(nodes) {
5281
- const nodesToCheck = nodes ?? this.leaves;
5282
5292
  const nodesToExtend = [];
5283
5293
  const nodeIds = [];
5284
- let resultNodes = [...nodesToCheck];
5285
- for (const node of nodesToCheck) {
5294
+ const validNodes = [];
5295
+ for (const node of nodes) {
5286
5296
  const nodeTx = getTxFromRawTxBytes(node.nodeTx);
5287
5297
  const { needRefresh } = getNextTransactionSequence(
5288
5298
  nodeTx.getInput(0).sequence
@@ -5290,9 +5300,14 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5290
5300
  if (needRefresh) {
5291
5301
  nodesToExtend.push(node);
5292
5302
  nodeIds.push(node.id);
5303
+ } else {
5304
+ validNodes.push(node);
5293
5305
  }
5294
5306
  }
5295
- resultNodes = resultNodes.filter((node) => !nodesToExtend.includes(node));
5307
+ if (nodesToExtend.length === 0) {
5308
+ return validNodes;
5309
+ }
5310
+ const nodesToAdd = [];
5296
5311
  for (const node of nodesToExtend) {
5297
5312
  const signingPubKey = await this.config.signer.generatePublicKey(
5298
5313
  sha2567(node.id)
@@ -5303,9 +5318,11 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5303
5318
  );
5304
5319
  this.leaves = this.leaves.filter((leaf) => leaf.id !== node.id);
5305
5320
  const newNodes = await this.transferLeavesToSelf(nodes2, signingPubKey);
5306
- resultNodes.push(...newNodes);
5321
+ nodesToAdd.push(...newNodes);
5307
5322
  }
5308
- return resultNodes;
5323
+ this.updateLeaves(nodeIds, nodesToAdd);
5324
+ validNodes.push(...nodesToAdd);
5325
+ return validNodes;
5309
5326
  }
5310
5327
  /**
5311
5328
  * Internal method to refresh timelock nodes.
@@ -5317,7 +5334,8 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5317
5334
  async checkRefreshTimelockNodes(nodes) {
5318
5335
  const nodesToRefresh = [];
5319
5336
  const nodeIds = [];
5320
- for (const node of nodes ?? this.leaves) {
5337
+ const validNodes = [];
5338
+ for (const node of nodes) {
5321
5339
  const refundTx = getTxFromRawTxBytes(node.refundTx);
5322
5340
  const { needRefresh } = getNextTransactionSequence(
5323
5341
  refundTx.getInput(0).sequence,
@@ -5326,15 +5344,14 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5326
5344
  if (needRefresh) {
5327
5345
  nodesToRefresh.push(node);
5328
5346
  nodeIds.push(node.id);
5347
+ } else {
5348
+ validNodes.push(node);
5329
5349
  }
5330
5350
  }
5331
5351
  if (nodesToRefresh.length === 0) {
5332
- return;
5352
+ return validNodes;
5333
5353
  }
5334
- const sparkClient = await this.connectionManager.createSparkClient(
5335
- this.config.getCoordinatorAddress()
5336
- );
5337
- const nodesResp = await sparkClient.query_nodes({
5354
+ const nodesResp = await this.queryNodes({
5338
5355
  source: {
5339
5356
  $case: "nodeIds",
5340
5357
  nodeIds: {
@@ -5348,6 +5365,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5348
5365
  for (const node of Object.values(nodesResp.nodes)) {
5349
5366
  nodesMap.set(node.id, node);
5350
5367
  }
5368
+ const nodesToAdd = [];
5351
5369
  for (const node of nodesToRefresh) {
5352
5370
  if (!node.parentNodeId) {
5353
5371
  throw new Error(`node ${node.id} has no parent`);
@@ -5368,9 +5386,11 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5368
5386
  if (!newNode) {
5369
5387
  throw new Error("Failed to refresh timelock node");
5370
5388
  }
5371
- this.leaves = this.leaves.filter((leaf) => leaf.id !== node.id);
5372
- this.leaves.push(newNode);
5389
+ nodesToAdd.push(newNode);
5373
5390
  }
5391
+ this.updateLeaves(nodeIds, nodesToAdd);
5392
+ validNodes.push(...nodesToAdd);
5393
+ return validNodes;
5374
5394
  }
5375
5395
  /**
5376
5396
  * Claims a specific transfer.
@@ -5378,11 +5398,16 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5378
5398
  * @param {Transfer} transfer - The transfer to claim
5379
5399
  * @returns {Promise<Object>} The claim result
5380
5400
  */
5381
- async claimTransfer(transfer, emit = false, retryCount = 0) {
5401
+ async claimTransfer({
5402
+ transfer,
5403
+ emit,
5404
+ retryCount,
5405
+ optimize
5406
+ }) {
5382
5407
  const MAX_RETRIES = 5;
5383
5408
  const BASE_DELAY_MS = 1e3;
5384
5409
  const MAX_DELAY_MS = 1e4;
5385
- if (retryCount > 0) {
5410
+ if (retryCount && retryCount > 0) {
5386
5411
  const delayMs = Math.min(
5387
5412
  BASE_DELAY_MS * Math.pow(2, retryCount - 1),
5388
5413
  MAX_DELAY_MS
@@ -5398,7 +5423,10 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5398
5423
  const leafPubKey = leafPubKeyMap.get(leaf.leaf.id);
5399
5424
  if (leafPubKey) {
5400
5425
  leavesToClaim.push({
5401
- leaf: leaf.leaf,
5426
+ leaf: {
5427
+ ...leaf.leaf,
5428
+ refundTx: leaf.intermediateRefundTx
5429
+ },
5402
5430
  signingPubKey: leafPubKey,
5403
5431
  newSigningPubKey: await this.config.signer.generatePublicKey(
5404
5432
  sha2567(leaf.leaf.id)
@@ -5411,7 +5439,6 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5411
5439
  transfer,
5412
5440
  leavesToClaim
5413
5441
  );
5414
- this.leaves.push(...response.nodes);
5415
5442
  if (emit) {
5416
5443
  this.emit(
5417
5444
  "transfer:claimed",
@@ -5421,14 +5448,25 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5421
5448
  }
5422
5449
  return response.nodes;
5423
5450
  });
5424
- await this.checkRefreshTimelockNodes(result);
5451
+ result = await this.checkRefreshTimelockNodes(result);
5425
5452
  result = await this.checkExtendTimeLockNodes(result);
5453
+ const existingIds = new Set(this.leaves.map((leaf) => leaf.id));
5454
+ const uniqueResults = result.filter((node) => !existingIds.has(node.id));
5455
+ this.leaves.push(...uniqueResults);
5456
+ if (optimize && transfer.type !== 40 /* COUNTER_SWAP */) {
5457
+ await this.optimizeLeaves();
5458
+ }
5426
5459
  return result;
5427
5460
  } catch (error) {
5428
- if (retryCount < MAX_RETRIES) {
5429
- this.claimTransfer(transfer, emit, retryCount + 1);
5461
+ if (retryCount && retryCount < MAX_RETRIES) {
5462
+ this.claimTransfer({
5463
+ transfer,
5464
+ emit,
5465
+ retryCount: retryCount + 1,
5466
+ optimize
5467
+ });
5430
5468
  return [];
5431
- } else if (retryCount > 0) {
5469
+ } else if (retryCount) {
5432
5470
  console.warn(
5433
5471
  "Failed to claim transfer. Please try reinitializing your wallet in a few minutes. Transfer ID: " + transfer.id,
5434
5472
  error
@@ -5463,7 +5501,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5463
5501
  continue;
5464
5502
  }
5465
5503
  promises.push(
5466
- this.claimTransfer(transfer, emit).then(() => transfer.id).catch((error) => {
5504
+ this.claimTransfer({ transfer, emit, optimize: true }).then(() => transfer.id).catch((error) => {
5467
5505
  console.warn(`Failed to claim transfer ${transfer.id}:`, error);
5468
5506
  return null;
5469
5507
  })
@@ -5498,11 +5536,11 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5498
5536
  *
5499
5537
  * @param {Object} params - Parameters for the lightning invoice
5500
5538
  * @param {number} params.amountSats - Amount in satoshis
5501
- * @param {string} params.memo - Description for the invoice
5539
+ * @param {string} [params.memo] - Description for the invoice. Should not be provided if the descriptionHash is provided.
5502
5540
  * @param {number} [params.expirySeconds] - Optional expiry time in seconds
5503
5541
  * @param {boolean} [params.includeSparkAddress] - Optional boolean signalling whether or not to include the spark address in the invoice
5504
5542
  * @param {string} [params.receiverIdentityPubkey] - Optional public key of the wallet receiving the lightning invoice. If not present, the receiver will be the creator of this request.
5505
- * @param {string} [params.descriptionHash] - Optional h tag of the invoice. This is the hash of a longer description to include in the lightning invoice. It is used in LNURL and UMA as the hash of the metadata.
5543
+ * @param {string} [params.descriptionHash] - Optional h tag of the invoice. This is the hash of a longer description to include in the lightning invoice. It is used in LNURL and UMA as the hash of the metadata. This field is mutually exclusive with the memo field. Only one or the other should be provided.
5506
5544
  * @returns {Promise<LightningReceiveRequest>} BOLT11 encoded invoice
5507
5545
  */
5508
5546
  async createLightningInvoice({
@@ -5549,6 +5587,16 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5549
5587
  expected: "Memo size within limits"
5550
5588
  });
5551
5589
  }
5590
+ if (memo && descriptionHash) {
5591
+ throw new ValidationError(
5592
+ "Memo and descriptionHash cannot be provided together. Please provide only one.",
5593
+ {
5594
+ field: "memo",
5595
+ value: memo,
5596
+ expected: "Memo or descriptionHash"
5597
+ }
5598
+ );
5599
+ }
5552
5600
  const requestLightningInvoice = async (amountSats2, paymentHash, memo2, receiverIdentityPubkey2, descriptionHash2) => {
5553
5601
  const network = this.config.getNetwork();
5554
5602
  let bitcoinNetwork = BitcoinNetwork_default.REGTEST;
@@ -5684,7 +5732,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5684
5732
  });
5685
5733
  }
5686
5734
  let leaves = await this.selectLeaves(totalAmount);
5687
- await this.checkRefreshTimelockNodes(leaves);
5735
+ leaves = await this.checkRefreshTimelockNodes(leaves);
5688
5736
  leaves = await this.checkExtendTimeLockNodes(leaves);
5689
5737
  const leavesToSend = await Promise.all(
5690
5738
  leaves.map(async (leaf) => ({
@@ -5865,7 +5913,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5865
5913
  );
5866
5914
  }
5867
5915
  }
5868
- await this.checkRefreshTimelockNodes(leavesToSend);
5916
+ leavesToSend = await this.checkRefreshTimelockNodes(leavesToSend);
5869
5917
  leavesToSend = await this.checkExtendTimeLockNodes(leavesToSend);
5870
5918
  const leafKeyTweaks = await Promise.all(
5871
5919
  leavesToSend.map(async (leaf) => ({
@@ -5935,7 +5983,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
5935
5983
  });
5936
5984
  }
5937
5985
  let leaves = await this.selectLeaves(amountSats);
5938
- await this.checkRefreshTimelockNodes(leaves);
5986
+ leaves = await this.checkRefreshTimelockNodes(leaves);
5939
5987
  leaves = await this.checkExtendTimeLockNodes(leaves);
5940
5988
  const feeEstimate = await sspClient.getCoopExitFeeEstimate({
5941
5989
  leafExternalIds: leaves.map((leaf) => leaf.id),
@@ -6169,6 +6217,33 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
6169
6217
  }
6170
6218
  }, 1e4);
6171
6219
  }
6220
+ async updateLeaves(leavesToRemove, leavesToAdd) {
6221
+ const leavesToRemoveSet = new Set(leavesToRemove);
6222
+ this.leaves = this.leaves.filter((leaf) => !leavesToRemoveSet.has(leaf.id));
6223
+ this.leaves.push(...leavesToAdd);
6224
+ }
6225
+ async queryNodes(baseRequest, sparkClientAddress, pageSize = 100) {
6226
+ const address = sparkClientAddress ?? this.config.getCoordinatorAddress();
6227
+ const aggregatedNodes = {};
6228
+ let offset = 0;
6229
+ while (true) {
6230
+ const sparkClient = await this.connectionManager.createSparkClient(address);
6231
+ const response = await sparkClient.query_nodes({
6232
+ ...baseRequest,
6233
+ limit: pageSize,
6234
+ offset
6235
+ });
6236
+ Object.assign(aggregatedNodes, response.nodes ?? {});
6237
+ const received = Object.keys(response.nodes ?? {}).length;
6238
+ if (received < pageSize) {
6239
+ return {
6240
+ nodes: aggregatedNodes,
6241
+ offset: response.offset
6242
+ };
6243
+ }
6244
+ offset += pageSize;
6245
+ }
6246
+ }
6172
6247
  };
6173
6248
 
6174
6249
  export {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DefaultSparkSigner
3
- } from "./chunk-W7N2ABBH.js";
3
+ } from "./chunk-RAPBVYJY.js";
4
4
  import {
5
5
  Network,
6
6
  NetworkToProto
@@ -47,8 +47,13 @@ var import_buffer = require("buffer");
47
47
  if (typeof globalThis.Buffer === "undefined") {
48
48
  globalThis.Buffer = import_buffer.Buffer;
49
49
  }
50
- if (typeof global === "undefined") {
51
- window.global = window.globalThis;
50
+ if (typeof window !== "undefined") {
51
+ if (typeof window.global === "undefined") {
52
+ window.global = window;
53
+ }
54
+ if (typeof window.globalThis === "undefined") {
55
+ window.globalThis = window;
56
+ }
52
57
  }
53
58
 
54
59
  // src/graphql/objects/BitcoinNetwork.ts
@@ -1,11 +1,11 @@
1
1
  import { B as BitcoinNetwork } from '../../BitcoinNetwork-TnABML0T.cjs';
2
2
  import { Query } from '@lightsparkdev/core';
3
- import { h as CurrencyAmount, P as PageInfo, D as SspClient } from '../../RequestLightningSendInput-BtR12ZlP.cjs';
4
- export { C as ClaimStaticDepositOutput, a as CompleteCoopExitInput, b as CompleteLeavesSwapInput, c as CoopExitFeeEstimate, d as CoopExitFeeEstimatesInput, e as CoopExitFeeEstimatesOutput, f as CoopExitRequest, i as CurrencyUnit, E as ExitSpeed, G as GetChallengeOutput, I as Invoice, L as Leaf, j as LeavesSwapFeeEstimateOutput, l as LeavesSwapRequest, n as LightningReceiveRequest, o as LightningReceiveRequestStatus, p as LightningSendFeeEstimateOutput, r as LightningSendRequest, s as LightningSendRequestStatus, R as RequestCoopExitInput, t as RequestLeavesSwapInput, u as RequestLightningReceiveInput, v as RequestLightningSendInput, S as SparkCoopExitRequestStatus, w as SparkLeavesSwapRequestStatus, x as SparkTransferToLeavesConnection, y as StaticDepositQuoteInput, z as StaticDepositQuoteOutput, A as SwapLeaf, T as Transfer, U as UserLeafInput, V as VerifyChallengeOutput, g as getCoopExitRequestQuery, k as getLeavesSwapRequestQuery, m as getLightningReceiveRequestQuery, q as getLightningSendRequestQuery } from '../../RequestLightningSendInput-BtR12ZlP.cjs';
3
+ import { h as CurrencyAmount, P as PageInfo, D as SspClient } from '../../RequestLightningSendInput-39_zGri6.cjs';
4
+ export { C as ClaimStaticDepositOutput, a as CompleteCoopExitInput, b as CompleteLeavesSwapInput, c as CoopExitFeeEstimate, d as CoopExitFeeEstimatesInput, e as CoopExitFeeEstimatesOutput, f as CoopExitRequest, i as CurrencyUnit, E as ExitSpeed, G as GetChallengeOutput, I as Invoice, L as Leaf, j as LeavesSwapFeeEstimateOutput, l as LeavesSwapRequest, n as LightningReceiveRequest, o as LightningReceiveRequestStatus, p as LightningSendFeeEstimateOutput, r as LightningSendRequest, s as LightningSendRequestStatus, R as RequestCoopExitInput, t as RequestLeavesSwapInput, u as RequestLightningReceiveInput, v as RequestLightningSendInput, S as SparkCoopExitRequestStatus, w as SparkLeavesSwapRequestStatus, x as SparkTransferToLeavesConnection, y as StaticDepositQuoteInput, z as StaticDepositQuoteOutput, A as SwapLeaf, T as Transfer, U as UserLeafInput, V as VerifyChallengeOutput, g as getCoopExitRequestQuery, k as getLeavesSwapRequestQuery, m as getLightningReceiveRequestQuery, q as getLightningSendRequestQuery } from '../../RequestLightningSendInput-39_zGri6.cjs';
5
5
  export { L as LightningSendFeeEstimateInput } from '../../LightningSendFeeEstimateInput-CJvPnCSB.cjs';
6
- import '../../signer-DQfFgVNA.cjs';
6
+ import '../../signer-C1t40Wus.cjs';
7
7
  import '@scure/bip32';
8
- import '../../spark-FHwyinrG.cjs';
8
+ import '../../spark-DXYE9gMM.cjs';
9
9
  import '@bufbuild/protobuf/wire';
10
10
  import 'nice-grpc-common';
11
11
  import 'bitcoinjs-lib';
@@ -1,11 +1,11 @@
1
1
  import { B as BitcoinNetwork } from '../../BitcoinNetwork-TnABML0T.js';
2
2
  import { Query } from '@lightsparkdev/core';
3
- import { h as CurrencyAmount, P as PageInfo, D as SspClient } from '../../RequestLightningSendInput-Dfx7JYWT.js';
4
- export { C as ClaimStaticDepositOutput, a as CompleteCoopExitInput, b as CompleteLeavesSwapInput, c as CoopExitFeeEstimate, d as CoopExitFeeEstimatesInput, e as CoopExitFeeEstimatesOutput, f as CoopExitRequest, i as CurrencyUnit, E as ExitSpeed, G as GetChallengeOutput, I as Invoice, L as Leaf, j as LeavesSwapFeeEstimateOutput, l as LeavesSwapRequest, n as LightningReceiveRequest, o as LightningReceiveRequestStatus, p as LightningSendFeeEstimateOutput, r as LightningSendRequest, s as LightningSendRequestStatus, R as RequestCoopExitInput, t as RequestLeavesSwapInput, u as RequestLightningReceiveInput, v as RequestLightningSendInput, S as SparkCoopExitRequestStatus, w as SparkLeavesSwapRequestStatus, x as SparkTransferToLeavesConnection, y as StaticDepositQuoteInput, z as StaticDepositQuoteOutput, A as SwapLeaf, T as Transfer, U as UserLeafInput, V as VerifyChallengeOutput, g as getCoopExitRequestQuery, k as getLeavesSwapRequestQuery, m as getLightningReceiveRequestQuery, q as getLightningSendRequestQuery } from '../../RequestLightningSendInput-Dfx7JYWT.js';
3
+ import { h as CurrencyAmount, P as PageInfo, D as SspClient } from '../../RequestLightningSendInput-B4JdzclX.js';
4
+ export { C as ClaimStaticDepositOutput, a as CompleteCoopExitInput, b as CompleteLeavesSwapInput, c as CoopExitFeeEstimate, d as CoopExitFeeEstimatesInput, e as CoopExitFeeEstimatesOutput, f as CoopExitRequest, i as CurrencyUnit, E as ExitSpeed, G as GetChallengeOutput, I as Invoice, L as Leaf, j as LeavesSwapFeeEstimateOutput, l as LeavesSwapRequest, n as LightningReceiveRequest, o as LightningReceiveRequestStatus, p as LightningSendFeeEstimateOutput, r as LightningSendRequest, s as LightningSendRequestStatus, R as RequestCoopExitInput, t as RequestLeavesSwapInput, u as RequestLightningReceiveInput, v as RequestLightningSendInput, S as SparkCoopExitRequestStatus, w as SparkLeavesSwapRequestStatus, x as SparkTransferToLeavesConnection, y as StaticDepositQuoteInput, z as StaticDepositQuoteOutput, A as SwapLeaf, T as Transfer, U as UserLeafInput, V as VerifyChallengeOutput, g as getCoopExitRequestQuery, k as getLeavesSwapRequestQuery, m as getLightningReceiveRequestQuery, q as getLightningSendRequestQuery } from '../../RequestLightningSendInput-B4JdzclX.js';
5
5
  export { L as LightningSendFeeEstimateInput } from '../../LightningSendFeeEstimateInput-CJvPnCSB.js';
6
- import '../../signer-Db_TjQFj.js';
6
+ import '../../signer-DFGw9RRp.js';
7
7
  import '@scure/bip32';
8
- import '../../spark-FHwyinrG.js';
8
+ import '../../spark-DXYE9gMM.js';
9
9
  import '@bufbuild/protobuf/wire';
10
10
  import 'nice-grpc-common';
11
11
  import 'bitcoinjs-lib';
@@ -21,7 +21,7 @@ import {
21
21
  import {
22
22
  BitcoinNetwork_default
23
23
  } from "../../chunk-HMLOC6TE.js";
24
- import "../../chunk-74S7NOHT.js";
24
+ import "../../chunk-MVRQ5US7.js";
25
25
  export {
26
26
  BitcoinNetwork_default as BitcoinNetwork,
27
27
  ClaimStaticDepositRequestType_default as ClaimStaticDepositRequestType,
@@ -1,7 +1,7 @@
1
- import { j as LeavesSwapFeeEstimateOutput, z as StaticDepositQuoteOutput, C as ClaimStaticDepositOutput, n as LightningReceiveRequest, r as LightningSendRequest, E as ExitSpeed, f as CoopExitRequest, e as CoopExitFeeEstimatesOutput } from './RequestLightningSendInput-Dfx7JYWT.js';
2
- import { h as SigningCommitment, V as VerifiableSecretShare, S as SparkSigner } from './signer-Db_TjQFj.js';
1
+ import { j as LeavesSwapFeeEstimateOutput, z as StaticDepositQuoteOutput, C as ClaimStaticDepositOutput, n as LightningReceiveRequest, r as LightningSendRequest, E as ExitSpeed, f as CoopExitRequest, e as CoopExitFeeEstimatesOutput } from './RequestLightningSendInput-B4JdzclX.js';
2
+ import { h as SigningCommitment, V as VerifiableSecretShare, S as SparkSigner } from './signer-DFGw9RRp.js';
3
3
  import { L as LightningSendFeeEstimateInput } from './LightningSendFeeEstimateInput-CJvPnCSB.js';
4
- import { h as RequestedSigningCommitments, U as UserSignedTxSigningJob, d as TreeNode, f as Transfer, L as LeafRefundTxSigningResult, i as NodeSignatures, F as FinalizeNodeSignaturesResponse, Q as QueryTransfersResponse, j as OutputWithPreviousTransactionData, k as TokenTransactionWithStatus } from './spark-FHwyinrG.js';
4
+ import { h as RequestedSigningCommitments, U as UserSignedTxSigningJob, d as TreeNode, f as Transfer, L as LeafRefundTxSigningResult, i as NodeSignatures, F as FinalizeNodeSignaturesResponse, Q as QueryTransfersResponse, j as OutputWithPreviousTransactionData, k as TokenTransactionWithStatus } from './spark-DXYE9gMM.js';
5
5
  import { WalletConfigService } from './services/config.js';
6
6
  import { ConnectionManager } from './services/connection.js';
7
7
  import { Lrc20ConnectionManager } from './services/lrc-connection.js';
@@ -10,9 +10,9 @@ import { ConfigOptions } from './services/wallet-config.js';
10
10
  import { LRCWallet } from '@buildonspark/lrc20-sdk';
11
11
  import { EventEmitter } from 'eventemitter3';
12
12
  import { SparkAddressFormat } from './address/index.js';
13
- import { a as WalletTransfer, W as WalletLeaf } from './sdk-types-BZhxaXMN.js';
13
+ import { a as WalletTransfer, W as WalletLeaf } from './sdk-types-BeI6DM_M.js';
14
14
  import './utils/index.js';
15
- import './network-Bc-W9qLR.js';
15
+ import './network-DobHpaV6.js';
16
16
 
17
17
  declare class SparkSDKError extends Error {
18
18
  readonly context: Record<string, unknown>;
@@ -444,7 +444,7 @@ declare class SparkWallet extends EventEmitter {
444
444
  * @private
445
445
  */
446
446
  private generateDepositAddress;
447
- private queryStaticDepositAddresses;
447
+ queryStaticDepositAddresses(): Promise<string[]>;
448
448
  /**
449
449
  * Get a quote on how much credit you can claim for a deposit from the SSP.
450
450
  *
@@ -569,11 +569,11 @@ declare class SparkWallet extends EventEmitter {
569
569
  *
570
570
  * @param {Object} params - Parameters for the lightning invoice
571
571
  * @param {number} params.amountSats - Amount in satoshis
572
- * @param {string} params.memo - Description for the invoice
572
+ * @param {string} [params.memo] - Description for the invoice. Should not be provided if the descriptionHash is provided.
573
573
  * @param {number} [params.expirySeconds] - Optional expiry time in seconds
574
574
  * @param {boolean} [params.includeSparkAddress] - Optional boolean signalling whether or not to include the spark address in the invoice
575
575
  * @param {string} [params.receiverIdentityPubkey] - Optional public key of the wallet receiving the lightning invoice. If not present, the receiver will be the creator of this request.
576
- * @param {string} [params.descriptionHash] - Optional h tag of the invoice. This is the hash of a longer description to include in the lightning invoice. It is used in LNURL and UMA as the hash of the metadata.
576
+ * @param {string} [params.descriptionHash] - Optional h tag of the invoice. This is the hash of a longer description to include in the lightning invoice. It is used in LNURL and UMA as the hash of the metadata. This field is mutually exclusive with the memo field. Only one or the other should be provided.
577
577
  * @returns {Promise<LightningReceiveRequest>} BOLT11 encoded invoice
578
578
  */
579
579
  createLightningInvoice({ amountSats, memo, expirySeconds, includeSparkAddress, receiverIdentityPubkey, descriptionHash, }: CreateLightningInvoiceParams): Promise<LightningReceiveRequest>;
@@ -739,6 +739,8 @@ declare class SparkWallet extends EventEmitter {
739
739
  private cleanup;
740
740
  cleanupConnections(): Promise<void>;
741
741
  private startPeriodicClaimTransfers;
742
+ private updateLeaves;
743
+ private queryNodes;
742
744
  }
743
745
 
744
746
  declare class DummyTx {
@@ -1,7 +1,7 @@
1
- import { j as LeavesSwapFeeEstimateOutput, z as StaticDepositQuoteOutput, C as ClaimStaticDepositOutput, n as LightningReceiveRequest, r as LightningSendRequest, E as ExitSpeed, f as CoopExitRequest, e as CoopExitFeeEstimatesOutput } from './RequestLightningSendInput-BtR12ZlP.cjs';
2
- import { h as SigningCommitment, V as VerifiableSecretShare, S as SparkSigner } from './signer-DQfFgVNA.cjs';
1
+ import { j as LeavesSwapFeeEstimateOutput, z as StaticDepositQuoteOutput, C as ClaimStaticDepositOutput, n as LightningReceiveRequest, r as LightningSendRequest, E as ExitSpeed, f as CoopExitRequest, e as CoopExitFeeEstimatesOutput } from './RequestLightningSendInput-39_zGri6.cjs';
2
+ import { h as SigningCommitment, V as VerifiableSecretShare, S as SparkSigner } from './signer-C1t40Wus.cjs';
3
3
  import { L as LightningSendFeeEstimateInput } from './LightningSendFeeEstimateInput-CJvPnCSB.cjs';
4
- import { h as RequestedSigningCommitments, U as UserSignedTxSigningJob, d as TreeNode, f as Transfer, L as LeafRefundTxSigningResult, i as NodeSignatures, F as FinalizeNodeSignaturesResponse, Q as QueryTransfersResponse, j as OutputWithPreviousTransactionData, k as TokenTransactionWithStatus } from './spark-FHwyinrG.cjs';
4
+ import { h as RequestedSigningCommitments, U as UserSignedTxSigningJob, d as TreeNode, f as Transfer, L as LeafRefundTxSigningResult, i as NodeSignatures, F as FinalizeNodeSignaturesResponse, Q as QueryTransfersResponse, j as OutputWithPreviousTransactionData, k as TokenTransactionWithStatus } from './spark-DXYE9gMM.cjs';
5
5
  import { WalletConfigService } from './services/config.cjs';
6
6
  import { ConnectionManager } from './services/connection.cjs';
7
7
  import { Lrc20ConnectionManager } from './services/lrc-connection.cjs';
@@ -10,9 +10,9 @@ import { ConfigOptions } from './services/wallet-config.cjs';
10
10
  import { LRCWallet } from '@buildonspark/lrc20-sdk';
11
11
  import { EventEmitter } from 'eventemitter3';
12
12
  import { SparkAddressFormat } from './address/index.cjs';
13
- import { a as WalletTransfer, W as WalletLeaf } from './sdk-types-BPwagWYa.cjs';
13
+ import { a as WalletTransfer, W as WalletLeaf } from './sdk-types-BuVMn2rX.cjs';
14
14
  import './utils/index.cjs';
15
- import './network-Dbxfi7Tp.cjs';
15
+ import './network-GFGEHkS4.cjs';
16
16
 
17
17
  declare class SparkSDKError extends Error {
18
18
  readonly context: Record<string, unknown>;
@@ -444,7 +444,7 @@ declare class SparkWallet extends EventEmitter {
444
444
  * @private
445
445
  */
446
446
  private generateDepositAddress;
447
- private queryStaticDepositAddresses;
447
+ queryStaticDepositAddresses(): Promise<string[]>;
448
448
  /**
449
449
  * Get a quote on how much credit you can claim for a deposit from the SSP.
450
450
  *
@@ -569,11 +569,11 @@ declare class SparkWallet extends EventEmitter {
569
569
  *
570
570
  * @param {Object} params - Parameters for the lightning invoice
571
571
  * @param {number} params.amountSats - Amount in satoshis
572
- * @param {string} params.memo - Description for the invoice
572
+ * @param {string} [params.memo] - Description for the invoice. Should not be provided if the descriptionHash is provided.
573
573
  * @param {number} [params.expirySeconds] - Optional expiry time in seconds
574
574
  * @param {boolean} [params.includeSparkAddress] - Optional boolean signalling whether or not to include the spark address in the invoice
575
575
  * @param {string} [params.receiverIdentityPubkey] - Optional public key of the wallet receiving the lightning invoice. If not present, the receiver will be the creator of this request.
576
- * @param {string} [params.descriptionHash] - Optional h tag of the invoice. This is the hash of a longer description to include in the lightning invoice. It is used in LNURL and UMA as the hash of the metadata.
576
+ * @param {string} [params.descriptionHash] - Optional h tag of the invoice. This is the hash of a longer description to include in the lightning invoice. It is used in LNURL and UMA as the hash of the metadata. This field is mutually exclusive with the memo field. Only one or the other should be provided.
577
577
  * @returns {Promise<LightningReceiveRequest>} BOLT11 encoded invoice
578
578
  */
579
579
  createLightningInvoice({ amountSats, memo, expirySeconds, includeSparkAddress, receiverIdentityPubkey, descriptionHash, }: CreateLightningInvoiceParams): Promise<LightningReceiveRequest>;
@@ -739,6 +739,8 @@ declare class SparkWallet extends EventEmitter {
739
739
  private cleanup;
740
740
  cleanupConnections(): Promise<void>;
741
741
  private startPeriodicClaimTransfers;
742
+ private updateLeaves;
743
+ private queryNodes;
742
744
  }
743
745
 
744
746
  declare class DummyTx {