@buildonspark/spark-sdk 0.2.4 → 0.2.6

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 (82) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/{chunk-3SEOTO43.js → chunk-3SPMJMUX.js} +3 -2
  3. package/dist/chunk-AVI5E5VT.js +66 -0
  4. package/dist/{chunk-WAQKYSDI.js → chunk-CQY5ML2A.js} +3 -2
  5. package/dist/{chunk-W4ZRBSWM.js → chunk-GUZ3WCB4.js} +466 -167
  6. package/dist/{client-KhNkrXz4.d.cts → client-CusuvuCe.d.cts} +199 -104
  7. package/dist/{client-BF4cn8F4.d.ts → client-Dn4Ld8pD.d.ts} +199 -104
  8. package/dist/debug.cjs +662 -336
  9. package/dist/debug.d.cts +9 -7
  10. package/dist/debug.d.ts +9 -7
  11. package/dist/debug.js +3 -3
  12. package/dist/graphql/objects/index.d.cts +6 -51
  13. package/dist/graphql/objects/index.d.ts +6 -51
  14. package/dist/graphql/objects/index.js +1 -1
  15. package/dist/index.cjs +713 -327
  16. package/dist/index.d.cts +19 -188
  17. package/dist/index.d.ts +19 -188
  18. package/dist/index.js +15 -8
  19. package/dist/index.node.cjs +638 -352
  20. package/dist/index.node.d.cts +7 -7
  21. package/dist/index.node.d.ts +7 -7
  22. package/dist/index.node.js +59 -100
  23. package/dist/native/index.cjs +655 -325
  24. package/dist/native/index.d.cts +253 -164
  25. package/dist/native/index.d.ts +253 -164
  26. package/dist/native/index.js +505 -172
  27. package/dist/proto/lrc20.d.cts +1 -1
  28. package/dist/proto/lrc20.d.ts +1 -1
  29. package/dist/proto/spark.d.cts +1 -1
  30. package/dist/proto/spark.d.ts +1 -1
  31. package/dist/proto/spark_token.d.cts +1 -1
  32. package/dist/proto/spark_token.d.ts +1 -1
  33. package/dist/{spark-B_7nZx6T.d.cts → spark-Cj4brrP5.d.cts} +1 -1
  34. package/dist/{spark-B_7nZx6T.d.ts → spark-Cj4brrP5.d.ts} +1 -1
  35. package/dist/{spark-wallet-C1Tr_VKI.d.ts → spark-wallet-B6YthxDI.d.ts} +61 -26
  36. package/dist/{spark-wallet-DG3x2obf.d.cts → spark-wallet-BbOf2P2l.d.cts} +61 -26
  37. package/dist/spark-wallet.node-BBk1sGS2.d.cts +12 -0
  38. package/dist/spark-wallet.node-Bffethig.d.ts +12 -0
  39. package/dist/tests/test-utils.cjs +86 -54
  40. package/dist/tests/test-utils.d.cts +24 -24
  41. package/dist/tests/test-utils.d.ts +24 -24
  42. package/dist/tests/test-utils.js +4 -4
  43. package/dist/token-transactions-0_5XMWjs.d.ts +184 -0
  44. package/dist/token-transactions-CD-Adb5y.d.cts +184 -0
  45. package/dist/types/index.cjs +3 -2
  46. package/dist/types/index.d.cts +3 -4
  47. package/dist/types/index.d.ts +3 -4
  48. package/dist/types/index.js +2 -2
  49. package/dist/{xchain-address-HBr6isnc.d.cts → xchain-address-BnKZ0-dY.d.cts} +6 -5
  50. package/dist/{xchain-address-BHu6CpZC.d.ts → xchain-address-Di3lu4Wy.d.ts} +6 -5
  51. package/package.json +7 -2
  52. package/src/graphql/client.ts +49 -8
  53. package/src/graphql/objects/SparkWalletUser.ts +1 -1
  54. package/src/graphql/queries/Transfers.ts +15 -0
  55. package/src/index.node.ts +5 -1
  56. package/src/index.ts +4 -1
  57. package/src/services/config.ts +13 -2
  58. package/src/services/token-transactions.ts +22 -8
  59. package/src/services/wallet-config.ts +22 -13
  60. package/src/spark-wallet/spark-wallet.browser.ts +72 -0
  61. package/src/spark-wallet/spark-wallet.node.ts +60 -118
  62. package/src/spark-wallet/spark-wallet.ts +400 -156
  63. package/src/tests/integration/ssp/coop-exit-validation.test.ts +233 -0
  64. package/src/tests/integration/ssp/coop-exit.test.ts +112 -93
  65. package/src/tests/integration/ssp/static-deposit-validation.test.ts +145 -0
  66. package/src/tests/integration/ssp/static_deposit.test.ts +453 -64
  67. package/src/tests/integration/ssp/transfers.test.ts +102 -0
  68. package/src/tests/integration/static_deposit.test.ts +92 -0
  69. package/src/tests/integration/transfer.test.ts +1 -1
  70. package/src/tests/utils/regtest-test-faucet.ts +8 -0
  71. package/src/tests/utils/spark-testing-wallet.ts +42 -0
  72. package/src/tests/utils/test-faucet.ts +6 -2
  73. package/src/types/sdk-types.ts +15 -0
  74. package/src/utils/bitcoin.ts +13 -0
  75. package/src/utils/token-identifier.ts +47 -4
  76. package/src/utils/token-transactions.ts +13 -9
  77. package/dist/chunk-TVUMSHWA.js +0 -7
  78. package/dist/sdk-types-CB9HrW5O.d.cts +0 -44
  79. package/dist/sdk-types-CkRNraXT.d.ts +0 -44
  80. package/dist/spark-wallet.node-CGxoeCpH.d.ts +0 -13
  81. package/dist/spark-wallet.node-CN9LoB_O.d.cts +0 -13
  82. package/src/graphql/queries/Transfer.ts +0 -10
@@ -15995,7 +15995,7 @@ function getLocalFrostSignerAddress() {
15995
15995
  var BASE_CONFIG = {
15996
15996
  network: "LOCAL",
15997
15997
  lrc20Address: getLrc20Url("LOCAL"),
15998
- coodinatorIdentifier: "0000000000000000000000000000000000000000000000000000000000000001",
15998
+ coordinatorIdentifier: "0000000000000000000000000000000000000000000000000000000000000001",
15999
15999
  frostSignerAddress: getLocalFrostSignerAddress(),
16000
16000
  threshold: 2,
16001
16001
  signingOperators: getLocalSigningOperators(),
@@ -16014,6 +16014,9 @@ var BASE_CONFIG = {
16014
16014
  baseUrl: getSspUrl("LOCAL"),
16015
16015
  identityPublicKey: getSspIdentityPublicKey("LOCAL"),
16016
16016
  schemaEndpoint: getSspSchemaEndpoint("LOCAL")
16017
+ },
16018
+ console: {
16019
+ otel: false
16017
16020
  }
16018
16021
  };
16019
16022
  var LOCAL_WALLET_CONFIG = {
@@ -16096,6 +16099,10 @@ function getSigningOperators() {
16096
16099
  };
16097
16100
  }
16098
16101
  function getLocalSigningOperators() {
16102
+ const addresses = Array.from(
16103
+ { length: 5 },
16104
+ (_, i) => isHermeticTest ? `https://${i}.spark.minikube.local` : `https://localhost:${i + 8535}`
16105
+ );
16099
16106
  const pubkeys = [
16100
16107
  "0322ca18fc489ae25418a0e768273c2c61cabb823edfb14feb891e9bec62016510",
16101
16108
  "0341727a6c41b168f07eb50865ab8c397a53c7eef628ac1020956b705e43b6cb27",
@@ -16107,31 +16114,31 @@ function getLocalSigningOperators() {
16107
16114
  "0000000000000000000000000000000000000000000000000000000000000001": {
16108
16115
  id: 0,
16109
16116
  identifier: "0000000000000000000000000000000000000000000000000000000000000001",
16110
- address: "https://localhost:8535",
16117
+ address: addresses[0],
16111
16118
  identityPublicKey: pubkeys[0]
16112
16119
  },
16113
16120
  "0000000000000000000000000000000000000000000000000000000000000002": {
16114
16121
  id: 1,
16115
16122
  identifier: "0000000000000000000000000000000000000000000000000000000000000002",
16116
- address: "https://localhost:8536",
16123
+ address: addresses[1],
16117
16124
  identityPublicKey: pubkeys[1]
16118
16125
  },
16119
16126
  "0000000000000000000000000000000000000000000000000000000000000003": {
16120
16127
  id: 2,
16121
16128
  identifier: "0000000000000000000000000000000000000000000000000000000000000003",
16122
- address: "https://localhost:8537",
16129
+ address: addresses[2],
16123
16130
  identityPublicKey: pubkeys[2]
16124
16131
  },
16125
16132
  "0000000000000000000000000000000000000000000000000000000000000004": {
16126
16133
  id: 3,
16127
16134
  identifier: "0000000000000000000000000000000000000000000000000000000000000004",
16128
- address: "https://localhost:8538",
16135
+ address: addresses[3],
16129
16136
  identityPublicKey: pubkeys[3]
16130
16137
  },
16131
16138
  "0000000000000000000000000000000000000000000000000000000000000005": {
16132
16139
  id: 4,
16133
16140
  identifier: "0000000000000000000000000000000000000000000000000000000000000005",
16134
- address: "https://localhost:8539",
16141
+ address: addresses[4],
16135
16142
  identityPublicKey: pubkeys[4]
16136
16143
  }
16137
16144
  };
@@ -16845,10 +16852,11 @@ var import_base3 = require("@scure/base");
16845
16852
  // src/utils/token-transactions.ts
16846
16853
  init_buffer();
16847
16854
  var import_utils9 = require("@noble/curves/abstract/utils");
16855
+ var import_utils10 = require("@scure/btc-signer/utils");
16848
16856
 
16849
16857
  // src/utils/transfer_package.ts
16850
16858
  init_buffer();
16851
- var import_utils10 = require("@noble/curves/abstract/utils");
16859
+ var import_utils11 = require("@noble/curves/abstract/utils");
16852
16860
  var import_sha23 = require("@noble/hashes/sha2");
16853
16861
 
16854
16862
  // src/utils/transaction.ts
@@ -16980,7 +16988,7 @@ function getEphemeralAnchorOutput() {
16980
16988
 
16981
16989
  // src/utils/unilateral-exit.ts
16982
16990
  init_buffer();
16983
- var import_utils11 = require("@noble/curves/abstract/utils");
16991
+ var import_utils12 = require("@noble/curves/abstract/utils");
16984
16992
  var import_legacy = require("@noble/hashes/legacy");
16985
16993
  var import_sha24 = require("@noble/hashes/sha2");
16986
16994
  var btc3 = __toESM(require("@scure/btc-signer"), 1);
@@ -17001,13 +17009,13 @@ var networkByType = {
17001
17009
  init_buffer();
17002
17010
  var import_secp256k17 = require("@bitcoinerlab/secp256k1");
17003
17011
  var import_lrc20_sdk2 = require("@buildonspark/lrc20-sdk");
17004
- var import_utils12 = require("@noble/curves/abstract/utils");
17012
+ var import_utils13 = require("@noble/curves/abstract/utils");
17005
17013
  var import_secp256k18 = require("@noble/curves/secp256k1");
17006
17014
  var import_sha25 = require("@noble/hashes/sha2");
17007
17015
  var import_bip32 = require("@scure/bip32");
17008
17016
  var import_bip39 = require("@scure/bip39");
17009
17017
  var import_english = require("@scure/bip39/wordlists/english");
17010
- var import_utils13 = require("@scure/btc-signer/utils");
17018
+ var import_utils14 = require("@scure/btc-signer/utils");
17011
17019
  var ecies = __toESM(require("eciesjs"), 1);
17012
17020
 
17013
17021
  // src/constants.ts
@@ -17015,7 +17023,7 @@ init_buffer();
17015
17023
  var import_core8 = require("@lightsparkdev/core");
17016
17024
  var isReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
17017
17025
  var isBun = globalThis.Bun !== void 0;
17018
- var packageVersion = true ? "0.2.4" : "unknown";
17026
+ var packageVersion = true ? "0.2.6" : "unknown";
17019
17027
  var baseEnvStr = "unknown";
17020
17028
  if (isBun) {
17021
17029
  const bunVersion = "version" in globalThis.Bun ? globalThis.Bun.version : "unknown-version";
@@ -17124,7 +17132,7 @@ var DefaultSparkSigner = class {
17124
17132
  });
17125
17133
  }
17126
17134
  const receiverEciesPrivKey = ecies.PrivateKey.fromHex(
17127
- (0, import_utils12.bytesToHex)(this.identityKey.privateKey)
17135
+ (0, import_utils13.bytesToHex)(this.identityKey.privateKey)
17128
17136
  );
17129
17137
  const privateKey = ecies.decrypt(receiverEciesPrivKey.toHex(), ciphertext);
17130
17138
  return privateKey;
@@ -17258,7 +17266,7 @@ var DefaultSparkSigner = class {
17258
17266
  threshold,
17259
17267
  numShares
17260
17268
  }) {
17261
- const secretAsInt = (0, import_utils12.bytesToNumberBE)(secret);
17269
+ const secretAsInt = (0, import_utils13.bytesToNumberBE)(secret);
17262
17270
  return splitSecretWithProofs(secretAsInt, curveOrder, threshold, numShares);
17263
17271
  }
17264
17272
  async signFrost({
@@ -17334,7 +17342,7 @@ var DefaultSparkSigner = class {
17334
17342
  }
17335
17343
  async createSparkWalletFromSeed(seed, accountNumber) {
17336
17344
  if (typeof seed === "string") {
17337
- seed = (0, import_utils12.hexToBytes)(seed);
17345
+ seed = (0, import_utils13.hexToBytes)(seed);
17338
17346
  }
17339
17347
  const {
17340
17348
  identityKey,
@@ -17346,7 +17354,7 @@ var DefaultSparkSigner = class {
17346
17354
  this.depositKey = depositKey;
17347
17355
  this.signingKey = signingKey.hdKey;
17348
17356
  this.staticDepositKey = staticDepositKey.hdKey;
17349
- return (0, import_utils12.bytesToHex)(identityKey.publicKey);
17357
+ return (0, import_utils13.bytesToHex)(identityKey.publicKey);
17350
17358
  }
17351
17359
  async signMessageWithIdentityKey(message, compact) {
17352
17360
  if (!this.identityKey?.privateKey) {
@@ -17367,7 +17375,7 @@ var DefaultSparkSigner = class {
17367
17375
  });
17368
17376
  }
17369
17377
  const receiverEciesPrivKey = ecies.PrivateKey.fromHex(
17370
- (0, import_utils12.bytesToHex)(this.identityKey.privateKey)
17378
+ (0, import_utils13.bytesToHex)(this.identityKey.privateKey)
17371
17379
  );
17372
17380
  const privateKey = ecies.decrypt(receiverEciesPrivKey.toHex(), ciphertext);
17373
17381
  const publicKey = import_secp256k18.secp256k1.getPublicKey(privateKey);
@@ -17419,15 +17427,15 @@ var DefaultSparkSigner = class {
17419
17427
  }
17420
17428
  signTransactionIndex(tx, index, publicKey) {
17421
17429
  let privateKey;
17422
- if ((0, import_utils12.equalBytes)(publicKey, this.identityKey?.publicKey ?? new Uint8Array())) {
17430
+ if ((0, import_utils13.equalBytes)(publicKey, this.identityKey?.publicKey ?? new Uint8Array())) {
17423
17431
  privateKey = this.identityKey?.privateKey;
17424
- } else if ((0, import_utils12.equalBytes)(publicKey, this.depositKey?.publicKey ?? new Uint8Array())) {
17432
+ } else if ((0, import_utils13.equalBytes)(publicKey, this.depositKey?.publicKey ?? new Uint8Array())) {
17425
17433
  privateKey = this.depositKey?.privateKey;
17426
17434
  }
17427
17435
  if (!privateKey) {
17428
17436
  throw new ValidationError("Private key not found for public key", {
17429
17437
  field: "privateKey",
17430
- value: (0, import_utils12.bytesToHex)(publicKey)
17438
+ value: (0, import_utils13.bytesToHex)(publicKey)
17431
17439
  });
17432
17440
  }
17433
17441
  tx.signIdx(privateKey, index);
@@ -17492,10 +17500,13 @@ var UnsafeStatelessSparkSigner = class extends DefaultSparkSigner {
17492
17500
  }
17493
17501
  };
17494
17502
 
17503
+ // src/spark-wallet/spark-wallet.browser.ts
17504
+ init_buffer();
17505
+
17495
17506
  // src/spark-wallet/spark-wallet.ts
17496
17507
  init_buffer();
17497
17508
  var import_core12 = require("@lightsparkdev/core");
17498
- var import_utils24 = require("@noble/curves/abstract/utils");
17509
+ var import_utils25 = require("@noble/curves/abstract/utils");
17499
17510
  var import_secp256k115 = require("@noble/curves/secp256k1");
17500
17511
  var import_bip392 = require("@scure/bip39");
17501
17512
  var import_english2 = require("@scure/bip39/wordlists/english");
@@ -18034,15 +18045,19 @@ var LightningSendFeeEstimate = `
18034
18045
  ${FRAGMENT13}
18035
18046
  `;
18036
18047
 
18037
- // src/graphql/queries/Transfer.ts
18048
+ // src/graphql/queries/Transfers.ts
18038
18049
  init_buffer();
18039
- var GetTransfer = `
18040
- query Transfer($transfer_spark_id: UUID!) {
18041
- transfer(transfer_spark_id: $transfer_spark_id) {
18050
+ var GetTransfers = `
18051
+ query Transfers($transfer_spark_ids: [UUID!]!) {
18052
+ transfers(transfer_spark_ids: $transfer_spark_ids) {
18042
18053
  ...TransferFragment
18054
+ transfer_user_request: user_request {
18055
+ ...UserRequestFragment
18056
+ }
18043
18057
  }
18044
18058
  }
18045
18059
  ${FRAGMENT2}
18060
+ ${FRAGMENT6}
18046
18061
  `;
18047
18062
 
18048
18063
  // src/graphql/queries/UserRequest.ts
@@ -18084,7 +18099,7 @@ var WalletConfigService = class {
18084
18099
  }
18085
18100
  }
18086
18101
  getCoordinatorAddress() {
18087
- const coordinator = this.config.signingOperators[this.config.coodinatorIdentifier];
18102
+ const coordinator = this.config.signingOperators[this.config.coordinatorIdentifier];
18088
18103
  if (!coordinator) {
18089
18104
  throw new ConfigurationError(
18090
18105
  "Coordinator not found in signing operators",
@@ -18105,7 +18120,7 @@ var WalletConfigService = class {
18105
18120
  return this.config.threshold;
18106
18121
  }
18107
18122
  getCoordinatorIdentifier() {
18108
- return this.config.coodinatorIdentifier;
18123
+ return this.config.coordinatorIdentifier;
18109
18124
  }
18110
18125
  getExpectedWithdrawBondSats() {
18111
18126
  return this.config.expectedWithdrawBondSats;
@@ -18146,9 +18161,17 @@ var WalletConfigService = class {
18146
18161
  getElectrsUrl() {
18147
18162
  return this.config.electrsUrl;
18148
18163
  }
18164
+ getSspBaseUrl() {
18165
+ return this.config.sspClientOptions.baseUrl;
18166
+ }
18149
18167
  getSspIdentityPublicKey() {
18150
18168
  return this.config.sspClientOptions.identityPublicKey;
18151
18169
  }
18170
+ getConsoleOptions() {
18171
+ return {
18172
+ ...this.config.console
18173
+ };
18174
+ }
18152
18175
  };
18153
18176
 
18154
18177
  // src/services/connection.ts
@@ -21963,7 +21986,7 @@ var import_uuidv73 = require("uuidv7");
21963
21986
 
21964
21987
  // src/services/transfer.ts
21965
21988
  init_buffer();
21966
- var import_utils14 = require("@noble/curves/abstract/utils");
21989
+ var import_utils15 = require("@noble/curves/abstract/utils");
21967
21990
  var import_secp256k19 = require("@noble/curves/secp256k1");
21968
21991
  var import_sha28 = require("@noble/hashes/sha2");
21969
21992
  var import_btc_signer2 = require("@scure/btc-signer");
@@ -21975,9 +21998,9 @@ var DEFAULT_EXPIRY_TIME = 10 * 60 * 1e3;
21975
21998
  init_buffer();
21976
21999
  var import_secp256k110 = require("@noble/curves/secp256k1");
21977
22000
  var import_sha29 = require("@noble/hashes/sha2");
21978
- var import_utils15 = require("@noble/hashes/utils");
22001
+ var import_utils16 = require("@noble/hashes/utils");
21979
22002
  var import_btc_signer4 = require("@scure/btc-signer");
21980
- var import_utils16 = require("@scure/btc-signer/utils");
22003
+ var import_utils17 = require("@scure/btc-signer/utils");
21981
22004
  var DepositService = class {
21982
22005
  config;
21983
22006
  connectionManager;
@@ -22028,7 +22051,7 @@ var DepositService = class {
22028
22051
  if (operator.identifier === this.config.getCoordinatorIdentifier()) {
22029
22052
  continue;
22030
22053
  }
22031
- const operatorPubkey2 = (0, import_utils15.hexToBytes)(operator.identityPublicKey);
22054
+ const operatorPubkey2 = (0, import_utils16.hexToBytes)(operator.identityPublicKey);
22032
22055
  const operatorSig = address2.depositAddressProof.addressSignatures[operator.identifier];
22033
22056
  if (!operatorSig) {
22034
22057
  throw new ValidationError("Operator signature not found", {
@@ -22113,7 +22136,7 @@ var DepositService = class {
22113
22136
  });
22114
22137
  }
22115
22138
  const depositOutPoint = {
22116
- txid: (0, import_utils15.hexToBytes)(getTxId(depositTx)),
22139
+ txid: (0, import_utils16.hexToBytes)(getTxId(depositTx)),
22117
22140
  index: vout
22118
22141
  };
22119
22142
  const depositTxOut = {
@@ -22132,8 +22155,8 @@ var DepositService = class {
22132
22155
  const { cpfpRefundTx, directRefundTx, directFromCpfpRefundTx } = createRefundTxs({
22133
22156
  sequence: INITIAL_SEQUENCE,
22134
22157
  directSequence: INITIAL_DIRECT_SEQUENCE,
22135
- input: { txid: (0, import_utils15.hexToBytes)(getTxId(cpfpRootTx)), index: 0 },
22136
- directInput: { txid: (0, import_utils15.hexToBytes)(getTxId(directRootTx)), index: 0 },
22158
+ input: { txid: (0, import_utils16.hexToBytes)(getTxId(cpfpRootTx)), index: 0 },
22159
+ directInput: { txid: (0, import_utils16.hexToBytes)(getTxId(directRootTx)), index: 0 },
22137
22160
  amountSats: amount,
22138
22161
  receivingPubkey: signingPubKey,
22139
22162
  network: this.config.getNetwork()
@@ -22263,7 +22286,7 @@ var DepositService = class {
22263
22286
  }
22264
22287
  );
22265
22288
  }
22266
- if (!(0, import_utils16.equalBytes)(treeResp.rootNodeSignatureShares.verifyingKey, verifyingKey)) {
22289
+ if (!(0, import_utils17.equalBytes)(treeResp.rootNodeSignatureShares.verifyingKey, verifyingKey)) {
22267
22290
  throw new ValidationError("Verifying key mismatch", {
22268
22291
  field: "verifyingKey",
22269
22292
  value: treeResp.rootNodeSignatureShares.verifyingKey,
@@ -22427,7 +22450,7 @@ var DepositService = class {
22427
22450
  });
22428
22451
  }
22429
22452
  const depositOutPoint = {
22430
- txid: (0, import_utils15.hexToBytes)(getTxId(depositTx)),
22453
+ txid: (0, import_utils16.hexToBytes)(getTxId(depositTx)),
22431
22454
  index: vout
22432
22455
  };
22433
22456
  const depositTxOut = {
@@ -22440,7 +22463,7 @@ var DepositService = class {
22440
22463
  const signingPubKey = await this.config.signer.getPublicKeyFromDerivation(keyDerivation);
22441
22464
  const { cpfpRefundTx } = createRefundTxs({
22442
22465
  sequence: INITIAL_SEQUENCE,
22443
- input: { txid: (0, import_utils15.hexToBytes)(getTxId(cpfpRootTx)), index: 0 },
22466
+ input: { txid: (0, import_utils16.hexToBytes)(getTxId(cpfpRootTx)), index: 0 },
22444
22467
  amountSats: amount,
22445
22468
  receivingPubkey: signingPubKey,
22446
22469
  network: this.config.getNetwork()
@@ -22510,7 +22533,7 @@ var DepositService = class {
22510
22533
  }
22511
22534
  );
22512
22535
  }
22513
- if (!(0, import_utils16.equalBytes)(treeResp.rootNodeSignatureShares.verifyingKey, verifyingKey)) {
22536
+ if (!(0, import_utils17.equalBytes)(treeResp.rootNodeSignatureShares.verifyingKey, verifyingKey)) {
22514
22537
  throw new ValidationError("Verifying key mismatch", {
22515
22538
  field: "verifyingKey",
22516
22539
  value: treeResp.rootNodeSignatureShares.verifyingKey,
@@ -22586,7 +22609,7 @@ var DepositService = class {
22586
22609
 
22587
22610
  // src/services/lightning.ts
22588
22611
  init_buffer();
22589
- var import_utils17 = require("@noble/curves/abstract/utils");
22612
+ var import_utils18 = require("@noble/curves/abstract/utils");
22590
22613
  var import_secp256k111 = require("@noble/curves/secp256k1");
22591
22614
  var import_sha210 = require("@noble/hashes/sha2");
22592
22615
  var import_uuidv74 = require("uuidv7");
@@ -22597,9 +22620,9 @@ var import_light_bolt11_decoder = require("light-bolt11-decoder");
22597
22620
 
22598
22621
  // src/services/token-transactions.ts
22599
22622
  init_buffer();
22600
- var import_utils18 = require("@noble/curves/abstract/utils");
22623
+ var import_utils19 = require("@noble/curves/abstract/utils");
22601
22624
  var import_secp256k113 = require("@noble/curves/secp256k1");
22602
- var import_utils19 = require("@noble/hashes/utils");
22625
+ var import_utils20 = require("@noble/hashes/utils");
22603
22626
 
22604
22627
  // src/utils/token-hashing.ts
22605
22628
  init_buffer();
@@ -22614,29 +22637,31 @@ init_buffer();
22614
22637
 
22615
22638
  // src/services/tree-creation.ts
22616
22639
  init_buffer();
22617
- var import_utils20 = require("@noble/curves/abstract/utils");
22640
+ var import_utils21 = require("@noble/curves/abstract/utils");
22618
22641
  var import_btc_signer5 = require("@scure/btc-signer");
22619
22642
 
22620
22643
  // src/spark-wallet/spark-wallet.ts
22621
22644
  var import_lrc20_sdk3 = require("@buildonspark/lrc20-sdk");
22622
22645
  var import_sha212 = require("@noble/hashes/sha2");
22646
+ var import_api = require("@opentelemetry/api");
22647
+ var import_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
22623
22648
  var import_eventemitter3 = require("eventemitter3");
22624
22649
 
22625
22650
  // src/services/signing.ts
22626
22651
  init_buffer();
22627
- var import_utils21 = require("@noble/curves/abstract/utils");
22652
+ var import_utils22 = require("@noble/curves/abstract/utils");
22628
22653
 
22629
22654
  // src/tests/utils/test-faucet.ts
22630
22655
  init_buffer();
22631
- var import_utils22 = require("@noble/curves/abstract/utils");
22656
+ var import_utils23 = require("@noble/curves/abstract/utils");
22632
22657
  var import_secp256k114 = require("@noble/curves/secp256k1");
22633
22658
  var btc5 = __toESM(require("@scure/btc-signer"), 1);
22634
22659
  var import_btc_signer6 = require("@scure/btc-signer");
22635
- var import_utils23 = require("@scure/btc-signer/utils");
22636
- var STATIC_FAUCET_KEY = (0, import_utils22.hexToBytes)(
22660
+ var import_utils24 = require("@scure/btc-signer/utils");
22661
+ var STATIC_FAUCET_KEY = (0, import_utils23.hexToBytes)(
22637
22662
  "deadbeef1337cafe4242424242424242deadbeef1337cafe4242424242424242"
22638
22663
  );
22639
- var STATIC_MINING_KEY = (0, import_utils22.hexToBytes)(
22664
+ var STATIC_MINING_KEY = (0, import_utils23.hexToBytes)(
22640
22665
  "1337cafe4242deadbeef4242424242421337cafe4242deadbeef424242424242"
22641
22666
  );
22642
22667
  var SATS_PER_BTC = 1e8;
@@ -22699,7 +22724,7 @@ var BitcoinFaucet = class _BitcoinFaucet {
22699
22724
  if (!scanResult.success || scanResult.unspents.length === 0) {
22700
22725
  const blockHash = await this.generateToAddress(1, address2);
22701
22726
  const block = await this.getBlock(blockHash[0]);
22702
- const fundingTx = import_btc_signer6.Transaction.fromRaw((0, import_utils22.hexToBytes)(block.tx[0].hex), {
22727
+ const fundingTx = import_btc_signer6.Transaction.fromRaw((0, import_utils23.hexToBytes)(block.tx[0].hex), {
22703
22728
  allowUnknownOutputs: true
22704
22729
  });
22705
22730
  await this.generateToAddress(100, this.miningAddress);
@@ -22761,13 +22786,13 @@ var BitcoinFaucet = class _BitcoinFaucet {
22761
22786
  },
22762
22787
  STATIC_MINING_KEY
22763
22788
  );
22764
- await this.broadcastTx((0, import_utils22.bytesToHex)(signedSplitTx.extract()));
22789
+ await this.broadcastTx((0, import_utils23.bytesToHex)(signedSplitTx.extract()));
22765
22790
  const splitTxId = signedSplitTx.id;
22766
22791
  for (let i = 0; i < numCoinsToCreate; i++) {
22767
22792
  this.coins.push({
22768
22793
  key: STATIC_FAUCET_KEY,
22769
22794
  outpoint: {
22770
- txid: (0, import_utils22.hexToBytes)(splitTxId),
22795
+ txid: (0, import_utils23.hexToBytes)(splitTxId),
22771
22796
  index: i
22772
22797
  },
22773
22798
  txout: signedSplitTx.getOutput(i)
@@ -22795,7 +22820,7 @@ var BitcoinFaucet = class _BitcoinFaucet {
22795
22820
  coinToSend.txout,
22796
22821
  coinToSend.key
22797
22822
  );
22798
- await this.broadcastTx((0, import_utils22.bytesToHex)(signedTx.extract()));
22823
+ await this.broadcastTx((0, import_utils23.bytesToHex)(signedTx.extract()));
22799
22824
  }
22800
22825
  async signFaucetCoin(unsignedTx, fundingTxOut, key) {
22801
22826
  const pubKey = import_secp256k114.secp256k1.getPublicKey(key);
@@ -22815,7 +22840,7 @@ var BitcoinFaucet = class _BitcoinFaucet {
22815
22840
  new Array(unsignedTx.inputsLength).fill(fundingTxOut.amount)
22816
22841
  );
22817
22842
  const merkleRoot = new Uint8Array();
22818
- const tweakedKey = (0, import_utils23.taprootTweakPrivKey)(key, merkleRoot);
22843
+ const tweakedKey = (0, import_utils24.taprootTweakPrivKey)(key, merkleRoot);
22819
22844
  if (!tweakedKey)
22820
22845
  throw new Error("Invalid private key for taproot tweaking");
22821
22846
  const signature = import_secp256k114.schnorr.sign(sighash, tweakedKey);
@@ -22885,7 +22910,7 @@ var BitcoinFaucet = class _BitcoinFaucet {
22885
22910
  const pubKey = import_secp256k114.secp256k1.getPublicKey(key);
22886
22911
  return getP2TRAddressFromPublicKey(pubKey, 4 /* LOCAL */);
22887
22912
  }
22888
- async sendToAddress(address2, amount) {
22913
+ async sendToAddress(address2, amount, blocksToGenerate = 1) {
22889
22914
  const coin = await this.fund();
22890
22915
  if (!coin) {
22891
22916
  throw new Error("No coins available");
@@ -22915,7 +22940,7 @@ var BitcoinFaucet = class _BitcoinFaucet {
22915
22940
  });
22916
22941
  }
22917
22942
  const signedTx = await this.signFaucetCoin(tx, coin.txout, coin.key);
22918
- const txHex = (0, import_utils22.bytesToHex)(signedTx.extract());
22943
+ const txHex = (0, import_utils23.bytesToHex)(signedTx.extract());
22919
22944
  await this.broadcastTx(txHex);
22920
22945
  const randomKey = import_secp256k114.secp256k1.utils.randomPrivateKey();
22921
22946
  const randomPubKey = import_secp256k114.secp256k1.getPublicKey(randomKey);
@@ -22923,7 +22948,7 @@ var BitcoinFaucet = class _BitcoinFaucet {
22923
22948
  randomPubKey,
22924
22949
  4 /* LOCAL */
22925
22950
  );
22926
- await this.generateToAddress(1, randomAddress);
22951
+ await this.generateToAddress(blocksToGenerate, randomAddress);
22927
22952
  return signedTx;
22928
22953
  }
22929
22954
  async getRawTransaction(txid) {
@@ -22934,6 +22959,13 @@ var BitcoinFaucet = class _BitcoinFaucet {
22934
22959
  // src/utils/chunkArray.ts
22935
22960
  init_buffer();
22936
22961
 
22962
+ // src/spark-wallet/spark-wallet.browser.ts
22963
+ var import_sdk_trace_web = require("@opentelemetry/sdk-trace-web");
22964
+ var import_instrumentation = require("@opentelemetry/instrumentation");
22965
+ var import_instrumentation_fetch = require("@opentelemetry/instrumentation-fetch");
22966
+ var import_core13 = require("@opentelemetry/core");
22967
+ var import_api2 = require("@opentelemetry/api");
22968
+
22937
22969
  // src/spark-wallet/types.ts
22938
22970
  init_buffer();
22939
22971
 
@@ -1,7 +1,7 @@
1
- import { Q as QueryTransfersResponse, f as Transfer, d as TreeNode } from '../spark-B_7nZx6T.cjs';
2
- import { b as ConfigOptions, w as SparkWalletProps } from '../spark-wallet-DG3x2obf.cjs';
3
- import { S as SparkSigner, D as DefaultSparkSigner } from '../client-KhNkrXz4.cjs';
4
- import { S as SparkWallet } from '../spark-wallet.node-CN9LoB_O.cjs';
1
+ import { Q as QueryTransfersResponse, c as Transfer, d as TreeNode } from '../spark-Cj4brrP5.cjs';
2
+ import { b as ConfigOptions, x as SparkWalletProps } from '../spark-wallet-BbOf2P2l.cjs';
3
+ import { S as SparkSigner, D as DefaultSparkSigner } from '../client-CusuvuCe.cjs';
4
+ import { S as SparkWalletNodeJS } from '../spark-wallet.node-BBk1sGS2.cjs';
5
5
  import { Transaction } from '@scure/btc-signer';
6
6
  import { TransactionInput, TransactionOutput } from '@scure/btc-signer/psbt';
7
7
  import '@bufbuild/protobuf/wire';
@@ -11,30 +11,12 @@ import 'bitcoinjs-lib';
11
11
  import 'nice-grpc';
12
12
  import 'nice-grpc-web';
13
13
  import '../proto/spark_token.cjs';
14
+ import '@opentelemetry/sdk-trace-base';
14
15
  import 'eventemitter3';
15
- import '../sdk-types-CB9HrW5O.cjs';
16
16
  import '@lightsparkdev/core';
17
17
  import '@scure/bip32';
18
18
  import '../types-BADxR3bm.cjs';
19
19
 
20
- interface ISparkWalletTesting extends SparkWallet {
21
- getSigner(): SparkSigner;
22
- queryPendingTransfers(): Promise<QueryTransfersResponse>;
23
- verifyPendingTransfer(transfer: Transfer): Promise<Map<string, Uint8Array>>;
24
- }
25
- declare class SparkWalletTesting extends SparkWallet implements ISparkWalletTesting {
26
- private disableEvents;
27
- constructor(options?: ConfigOptions, signer?: SparkSigner, disableEvents?: boolean);
28
- static initialize(props: SparkWalletProps, disableEvents?: boolean): Promise<{
29
- wallet: SparkWalletTesting;
30
- mnemonic: string | undefined;
31
- }>;
32
- protected setupBackgroundStream(): Promise<void>;
33
- getSigner(): SparkSigner;
34
- queryPendingTransfers(): Promise<QueryTransfersResponse>;
35
- verifyPendingTransfer(transfer: Transfer): Promise<Map<string, Uint8Array>>;
36
- }
37
-
38
20
  type FaucetCoin = {
39
21
  key: Uint8Array;
40
22
  outpoint: TransactionInput;
@@ -61,10 +43,28 @@ declare class BitcoinFaucet {
61
43
  getBlock(blockHash: string): Promise<any>;
62
44
  broadcastTx(txHex: string): Promise<any>;
63
45
  getNewAddress(): Promise<string>;
64
- sendToAddress(address: string, amount: bigint): Promise<Transaction>;
46
+ sendToAddress(address: string, amount: bigint, blocksToGenerate?: number): Promise<Transaction>;
65
47
  getRawTransaction(txid: string): Promise<any>;
66
48
  }
67
49
 
50
+ interface ISparkWalletTesting extends SparkWalletNodeJS {
51
+ getSigner(): SparkSigner;
52
+ queryPendingTransfers(): Promise<QueryTransfersResponse>;
53
+ verifyPendingTransfer(transfer: Transfer): Promise<Map<string, Uint8Array>>;
54
+ }
55
+ declare class SparkWalletTesting extends SparkWalletNodeJS implements ISparkWalletTesting {
56
+ private disableEvents;
57
+ constructor(options?: ConfigOptions, signer?: SparkSigner, disableEvents?: boolean);
58
+ static initialize(props: SparkWalletProps, disableEvents?: boolean): Promise<{
59
+ wallet: SparkWalletTesting;
60
+ mnemonic: string | undefined;
61
+ }>;
62
+ protected setupBackgroundStream(): Promise<void>;
63
+ getSigner(): SparkSigner;
64
+ queryPendingTransfers(): Promise<QueryTransfersResponse>;
65
+ verifyPendingTransfer(transfer: Transfer): Promise<Map<string, Uint8Array>>;
66
+ }
67
+
68
68
  declare function getTestWalletConfig(): ConfigOptions;
69
69
  declare function getTestWalletConfigWithIdentityKey(identityPrivateKey: Uint8Array): ConfigOptions;
70
70
  declare function createNewTree(wallet: SparkWalletTesting, leafId: string, faucet: BitcoinFaucet, amountSats?: bigint): Promise<TreeNode>;
@@ -1,7 +1,7 @@
1
- import { Q as QueryTransfersResponse, f as Transfer, d as TreeNode } from '../spark-B_7nZx6T.js';
2
- import { b as ConfigOptions, w as SparkWalletProps } from '../spark-wallet-C1Tr_VKI.js';
3
- import { S as SparkSigner, D as DefaultSparkSigner } from '../client-BF4cn8F4.js';
4
- import { S as SparkWallet } from '../spark-wallet.node-CGxoeCpH.js';
1
+ import { Q as QueryTransfersResponse, c as Transfer, d as TreeNode } from '../spark-Cj4brrP5.js';
2
+ import { b as ConfigOptions, x as SparkWalletProps } from '../spark-wallet-B6YthxDI.js';
3
+ import { S as SparkSigner, D as DefaultSparkSigner } from '../client-Dn4Ld8pD.js';
4
+ import { S as SparkWalletNodeJS } from '../spark-wallet.node-Bffethig.js';
5
5
  import { Transaction } from '@scure/btc-signer';
6
6
  import { TransactionInput, TransactionOutput } from '@scure/btc-signer/psbt';
7
7
  import '@bufbuild/protobuf/wire';
@@ -11,30 +11,12 @@ import 'bitcoinjs-lib';
11
11
  import 'nice-grpc';
12
12
  import 'nice-grpc-web';
13
13
  import '../proto/spark_token.js';
14
+ import '@opentelemetry/sdk-trace-base';
14
15
  import 'eventemitter3';
15
- import '../sdk-types-CkRNraXT.js';
16
16
  import '@lightsparkdev/core';
17
17
  import '@scure/bip32';
18
18
  import '../types-BADxR3bm.js';
19
19
 
20
- interface ISparkWalletTesting extends SparkWallet {
21
- getSigner(): SparkSigner;
22
- queryPendingTransfers(): Promise<QueryTransfersResponse>;
23
- verifyPendingTransfer(transfer: Transfer): Promise<Map<string, Uint8Array>>;
24
- }
25
- declare class SparkWalletTesting extends SparkWallet implements ISparkWalletTesting {
26
- private disableEvents;
27
- constructor(options?: ConfigOptions, signer?: SparkSigner, disableEvents?: boolean);
28
- static initialize(props: SparkWalletProps, disableEvents?: boolean): Promise<{
29
- wallet: SparkWalletTesting;
30
- mnemonic: string | undefined;
31
- }>;
32
- protected setupBackgroundStream(): Promise<void>;
33
- getSigner(): SparkSigner;
34
- queryPendingTransfers(): Promise<QueryTransfersResponse>;
35
- verifyPendingTransfer(transfer: Transfer): Promise<Map<string, Uint8Array>>;
36
- }
37
-
38
20
  type FaucetCoin = {
39
21
  key: Uint8Array;
40
22
  outpoint: TransactionInput;
@@ -61,10 +43,28 @@ declare class BitcoinFaucet {
61
43
  getBlock(blockHash: string): Promise<any>;
62
44
  broadcastTx(txHex: string): Promise<any>;
63
45
  getNewAddress(): Promise<string>;
64
- sendToAddress(address: string, amount: bigint): Promise<Transaction>;
46
+ sendToAddress(address: string, amount: bigint, blocksToGenerate?: number): Promise<Transaction>;
65
47
  getRawTransaction(txid: string): Promise<any>;
66
48
  }
67
49
 
50
+ interface ISparkWalletTesting extends SparkWalletNodeJS {
51
+ getSigner(): SparkSigner;
52
+ queryPendingTransfers(): Promise<QueryTransfersResponse>;
53
+ verifyPendingTransfer(transfer: Transfer): Promise<Map<string, Uint8Array>>;
54
+ }
55
+ declare class SparkWalletTesting extends SparkWalletNodeJS implements ISparkWalletTesting {
56
+ private disableEvents;
57
+ constructor(options?: ConfigOptions, signer?: SparkSigner, disableEvents?: boolean);
58
+ static initialize(props: SparkWalletProps, disableEvents?: boolean): Promise<{
59
+ wallet: SparkWalletTesting;
60
+ mnemonic: string | undefined;
61
+ }>;
62
+ protected setupBackgroundStream(): Promise<void>;
63
+ getSigner(): SparkSigner;
64
+ queryPendingTransfers(): Promise<QueryTransfersResponse>;
65
+ verifyPendingTransfer(transfer: Transfer): Promise<Map<string, Uint8Array>>;
66
+ }
67
+
68
68
  declare function getTestWalletConfig(): ConfigOptions;
69
69
  declare function getTestWalletConfigWithIdentityKey(identityPrivateKey: Uint8Array): ConfigOptions;
70
70
  declare function createNewTree(wallet: SparkWalletTesting, leafId: string, faucet: BitcoinFaucet, amountSats?: bigint): Promise<TreeNode>;
@@ -1,4 +1,4 @@
1
- import "../chunk-TVUMSHWA.js";
1
+ import "../chunk-AVI5E5VT.js";
2
2
  import "../chunk-BYXBJQAS.js";
3
3
  import {
4
4
  BitcoinFaucet,
@@ -11,10 +11,10 @@ import {
11
11
  WalletConfigService,
12
12
  getNetwork,
13
13
  getP2TRAddressFromPublicKey
14
- } from "../chunk-W4ZRBSWM.js";
14
+ } from "../chunk-GUZ3WCB4.js";
15
15
  import "../chunk-G4MSZ6DE.js";
16
- import "../chunk-3SEOTO43.js";
17
- import "../chunk-WAQKYSDI.js";
16
+ import "../chunk-3SPMJMUX.js";
17
+ import "../chunk-CQY5ML2A.js";
18
18
  import "../chunk-AAZWSPUK.js";
19
19
  import "../chunk-MVRQ5US7.js";
20
20