@buildonspark/spark-sdk 0.2.11 → 0.2.12

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 (94) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/bare/index.cjs +703 -206
  3. package/dist/bare/index.d.cts +47 -3
  4. package/dist/bare/index.d.ts +47 -3
  5. package/dist/bare/index.js +626 -133
  6. package/dist/{chunk-A5M55UR3.js → chunk-5VWGOHED.js} +499 -8
  7. package/dist/{chunk-3WBPICWC.js → chunk-NQMQVXR5.js} +1 -1
  8. package/dist/{chunk-QNYJGFPD.js → chunk-OEK3R57K.js} +149 -123
  9. package/dist/{chunk-76SYPHOC.js → chunk-TB7DG5CU.js} +2 -2
  10. package/dist/{chunk-6CMNEDBK.js → chunk-XXTWWW6L.js} +1 -1
  11. package/dist/{client-Dd3QnxQu.d.ts → client-D7KDa4Ih.d.ts} +1 -1
  12. package/dist/{client-B9CAWKWz.d.cts → client-DVuA5-7M.d.cts} +1 -1
  13. package/dist/debug.cjs +703 -206
  14. package/dist/debug.d.cts +4 -4
  15. package/dist/debug.d.ts +4 -4
  16. package/dist/debug.js +4 -4
  17. package/dist/graphql/objects/index.d.cts +3 -3
  18. package/dist/graphql/objects/index.d.ts +3 -3
  19. package/dist/index.cjs +725 -228
  20. package/dist/index.d.cts +6 -6
  21. package/dist/index.d.ts +6 -6
  22. package/dist/index.js +5 -5
  23. package/dist/index.node.cjs +725 -228
  24. package/dist/index.node.d.cts +6 -6
  25. package/dist/index.node.d.ts +6 -6
  26. package/dist/index.node.js +4 -4
  27. package/dist/{logging-Bt_WdZbu.d.ts → logging-ClNhGzus.d.ts} +3 -3
  28. package/dist/{logging-BOAzMqpM.d.cts → logging-D3kvES69.d.cts} +3 -3
  29. package/dist/native/index.cjs +724 -227
  30. package/dist/native/index.d.cts +47 -3
  31. package/dist/native/index.d.ts +47 -3
  32. package/dist/native/index.js +628 -135
  33. package/dist/proto/spark.cjs +499 -8
  34. package/dist/proto/spark.d.cts +1 -1
  35. package/dist/proto/spark.d.ts +1 -1
  36. package/dist/proto/spark.js +17 -1
  37. package/dist/proto/spark_token.d.cts +1 -1
  38. package/dist/proto/spark_token.d.ts +1 -1
  39. package/dist/proto/spark_token.js +2 -2
  40. package/dist/{spark-CtGJPkx4.d.cts → spark-C7OG9mGJ.d.cts} +79 -2
  41. package/dist/{spark-CtGJPkx4.d.ts → spark-C7OG9mGJ.d.ts} +79 -2
  42. package/dist/{spark-wallet-yc2KhsVY.d.cts → spark-wallet-Dg5IRQe2.d.cts} +3 -5
  43. package/dist/{spark-wallet-Cp3yv6cK.d.ts → spark-wallet-DiHSU-pz.d.ts} +3 -5
  44. package/dist/{spark-wallet.node-D4IovOHu.d.ts → spark-wallet.node-BZrxwomN.d.ts} +1 -1
  45. package/dist/{spark-wallet.node-D0Qw5Wb4.d.cts → spark-wallet.node-DSWb18zh.d.cts} +1 -1
  46. package/dist/tests/test-utils.cjs +573 -66
  47. package/dist/tests/test-utils.d.cts +4 -4
  48. package/dist/tests/test-utils.d.ts +4 -4
  49. package/dist/tests/test-utils.js +5 -5
  50. package/dist/{token-transactions-CwhlOgIP.d.cts → token-transactions-B-WqFYpW.d.cts} +2 -2
  51. package/dist/{token-transactions-0nmR9mQO.d.ts → token-transactions-DovxHIxV.d.ts} +2 -2
  52. package/dist/types/index.cjs +492 -9
  53. package/dist/types/index.d.cts +2 -2
  54. package/dist/types/index.d.ts +2 -2
  55. package/dist/types/index.js +2 -2
  56. package/package.json +1 -1
  57. package/src/proto/common.ts +1 -1
  58. package/src/proto/google/protobuf/descriptor.ts +4 -10
  59. package/src/proto/google/protobuf/duration.ts +1 -1
  60. package/src/proto/google/protobuf/empty.ts +1 -1
  61. package/src/proto/google/protobuf/timestamp.ts +1 -1
  62. package/src/proto/mock.ts +1 -1
  63. package/src/proto/spark.ts +593 -3
  64. package/src/proto/spark_authn.ts +1 -1
  65. package/src/proto/spark_token.ts +1 -1
  66. package/src/proto/validate/validate.ts +27 -79
  67. package/src/services/deposit.ts +55 -3
  68. package/src/services/lightning.ts +2 -2
  69. package/src/services/signing.ts +1 -1
  70. package/src/services/token-transactions.ts +2 -5
  71. package/src/services/transfer.ts +2 -2
  72. package/src/signer/signer.ts +2 -2
  73. package/src/spark-wallet/spark-wallet.ts +25 -33
  74. package/src/tests/address.test.ts +10 -10
  75. package/src/tests/bitcoin.test.ts +2 -2
  76. package/src/tests/integration/coop-exit.test.ts +1 -1
  77. package/src/tests/integration/lightning.test.ts +1 -1
  78. package/src/tests/integration/ssp/static_deposit.test.ts +122 -1
  79. package/src/tests/integration/swap.test.ts +1 -1
  80. package/src/tests/integration/transfer.test.ts +1 -5
  81. package/src/tests/integration/wallet.test.ts +7 -7
  82. package/src/tests/integration/watchtower.test.ts +1 -1
  83. package/src/tests/token-hashing.test.ts +3 -6
  84. package/src/tests/token-outputs.test.ts +3 -3
  85. package/src/tests/utils/test-faucet.ts +2 -2
  86. package/src/types/sdk-types.ts +1 -1
  87. package/src/utils/adaptor-signature.ts +1 -1
  88. package/src/utils/address.ts +1 -1
  89. package/src/utils/bitcoin.ts +1 -5
  90. package/src/utils/keys.ts +1 -1
  91. package/src/utils/secret-sharing.ts +1 -1
  92. package/src/utils/token-transactions.ts +1 -2
  93. package/src/utils/transfer_package.ts +1 -1
  94. package/src/utils/unilateral-exit.ts +1 -1
@@ -162,14 +162,14 @@ var NotImplementedError = class extends SparkSDKError {
162
162
 
163
163
  // src/spark-wallet/spark-wallet.ts
164
164
  import { isNode as isNode3, isObject as isObject10, mapCurrencyAmount } from "@lightsparkdev/core";
165
+ import { secp256k1 as secp256k114 } from "@noble/curves/secp256k1";
165
166
  import {
166
- bytesToHex as bytesToHex12,
167
+ bytesToHex as bytesToHex11,
167
168
  bytesToNumberBE as bytesToNumberBE8,
168
169
  equalBytes as equalBytes6,
169
170
  hexToBytes as hexToBytes11,
170
171
  numberToVarBytesBE
171
- } from "@noble/curves/abstract/utils";
172
- import { secp256k1 as secp256k114 } from "@noble/curves/secp256k1";
172
+ } from "@noble/curves/utils";
173
173
  import { validateMnemonic } from "@scure/bip39";
174
174
  import { wordlist as wordlist2 } from "@scure/bip39/wordlists/english";
175
175
  import { Address as Address4, OutScript as OutScript3, Transaction as Transaction7 } from "@scure/btc-signer";
@@ -2748,6 +2748,41 @@ function utxoSwapRequestTypeToJSON(object) {
2748
2748
  return "UNRECOGNIZED";
2749
2749
  }
2750
2750
  }
2751
+ function invoiceStatusFromJSON(object) {
2752
+ switch (object) {
2753
+ case 0:
2754
+ case "NOT_FOUND":
2755
+ return 0 /* NOT_FOUND */;
2756
+ case 1:
2757
+ case "PENDING":
2758
+ return 1 /* PENDING */;
2759
+ case 2:
2760
+ case "FINALIZED":
2761
+ return 2 /* FINALIZED */;
2762
+ case 3:
2763
+ case "EXPIRED":
2764
+ return 3 /* EXPIRED */;
2765
+ case -1:
2766
+ case "UNRECOGNIZED":
2767
+ default:
2768
+ return -1 /* UNRECOGNIZED */;
2769
+ }
2770
+ }
2771
+ function invoiceStatusToJSON(object) {
2772
+ switch (object) {
2773
+ case 0 /* NOT_FOUND */:
2774
+ return "NOT_FOUND";
2775
+ case 1 /* PENDING */:
2776
+ return "PENDING";
2777
+ case 2 /* FINALIZED */:
2778
+ return "FINALIZED";
2779
+ case 3 /* EXPIRED */:
2780
+ return "EXPIRED";
2781
+ case -1 /* UNRECOGNIZED */:
2782
+ default:
2783
+ return "UNRECOGNIZED";
2784
+ }
2785
+ }
2751
2786
  function initiatePreimageSwapRequest_ReasonFromJSON(object) {
2752
2787
  switch (object) {
2753
2788
  case 0:
@@ -3487,6 +3522,140 @@ var GenerateDepositAddressResponse = {
3487
3522
  return message;
3488
3523
  }
3489
3524
  };
3525
+ function createBaseGenerateStaticDepositAddressRequest() {
3526
+ return { signingPublicKey: new Uint8Array(0), identityPublicKey: new Uint8Array(0), network: 0 };
3527
+ }
3528
+ var GenerateStaticDepositAddressRequest = {
3529
+ encode(message, writer = new BinaryWriter4()) {
3530
+ if (message.signingPublicKey.length !== 0) {
3531
+ writer.uint32(10).bytes(message.signingPublicKey);
3532
+ }
3533
+ if (message.identityPublicKey.length !== 0) {
3534
+ writer.uint32(18).bytes(message.identityPublicKey);
3535
+ }
3536
+ if (message.network !== 0) {
3537
+ writer.uint32(24).int32(message.network);
3538
+ }
3539
+ return writer;
3540
+ },
3541
+ decode(input, length) {
3542
+ const reader = input instanceof BinaryReader4 ? input : new BinaryReader4(input);
3543
+ const end = length === void 0 ? reader.len : reader.pos + length;
3544
+ const message = createBaseGenerateStaticDepositAddressRequest();
3545
+ while (reader.pos < end) {
3546
+ const tag = reader.uint32();
3547
+ switch (tag >>> 3) {
3548
+ case 1: {
3549
+ if (tag !== 10) {
3550
+ break;
3551
+ }
3552
+ message.signingPublicKey = reader.bytes();
3553
+ continue;
3554
+ }
3555
+ case 2: {
3556
+ if (tag !== 18) {
3557
+ break;
3558
+ }
3559
+ message.identityPublicKey = reader.bytes();
3560
+ continue;
3561
+ }
3562
+ case 3: {
3563
+ if (tag !== 24) {
3564
+ break;
3565
+ }
3566
+ message.network = reader.int32();
3567
+ continue;
3568
+ }
3569
+ }
3570
+ if ((tag & 7) === 4 || tag === 0) {
3571
+ break;
3572
+ }
3573
+ reader.skip(tag & 7);
3574
+ }
3575
+ return message;
3576
+ },
3577
+ fromJSON(object) {
3578
+ return {
3579
+ signingPublicKey: isSet3(object.signingPublicKey) ? bytesFromBase642(object.signingPublicKey) : new Uint8Array(0),
3580
+ identityPublicKey: isSet3(object.identityPublicKey) ? bytesFromBase642(object.identityPublicKey) : new Uint8Array(0),
3581
+ network: isSet3(object.network) ? networkFromJSON(object.network) : 0
3582
+ };
3583
+ },
3584
+ toJSON(message) {
3585
+ const obj = {};
3586
+ if (message.signingPublicKey.length !== 0) {
3587
+ obj.signingPublicKey = base64FromBytes2(message.signingPublicKey);
3588
+ }
3589
+ if (message.identityPublicKey.length !== 0) {
3590
+ obj.identityPublicKey = base64FromBytes2(message.identityPublicKey);
3591
+ }
3592
+ if (message.network !== 0) {
3593
+ obj.network = networkToJSON(message.network);
3594
+ }
3595
+ return obj;
3596
+ },
3597
+ create(base) {
3598
+ return GenerateStaticDepositAddressRequest.fromPartial(base ?? {});
3599
+ },
3600
+ fromPartial(object) {
3601
+ const message = createBaseGenerateStaticDepositAddressRequest();
3602
+ message.signingPublicKey = object.signingPublicKey ?? new Uint8Array(0);
3603
+ message.identityPublicKey = object.identityPublicKey ?? new Uint8Array(0);
3604
+ message.network = object.network ?? 0;
3605
+ return message;
3606
+ }
3607
+ };
3608
+ function createBaseGenerateStaticDepositAddressResponse() {
3609
+ return { depositAddress: void 0 };
3610
+ }
3611
+ var GenerateStaticDepositAddressResponse = {
3612
+ encode(message, writer = new BinaryWriter4()) {
3613
+ if (message.depositAddress !== void 0) {
3614
+ Address.encode(message.depositAddress, writer.uint32(10).fork()).join();
3615
+ }
3616
+ return writer;
3617
+ },
3618
+ decode(input, length) {
3619
+ const reader = input instanceof BinaryReader4 ? input : new BinaryReader4(input);
3620
+ const end = length === void 0 ? reader.len : reader.pos + length;
3621
+ const message = createBaseGenerateStaticDepositAddressResponse();
3622
+ while (reader.pos < end) {
3623
+ const tag = reader.uint32();
3624
+ switch (tag >>> 3) {
3625
+ case 1: {
3626
+ if (tag !== 10) {
3627
+ break;
3628
+ }
3629
+ message.depositAddress = Address.decode(reader, reader.uint32());
3630
+ continue;
3631
+ }
3632
+ }
3633
+ if ((tag & 7) === 4 || tag === 0) {
3634
+ break;
3635
+ }
3636
+ reader.skip(tag & 7);
3637
+ }
3638
+ return message;
3639
+ },
3640
+ fromJSON(object) {
3641
+ return { depositAddress: isSet3(object.depositAddress) ? Address.fromJSON(object.depositAddress) : void 0 };
3642
+ },
3643
+ toJSON(message) {
3644
+ const obj = {};
3645
+ if (message.depositAddress !== void 0) {
3646
+ obj.depositAddress = Address.toJSON(message.depositAddress);
3647
+ }
3648
+ return obj;
3649
+ },
3650
+ create(base) {
3651
+ return GenerateStaticDepositAddressResponse.fromPartial(base ?? {});
3652
+ },
3653
+ fromPartial(object) {
3654
+ const message = createBaseGenerateStaticDepositAddressResponse();
3655
+ message.depositAddress = object.depositAddress !== void 0 && object.depositAddress !== null ? Address.fromPartial(object.depositAddress) : void 0;
3656
+ return message;
3657
+ }
3658
+ };
3490
3659
  function createBaseUTXO() {
3491
3660
  return { rawTx: new Uint8Array(0), vout: 0, network: 0, txid: new Uint8Array(0) };
3492
3661
  }
@@ -9600,7 +9769,8 @@ function createBaseTransferLeaf() {
9600
9769
  signature: new Uint8Array(0),
9601
9770
  intermediateRefundTx: new Uint8Array(0),
9602
9771
  intermediateDirectRefundTx: new Uint8Array(0),
9603
- intermediateDirectFromCpfpRefundTx: new Uint8Array(0)
9772
+ intermediateDirectFromCpfpRefundTx: new Uint8Array(0),
9773
+ pendingKeyTweakPublicKey: new Uint8Array(0)
9604
9774
  };
9605
9775
  }
9606
9776
  var TransferLeaf = {
@@ -9623,6 +9793,9 @@ var TransferLeaf = {
9623
9793
  if (message.intermediateDirectFromCpfpRefundTx.length !== 0) {
9624
9794
  writer.uint32(50).bytes(message.intermediateDirectFromCpfpRefundTx);
9625
9795
  }
9796
+ if (message.pendingKeyTweakPublicKey.length !== 0) {
9797
+ writer.uint32(58).bytes(message.pendingKeyTweakPublicKey);
9798
+ }
9626
9799
  return writer;
9627
9800
  },
9628
9801
  decode(input, length) {
@@ -9674,6 +9847,13 @@ var TransferLeaf = {
9674
9847
  message.intermediateDirectFromCpfpRefundTx = reader.bytes();
9675
9848
  continue;
9676
9849
  }
9850
+ case 7: {
9851
+ if (tag !== 58) {
9852
+ break;
9853
+ }
9854
+ message.pendingKeyTweakPublicKey = reader.bytes();
9855
+ continue;
9856
+ }
9677
9857
  }
9678
9858
  if ((tag & 7) === 4 || tag === 0) {
9679
9859
  break;
@@ -9689,7 +9869,8 @@ var TransferLeaf = {
9689
9869
  signature: isSet3(object.signature) ? bytesFromBase642(object.signature) : new Uint8Array(0),
9690
9870
  intermediateRefundTx: isSet3(object.intermediateRefundTx) ? bytesFromBase642(object.intermediateRefundTx) : new Uint8Array(0),
9691
9871
  intermediateDirectRefundTx: isSet3(object.intermediateDirectRefundTx) ? bytesFromBase642(object.intermediateDirectRefundTx) : new Uint8Array(0),
9692
- intermediateDirectFromCpfpRefundTx: isSet3(object.intermediateDirectFromCpfpRefundTx) ? bytesFromBase642(object.intermediateDirectFromCpfpRefundTx) : new Uint8Array(0)
9872
+ intermediateDirectFromCpfpRefundTx: isSet3(object.intermediateDirectFromCpfpRefundTx) ? bytesFromBase642(object.intermediateDirectFromCpfpRefundTx) : new Uint8Array(0),
9873
+ pendingKeyTweakPublicKey: isSet3(object.pendingKeyTweakPublicKey) ? bytesFromBase642(object.pendingKeyTweakPublicKey) : new Uint8Array(0)
9693
9874
  };
9694
9875
  },
9695
9876
  toJSON(message) {
@@ -9712,6 +9893,9 @@ var TransferLeaf = {
9712
9893
  if (message.intermediateDirectFromCpfpRefundTx.length !== 0) {
9713
9894
  obj.intermediateDirectFromCpfpRefundTx = base64FromBytes2(message.intermediateDirectFromCpfpRefundTx);
9714
9895
  }
9896
+ if (message.pendingKeyTweakPublicKey.length !== 0) {
9897
+ obj.pendingKeyTweakPublicKey = base64FromBytes2(message.pendingKeyTweakPublicKey);
9898
+ }
9715
9899
  return obj;
9716
9900
  },
9717
9901
  create(base) {
@@ -9725,6 +9909,7 @@ var TransferLeaf = {
9725
9909
  message.intermediateRefundTx = object.intermediateRefundTx ?? new Uint8Array(0);
9726
9910
  message.intermediateDirectRefundTx = object.intermediateDirectRefundTx ?? new Uint8Array(0);
9727
9911
  message.intermediateDirectFromCpfpRefundTx = object.intermediateDirectFromCpfpRefundTx ?? new Uint8Array(0);
9912
+ message.pendingKeyTweakPublicKey = object.pendingKeyTweakPublicKey ?? new Uint8Array(0);
9728
9913
  return message;
9729
9914
  }
9730
9915
  };
@@ -12622,13 +12807,16 @@ var QueryUserSignedRefundsRequest = {
12622
12807
  }
12623
12808
  };
12624
12809
  function createBaseQueryUserSignedRefundsResponse() {
12625
- return { userSignedRefunds: [] };
12810
+ return { userSignedRefunds: [], transfer: void 0 };
12626
12811
  }
12627
12812
  var QueryUserSignedRefundsResponse = {
12628
12813
  encode(message, writer = new BinaryWriter4()) {
12629
12814
  for (const v of message.userSignedRefunds) {
12630
12815
  UserSignedRefund.encode(v, writer.uint32(10).fork()).join();
12631
12816
  }
12817
+ if (message.transfer !== void 0) {
12818
+ Transfer6.encode(message.transfer, writer.uint32(26).fork()).join();
12819
+ }
12632
12820
  return writer;
12633
12821
  },
12634
12822
  decode(input, length) {
@@ -12645,6 +12833,13 @@ var QueryUserSignedRefundsResponse = {
12645
12833
  message.userSignedRefunds.push(UserSignedRefund.decode(reader, reader.uint32()));
12646
12834
  continue;
12647
12835
  }
12836
+ case 3: {
12837
+ if (tag !== 26) {
12838
+ break;
12839
+ }
12840
+ message.transfer = Transfer6.decode(reader, reader.uint32());
12841
+ continue;
12842
+ }
12648
12843
  }
12649
12844
  if ((tag & 7) === 4 || tag === 0) {
12650
12845
  break;
@@ -12655,7 +12850,8 @@ var QueryUserSignedRefundsResponse = {
12655
12850
  },
12656
12851
  fromJSON(object) {
12657
12852
  return {
12658
- userSignedRefunds: globalThis.Array.isArray(object?.userSignedRefunds) ? object.userSignedRefunds.map((e) => UserSignedRefund.fromJSON(e)) : []
12853
+ userSignedRefunds: globalThis.Array.isArray(object?.userSignedRefunds) ? object.userSignedRefunds.map((e) => UserSignedRefund.fromJSON(e)) : [],
12854
+ transfer: isSet3(object.transfer) ? Transfer6.fromJSON(object.transfer) : void 0
12659
12855
  };
12660
12856
  },
12661
12857
  toJSON(message) {
@@ -12663,6 +12859,9 @@ var QueryUserSignedRefundsResponse = {
12663
12859
  if (message.userSignedRefunds?.length) {
12664
12860
  obj.userSignedRefunds = message.userSignedRefunds.map((e) => UserSignedRefund.toJSON(e));
12665
12861
  }
12862
+ if (message.transfer !== void 0) {
12863
+ obj.transfer = Transfer6.toJSON(message.transfer);
12864
+ }
12666
12865
  return obj;
12667
12866
  },
12668
12867
  create(base) {
@@ -12671,6 +12870,7 @@ var QueryUserSignedRefundsResponse = {
12671
12870
  fromPartial(object) {
12672
12871
  const message = createBaseQueryUserSignedRefundsResponse();
12673
12872
  message.userSignedRefunds = object.userSignedRefunds?.map((e) => UserSignedRefund.fromPartial(e)) || [];
12873
+ message.transfer = object.transfer !== void 0 && object.transfer !== null ? Transfer6.fromPartial(object.transfer) : void 0;
12674
12874
  return message;
12675
12875
  }
12676
12876
  };
@@ -13557,7 +13757,8 @@ function createBaseDepositAddressQueryResult() {
13557
13757
  depositAddress: "",
13558
13758
  userSigningPublicKey: new Uint8Array(0),
13559
13759
  verifyingPublicKey: new Uint8Array(0),
13560
- leafId: void 0
13760
+ leafId: void 0,
13761
+ proofOfPossession: void 0
13561
13762
  };
13562
13763
  }
13563
13764
  var DepositAddressQueryResult = {
@@ -13574,6 +13775,9 @@ var DepositAddressQueryResult = {
13574
13775
  if (message.leafId !== void 0) {
13575
13776
  writer.uint32(34).string(message.leafId);
13576
13777
  }
13778
+ if (message.proofOfPossession !== void 0) {
13779
+ DepositAddressProof.encode(message.proofOfPossession, writer.uint32(42).fork()).join();
13780
+ }
13577
13781
  return writer;
13578
13782
  },
13579
13783
  decode(input, length) {
@@ -13611,6 +13815,13 @@ var DepositAddressQueryResult = {
13611
13815
  message.leafId = reader.string();
13612
13816
  continue;
13613
13817
  }
13818
+ case 5: {
13819
+ if (tag !== 42) {
13820
+ break;
13821
+ }
13822
+ message.proofOfPossession = DepositAddressProof.decode(reader, reader.uint32());
13823
+ continue;
13824
+ }
13614
13825
  }
13615
13826
  if ((tag & 7) === 4 || tag === 0) {
13616
13827
  break;
@@ -13624,7 +13835,8 @@ var DepositAddressQueryResult = {
13624
13835
  depositAddress: isSet3(object.depositAddress) ? globalThis.String(object.depositAddress) : "",
13625
13836
  userSigningPublicKey: isSet3(object.userSigningPublicKey) ? bytesFromBase642(object.userSigningPublicKey) : new Uint8Array(0),
13626
13837
  verifyingPublicKey: isSet3(object.verifyingPublicKey) ? bytesFromBase642(object.verifyingPublicKey) : new Uint8Array(0),
13627
- leafId: isSet3(object.leafId) ? globalThis.String(object.leafId) : void 0
13838
+ leafId: isSet3(object.leafId) ? globalThis.String(object.leafId) : void 0,
13839
+ proofOfPossession: isSet3(object.proofOfPossession) ? DepositAddressProof.fromJSON(object.proofOfPossession) : void 0
13628
13840
  };
13629
13841
  },
13630
13842
  toJSON(message) {
@@ -13641,6 +13853,9 @@ var DepositAddressQueryResult = {
13641
13853
  if (message.leafId !== void 0) {
13642
13854
  obj.leafId = message.leafId;
13643
13855
  }
13856
+ if (message.proofOfPossession !== void 0) {
13857
+ obj.proofOfPossession = DepositAddressProof.toJSON(message.proofOfPossession);
13858
+ }
13644
13859
  return obj;
13645
13860
  },
13646
13861
  create(base) {
@@ -13652,6 +13867,7 @@ var DepositAddressQueryResult = {
13652
13867
  message.userSigningPublicKey = object.userSigningPublicKey ?? new Uint8Array(0);
13653
13868
  message.verifyingPublicKey = object.verifyingPublicKey ?? new Uint8Array(0);
13654
13869
  message.leafId = object.leafId ?? void 0;
13870
+ message.proofOfPossession = object.proofOfPossession !== void 0 && object.proofOfPossession !== null ? DepositAddressProof.fromPartial(object.proofOfPossession) : void 0;
13655
13871
  return message;
13656
13872
  }
13657
13873
  };
@@ -15616,7 +15832,7 @@ var QueryNodesByValueResponse_NodesEntry = {
15616
15832
  }
15617
15833
  };
15618
15834
  function createBaseGetUtxosForAddressRequest() {
15619
- return { address: "", offset: 0, limit: 0, network: 0 };
15835
+ return { address: "", offset: 0, limit: 0, network: 0, excludeClaimed: false };
15620
15836
  }
15621
15837
  var GetUtxosForAddressRequest = {
15622
15838
  encode(message, writer = new BinaryWriter4()) {
@@ -15632,6 +15848,9 @@ var GetUtxosForAddressRequest = {
15632
15848
  if (message.network !== 0) {
15633
15849
  writer.uint32(32).int32(message.network);
15634
15850
  }
15851
+ if (message.excludeClaimed !== false) {
15852
+ writer.uint32(40).bool(message.excludeClaimed);
15853
+ }
15635
15854
  return writer;
15636
15855
  },
15637
15856
  decode(input, length) {
@@ -15669,6 +15888,13 @@ var GetUtxosForAddressRequest = {
15669
15888
  message.network = reader.int32();
15670
15889
  continue;
15671
15890
  }
15891
+ case 5: {
15892
+ if (tag !== 40) {
15893
+ break;
15894
+ }
15895
+ message.excludeClaimed = reader.bool();
15896
+ continue;
15897
+ }
15672
15898
  }
15673
15899
  if ((tag & 7) === 4 || tag === 0) {
15674
15900
  break;
@@ -15682,7 +15908,8 @@ var GetUtxosForAddressRequest = {
15682
15908
  address: isSet3(object.address) ? globalThis.String(object.address) : "",
15683
15909
  offset: isSet3(object.offset) ? globalThis.Number(object.offset) : 0,
15684
15910
  limit: isSet3(object.limit) ? globalThis.Number(object.limit) : 0,
15685
- network: isSet3(object.network) ? networkFromJSON(object.network) : 0
15911
+ network: isSet3(object.network) ? networkFromJSON(object.network) : 0,
15912
+ excludeClaimed: isSet3(object.excludeClaimed) ? globalThis.Boolean(object.excludeClaimed) : false
15686
15913
  };
15687
15914
  },
15688
15915
  toJSON(message) {
@@ -15699,6 +15926,9 @@ var GetUtxosForAddressRequest = {
15699
15926
  if (message.network !== 0) {
15700
15927
  obj.network = networkToJSON(message.network);
15701
15928
  }
15929
+ if (message.excludeClaimed !== false) {
15930
+ obj.excludeClaimed = message.excludeClaimed;
15931
+ }
15702
15932
  return obj;
15703
15933
  },
15704
15934
  create(base) {
@@ -15710,6 +15940,7 @@ var GetUtxosForAddressRequest = {
15710
15940
  message.offset = object.offset ?? 0;
15711
15941
  message.limit = object.limit ?? 0;
15712
15942
  message.network = object.network ?? 0;
15943
+ message.excludeClaimed = object.excludeClaimed ?? false;
15713
15944
  return message;
15714
15945
  }
15715
15946
  };
@@ -15781,6 +16012,225 @@ var GetUtxosForAddressResponse = {
15781
16012
  return message;
15782
16013
  }
15783
16014
  };
16015
+ function createBaseQuerySparkInvoicesRequest() {
16016
+ return { limit: 0, offset: 0, invoice: [] };
16017
+ }
16018
+ var QuerySparkInvoicesRequest = {
16019
+ encode(message, writer = new BinaryWriter4()) {
16020
+ if (message.limit !== 0) {
16021
+ writer.uint32(8).int64(message.limit);
16022
+ }
16023
+ if (message.offset !== 0) {
16024
+ writer.uint32(16).int64(message.offset);
16025
+ }
16026
+ for (const v of message.invoice) {
16027
+ writer.uint32(26).string(v);
16028
+ }
16029
+ return writer;
16030
+ },
16031
+ decode(input, length) {
16032
+ const reader = input instanceof BinaryReader4 ? input : new BinaryReader4(input);
16033
+ const end = length === void 0 ? reader.len : reader.pos + length;
16034
+ const message = createBaseQuerySparkInvoicesRequest();
16035
+ while (reader.pos < end) {
16036
+ const tag = reader.uint32();
16037
+ switch (tag >>> 3) {
16038
+ case 1: {
16039
+ if (tag !== 8) {
16040
+ break;
16041
+ }
16042
+ message.limit = longToNumber2(reader.int64());
16043
+ continue;
16044
+ }
16045
+ case 2: {
16046
+ if (tag !== 16) {
16047
+ break;
16048
+ }
16049
+ message.offset = longToNumber2(reader.int64());
16050
+ continue;
16051
+ }
16052
+ case 3: {
16053
+ if (tag !== 26) {
16054
+ break;
16055
+ }
16056
+ message.invoice.push(reader.string());
16057
+ continue;
16058
+ }
16059
+ }
16060
+ if ((tag & 7) === 4 || tag === 0) {
16061
+ break;
16062
+ }
16063
+ reader.skip(tag & 7);
16064
+ }
16065
+ return message;
16066
+ },
16067
+ fromJSON(object) {
16068
+ return {
16069
+ limit: isSet3(object.limit) ? globalThis.Number(object.limit) : 0,
16070
+ offset: isSet3(object.offset) ? globalThis.Number(object.offset) : 0,
16071
+ invoice: globalThis.Array.isArray(object?.invoice) ? object.invoice.map((e) => globalThis.String(e)) : []
16072
+ };
16073
+ },
16074
+ toJSON(message) {
16075
+ const obj = {};
16076
+ if (message.limit !== 0) {
16077
+ obj.limit = Math.round(message.limit);
16078
+ }
16079
+ if (message.offset !== 0) {
16080
+ obj.offset = Math.round(message.offset);
16081
+ }
16082
+ if (message.invoice?.length) {
16083
+ obj.invoice = message.invoice;
16084
+ }
16085
+ return obj;
16086
+ },
16087
+ create(base) {
16088
+ return QuerySparkInvoicesRequest.fromPartial(base ?? {});
16089
+ },
16090
+ fromPartial(object) {
16091
+ const message = createBaseQuerySparkInvoicesRequest();
16092
+ message.limit = object.limit ?? 0;
16093
+ message.offset = object.offset ?? 0;
16094
+ message.invoice = object.invoice?.map((e) => e) || [];
16095
+ return message;
16096
+ }
16097
+ };
16098
+ function createBaseQuerySparkInvoicesResponse() {
16099
+ return { offset: 0, invoiceStatuses: [] };
16100
+ }
16101
+ var QuerySparkInvoicesResponse = {
16102
+ encode(message, writer = new BinaryWriter4()) {
16103
+ if (message.offset !== 0) {
16104
+ writer.uint32(8).int64(message.offset);
16105
+ }
16106
+ for (const v of message.invoiceStatuses) {
16107
+ InvoiceResponse.encode(v, writer.uint32(18).fork()).join();
16108
+ }
16109
+ return writer;
16110
+ },
16111
+ decode(input, length) {
16112
+ const reader = input instanceof BinaryReader4 ? input : new BinaryReader4(input);
16113
+ const end = length === void 0 ? reader.len : reader.pos + length;
16114
+ const message = createBaseQuerySparkInvoicesResponse();
16115
+ while (reader.pos < end) {
16116
+ const tag = reader.uint32();
16117
+ switch (tag >>> 3) {
16118
+ case 1: {
16119
+ if (tag !== 8) {
16120
+ break;
16121
+ }
16122
+ message.offset = longToNumber2(reader.int64());
16123
+ continue;
16124
+ }
16125
+ case 2: {
16126
+ if (tag !== 18) {
16127
+ break;
16128
+ }
16129
+ message.invoiceStatuses.push(InvoiceResponse.decode(reader, reader.uint32()));
16130
+ continue;
16131
+ }
16132
+ }
16133
+ if ((tag & 7) === 4 || tag === 0) {
16134
+ break;
16135
+ }
16136
+ reader.skip(tag & 7);
16137
+ }
16138
+ return message;
16139
+ },
16140
+ fromJSON(object) {
16141
+ return {
16142
+ offset: isSet3(object.offset) ? globalThis.Number(object.offset) : 0,
16143
+ invoiceStatuses: globalThis.Array.isArray(object?.invoiceStatuses) ? object.invoiceStatuses.map((e) => InvoiceResponse.fromJSON(e)) : []
16144
+ };
16145
+ },
16146
+ toJSON(message) {
16147
+ const obj = {};
16148
+ if (message.offset !== 0) {
16149
+ obj.offset = Math.round(message.offset);
16150
+ }
16151
+ if (message.invoiceStatuses?.length) {
16152
+ obj.invoiceStatuses = message.invoiceStatuses.map((e) => InvoiceResponse.toJSON(e));
16153
+ }
16154
+ return obj;
16155
+ },
16156
+ create(base) {
16157
+ return QuerySparkInvoicesResponse.fromPartial(base ?? {});
16158
+ },
16159
+ fromPartial(object) {
16160
+ const message = createBaseQuerySparkInvoicesResponse();
16161
+ message.offset = object.offset ?? 0;
16162
+ message.invoiceStatuses = object.invoiceStatuses?.map((e) => InvoiceResponse.fromPartial(e)) || [];
16163
+ return message;
16164
+ }
16165
+ };
16166
+ function createBaseInvoiceResponse() {
16167
+ return { invoice: "", status: 0 };
16168
+ }
16169
+ var InvoiceResponse = {
16170
+ encode(message, writer = new BinaryWriter4()) {
16171
+ if (message.invoice !== "") {
16172
+ writer.uint32(10).string(message.invoice);
16173
+ }
16174
+ if (message.status !== 0) {
16175
+ writer.uint32(16).int32(message.status);
16176
+ }
16177
+ return writer;
16178
+ },
16179
+ decode(input, length) {
16180
+ const reader = input instanceof BinaryReader4 ? input : new BinaryReader4(input);
16181
+ const end = length === void 0 ? reader.len : reader.pos + length;
16182
+ const message = createBaseInvoiceResponse();
16183
+ while (reader.pos < end) {
16184
+ const tag = reader.uint32();
16185
+ switch (tag >>> 3) {
16186
+ case 1: {
16187
+ if (tag !== 10) {
16188
+ break;
16189
+ }
16190
+ message.invoice = reader.string();
16191
+ continue;
16192
+ }
16193
+ case 2: {
16194
+ if (tag !== 16) {
16195
+ break;
16196
+ }
16197
+ message.status = reader.int32();
16198
+ continue;
16199
+ }
16200
+ }
16201
+ if ((tag & 7) === 4 || tag === 0) {
16202
+ break;
16203
+ }
16204
+ reader.skip(tag & 7);
16205
+ }
16206
+ return message;
16207
+ },
16208
+ fromJSON(object) {
16209
+ return {
16210
+ invoice: isSet3(object.invoice) ? globalThis.String(object.invoice) : "",
16211
+ status: isSet3(object.status) ? invoiceStatusFromJSON(object.status) : 0
16212
+ };
16213
+ },
16214
+ toJSON(message) {
16215
+ const obj = {};
16216
+ if (message.invoice !== "") {
16217
+ obj.invoice = message.invoice;
16218
+ }
16219
+ if (message.status !== 0) {
16220
+ obj.status = invoiceStatusToJSON(message.status);
16221
+ }
16222
+ return obj;
16223
+ },
16224
+ create(base) {
16225
+ return InvoiceResponse.fromPartial(base ?? {});
16226
+ },
16227
+ fromPartial(object) {
16228
+ const message = createBaseInvoiceResponse();
16229
+ message.invoice = object.invoice ?? "";
16230
+ message.status = object.status ?? 0;
16231
+ return message;
16232
+ }
16233
+ };
15784
16234
  var SparkServiceDefinition = {
15785
16235
  name: "SparkService",
15786
16236
  fullName: "spark.SparkService",
@@ -15793,6 +16243,15 @@ var SparkServiceDefinition = {
15793
16243
  responseStream: false,
15794
16244
  options: {}
15795
16245
  },
16246
+ /** Generates a new static deposit address of the user or returns the existing one for the specified network. */
16247
+ generate_static_deposit_address: {
16248
+ name: "generate_static_deposit_address",
16249
+ requestType: GenerateStaticDepositAddressRequest,
16250
+ requestStream: false,
16251
+ responseType: GenerateStaticDepositAddressResponse,
16252
+ responseStream: false,
16253
+ options: {}
16254
+ },
15796
16255
  start_deposit_tree_creation: {
15797
16256
  name: "start_deposit_tree_creation",
15798
16257
  requestType: StartDepositTreeCreationRequest,
@@ -16234,6 +16693,14 @@ var SparkServiceDefinition = {
16234
16693
  responseType: GetUtxosForAddressResponse,
16235
16694
  responseStream: false,
16236
16695
  options: {}
16696
+ },
16697
+ query_spark_invoices: {
16698
+ name: "query_spark_invoices",
16699
+ requestType: QuerySparkInvoicesRequest,
16700
+ requestStream: false,
16701
+ responseType: QuerySparkInvoicesResponse,
16702
+ responseStream: false,
16703
+ options: {}
16237
16704
  }
16238
16705
  }
16239
16706
  };
@@ -16298,13 +16765,13 @@ function isSet3(value) {
16298
16765
 
16299
16766
  // src/signer/signer.ts
16300
16767
  import { privateNegate } from "@bitcoinerlab/secp256k1";
16768
+ import { schnorr, secp256k1 as secp256k14 } from "@noble/curves/secp256k1";
16301
16769
  import {
16302
16770
  bytesToHex as bytesToHex4,
16303
16771
  bytesToNumberBE,
16304
16772
  equalBytes as equalBytes2,
16305
16773
  hexToBytes
16306
- } from "@noble/curves/abstract/utils";
16307
- import { schnorr, secp256k1 as secp256k14 } from "@noble/curves/secp256k1";
16774
+ } from "@noble/curves/utils";
16308
16775
  import { sha256 as sha2562 } from "@noble/hashes/sha2";
16309
16776
  import { HDKey } from "@scure/bip32";
16310
16777
  import { generateMnemonic, mnemonicToSeed } from "@scure/bip39";
@@ -16316,7 +16783,7 @@ import * as ecies from "eciesjs";
16316
16783
  import { isNode, isBare } from "@lightsparkdev/core";
16317
16784
  var isReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
16318
16785
  var isBun = globalThis.Bun !== void 0;
16319
- var packageVersion = true ? "0.2.11" : "unknown";
16786
+ var packageVersion = true ? "0.2.12" : "unknown";
16320
16787
  var baseEnvStr = "unknown";
16321
16788
  if (isBun) {
16322
16789
  const bunVersion = "version" in globalThis.Bun ? globalThis.Bun.version : "unknown-version";
@@ -16335,8 +16802,8 @@ if (isBun) {
16335
16802
  var clientEnv = `js-spark-sdk/${packageVersion} ${baseEnvStr}`;
16336
16803
 
16337
16804
  // src/utils/keys.ts
16338
- import { numberToBytesBE } from "@noble/curves/abstract/utils";
16339
16805
  import { secp256k1 } from "@noble/curves/secp256k1";
16806
+ import { numberToBytesBE } from "@noble/curves/utils";
16340
16807
  function addPublicKeys(a, b) {
16341
16808
  if (a.length !== 33 || b.length !== 33) {
16342
16809
  throw new ValidationError("Public keys must be 33 bytes", {
@@ -16433,8 +16900,8 @@ function lastKeyWithTarget(target, keys) {
16433
16900
  }
16434
16901
 
16435
16902
  // src/utils/secret-sharing.ts
16436
- import { bytesToHex as bytesToHex3, equalBytes } from "@noble/curves/abstract/utils";
16437
16903
  import { secp256k1 as secp256k12 } from "@noble/curves/secp256k1";
16904
+ import { bytesToHex as bytesToHex3, equalBytes } from "@noble/curves/utils";
16438
16905
  function getRandomBigInt(max) {
16439
16906
  const byteLength = max.toString(2).length + 7 >> 3;
16440
16907
  const maxBigInt = max;
@@ -21723,12 +22190,8 @@ import { Transaction as Transaction4 } from "@scure/btc-signer";
21723
22190
  import { uuidv7 as uuidv72 } from "uuidv7";
21724
22191
 
21725
22192
  // src/utils/bitcoin.ts
21726
- import {
21727
- bytesToHex as bytesToHex5,
21728
- bytesToNumberBE as bytesToNumberBE2,
21729
- hexToBytes as hexToBytes2
21730
- } from "@noble/curves/abstract/utils";
21731
22193
  import { schnorr as schnorr2, secp256k1 as secp256k15 } from "@noble/curves/secp256k1";
22194
+ import { bytesToHex as bytesToHex5, bytesToNumberBE as bytesToNumberBE2, hexToBytes as hexToBytes2 } from "@noble/curves/utils";
21732
22195
  import { sha256 as sha2564 } from "@noble/hashes/sha2";
21733
22196
  import * as btc2 from "@scure/btc-signer";
21734
22197
  function computeTaprootKeyNoScript(pubkey) {
@@ -22214,20 +22677,20 @@ function getEphemeralAnchorOutput() {
22214
22677
  }
22215
22678
 
22216
22679
  // src/services/transfer.ts
22680
+ import { secp256k1 as secp256k16 } from "@noble/curves/secp256k1";
22217
22681
  import {
22218
22682
  bytesToHex as bytesToHex6,
22219
22683
  equalBytes as equalBytes3,
22220
22684
  hexToBytes as hexToBytes4,
22221
22685
  numberToBytesBE as numberToBytesBE2
22222
- } from "@noble/curves/abstract/utils";
22223
- import { secp256k1 as secp256k16 } from "@noble/curves/secp256k1";
22686
+ } from "@noble/curves/utils";
22224
22687
  import { sha256 as sha2566 } from "@noble/hashes/sha2";
22225
22688
  import { Transaction as Transaction3 } from "@scure/btc-signer";
22226
22689
  import * as ecies2 from "eciesjs";
22227
22690
  import { uuidv7 } from "uuidv7";
22228
22691
 
22229
22692
  // src/utils/transfer_package.ts
22230
- import { hexToBytes as hexToBytes3 } from "@noble/curves/abstract/utils";
22693
+ import { hexToBytes as hexToBytes3 } from "@noble/curves/utils";
22231
22694
  import { sha256 as sha2565 } from "@noble/hashes/sha2";
22232
22695
  function getTransferPackageSigningPayload(transferID, transferPackage) {
22233
22696
  const encryptedPayload = transferPackage.keyTweakPackage;
@@ -24164,7 +24627,8 @@ var DepositService = class {
24164
24627
  }
24165
24628
  async validateDepositAddress({
24166
24629
  address: address2,
24167
- userPubkey
24630
+ userPubkey,
24631
+ verifyCoordinatorProof = false
24168
24632
  }) {
24169
24633
  if (!address2.depositAddressProof || !address2.depositAddressProof.proofOfPossessionSignature || !address2.depositAddressProof.addressSignatures) {
24170
24634
  throw new ValidationError(
@@ -24202,7 +24666,7 @@ var DepositService = class {
24202
24666
  }
24203
24667
  const addrHash = sha2568(address2.address);
24204
24668
  for (const operator of Object.values(this.config.getSigningOperators())) {
24205
- if (operator.identifier === this.config.getCoordinatorIdentifier()) {
24669
+ if (operator.identifier === this.config.getCoordinatorIdentifier() && !verifyCoordinatorProof) {
24206
24670
  continue;
24207
24671
  }
24208
24672
  const operatorPubkey2 = hexToBytes5(operator.identityPublicKey);
@@ -24227,6 +24691,46 @@ var DepositService = class {
24227
24691
  }
24228
24692
  }
24229
24693
  }
24694
+ async generateStaticDepositAddress({
24695
+ signingPubkey
24696
+ }) {
24697
+ const sparkClient = await this.connectionManager.createSparkClient(
24698
+ this.config.getCoordinatorAddress()
24699
+ );
24700
+ let depositResp;
24701
+ try {
24702
+ depositResp = await sparkClient.generate_static_deposit_address({
24703
+ signingPublicKey: signingPubkey,
24704
+ identityPublicKey: await this.config.signer.getIdentityPublicKey(),
24705
+ network: this.config.getNetworkProto()
24706
+ });
24707
+ } catch (error) {
24708
+ throw new NetworkError(
24709
+ "Failed to generate static deposit address",
24710
+ {
24711
+ operation: "generate_static_deposit_address",
24712
+ errorCount: 1,
24713
+ errors: error instanceof Error ? error.message : String(error)
24714
+ },
24715
+ error
24716
+ );
24717
+ }
24718
+ if (!depositResp.depositAddress) {
24719
+ throw new ValidationError(
24720
+ "No static deposit address response from coordinator",
24721
+ {
24722
+ field: "depositAddress",
24723
+ value: depositResp
24724
+ }
24725
+ );
24726
+ }
24727
+ await this.validateDepositAddress({
24728
+ address: depositResp.depositAddress,
24729
+ userPubkey: signingPubkey,
24730
+ verifyCoordinatorProof: true
24731
+ });
24732
+ return depositResp;
24733
+ }
24230
24734
  async generateDepositAddress({
24231
24735
  signingPubkey,
24232
24736
  leafId,
@@ -24766,12 +25270,12 @@ var DepositService = class {
24766
25270
  };
24767
25271
 
24768
25272
  // src/services/lightning.ts
25273
+ import { secp256k1 as secp256k18 } from "@noble/curves/secp256k1";
24769
25274
  import {
24770
25275
  bytesToNumberBE as bytesToNumberBE3,
24771
25276
  hexToBytes as hexToBytes6,
24772
25277
  numberToBytesBE as numberToBytesBE3
24773
- } from "@noble/curves/abstract/utils";
24774
- import { secp256k1 as secp256k18 } from "@noble/curves/secp256k1";
25278
+ } from "@noble/curves/utils";
24775
25279
  import { sha256 as sha2569 } from "@noble/hashes/sha2";
24776
25280
  import { uuidv7 as uuidv73 } from "uuidv7";
24777
25281
 
@@ -25117,18 +25621,18 @@ var LightningService = class {
25117
25621
  };
25118
25622
 
25119
25623
  // src/services/token-transactions.ts
25624
+ import { secp256k1 as secp256k111 } from "@noble/curves/secp256k1";
25120
25625
  import {
25121
- bytesToHex as bytesToHex9,
25626
+ bytesToHex as bytesToHex8,
25122
25627
  bytesToNumberBE as bytesToNumberBE6,
25123
25628
  numberToBytesBE as numberToBytesBE4
25124
- } from "@noble/curves/abstract/utils";
25125
- import { secp256k1 as secp256k111 } from "@noble/curves/secp256k1";
25629
+ } from "@noble/curves/utils";
25126
25630
  import { hexToBytes as hexToBytes8 } from "@noble/hashes/utils";
25127
25631
 
25128
25632
  // src/utils/address.ts
25129
25633
  import { BinaryWriter as BinaryWriter8 } from "@bufbuild/protobuf/wire";
25130
- import { bytesToNumberBE as bytesToNumberBE4 } from "@noble/curves/abstract/utils";
25131
25634
  import { schnorr as schnorr4, secp256k1 as secp256k19 } from "@noble/curves/secp256k1";
25635
+ import { bytesToNumberBE as bytesToNumberBE4 } from "@noble/curves/utils";
25132
25636
  import { bytesToHex as bytesToHex7, hexToBytes as hexToBytes7 } from "@noble/hashes/utils";
25133
25637
  import { bech32m } from "@scure/base";
25134
25638
  import { UUID } from "uuidv7";
@@ -27613,8 +28117,7 @@ function validateTokenTransaction(finalTokenTransaction, partialTokenTransaction
27613
28117
  }
27614
28118
 
27615
28119
  // src/utils/token-transactions.ts
27616
- import { bytesToNumberBE as bytesToNumberBE5 } from "@noble/curves/abstract/utils";
27617
- import { equalBytes as equalBytes5 } from "@scure/btc-signer/utils";
28120
+ import { bytesToNumberBE as bytesToNumberBE5, equalBytes as equalBytes5 } from "@noble/curves/utils";
27618
28121
  function sumAvailableTokens(outputs) {
27619
28122
  try {
27620
28123
  return outputs.reduce(
@@ -27957,7 +28460,7 @@ var TokenTransactionService = class {
27957
28460
  {
27958
28461
  field: "revocationCommitment",
27959
28462
  value: derivedRevocationCommitment,
27960
- expected: bytesToHex9(outputsToSpendCommitments[outputIndex]),
28463
+ expected: bytesToHex8(outputsToSpendCommitments[outputIndex]),
27961
28464
  outputIndex
27962
28465
  }
27963
28466
  )
@@ -27983,7 +28486,7 @@ var TokenTransactionService = class {
27983
28486
  threshold
27984
28487
  );
27985
28488
  }
27986
- return bytesToHex9(finalTokenTransactionHash);
28489
+ return bytesToHex8(finalTokenTransactionHash);
27987
28490
  }
27988
28491
  async broadcastTokenTransactionV1(tokenTransaction, signingOperators, outputsToSpendSigningPublicKeys, outputsToSpendCommitments) {
27989
28492
  const { finalTokenTransaction, finalTokenTransactionHash, threshold } = await this.startTokenTransaction(
@@ -27997,7 +28500,7 @@ var TokenTransactionService = class {
27997
28500
  finalTokenTransactionHash,
27998
28501
  signingOperators
27999
28502
  );
28000
- return bytesToHex9(finalTokenTransactionHash);
28503
+ return bytesToHex8(finalTokenTransactionHash);
28001
28504
  }
28002
28505
  async startTokenTransactionV0(tokenTransaction, signingOperators, outputsToSpendSigningPublicKeys, outputsToSpendCommitments) {
28003
28506
  const sparkClient = await this.connectionManager.createSparkClient(
@@ -28589,7 +29092,7 @@ var TokenTransactionService = class {
28589
29092
  // Helper function for deciding if the signer public key is the identity public key
28590
29093
  async signMessageWithKey(message, publicKey) {
28591
29094
  const tokenSignatures = this.config.getTokenSignatures();
28592
- if (bytesToHex9(publicKey) === bytesToHex9(await this.config.signer.getIdentityPublicKey())) {
29095
+ if (bytesToHex8(publicKey) === bytesToHex8(await this.config.signer.getIdentityPublicKey())) {
28593
29096
  if (tokenSignatures === "SCHNORR") {
28594
29097
  return await this.config.signer.signSchnorrWithIdentityKey(message);
28595
29098
  } else {
@@ -28598,8 +29101,8 @@ var TokenTransactionService = class {
28598
29101
  } else {
28599
29102
  throw new ValidationError("Invalid public key", {
28600
29103
  field: "publicKey",
28601
- value: bytesToHex9(publicKey),
28602
- expected: bytesToHex9(await this.config.signer.getIdentityPublicKey())
29104
+ value: bytesToHex8(publicKey),
29105
+ expected: bytesToHex8(await this.config.signer.getIdentityPublicKey())
28603
29106
  });
28604
29107
  }
28605
29108
  }
@@ -28729,8 +29232,8 @@ function isTokenTransaction(tokenTransaction) {
28729
29232
 
28730
29233
  // src/utils/adaptor-signature.ts
28731
29234
  import { mod } from "@noble/curves/abstract/modular";
28732
- import { bytesToNumberBE as bytesToNumberBE7, numberToBytesBE as numberToBytesBE5 } from "@noble/curves/abstract/utils";
28733
29235
  import { schnorr as schnorr5, secp256k1 as secp256k112 } from "@noble/curves/secp256k1";
29236
+ import { bytesToNumberBE as bytesToNumberBE7, numberToBytesBE as numberToBytesBE5 } from "@noble/curves/utils";
28734
29237
  function generateSignatureFromExistingAdaptor(signature, adaptorPrivateKeyBytes) {
28735
29238
  const { r, s } = parseSignature(signature);
28736
29239
  const sBigInt = bytesToNumberBE7(s);
@@ -28868,7 +29371,7 @@ import { EventEmitter } from "eventemitter3";
28868
29371
  import { ClientError, Status } from "nice-grpc-common";
28869
29372
 
28870
29373
  // src/services/signing.ts
28871
- import { hexToBytes as hexToBytes9 } from "@noble/curves/abstract/utils";
29374
+ import { hexToBytes as hexToBytes9 } from "@noble/curves/utils";
28872
29375
  var SigningService = class {
28873
29376
  config;
28874
29377
  constructor(config) {
@@ -29033,8 +29536,8 @@ var SigningService = class {
29033
29536
  };
29034
29537
 
29035
29538
  // src/tests/utils/test-faucet.ts
29036
- import { bytesToHex as bytesToHex10, hexToBytes as hexToBytes10 } from "@noble/curves/abstract/utils";
29037
29539
  import { schnorr as schnorr6, secp256k1 as secp256k113 } from "@noble/curves/secp256k1";
29540
+ import { bytesToHex as bytesToHex9, hexToBytes as hexToBytes10 } from "@noble/curves/utils";
29038
29541
  import * as btc3 from "@scure/btc-signer";
29039
29542
  import { Address as Address3, OutScript as OutScript2, SigHash as SigHash2, Transaction as Transaction6 } from "@scure/btc-signer";
29040
29543
  import { taprootTweakPrivKey as taprootTweakPrivKey2 } from "@scure/btc-signer/utils";
@@ -29166,7 +29669,7 @@ var BitcoinFaucet = class _BitcoinFaucet {
29166
29669
  },
29167
29670
  STATIC_MINING_KEY
29168
29671
  );
29169
- await this.broadcastTx(bytesToHex10(signedSplitTx.extract()));
29672
+ await this.broadcastTx(bytesToHex9(signedSplitTx.extract()));
29170
29673
  const splitTxId = signedSplitTx.id;
29171
29674
  for (let i = 0; i < numCoinsToCreate; i++) {
29172
29675
  this.coins.push({
@@ -29200,7 +29703,7 @@ var BitcoinFaucet = class _BitcoinFaucet {
29200
29703
  coinToSend.txout,
29201
29704
  coinToSend.key
29202
29705
  );
29203
- await this.broadcastTx(bytesToHex10(signedTx.extract()));
29706
+ await this.broadcastTx(bytesToHex9(signedTx.extract()));
29204
29707
  }
29205
29708
  async signFaucetCoin(unsignedTx, fundingTxOut, key) {
29206
29709
  const pubKey = secp256k113.getPublicKey(key);
@@ -29320,7 +29823,7 @@ var BitcoinFaucet = class _BitcoinFaucet {
29320
29823
  });
29321
29824
  }
29322
29825
  const signedTx = await this.signFaucetCoin(tx, coin.txout, coin.key);
29323
- const txHex = bytesToHex10(signedTx.extract());
29826
+ const txHex = bytesToHex9(signedTx.extract());
29324
29827
  await this.broadcastTx(txHex);
29325
29828
  const randomKey = secp256k113.utils.randomPrivateKey();
29326
29829
  const randomPubKey = secp256k113.getPublicKey(randomKey);
@@ -29337,18 +29840,18 @@ var BitcoinFaucet = class _BitcoinFaucet {
29337
29840
  };
29338
29841
 
29339
29842
  // src/types/sdk-types.ts
29340
- import { bytesToHex as bytesToHex11 } from "@noble/curves/abstract/utils";
29843
+ import { bytesToHex as bytesToHex10 } from "@noble/curves/utils";
29341
29844
  function mapTreeNodeToWalletLeaf(proto) {
29342
29845
  return {
29343
29846
  id: proto.id,
29344
29847
  treeId: proto.treeId,
29345
29848
  value: proto.value,
29346
29849
  parentNodeId: proto.parentNodeId,
29347
- nodeTx: bytesToHex11(proto.nodeTx),
29348
- refundTx: bytesToHex11(proto.refundTx),
29850
+ nodeTx: bytesToHex10(proto.nodeTx),
29851
+ refundTx: bytesToHex10(proto.refundTx),
29349
29852
  vout: proto.vout,
29350
- verifyingPublicKey: bytesToHex11(proto.verifyingPublicKey),
29351
- ownerIdentityPublicKey: bytesToHex11(proto.ownerIdentityPublicKey),
29853
+ verifyingPublicKey: bytesToHex10(proto.verifyingPublicKey),
29854
+ ownerIdentityPublicKey: bytesToHex10(proto.ownerIdentityPublicKey),
29352
29855
  signingKeyshare: proto.signingKeyshare,
29353
29856
  status: proto.status,
29354
29857
  network: Network[proto.network]
@@ -29357,14 +29860,14 @@ function mapTreeNodeToWalletLeaf(proto) {
29357
29860
  function mapTransferLeafToWalletTransferLeaf(proto) {
29358
29861
  return {
29359
29862
  leaf: proto.leaf ? mapTreeNodeToWalletLeaf(proto.leaf) : void 0,
29360
- secretCipher: bytesToHex11(proto.secretCipher),
29361
- signature: bytesToHex11(proto.signature),
29362
- intermediateRefundTx: bytesToHex11(proto.intermediateRefundTx)
29863
+ secretCipher: bytesToHex10(proto.secretCipher),
29864
+ signature: bytesToHex10(proto.signature),
29865
+ intermediateRefundTx: bytesToHex10(proto.intermediateRefundTx)
29363
29866
  };
29364
29867
  }
29365
29868
  function mapTransferToWalletTransfer(proto, identityPublicKey, userRequest) {
29366
- const receiverIdentityPublicKey = bytesToHex11(proto.receiverIdentityPublicKey);
29367
- const senderIdentityPublicKey = bytesToHex11(proto.senderIdentityPublicKey);
29869
+ const receiverIdentityPublicKey = bytesToHex10(proto.receiverIdentityPublicKey);
29870
+ const senderIdentityPublicKey = bytesToHex10(proto.senderIdentityPublicKey);
29368
29871
  return {
29369
29872
  id: proto.id,
29370
29873
  senderIdentityPublicKey,
@@ -29931,7 +30434,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
29931
30434
  * @returns {Promise<string>} The identity public key as a hex string.
29932
30435
  */
29933
30436
  async getIdentityPublicKey() {
29934
- return bytesToHex12(await this.config.signer.getIdentityPublicKey());
30437
+ return bytesToHex11(await this.config.signer.getIdentityPublicKey());
29935
30438
  }
29936
30439
  /**
29937
30440
  * Gets the Spark address of the wallet.
@@ -29941,7 +30444,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
29941
30444
  async getSparkAddress() {
29942
30445
  if (!this.sparkAddress) {
29943
30446
  this.sparkAddress = encodeSparkAddress({
29944
- identityPublicKey: bytesToHex12(
30447
+ identityPublicKey: bytesToHex11(
29945
30448
  await this.config.signer.getIdentityPublicKey()
29946
30449
  ),
29947
30450
  network: this.config.getNetworkType()
@@ -30025,7 +30528,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
30025
30528
  const signature = await this.config.signer.signSchnorrWithIdentityKey(hash);
30026
30529
  return encodeSparkAddressWithSignature(
30027
30530
  {
30028
- identityPublicKey: bytesToHex12(identityPublicKey),
30531
+ identityPublicKey: bytesToHex11(identityPublicKey),
30029
30532
  network: this.config.getNetworkType(),
30030
30533
  sparkInvoiceFields: invoiceFields
30031
30534
  },
@@ -30093,7 +30596,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
30093
30596
  });
30094
30597
  }
30095
30598
  this.sparkAddress = encodeSparkAddress({
30096
- identityPublicKey: bytesToHex12(identityPublicKey),
30599
+ identityPublicKey: bytesToHex11(identityPublicKey),
30097
30600
  network: this.config.getNetworkType()
30098
30601
  });
30099
30602
  return this.sparkAddress;
@@ -30273,18 +30776,18 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
30273
30776
  const userLeaves = [];
30274
30777
  userLeaves.push({
30275
30778
  leaf_id: transfer.leaves[0].leaf.id,
30276
- raw_unsigned_refund_transaction: bytesToHex12(
30779
+ raw_unsigned_refund_transaction: bytesToHex11(
30277
30780
  transfer.leaves[0].intermediateRefundTx
30278
30781
  ),
30279
- direct_raw_unsigned_refund_transaction: bytesToHex12(
30782
+ direct_raw_unsigned_refund_transaction: bytesToHex11(
30280
30783
  transfer.leaves[0].intermediateDirectRefundTx
30281
30784
  ),
30282
- direct_from_cpfp_raw_unsigned_refund_transaction: bytesToHex12(
30785
+ direct_from_cpfp_raw_unsigned_refund_transaction: bytesToHex11(
30283
30786
  transfer.leaves[0].intermediateDirectFromCpfpRefundTx
30284
30787
  ),
30285
- adaptor_added_signature: bytesToHex12(cpfpAdaptorSignature),
30286
- direct_adaptor_added_signature: bytesToHex12(directAdaptorSignature),
30287
- direct_from_cpfp_adaptor_added_signature: bytesToHex12(
30788
+ adaptor_added_signature: bytesToHex11(cpfpAdaptorSignature),
30789
+ direct_adaptor_added_signature: bytesToHex11(directAdaptorSignature),
30790
+ direct_from_cpfp_adaptor_added_signature: bytesToHex11(
30288
30791
  directFromCpfpAdaptorSignature
30289
30792
  )
30290
30793
  });
@@ -30337,24 +30840,24 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
30337
30840
  }
30338
30841
  userLeaves.push({
30339
30842
  leaf_id: leaf.leaf.id,
30340
- raw_unsigned_refund_transaction: bytesToHex12(
30843
+ raw_unsigned_refund_transaction: bytesToHex11(
30341
30844
  leaf.intermediateRefundTx
30342
30845
  ),
30343
- direct_raw_unsigned_refund_transaction: bytesToHex12(
30846
+ direct_raw_unsigned_refund_transaction: bytesToHex11(
30344
30847
  leaf.intermediateDirectRefundTx
30345
30848
  ),
30346
- direct_from_cpfp_raw_unsigned_refund_transaction: bytesToHex12(
30849
+ direct_from_cpfp_raw_unsigned_refund_transaction: bytesToHex11(
30347
30850
  leaf.intermediateDirectFromCpfpRefundTx
30348
30851
  ),
30349
- adaptor_added_signature: bytesToHex12(cpfpSignature),
30350
- direct_adaptor_added_signature: bytesToHex12(directSignature),
30351
- direct_from_cpfp_adaptor_added_signature: bytesToHex12(
30852
+ adaptor_added_signature: bytesToHex11(cpfpSignature),
30853
+ direct_adaptor_added_signature: bytesToHex11(directSignature),
30854
+ direct_from_cpfp_adaptor_added_signature: bytesToHex11(
30352
30855
  directFromCpfpSignature
30353
30856
  )
30354
30857
  });
30355
30858
  }
30356
30859
  const sspClient = this.getSspClient();
30357
- const cpfpAdaptorPubkey = bytesToHex12(
30860
+ const cpfpAdaptorPubkey = bytesToHex11(
30358
30861
  secp256k114.getPublicKey(cpfpAdaptorPrivateKey)
30359
30862
  );
30360
30863
  if (!cpfpAdaptorPubkey) {
@@ -30362,13 +30865,13 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
30362
30865
  }
30363
30866
  let directAdaptorPubkey;
30364
30867
  if (directAdaptorPrivateKey.length > 0) {
30365
- directAdaptorPubkey = bytesToHex12(
30868
+ directAdaptorPubkey = bytesToHex11(
30366
30869
  secp256k114.getPublicKey(directAdaptorPrivateKey)
30367
30870
  );
30368
30871
  }
30369
30872
  let directFromCpfpAdaptorPubkey;
30370
30873
  if (directFromCpfpAdaptorPrivateKey.length > 0) {
30371
- directFromCpfpAdaptorPubkey = bytesToHex12(
30874
+ directFromCpfpAdaptorPubkey = bytesToHex11(
30372
30875
  secp256k114.getPublicKey(directFromCpfpAdaptorPrivateKey)
30373
30876
  );
30374
30877
  }
@@ -30508,9 +31011,9 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
30508
31011
  directFromCpfpSignatureMap
30509
31012
  );
30510
31013
  const completeResponse = await sspClient.completeLeaveSwap({
30511
- adaptorSecretKey: bytesToHex12(cpfpAdaptorPrivateKey),
30512
- directAdaptorSecretKey: bytesToHex12(directAdaptorPrivateKey),
30513
- directFromCpfpAdaptorSecretKey: bytesToHex12(
31014
+ adaptorSecretKey: bytesToHex11(cpfpAdaptorPrivateKey),
31015
+ directAdaptorSecretKey: bytesToHex11(directAdaptorPrivateKey),
31016
+ directFromCpfpAdaptorSecretKey: bytesToHex11(
30514
31017
  directFromCpfpAdaptorPrivateKey
30515
31018
  ),
30516
31019
  userOutboundTransferExternalId: transfer.id,
@@ -30605,7 +31108,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
30605
31108
  let tokenMetadataMap = /* @__PURE__ */ new Map();
30606
31109
  for (const [tokenIdentifier, metadata] of this.tokenMetadata) {
30607
31110
  tokenMetadataMap.set(tokenIdentifier, {
30608
- tokenPublicKey: bytesToHex12(metadata.issuerPublicKey),
31111
+ tokenPublicKey: bytesToHex11(metadata.issuerPublicKey),
30609
31112
  rawTokenIdentifier: metadata.tokenIdentifier,
30610
31113
  tokenName: metadata.tokenName,
30611
31114
  tokenTicker: metadata.tokenTicker,
@@ -30645,7 +31148,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
30645
31148
  * @returns {Promise<string>} A Bitcoin address for depositing funds
30646
31149
  */
30647
31150
  async getSingleUseDepositAddress() {
30648
- return await this.generateDepositAddress(false);
31151
+ return await this.generateDepositAddress();
30649
31152
  }
30650
31153
  /**
30651
31154
  * Generates a new static deposit address for receiving bitcoin funds.
@@ -30654,43 +31157,32 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
30654
31157
  * @returns {Promise<string>} A Bitcoin address for depositing funds
30655
31158
  */
30656
31159
  async getStaticDepositAddress() {
30657
- try {
30658
- return await this.generateDepositAddress(true);
30659
- } catch (error) {
30660
- if (error.message?.includes("static deposit address already exists")) {
30661
- const existingAddresses = await this.queryStaticDepositAddresses();
30662
- if (existingAddresses.length > 0 && existingAddresses[0]) {
30663
- return existingAddresses[0];
30664
- } else {
30665
- throw error;
30666
- }
30667
- } else {
30668
- throw error;
30669
- }
31160
+ const signingPubkey = await this.config.signer.getStaticDepositSigningKey(0);
31161
+ const address2 = await this.depositService.generateStaticDepositAddress({
31162
+ signingPubkey
31163
+ });
31164
+ if (!address2.depositAddress) {
31165
+ throw new RPCError("Failed to generate static deposit address", {
31166
+ method: "generateStaticDepositAddress",
31167
+ params: { signingPubkey }
31168
+ });
30670
31169
  }
31170
+ return address2.depositAddress.address;
30671
31171
  }
30672
31172
  /**
30673
31173
  * Generates a deposit address for receiving funds.
30674
- *
30675
- * @param {boolean} static - Whether the address is static or single use
30676
31174
  * @returns {Promise<string>} A deposit address
30677
31175
  * @private
30678
31176
  */
30679
- async generateDepositAddress(isStatic) {
31177
+ async generateDepositAddress() {
30680
31178
  const leafId = uuidv74();
30681
- let signingPubkey;
30682
- if (isStatic) {
30683
- signingPubkey = await this.config.signer.getStaticDepositSigningKey(0);
30684
- } else {
30685
- signingPubkey = await this.config.signer.getPublicKeyFromDerivation({
30686
- type: "leaf" /* LEAF */,
30687
- path: leafId
30688
- });
30689
- }
31179
+ const signingPubkey = await this.config.signer.getPublicKeyFromDerivation({
31180
+ type: "leaf" /* LEAF */,
31181
+ path: leafId
31182
+ });
30690
31183
  const address2 = await this.depositService.generateDepositAddress({
30691
31184
  signingPubkey,
30692
- leafId,
30693
- isStatic
31185
+ leafId
30694
31186
  });
30695
31187
  if (!address2.depositAddress) {
30696
31188
  throw new RPCError("Failed to generate deposit address", {
@@ -30717,7 +31209,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
30717
31209
  * @param offset - Pagination offset (default 0).
30718
31210
  * @returns {Promise<{ txid: string, vout: number }[]>} List of confirmed UTXOs.
30719
31211
  */
30720
- async getUtxosForDepositAddress(depositAddress, limit = 100, offset = 0) {
31212
+ async getUtxosForDepositAddress(depositAddress, limit = 100, offset = 0, excludeClaimed = false) {
30721
31213
  if (!depositAddress) {
30722
31214
  throw new ValidationError("Deposit address cannot be empty", {
30723
31215
  field: "depositAddress"
@@ -30731,10 +31223,11 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
30731
31223
  address: depositAddress,
30732
31224
  network: NetworkToProto[this.config.getNetwork()],
30733
31225
  limit,
30734
- offset
31226
+ offset,
31227
+ excludeClaimed
30735
31228
  });
30736
31229
  return response.utxos.map((utxo) => ({
30737
- txid: bytesToHex12(utxo.txid),
31230
+ txid: bytesToHex11(utxo.txid),
30738
31231
  vout: utxo.vout
30739
31232
  })) ?? [];
30740
31233
  } catch (error) {
@@ -30804,7 +31297,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
30804
31297
  if (network === BitcoinNetwork_default.FUTURE_VALUE) {
30805
31298
  network = BitcoinNetwork_default.REGTEST;
30806
31299
  }
30807
- const depositSecretKey = bytesToHex12(
31300
+ const depositSecretKey = bytesToHex11(
30808
31301
  await this.config.signer.getStaticDepositSecretKey(0)
30809
31302
  );
30810
31303
  const message = await this.getStaticDepositSigningPayload(
@@ -30817,7 +31310,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
30817
31310
  );
30818
31311
  const hashBuffer = sha25612(message);
30819
31312
  const signatureBytes = await this.config.signer.signMessageWithIdentityKey(hashBuffer);
30820
- const signature = bytesToHex12(signatureBytes);
31313
+ const signature = bytesToHex11(signatureBytes);
30821
31314
  const response = await this.sspClient.claimStaticDeposit({
30822
31315
  transactionId,
30823
31316
  outputIndex,
@@ -30969,7 +31462,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
30969
31462
  networkJSON.toLowerCase(),
30970
31463
  2 /* Refund */,
30971
31464
  creditAmountSats,
30972
- bytesToHex12(spendTxSighash)
31465
+ bytesToHex11(spendTxSighash)
30973
31466
  );
30974
31467
  const hashBuffer = sha25612(message);
30975
31468
  const swapResponseUserSignature = await this.config.signer.signMessageWithIdentityKey(hashBuffer);
@@ -31492,7 +31985,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
31492
31985
  }
31493
31986
  return mapTransferToWalletTransfer(
31494
31987
  transfer,
31495
- bytesToHex12(await this.config.signer.getIdentityPublicKey())
31988
+ bytesToHex11(await this.config.signer.getIdentityPublicKey())
31496
31989
  );
31497
31990
  });
31498
31991
  }
@@ -31848,7 +32341,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
31848
32341
  const invoice2 = await sspClient.requestLightningReceive({
31849
32342
  amountSats: amountSats2,
31850
32343
  network: bitcoinNetwork,
31851
- paymentHash: bytesToHex12(paymentHash),
32344
+ paymentHash: bytesToHex11(paymentHash),
31852
32345
  expirySecs: expirySeconds,
31853
32346
  memo: memo2,
31854
32347
  includeSparkAddress,
@@ -32378,7 +32871,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
32378
32871
  return transfers?.[0];
32379
32872
  }
32380
32873
  async constructTransfersWithUserRequest(transfers) {
32381
- const identityPublicKey = bytesToHex12(
32874
+ const identityPublicKey = bytesToHex11(
32382
32875
  await this.config.signer.getIdentityPublicKey()
32383
32876
  );
32384
32877
  const userRequests = await this.sspClient?.getTransfers(
@@ -32622,7 +33115,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
32622
33115
  hash,
32623
33116
  compact
32624
33117
  );
32625
- return bytesToHex12(signature);
33118
+ return bytesToHex11(signature);
32626
33119
  }
32627
33120
  /**
32628
33121
  * Validates a message with the identity key.
@@ -32680,7 +33173,7 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
32680
33173
  publicKey,
32681
33174
  this.config.getNetwork()
32682
33175
  );
32683
- if (bytesToHex12(script) === bytesToHex12(identityScript)) {
33176
+ if (bytesToHex11(script) === bytesToHex11(identityScript)) {
32684
33177
  try {
32685
33178
  this.config.signer.signTransactionIndex(tx, i, publicKey);
32686
33179
  inputsSigned++;
@@ -32724,13 +33217,13 @@ var SparkWallet = class _SparkWallet extends EventEmitter {
32724
33217
  depositPubKey,
32725
33218
  this.config.getNetwork()
32726
33219
  );
32727
- if (bytesToHex12(script) === bytesToHex12(identityScript)) {
33220
+ if (bytesToHex11(script) === bytesToHex11(identityScript)) {
32728
33221
  return {
32729
33222
  publicKey: identityPubKey,
32730
33223
  keyType: "identity"
32731
33224
  };
32732
33225
  }
32733
- if (bytesToHex12(script) === bytesToHex12(depositScript)) {
33226
+ if (bytesToHex11(script) === bytesToHex11(depositScript)) {
32734
33227
  return {
32735
33228
  publicKey: depositPubKey,
32736
33229
  keyType: "deposit"
@@ -33247,7 +33740,7 @@ async function isTxBroadcast(txid, baseUrl, network) {
33247
33740
  }
33248
33741
 
33249
33742
  // src/utils/unilateral-exit.ts
33250
- import { bytesToHex as bytesToHex13, hexToBytes as hexToBytes12 } from "@noble/curves/abstract/utils";
33743
+ import { bytesToHex as bytesToHex12, hexToBytes as hexToBytes12 } from "@noble/curves/utils";
33251
33744
  import { ripemd160 } from "@noble/hashes/legacy";
33252
33745
  import { sha256 as sha25613 } from "@noble/hashes/sha2";
33253
33746
  import * as btc4 from "@scure/btc-signer";
@@ -33318,10 +33811,10 @@ async function constructUnilateralExitTxs(nodeHexStrings, sparkClient, network)
33318
33811
  }
33319
33812
  }
33320
33813
  for (const chainNode of chain) {
33321
- const nodeTx = bytesToHex13(chainNode.nodeTx);
33814
+ const nodeTx = bytesToHex12(chainNode.nodeTx);
33322
33815
  transactions.push(nodeTx);
33323
33816
  if (chainNode.id === node.id) {
33324
- const refundTx = bytesToHex13(chainNode.refundTx);
33817
+ const refundTx = bytesToHex12(chainNode.refundTx);
33325
33818
  transactions.push(refundTx);
33326
33819
  }
33327
33820
  }
@@ -33427,7 +33920,7 @@ async function constructUnilateralExitFeeBumpPackages(nodeHexStrings, utxos, fee
33427
33920
  }
33428
33921
  }
33429
33922
  for (const chainNode of chain) {
33430
- let nodeTxHex = bytesToHex13(chainNode.nodeTx);
33923
+ let nodeTxHex = bytesToHex12(chainNode.nodeTx);
33431
33924
  try {
33432
33925
  const txObj = getTxFromRawTxHex(nodeTxHex);
33433
33926
  const txid = getTxId(txObj);
@@ -33444,7 +33937,7 @@ async function constructUnilateralExitFeeBumpPackages(nodeHexStrings, utxos, fee
33444
33937
  for (let i = txObj.outputsLength - 1; i >= 0; i--) {
33445
33938
  const output = txObj.getOutput(i);
33446
33939
  if (output?.amount === 0n && output.script) {
33447
- anchorOutputScriptHex = bytesToHex13(output.script);
33940
+ anchorOutputScriptHex = bytesToHex12(output.script);
33448
33941
  break;
33449
33942
  }
33450
33943
  }
@@ -33469,7 +33962,7 @@ async function constructUnilateralExitFeeBumpPackages(nodeHexStrings, utxos, fee
33469
33962
  var feeBumpOut = feeBumpTx.outputsLength === 1 ? feeBumpTx.getOutput(0) : null;
33470
33963
  var feeBumpOutPubKey = null;
33471
33964
  for (const usedUtxo of usedUtxos) {
33472
- if (feeBumpOut && bytesToHex13(feeBumpOut.script) == usedUtxo.script) {
33965
+ if (feeBumpOut && bytesToHex12(feeBumpOut.script) == usedUtxo.script) {
33473
33966
  feeBumpOutPubKey = usedUtxo.publicKey;
33474
33967
  }
33475
33968
  const index = availableUtxos.findIndex(
@@ -33484,20 +33977,20 @@ async function constructUnilateralExitFeeBumpPackages(nodeHexStrings, utxos, fee
33484
33977
  txid: getTxId(feeBumpTx),
33485
33978
  vout: 0,
33486
33979
  value: feeBumpOut.amount,
33487
- script: bytesToHex13(feeBumpOut.script),
33980
+ script: bytesToHex12(feeBumpOut.script),
33488
33981
  publicKey: feeBumpOutPubKey
33489
33982
  });
33490
33983
  const finalNodeTx = correctedParentTx || nodeTxHex;
33491
33984
  txPackages.push({ tx: finalNodeTx, feeBumpPsbt: nodeFeeBumpPsbt });
33492
33985
  if (chainNode.id === node.id) {
33493
- let refundTxHex = bytesToHex13(chainNode.refundTx);
33986
+ let refundTxHex = bytesToHex12(chainNode.refundTx);
33494
33987
  try {
33495
33988
  const txObj = getTxFromRawTxHex(refundTxHex);
33496
33989
  let anchorOutputScriptHex;
33497
33990
  for (let i = txObj.outputsLength - 1; i >= 0; i--) {
33498
33991
  const output = txObj.getOutput(i);
33499
33992
  if (output?.amount === 0n && output.script) {
33500
- anchorOutputScriptHex = bytesToHex13(output.script);
33993
+ anchorOutputScriptHex = bytesToHex12(output.script);
33501
33994
  break;
33502
33995
  }
33503
33996
  }
@@ -33525,7 +34018,7 @@ async function constructUnilateralExitFeeBumpPackages(nodeHexStrings, utxos, fee
33525
34018
  var feeBumpOut = feeBumpTx2.outputsLength === 1 ? feeBumpTx2.getOutput(0) : null;
33526
34019
  var feeBumpOutPubKey = null;
33527
34020
  for (const usedUtxo of usedUtxos) {
33528
- if (feeBumpOut && bytesToHex13(feeBumpOut.script) == usedUtxo.script) {
34021
+ if (feeBumpOut && bytesToHex12(feeBumpOut.script) == usedUtxo.script) {
33529
34022
  feeBumpOutPubKey = usedUtxo.publicKey;
33530
34023
  }
33531
34024
  const index = availableUtxos.findIndex(
@@ -33540,7 +34033,7 @@ async function constructUnilateralExitFeeBumpPackages(nodeHexStrings, utxos, fee
33540
34033
  txid: getTxId(feeBumpTx2),
33541
34034
  vout: 0,
33542
34035
  value: feeBumpOut.amount,
33543
- script: bytesToHex13(feeBumpOut.script),
34036
+ script: bytesToHex12(feeBumpOut.script),
33544
34037
  publicKey: feeBumpOutPubKey
33545
34038
  });
33546
34039
  txPackages.push({
@@ -33638,7 +34131,7 @@ function constructFeeBumpTx(txHex, utxos, feeRate, previousFeeBumpTx) {
33638
34131
  const pubKeyHash = hash160(hexToBytes12(fundingUtxo.publicKey));
33639
34132
  const scriptToUse = new Uint8Array([0, 20, ...pubKeyHash]);
33640
34133
  const providedScript = hexToBytes12(fundingUtxo.script);
33641
- if (bytesToHex13(scriptToUse) !== bytesToHex13(providedScript)) {
34134
+ if (bytesToHex12(scriptToUse) !== bytesToHex12(providedScript)) {
33642
34135
  throw new Error(
33643
34136
  `\u274C Derived script doesn't match provided script for UTXO ${i + 1}.`
33644
34137
  );
@@ -33703,7 +34196,7 @@ function constructFeeBumpTx(txHex, utxos, feeRate, previousFeeBumpTx) {
33703
34196
  }
33704
34197
  let psbtHex;
33705
34198
  try {
33706
- psbtHex = bytesToHex13(builder.toPSBT());
34199
+ psbtHex = bytesToHex12(builder.toPSBT());
33707
34200
  } catch (error) {
33708
34201
  throw new Error(`Failed to extract transaction: ${error}`);
33709
34202
  }