@sip-protocol/sdk 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/LICENSE +21 -0
  2. package/dist/{TransportWebUSB-YQMAGJAJ.mjs → TransportWebUSB-2KITI5HD.mjs} +24 -12
  3. package/dist/browser.d.mts +4 -4
  4. package/dist/browser.d.ts +4 -4
  5. package/dist/browser.js +1346 -838
  6. package/dist/browser.mjs +13 -3
  7. package/dist/{chunk-64AYA5F5.mjs → chunk-G3TBBG2K.mjs} +221 -146
  8. package/dist/{chunk-4GRJ5MAW.mjs → chunk-KXETSSKP.mjs} +4 -0
  9. package/dist/{chunk-6EU6WQFK.mjs → chunk-PT2DNA7E.mjs} +257 -235
  10. package/dist/{constants-LHAAUC2T.mjs → constants-DCJYTIU3.mjs} +5 -1
  11. package/dist/{dist-2OGQ7FED.mjs → dist-PYEXZNFD.mjs} +609 -221
  12. package/dist/{index-DeE1ZzA4.d.mts → index-B1d8pihL.d.mts} +117 -33
  13. package/dist/{index-DXh2IGkz.d.ts → index-UQhQJZbM.d.ts} +117 -33
  14. package/dist/index.d.mts +3 -3
  15. package/dist/index.d.ts +3 -3
  16. package/dist/index.js +1339 -831
  17. package/dist/index.mjs +13 -3
  18. package/dist/{interface-Bf7w1PLW.d.mts → interface-CQi0-WfS.d.mts} +2 -2
  19. package/dist/{interface-Bf7w1PLW.d.ts → interface-CQi0-WfS.d.ts} +2 -2
  20. package/dist/{noir-kzbLVTei.d.mts → noir-CwPIyBLj.d.mts} +1 -1
  21. package/dist/{noir-kzbLVTei.d.ts → noir-CwPIyBLj.d.ts} +1 -1
  22. package/dist/proofs/halo2.d.mts +1 -1
  23. package/dist/proofs/halo2.d.ts +1 -1
  24. package/dist/proofs/kimchi.d.mts +1 -1
  25. package/dist/proofs/kimchi.d.ts +1 -1
  26. package/dist/proofs/noir.d.mts +1 -1
  27. package/dist/proofs/noir.d.ts +1 -1
  28. package/dist/{solana-U3MEGU7W.mjs → solana-ZWNIQTSU.mjs} +6 -6
  29. package/package.json +32 -32
  30. package/src/adapters/gelato-relay.ts +386 -0
  31. package/src/adapters/index.ts +28 -0
  32. package/src/adapters/oneinch.ts +126 -0
  33. package/src/chains/ethereum/privacy-adapter.ts +8 -5
  34. package/src/chains/ethereum/stealth.ts +17 -14
  35. package/src/chains/near/privacy-adapter.ts +8 -5
  36. package/src/chains/near/resolver.ts +22 -8
  37. package/src/chains/near/stealth.ts +9 -9
  38. package/src/chains/solana/constants.ts +13 -1
  39. package/src/chains/solana/ephemeral-keys.ts +3 -257
  40. package/src/chains/solana/index.ts +2 -3
  41. package/src/chains/solana/providers/helius-enhanced.ts +6 -6
  42. package/src/chains/solana/providers/webhook.ts +2 -2
  43. package/src/chains/solana/scan.ts +9 -8
  44. package/src/chains/solana/stealth-scanner.ts +3 -3
  45. package/src/chains/solana/types.ts +18 -4
  46. package/src/cosmos/ibc-stealth.ts +6 -6
  47. package/src/index.ts +6 -0
  48. package/src/move/aptos.ts +15 -9
  49. package/src/move/sui.ts +15 -9
  50. package/src/nft/private-nft.ts +10 -6
  51. package/src/privacy-backends/shadowwire.ts +13 -0
  52. package/src/stealth/ed25519.ts +173 -12
  53. package/src/stealth/index.ts +47 -4
  54. package/src/stealth/secp256k1.ts +144 -7
  55. package/src/stealth.ts +7 -0
  56. package/src/wallet/ethereum/privacy-adapter.ts +1 -1
  57. package/src/wallet/hardware/ledger-privacy.ts +2 -2
  58. package/src/wallet/near/adapter.ts +2 -2
  59. package/src/wallet/near/meteor-wallet.ts +2 -2
  60. package/src/wallet/near/my-near-wallet.ts +2 -2
  61. package/src/wallet/near/wallet-selector.ts +2 -2
  62. package/src/wallet/solana/privacy-adapter.ts +9 -9
  63. package/dist/chunk-5EKF243P.mjs +0 -33809
  64. package/dist/chunk-YWGJ77A2.mjs +0 -33806
@@ -34,7 +34,7 @@ import {
34
34
  validateEd25519StealthAddress,
35
35
  validateEd25519StealthMetaAddress,
36
36
  verifyOpening
37
- } from "./chunk-64AYA5F5.mjs";
37
+ } from "./chunk-G3TBBG2K.mjs";
38
38
  import {
39
39
  ProofGenerationError
40
40
  } from "./chunk-HOR7PM3M.mjs";
@@ -51,7 +51,7 @@ import {
51
51
  SOLANA_RPC_ENDPOINTS,
52
52
  SUI_RPC_ENDPOINTS,
53
53
  ZCASH_RPC_CONFIG
54
- } from "./chunk-4GRJ5MAW.mjs";
54
+ } from "./chunk-KXETSSKP.mjs";
55
55
  import {
56
56
  __export
57
57
  } from "./chunk-XGB3TDIC.mjs";
@@ -1230,11 +1230,11 @@ function deriveAptosStealthPrivateKey(stealthAddress, spendingPrivateKey, viewin
1230
1230
  aptosAddress
1231
1231
  };
1232
1232
  }
1233
- function checkAptosStealthAddress(stealthAddress, spendingPrivateKey, viewingPrivateKey) {
1233
+ function checkAptosStealthAddress(stealthAddress, viewingPrivateKey, spendingPublicKey) {
1234
1234
  return checkEd25519StealthAddress(
1235
1235
  stealthAddress,
1236
- spendingPrivateKey,
1237
- viewingPrivateKey
1236
+ viewingPrivateKey,
1237
+ spendingPublicKey
1238
1238
  );
1239
1239
  }
1240
1240
  var AptosStealthService = class {
@@ -1270,13 +1270,16 @@ var AptosStealthService = class {
1270
1270
  /**
1271
1271
  * Check if a stealth address belongs to this recipient
1272
1272
  *
1273
+ * Canonical EIP-5564 view-only check: requires only the recipient's viewing
1274
+ * private key plus their spending PUBLIC key (no spending private key needed).
1275
+ *
1273
1276
  * @param stealthAddress - Stealth address to check
1274
- * @param spendingPrivateKey - Recipient's spending private key
1275
1277
  * @param viewingPrivateKey - Recipient's viewing private key
1278
+ * @param spendingPublicKey - Recipient's spending public key (meta-address spendingKey)
1276
1279
  * @returns true if the address belongs to this recipient
1277
1280
  */
1278
- checkStealthAddress(stealthAddress, spendingPrivateKey, viewingPrivateKey) {
1279
- return checkAptosStealthAddress(stealthAddress, spendingPrivateKey, viewingPrivateKey);
1281
+ checkStealthAddress(stealthAddress, viewingPrivateKey, spendingPublicKey) {
1282
+ return checkAptosStealthAddress(stealthAddress, viewingPrivateKey, spendingPublicKey);
1280
1283
  }
1281
1284
  /**
1282
1285
  * Validate an Aptos address format
@@ -1366,11 +1369,11 @@ function deriveSuiStealthPrivateKey(stealthAddress, spendingPrivateKey, viewingP
1366
1369
  suiAddress
1367
1370
  };
1368
1371
  }
1369
- function checkSuiStealthAddress(stealthAddress, spendingPrivateKey, viewingPrivateKey) {
1372
+ function checkSuiStealthAddress(stealthAddress, viewingPrivateKey, spendingPublicKey) {
1370
1373
  return checkEd25519StealthAddress(
1371
1374
  stealthAddress,
1372
- spendingPrivateKey,
1373
- viewingPrivateKey
1375
+ viewingPrivateKey,
1376
+ spendingPublicKey
1374
1377
  );
1375
1378
  }
1376
1379
  var SuiStealthService = class {
@@ -1406,13 +1409,16 @@ var SuiStealthService = class {
1406
1409
  /**
1407
1410
  * Check if a stealth address belongs to this recipient
1408
1411
  *
1412
+ * Canonical EIP-5564 view-only check: requires only the recipient's viewing
1413
+ * private key plus their spending PUBLIC key (no spending private key needed).
1414
+ *
1409
1415
  * @param stealthAddress - Stealth address to check
1410
- * @param spendingPrivateKey - Recipient's spending private key
1411
1416
  * @param viewingPrivateKey - Recipient's viewing private key
1417
+ * @param spendingPublicKey - Recipient's spending public key (meta-address spendingKey)
1412
1418
  * @returns true if the address belongs to this recipient
1413
1419
  */
1414
- checkStealthAddress(stealthAddress, spendingPrivateKey, viewingPrivateKey) {
1415
- return checkSuiStealthAddress(stealthAddress, spendingPrivateKey, viewingPrivateKey);
1420
+ checkStealthAddress(stealthAddress, viewingPrivateKey, spendingPublicKey) {
1421
+ return checkSuiStealthAddress(stealthAddress, viewingPrivateKey, spendingPublicKey);
1416
1422
  }
1417
1423
  /**
1418
1424
  * Validate a Sui address format
@@ -2198,6 +2204,10 @@ import {
2198
2204
  } from "@solana/web3.js";
2199
2205
  import { bytesToHex as bytesToHex6 } from "@noble/hashes/utils";
2200
2206
 
2207
+ // src/adapters/gelato-relay.ts
2208
+ import { keccak_256 } from "@noble/hashes/sha3";
2209
+ import { bytesToHex as bytesToHex7 } from "@noble/hashes/utils";
2210
+
2201
2211
  // src/sip.ts
2202
2212
  var SIP = class {
2203
2213
  config;
@@ -2672,10 +2682,10 @@ var SIP = class {
2672
2682
  "chain"
2673
2683
  );
2674
2684
  }
2675
- const { sendPrivateSPLTransfer: sendPrivateSPLTransfer2 } = await import("./solana-U3MEGU7W.mjs");
2685
+ const { sendPrivateSPLTransfer: sendPrivateSPLTransfer2 } = await import("./solana-ZWNIQTSU.mjs");
2676
2686
  const { PublicKey: SolanaPublicKey } = await import("@solana/web3.js");
2677
2687
  const { getAssociatedTokenAddress } = await import("@solana/spl-token");
2678
- const { SOLANA_TOKEN_MINTS: SOLANA_TOKEN_MINTS3 } = await import("./constants-LHAAUC2T.mjs");
2688
+ const { SOLANA_TOKEN_MINTS: SOLANA_TOKEN_MINTS3 } = await import("./constants-DCJYTIU3.mjs");
2679
2689
  let mint;
2680
2690
  if (params.token in SOLANA_TOKEN_MINTS3) {
2681
2691
  mint = new SolanaPublicKey(SOLANA_TOKEN_MINTS3[params.token]);
@@ -2728,7 +2738,7 @@ function createProductionSIP(config) {
2728
2738
  // src/cosmos/stealth.ts
2729
2739
  import { sha256 as sha2564 } from "@noble/hashes/sha256";
2730
2740
  import { ripemd160 } from "@noble/hashes/ripemd160";
2731
- import { hexToBytes as hexToBytes5, bytesToHex as bytesToHex7 } from "@noble/hashes/utils";
2741
+ import { hexToBytes as hexToBytes5, bytesToHex as bytesToHex8 } from "@noble/hashes/utils";
2732
2742
  import { bech32 } from "@scure/base";
2733
2743
  var CHAIN_PREFIXES = {
2734
2744
  cosmos: "cosmos",
@@ -2810,8 +2820,8 @@ var CosmosStealthService = class {
2810
2820
  );
2811
2821
  }
2812
2822
  const metaAddress = {
2813
- spendingKey: `0x${bytesToHex7(spendingPubKey)}`,
2814
- viewingKey: `0x${bytesToHex7(viewingPubKey)}`,
2823
+ spendingKey: `0x${bytesToHex8(spendingPubKey)}`,
2824
+ viewingKey: `0x${bytesToHex8(viewingPubKey)}`,
2815
2825
  chain: "ethereum"
2816
2826
  // Use ethereum for secp256k1 generation
2817
2827
  };
@@ -3024,13 +3034,13 @@ function isValidCosmosAddress(address, expectedChain) {
3024
3034
  }
3025
3035
 
3026
3036
  // src/cosmos/ibc-stealth.ts
3027
- import { hexToBytes as hexToBytes6, bytesToHex as bytesToHex8 } from "@noble/hashes/utils";
3037
+ import { hexToBytes as hexToBytes6, bytesToHex as bytesToHex9 } from "@noble/hashes/utils";
3028
3038
  import { secp256k1 } from "@noble/curves/secp256k1";
3029
3039
  import { sha256 as sha2565 } from "@noble/hashes/sha256";
3030
3040
 
3031
3041
  // src/proofs/mock.ts
3032
3042
  import { sha256 as sha2566 } from "@noble/hashes/sha256";
3033
- import { bytesToHex as bytesToHex9, randomBytes as randomBytes4 } from "@noble/hashes/utils";
3043
+ import { bytesToHex as bytesToHex10, randomBytes as randomBytes4 } from "@noble/hashes/utils";
3034
3044
  var log3 = createLogger("proofs/mock");
3035
3045
  var MOCK_PROOF_PREFIX = "0x4d4f434b";
3036
3046
  var MockProofProvider = class {
@@ -3211,11 +3221,11 @@ var MockProofProvider = class {
3211
3221
  combined.set(new TextEncoder().encode("MOCK"), 0);
3212
3222
  combined.set(hash2, 4);
3213
3223
  combined.set(random, 4 + hash2.length);
3214
- return `${MOCK_PROOF_PREFIX}${bytesToHex9(combined.slice(4))}`;
3224
+ return `${MOCK_PROOF_PREFIX}${bytesToHex10(combined.slice(4))}`;
3215
3225
  }
3216
3226
  hashToHex(data) {
3217
3227
  const hash2 = sha2566(new TextEncoder().encode(data));
3218
- return `0x${bytesToHex9(hash2)}`;
3228
+ return `0x${bytesToHex10(hash2)}`;
3219
3229
  }
3220
3230
  };
3221
3231
 
@@ -3500,7 +3510,7 @@ function hexToBytes7(hex) {
3500
3510
  }
3501
3511
  return bytes;
3502
3512
  }
3503
- function bytesToHex10(bytes) {
3513
+ function bytesToHex11(bytes) {
3504
3514
  return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
3505
3515
  }
3506
3516
  function isBrowser() {
@@ -3949,46 +3959,46 @@ var ComplianceProofProvider = class {
3949
3959
  }
3950
3960
  async hashViewingKey(viewingKey) {
3951
3961
  const { sha256: sha25635 } = await import("@noble/hashes/sha256");
3952
- const { bytesToHex: bytesToHex56 } = await import("@noble/hashes/utils");
3962
+ const { bytesToHex: bytesToHex57 } = await import("@noble/hashes/utils");
3953
3963
  const keyString = typeof viewingKey === "string" ? viewingKey : JSON.stringify(viewingKey);
3954
3964
  const encoder = new TextEncoder();
3955
3965
  const keyBytes = encoder.encode(keyString);
3956
- return bytesToHex56(sha25635(keyBytes));
3966
+ return bytesToHex57(sha25635(keyBytes));
3957
3967
  }
3958
3968
  async computeDecryptionCommitment(viewingKey, encryptedData) {
3959
3969
  const { sha256: sha25635 } = await import("@noble/hashes/sha256");
3960
- const { bytesToHex: bytesToHex56 } = await import("@noble/hashes/utils");
3970
+ const { bytesToHex: bytesToHex57 } = await import("@noble/hashes/utils");
3961
3971
  const keyHash = await this.hashViewingKey(viewingKey);
3962
3972
  const keyBytes = this.hexToBytes(keyHash);
3963
3973
  const preimage = new Uint8Array([...keyBytes, ...encryptedData.slice(0, 32)]);
3964
- return bytesToHex56(sha25635(preimage));
3974
+ return bytesToHex57(sha25635(preimage));
3965
3975
  }
3966
3976
  async computeAuditorHash(auditorPublicKey, transactionHash) {
3967
3977
  const { sha256: sha25635 } = await import("@noble/hashes/sha256");
3968
- const { bytesToHex: bytesToHex56 } = await import("@noble/hashes/utils");
3978
+ const { bytesToHex: bytesToHex57 } = await import("@noble/hashes/utils");
3969
3979
  const auditorBytes = this.hexToBytes(auditorPublicKey.replace("0x", "").padStart(64, "0"));
3970
3980
  const txBytes = this.hexToBytes(transactionHash.replace("0x", "").padStart(64, "0"));
3971
3981
  const preimage = new Uint8Array([...auditorBytes, ...txBytes]);
3972
- return bytesToHex56(sha25635(preimage));
3982
+ return bytesToHex57(sha25635(preimage));
3973
3983
  }
3974
3984
  async computeAddressCommitment(address, blinding) {
3975
3985
  const { sha256: sha25635 } = await import("@noble/hashes/sha256");
3976
- const { bytesToHex: bytesToHex56 } = await import("@noble/hashes/utils");
3986
+ const { bytesToHex: bytesToHex57 } = await import("@noble/hashes/utils");
3977
3987
  const addressBytes = this.hexToBytes(address.replace("0x", "").padStart(64, "0"));
3978
3988
  const preimage = new Uint8Array([...addressBytes, ...blinding.slice(0, 32)]);
3979
- return bytesToHex56(sha25635(preimage));
3989
+ return bytesToHex57(sha25635(preimage));
3980
3990
  }
3981
3991
  async computeNonMembershipProof(senderAddress, recipientAddress, _sanctionsListRoot) {
3982
3992
  const { sha256: sha25635 } = await import("@noble/hashes/sha256");
3983
- const { bytesToHex: bytesToHex56 } = await import("@noble/hashes/utils");
3993
+ const { bytesToHex: bytesToHex57 } = await import("@noble/hashes/utils");
3984
3994
  const senderBytes = this.hexToBytes(senderAddress.replace("0x", "").padStart(64, "0"));
3985
3995
  const recipientBytes = this.hexToBytes(recipientAddress.replace("0x", "").padStart(64, "0"));
3986
3996
  const preimage = new Uint8Array([...senderBytes, ...recipientBytes]);
3987
- return bytesToHex56(sha25635(preimage));
3997
+ return bytesToHex57(sha25635(preimage));
3988
3998
  }
3989
3999
  async computeBalanceCommitment(balance, blinding) {
3990
4000
  const { sha256: sha25635 } = await import("@noble/hashes/sha256");
3991
- const { bytesToHex: bytesToHex56 } = await import("@noble/hashes/utils");
4001
+ const { bytesToHex: bytesToHex57 } = await import("@noble/hashes/utils");
3992
4002
  const balanceBytes = new Uint8Array(8);
3993
4003
  let v = balance;
3994
4004
  for (let i = 7; i >= 0; i--) {
@@ -3996,11 +4006,11 @@ var ComplianceProofProvider = class {
3996
4006
  v = v >> 8n;
3997
4007
  }
3998
4008
  const preimage = new Uint8Array([...balanceBytes, ...blinding.slice(0, 32)]);
3999
- return bytesToHex56(sha25635(preimage));
4009
+ return bytesToHex57(sha25635(preimage));
4000
4010
  }
4001
4011
  async generateComplianceProofBytes(type, publicInputs) {
4002
4012
  const { sha256: sha25635 } = await import("@noble/hashes/sha256");
4003
- const { bytesToHex: bytesToHex56 } = await import("@noble/hashes/utils");
4013
+ const { bytesToHex: bytesToHex57 } = await import("@noble/hashes/utils");
4004
4014
  const circuitId = COMPLIANCE_CIRCUIT_IDS[type];
4005
4015
  const encoder = new TextEncoder();
4006
4016
  const inputBytes = publicInputs.flatMap((pi) => Array.from(this.hexToBytes(pi.replace("0x", ""))));
@@ -4011,7 +4021,7 @@ var ComplianceProofProvider = class {
4011
4021
  const hash2 = sha25635(preimage);
4012
4022
  let proofBytes = "";
4013
4023
  for (let i = 0; i < 8; i++) {
4014
- proofBytes += bytesToHex56(sha25635(new Uint8Array([...hash2, i])));
4024
+ proofBytes += bytesToHex57(sha25635(new Uint8Array([...hash2, i])));
4015
4025
  }
4016
4026
  return proofBytes;
4017
4027
  }
@@ -4039,7 +4049,7 @@ var ComplianceProofProvider = class {
4039
4049
  };
4040
4050
 
4041
4051
  // src/proofs/aggregator.ts
4042
- import { randomBytes as randomBytes5, bytesToHex as bytesToHex11 } from "@noble/hashes/utils";
4052
+ import { randomBytes as randomBytes5, bytesToHex as bytesToHex12 } from "@noble/hashes/utils";
4043
4053
  import {
4044
4054
  ProofAggregationStrategy as Strategy,
4045
4055
  ComposedProofStatus
@@ -4061,7 +4071,7 @@ var DEFAULT_AGGREGATOR_CONFIG = {
4061
4071
  };
4062
4072
  function generateId(prefix) {
4063
4073
  const bytes = randomBytes5(8);
4064
- return `${prefix}-${bytesToHex11(bytes)}`;
4074
+ return `${prefix}-${bytesToHex12(bytes)}`;
4065
4075
  }
4066
4076
  function computeProofHash(proofs) {
4067
4077
  const data = proofs.map((p) => p.proof).join("");
@@ -4464,7 +4474,7 @@ var ProofAggregator = class {
4464
4474
  const proofBytes = randomBytes5(256);
4465
4475
  return {
4466
4476
  id: generateId(`recursive-${depth}`),
4467
- proof: `0x${bytesToHex11(proofBytes)}`,
4477
+ proof: `0x${bytesToHex12(proofBytes)}`,
4468
4478
  publicInputs: combinedInputs.slice(0, 10),
4469
4479
  metadata: {
4470
4480
  system: targetSystem,
@@ -4679,7 +4689,7 @@ function createProofAggregator(config) {
4679
4689
  }
4680
4690
 
4681
4691
  // src/proofs/verifier.ts
4682
- import { randomBytes as randomBytes6, bytesToHex as bytesToHex12 } from "@noble/hashes/utils";
4692
+ import { randomBytes as randomBytes6, bytesToHex as bytesToHex13 } from "@noble/hashes/utils";
4683
4693
  var DEFAULT_PIPELINE_CONFIG = {
4684
4694
  enableParallel: true,
4685
4695
  maxConcurrent: 4,
@@ -4693,7 +4703,7 @@ var DEFAULT_PIPELINE_CONFIG = {
4693
4703
  generateVerificationProof: false
4694
4704
  };
4695
4705
  function generateId2(prefix) {
4696
- return `${prefix}-${bytesToHex12(randomBytes6(8))}`;
4706
+ return `${prefix}-${bytesToHex13(randomBytes6(8))}`;
4697
4707
  }
4698
4708
  function computeLinkHash(sourceProof, targetProof) {
4699
4709
  const combinedData = sourceProof.proof + targetProof.proof;
@@ -5673,7 +5683,7 @@ function createCrossSystemValidator(options) {
5673
5683
  }
5674
5684
 
5675
5685
  // src/proofs/orchestrator.ts
5676
- import { randomBytes as randomBytes7, bytesToHex as bytesToHex13 } from "@noble/hashes/utils";
5686
+ import { randomBytes as randomBytes7, bytesToHex as bytesToHex14 } from "@noble/hashes/utils";
5677
5687
  import {
5678
5688
  ProofAggregationStrategy as Strategy2,
5679
5689
  ComposedProofStatus as ComposedProofStatus2
@@ -5732,7 +5742,7 @@ var BUILTIN_TEMPLATES = [
5732
5742
  }
5733
5743
  ];
5734
5744
  function generateId3(prefix) {
5735
- return `${prefix}-${bytesToHex13(randomBytes7(8))}`;
5745
+ return `${prefix}-${bytesToHex14(randomBytes7(8))}`;
5736
5746
  }
5737
5747
  function delay2(ms) {
5738
5748
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -6289,7 +6299,7 @@ var IncompatibleSystemsError = class extends ProofCompositionError {
6289
6299
 
6290
6300
  // src/proofs/composer/base.ts
6291
6301
  import { randomBytes as randomBytes8 } from "@noble/hashes/utils";
6292
- import { bytesToHex as bytesToHex14 } from "@noble/hashes/utils";
6302
+ import { bytesToHex as bytesToHex15 } from "@noble/hashes/utils";
6293
6303
  import {
6294
6304
  ProofAggregationStrategy as Strategy3,
6295
6305
  ComposedProofStatus as ComposedProofStatus4,
@@ -6298,7 +6308,7 @@ import {
6298
6308
  } from "@sip-protocol/types";
6299
6309
  function generateId4(prefix) {
6300
6310
  const bytes = randomBytes8(8);
6301
- return `${prefix}-${bytesToHex14(bytes)}`;
6311
+ return `${prefix}-${bytesToHex15(bytes)}`;
6302
6312
  }
6303
6313
  function computeProofHash2(proofs) {
6304
6314
  const data = proofs.map((p) => p.proof).join("");
@@ -6998,7 +7008,7 @@ var DEFAULT_CONVERSION_OPTIONS = {
6998
7008
  var CONVERTER_VERSION = "1.0.0";
6999
7009
  var SUPPORTED_NOIR_VERSIONS = ["0.30", "0.31", "0.32", "0.33", "0.34", "0.35", "1.0"];
7000
7010
  var SUPPORTED_BB_VERSIONS = ["0.47", "0.48", "0.49", "0.50", "0.51", "0.52", "0.53"];
7001
- function bytesToHex15(bytes) {
7011
+ function bytesToHex16(bytes) {
7002
7012
  return "0x" + Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
7003
7013
  }
7004
7014
  function hexToBytes8(hex) {
@@ -7044,7 +7054,7 @@ var NoirProofConverter = class {
7044
7054
  nativeProof.proofData.length
7045
7055
  );
7046
7056
  }
7047
- const proofHex = bytesToHex15(nativeProof.proofData);
7057
+ const proofHex = bytesToHex16(nativeProof.proofData);
7048
7058
  const publicInputsHex = nativeProof.publicInputs.map((input) => {
7049
7059
  if (input.startsWith("0x")) {
7050
7060
  return input;
@@ -7052,7 +7062,7 @@ var NoirProofConverter = class {
7052
7062
  const bigInt = BigInt(input);
7053
7063
  return "0x" + bigInt.toString(16).padStart(64, "0");
7054
7064
  });
7055
- const verificationKey = opts.includeVerificationKey && nativeProof.verificationKey ? typeof nativeProof.verificationKey === "string" ? nativeProof.verificationKey : bytesToHex15(nativeProof.verificationKey) : void 0;
7065
+ const verificationKey = opts.includeVerificationKey && nativeProof.verificationKey ? typeof nativeProof.verificationKey === "string" ? nativeProof.verificationKey : bytesToHex16(nativeProof.verificationKey) : void 0;
7056
7066
  const metadata = {
7057
7067
  system: "noir",
7058
7068
  systemVersion: nativeProof.noirVersion || "unknown",
@@ -7285,7 +7295,7 @@ var CONVERTER_VERSION2 = "1.0.0";
7285
7295
  var SUPPORTED_HALO2_VERSIONS = ["0.2", "0.3", "1.0"];
7286
7296
  var MIN_K_VALUE = 4;
7287
7297
  var MAX_K_VALUE = 28;
7288
- function bytesToHex16(bytes) {
7298
+ function bytesToHex17(bytes) {
7289
7299
  return "0x" + Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
7290
7300
  }
7291
7301
  function hexToBytes9(hex) {
@@ -7327,7 +7337,7 @@ var Halo2ProofConverter = class {
7327
7337
  nativeProof.proofData.length
7328
7338
  );
7329
7339
  }
7330
- const proofHex = bytesToHex16(nativeProof.proofData);
7340
+ const proofHex = bytesToHex17(nativeProof.proofData);
7331
7341
  const publicInputsHex = nativeProof.publicInputs.map((input) => {
7332
7342
  if (input.startsWith("0x")) {
7333
7343
  return input;
@@ -7335,7 +7345,7 @@ var Halo2ProofConverter = class {
7335
7345
  const bigInt = BigInt(input);
7336
7346
  return "0x" + bigInt.toString(16).padStart(64, "0");
7337
7347
  });
7338
- const verificationKey = opts.includeVerificationKey && nativeProof.verificationKey ? typeof nativeProof.verificationKey === "string" ? nativeProof.verificationKey : bytesToHex16(nativeProof.verificationKey) : void 0;
7348
+ const verificationKey = opts.includeVerificationKey && nativeProof.verificationKey ? typeof nativeProof.verificationKey === "string" ? nativeProof.verificationKey : bytesToHex17(nativeProof.verificationKey) : void 0;
7339
7349
  const circuitId = nativeProof.provingKeyCommitment ? `halo2-k${nativeProof.k || "unknown"}-${nativeProof.provingKeyCommitment.slice(0, 16)}` : `halo2-k${nativeProof.k || "unknown"}`;
7340
7350
  const metadata = {
7341
7351
  system: "halo2",
@@ -7572,7 +7582,7 @@ function createHalo2Converter() {
7572
7582
  var CONVERTER_VERSION3 = "1.0.0";
7573
7583
  var SUPPORTED_KIMCHI_VERSIONS = ["0.15", "0.16", "0.17", "0.18", "1.0", "1.1", "1.2"];
7574
7584
  var PALLAS_MODULUS2 = BigInt("0x40000000000000000000000000000000224698fc094cf91b992d30ed00000001");
7575
- function bytesToHex17(bytes) {
7585
+ function bytesToHex18(bytes) {
7576
7586
  return "0x" + Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
7577
7587
  }
7578
7588
  function hexToBytes10(hex) {
@@ -7622,7 +7632,7 @@ var KimchiProofConverter = class {
7622
7632
  nativeProof.proofData.length
7623
7633
  );
7624
7634
  }
7625
- const proofHex = bytesToHex17(nativeProof.proofData);
7635
+ const proofHex = bytesToHex18(nativeProof.proofData);
7626
7636
  const publicInputsHex = nativeProof.publicInputs.map((input) => {
7627
7637
  if (input.startsWith("0x")) {
7628
7638
  return input;
@@ -7630,7 +7640,7 @@ var KimchiProofConverter = class {
7630
7640
  const bigInt = BigInt(input);
7631
7641
  return "0x" + bigInt.toString(16).padStart(64, "0");
7632
7642
  });
7633
- const verificationKey = opts.includeVerificationKey && nativeProof.verificationKey ? typeof nativeProof.verificationKey === "string" ? nativeProof.verificationKey : bytesToHex17(nativeProof.verificationKey) : void 0;
7643
+ const verificationKey = opts.includeVerificationKey && nativeProof.verificationKey ? typeof nativeProof.verificationKey === "string" ? nativeProof.verificationKey : bytesToHex18(nativeProof.verificationKey) : void 0;
7634
7644
  const circuitId = nativeProof.verifierIndexCommitment ? `kimchi-${nativeProof.verifierIndexCommitment.slice(0, 16)}` : "kimchi-unknown";
7635
7645
  const metadata = {
7636
7646
  system: "kimchi",
@@ -8013,7 +8023,7 @@ var DEFAULT_WARMING_CONFIG = {
8013
8023
 
8014
8024
  // src/proofs/cache/key-generator.ts
8015
8025
  import { sha256 as sha2567 } from "@noble/hashes/sha256";
8016
- import { bytesToHex as bytesToHex18 } from "@noble/hashes/utils";
8026
+ import { bytesToHex as bytesToHex19 } from "@noble/hashes/utils";
8017
8027
  var KEY_SEPARATOR = ":";
8018
8028
  var KEY_PREFIX = "sip-proof";
8019
8029
  var KEY_VERSION = "v1";
@@ -8035,7 +8045,7 @@ function canonicalize(value) {
8035
8045
  return value.toString();
8036
8046
  }
8037
8047
  if (value instanceof Uint8Array) {
8038
- return `bytes:${bytesToHex18(value)}`;
8048
+ return `bytes:${bytesToHex19(value)}`;
8039
8049
  }
8040
8050
  if (Array.isArray(value)) {
8041
8051
  return `[${value.map(canonicalize).join(",")}]`;
@@ -8098,7 +8108,7 @@ var CacheKeyGenerator = class {
8098
8108
  hashInputs(inputs) {
8099
8109
  const canonical = canonicalize(inputs);
8100
8110
  const hash2 = sha2567(new TextEncoder().encode(canonical));
8101
- return bytesToHex18(hash2);
8111
+ return bytesToHex19(hash2);
8102
8112
  }
8103
8113
  /**
8104
8114
  * Generate a cache key from raw inputs
@@ -9547,11 +9557,11 @@ var CHAIN_NUMERIC_IDS = {
9547
9557
  // src/oracle/verification.ts
9548
9558
  import { ed25519 } from "@noble/curves/ed25519";
9549
9559
  import { sha256 as sha2569 } from "@noble/hashes/sha256";
9550
- import { bytesToHex as bytesToHex20, hexToBytes as hexToBytes12 } from "@noble/hashes/utils";
9560
+ import { bytesToHex as bytesToHex21, hexToBytes as hexToBytes12 } from "@noble/hashes/utils";
9551
9561
 
9552
9562
  // src/oracle/serialization.ts
9553
9563
  import { sha256 as sha2568 } from "@noble/hashes/sha256";
9554
- import { bytesToHex as bytesToHex19, hexToBytes as hexToBytes11, utf8ToBytes as utf8ToBytes2 } from "@noble/hashes/utils";
9564
+ import { bytesToHex as bytesToHex20, hexToBytes as hexToBytes11, utf8ToBytes as utf8ToBytes2 } from "@noble/hashes/utils";
9555
9565
  function serializeAttestationMessage(message) {
9556
9566
  const buffer = new Uint8Array(197);
9557
9567
  const view = new DataView(buffer.buffer);
@@ -9594,19 +9604,19 @@ function deserializeAttestationMessage(bytes) {
9594
9604
  const version = bytes[offset++];
9595
9605
  const chainId = view.getUint32(offset, false);
9596
9606
  offset += 4;
9597
- const intentHash = `0x${bytesToHex19(bytes.slice(offset, offset + 32))}`;
9607
+ const intentHash = `0x${bytesToHex20(bytes.slice(offset, offset + 32))}`;
9598
9608
  offset += 32;
9599
- const recipient = `0x${bytesToHex19(bytes.slice(offset, offset + 32))}`;
9609
+ const recipient = `0x${bytesToHex20(bytes.slice(offset, offset + 32))}`;
9600
9610
  offset += 32;
9601
9611
  const amount = bytesToBigint(bytes.slice(offset, offset + 16));
9602
9612
  offset += 16;
9603
- const assetId = `0x${bytesToHex19(bytes.slice(offset, offset + 32))}`;
9613
+ const assetId = `0x${bytesToHex20(bytes.slice(offset, offset + 32))}`;
9604
9614
  offset += 32;
9605
- const txHash = `0x${bytesToHex19(bytes.slice(offset, offset + 32))}`;
9615
+ const txHash = `0x${bytesToHex20(bytes.slice(offset, offset + 32))}`;
9606
9616
  offset += 32;
9607
9617
  const blockNumber = view.getBigUint64(offset, false);
9608
9618
  offset += 8;
9609
- const blockHash = `0x${bytesToHex19(bytes.slice(offset, offset + 32))}`;
9619
+ const blockHash = `0x${bytesToHex20(bytes.slice(offset, offset + 32))}`;
9610
9620
  offset += 32;
9611
9621
  const timestamp = Number(view.getBigUint64(offset, false));
9612
9622
  return {
@@ -9674,7 +9684,7 @@ function bytesToBigint(bytes) {
9674
9684
  function deriveOracleId(publicKey) {
9675
9685
  const keyBytes = typeof publicKey === "string" ? hexToBytes12(publicKey.startsWith("0x") ? publicKey.slice(2) : publicKey) : publicKey;
9676
9686
  const hash2 = sha2569(keyBytes);
9677
- return `0x${bytesToHex20(hash2)}`;
9687
+ return `0x${bytesToHex21(hash2)}`;
9678
9688
  }
9679
9689
  function verifyAttestation(attestation, registry) {
9680
9690
  const { message, signatures } = attestation;
@@ -9749,7 +9759,7 @@ function signAttestationMessage(messageHash, privateKey) {
9749
9759
  const oracleId = deriveOracleId(publicKey);
9750
9760
  return {
9751
9761
  oracleId,
9752
- signature: `0x${bytesToHex20(signature)}`
9762
+ signature: `0x${bytesToHex21(signature)}`
9753
9763
  };
9754
9764
  }
9755
9765
  function createOracleRegistry(config = {}) {
@@ -9999,7 +10009,7 @@ import { ReportStatus as ReportStatus2 } from "@sip-protocol/types";
9999
10009
  import {
10000
10010
  IntentStatus as IntentStatus3
10001
10011
  } from "@sip-protocol/types";
10002
- import { bytesToHex as bytesToHex21, randomBytes as randomBytes9 } from "@noble/hashes/utils";
10012
+ import { bytesToHex as bytesToHex22, randomBytes as randomBytes9 } from "@noble/hashes/utils";
10003
10013
  var MockSolver = class {
10004
10014
  info;
10005
10015
  capabilities;
@@ -10081,7 +10091,7 @@ var MockSolver = class {
10081
10091
  const spreadAmount = baseOutput * BigInt(Math.floor(this.spreadPercent * 1e4)) / 10000n;
10082
10092
  const outputAmount = baseOutput + spreadAmount;
10083
10093
  const feeAmount = outputAmount * BigInt(Math.floor(this.feePercent * 1e4)) / 10000n;
10084
- const quoteId = `quote-${bytesToHex21(randomBytes9(8))}`;
10094
+ const quoteId = `quote-${bytesToHex22(randomBytes9(8))}`;
10085
10095
  const now = Math.floor(Date.now() / 1e3);
10086
10096
  const quote = {
10087
10097
  quoteId,
@@ -10092,7 +10102,7 @@ var MockSolver = class {
10092
10102
  expiry: now + 60,
10093
10103
  // Quote valid for 1 minute
10094
10104
  fee: feeAmount,
10095
- signature: `0x${bytesToHex21(randomBytes9(64))}`,
10105
+ signature: `0x${bytesToHex22(randomBytes9(64))}`,
10096
10106
  // Mock signature
10097
10107
  validUntil: now + 60,
10098
10108
  estimatedGas: 200000n
@@ -10129,7 +10139,7 @@ var MockSolver = class {
10129
10139
  error: status.error
10130
10140
  };
10131
10141
  }
10132
- const txHash = `0x${bytesToHex21(randomBytes9(32))}`;
10142
+ const txHash = `0x${bytesToHex22(randomBytes9(32))}`;
10133
10143
  status.status = "completed";
10134
10144
  status.txHash = txHash;
10135
10145
  return {
@@ -10139,10 +10149,10 @@ var MockSolver = class {
10139
10149
  txHash: intent.privacyLevel === "transparent" ? txHash : void 0,
10140
10150
  fulfillmentProof: {
10141
10151
  type: "fulfillment",
10142
- proof: `0x${bytesToHex21(randomBytes9(128))}`,
10152
+ proof: `0x${bytesToHex22(randomBytes9(128))}`,
10143
10153
  publicInputs: [
10144
- `0x${bytesToHex21(new TextEncoder().encode(intent.intentId))}`,
10145
- `0x${bytesToHex21(new TextEncoder().encode(quote.quoteId))}`
10154
+ `0x${bytesToHex22(new TextEncoder().encode(intent.intentId))}`,
10155
+ `0x${bytesToHex22(new TextEncoder().encode(quote.quoteId))}`
10146
10156
  ]
10147
10157
  },
10148
10158
  fulfilledAt: Math.floor(Date.now() / 1e3)
@@ -11710,7 +11720,7 @@ function createZcashNativeBackend(config) {
11710
11720
 
11711
11721
  // src/settlement/backends/direct-chain.ts
11712
11722
  import { PrivacyLevel as PrivacyLevel5 } from "@sip-protocol/types";
11713
- import { randomBytes as randomBytes10, bytesToHex as bytesToHex22 } from "@noble/hashes/utils";
11723
+ import { randomBytes as randomBytes10, bytesToHex as bytesToHex23 } from "@noble/hashes/utils";
11714
11724
  var DEFAULT_GAS_FEES = {
11715
11725
  ethereum: 21000n * 50n * 1000000000n,
11716
11726
  // 21k gas * 50 gwei = 0.00105 ETH
@@ -13043,7 +13053,7 @@ import { ZcashErrorCode as ZcashErrorCode3 } from "@sip-protocol/types";
13043
13053
  // src/bitcoin/taproot.ts
13044
13054
  import { secp256k1 as secp256k12, schnorr } from "@noble/curves/secp256k1";
13045
13055
  import { sha256 as sha25610 } from "@noble/hashes/sha256";
13046
- import { bytesToHex as bytesToHex23, hexToBytes as hexToBytes13 } from "@noble/hashes/utils";
13056
+ import { bytesToHex as bytesToHex24, hexToBytes as hexToBytes13 } from "@noble/hashes/utils";
13047
13057
  var BECH32_CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
13048
13058
  var BECH32_GENERATOR = [996825010, 642813549, 513874426, 1027748829, 705979059];
13049
13059
  function taggedHash(tag, data) {
@@ -13098,16 +13108,16 @@ function computeTweakedKey(internalKey, merkleRoot) {
13098
13108
  }
13099
13109
  const tweakData = merkleRoot ? new Uint8Array([...internalKey, ...merkleRoot]) : internalKey;
13100
13110
  const tweak = taggedHash("TapTweak", tweakData);
13101
- const tweakScalar = BigInt("0x" + bytesToHex23(tweak)) % secp256k12.CURVE.n;
13111
+ const tweakScalar = BigInt("0x" + bytesToHex24(tweak)) % secp256k12.CURVE.n;
13102
13112
  const internalPoint = secp256k12.ProjectivePoint.fromHex(
13103
- "02" + bytesToHex23(internalKey)
13113
+ "02" + bytesToHex24(internalKey)
13104
13114
  );
13105
13115
  const tweakPoint = secp256k12.ProjectivePoint.BASE.multiply(tweakScalar);
13106
13116
  const tweakedPoint = internalPoint.add(tweakPoint);
13107
13117
  const tweakedKeyBytes = tweakedPoint.toRawBytes(false);
13108
13118
  const xOnly = tweakedKeyBytes.slice(1, 33);
13109
13119
  const yCoord = tweakedKeyBytes.slice(33, 65);
13110
- const yBigInt = BigInt("0x" + bytesToHex23(yCoord));
13120
+ const yBigInt = BigInt("0x" + bytesToHex24(yCoord));
13111
13121
  const parity = Number(yBigInt & 1n);
13112
13122
  return {
13113
13123
  tweakedKey: xOnly,
@@ -13137,9 +13147,9 @@ function createTaprootOutput(internalKey, scripts) {
13137
13147
  }
13138
13148
  const { tweakedKey, parity } = computeTweakedKey(internalKey, merkleRoot);
13139
13149
  return {
13140
- tweakedKey: `0x${bytesToHex23(tweakedKey)}`,
13141
- internalKey: `0x${bytesToHex23(internalKey)}`,
13142
- merkleRoot: merkleRoot ? `0x${bytesToHex23(merkleRoot)}` : void 0,
13150
+ tweakedKey: `0x${bytesToHex24(tweakedKey)}`,
13151
+ internalKey: `0x${bytesToHex24(internalKey)}`,
13152
+ merkleRoot: merkleRoot ? `0x${bytesToHex24(merkleRoot)}` : void 0,
13143
13153
  parity
13144
13154
  };
13145
13155
  }
@@ -13305,7 +13315,7 @@ function schnorrSignHex(message, privateKey, auxRand) {
13305
13315
  const privateKeyBytes = hexToBytes13(privateKey.slice(2));
13306
13316
  const auxRandBytes = auxRand ? hexToBytes13(auxRand.slice(2)) : void 0;
13307
13317
  const signature = schnorrSign(messageBytes, privateKeyBytes, auxRandBytes);
13308
- return `0x${bytesToHex23(signature)}`;
13318
+ return `0x${bytesToHex24(signature)}`;
13309
13319
  }
13310
13320
  function schnorrVerifyHex(signature, message, publicKey) {
13311
13321
  if (!isValidHex(signature)) {
@@ -13326,7 +13336,7 @@ function schnorrVerifyHex(signature, message, publicKey) {
13326
13336
  // src/bitcoin/silent-payments.ts
13327
13337
  import { secp256k1 as secp256k13 } from "@noble/curves/secp256k1";
13328
13338
  import { sha256 as sha25611 } from "@noble/hashes/sha256";
13329
- import { bytesToHex as bytesToHex24, hexToBytes as hexToBytes14 } from "@noble/hashes/utils";
13339
+ import { bytesToHex as bytesToHex25, hexToBytes as hexToBytes14 } from "@noble/hashes/utils";
13330
13340
 
13331
13341
  // src/payment/payment.ts
13332
13342
  import {
@@ -13335,7 +13345,7 @@ import {
13335
13345
  PaymentStatus
13336
13346
  } from "@sip-protocol/types";
13337
13347
  import { sha256 as sha25612 } from "@noble/hashes/sha256";
13338
- import { bytesToHex as bytesToHex25, hexToBytes as hexToBytes15, randomBytes as randomBytes11 } from "@noble/hashes/utils";
13348
+ import { bytesToHex as bytesToHex26, hexToBytes as hexToBytes15, randomBytes as randomBytes11 } from "@noble/hashes/utils";
13339
13349
  import { xchacha20poly1305 as xchacha20poly13052 } from "@noble/ciphers/chacha.js";
13340
13350
  import { hkdf as hkdf2 } from "@noble/hashes/hkdf";
13341
13351
 
@@ -13832,7 +13842,7 @@ async function createShieldedPayment(params, options) {
13832
13842
  if (viewingKey) {
13833
13843
  const keyHex = viewingKey.startsWith("0x") ? viewingKey.slice(2) : viewingKey;
13834
13844
  const keyBytes = hexToBytes15(keyHex);
13835
- viewingKeyHash = `0x${bytesToHex25(sha25612(keyBytes))}`;
13845
+ viewingKeyHash = `0x${bytesToHex26(sha25612(keyBytes))}`;
13836
13846
  }
13837
13847
  const privacyConfig = getPrivacyConfig(
13838
13848
  privacy,
@@ -13909,7 +13919,7 @@ function encryptMemo(memo, viewingKey) {
13909
13919
  const result = new Uint8Array(nonce.length + ciphertext.length);
13910
13920
  result.set(nonce);
13911
13921
  result.set(ciphertext, nonce.length);
13912
- return `0x${bytesToHex25(result)}`;
13922
+ return `0x${bytesToHex26(result)}`;
13913
13923
  } finally {
13914
13924
  secureWipe(keyBytes);
13915
13925
  secureWipe(encKey);
@@ -13974,7 +13984,7 @@ import {
13974
13984
  } from "@sip-protocol/types";
13975
13985
  import { secp256k1 as secp256k14 } from "@noble/curves/secp256k1";
13976
13986
  import { sha256 as sha25613 } from "@noble/hashes/sha256";
13977
- import { bytesToHex as bytesToHex26, hexToBytes as hexToBytes16, randomBytes as randomBytes12 } from "@noble/hashes/utils";
13987
+ import { bytesToHex as bytesToHex27, hexToBytes as hexToBytes16, randomBytes as randomBytes12 } from "@noble/hashes/utils";
13978
13988
  var DEFAULT_PROPOSAL_TTL = 7 * 24 * 60 * 60;
13979
13989
  var Treasury = class _Treasury {
13980
13990
  config;
@@ -14466,11 +14476,11 @@ var Treasury = class _Treasury {
14466
14476
  };
14467
14477
  function generateTreasuryId() {
14468
14478
  const bytes = randomBytes12(16);
14469
- return `treasury_${bytesToHex26(bytes)}`;
14479
+ return `treasury_${bytesToHex27(bytes)}`;
14470
14480
  }
14471
14481
  function generateProposalId() {
14472
14482
  const bytes = randomBytes12(16);
14473
- return `prop_${bytesToHex26(bytes)}`;
14483
+ return `prop_${bytesToHex27(bytes)}`;
14474
14484
  }
14475
14485
  function computeProposalHash(proposal) {
14476
14486
  const data = JSON.stringify({
@@ -14660,7 +14670,7 @@ function validateBatchProposalParams(params, config) {
14660
14670
  import {
14661
14671
  ReportStatus
14662
14672
  } from "@sip-protocol/types";
14663
- import { bytesToHex as bytesToHex27, randomBytes as randomBytes13 } from "@noble/hashes/utils";
14673
+ import { bytesToHex as bytesToHex28, randomBytes as randomBytes13 } from "@noble/hashes/utils";
14664
14674
  var DEFAULTS2 = {
14665
14675
  riskThreshold: 70,
14666
14676
  highValueThreshold: 10000000000n,
@@ -15407,7 +15417,7 @@ var ComplianceManager = class _ComplianceManager {
15407
15417
  }
15408
15418
  };
15409
15419
  function generateId5(prefix) {
15410
- return `${prefix}_${bytesToHex27(randomBytes13(12))}`;
15420
+ return `${prefix}_${bytesToHex28(randomBytes13(12))}`;
15411
15421
  }
15412
15422
  function validateRegisterAuditorParams(params) {
15413
15423
  if (!params.organization?.trim()) {
@@ -15496,7 +15506,7 @@ function validateReportParams(params) {
15496
15506
 
15497
15507
  // src/compliance/reports.ts
15498
15508
  import { sha256 as sha25614 } from "@noble/hashes/sha256";
15499
- import { hexToBytes as hexToBytes17, bytesToHex as bytesToHex28 } from "@noble/hashes/utils";
15509
+ import { hexToBytes as hexToBytes17, bytesToHex as bytesToHex29 } from "@noble/hashes/utils";
15500
15510
 
15501
15511
  // src/compliance/pdf.ts
15502
15512
  function generatePdfReport(report, options = {}) {
@@ -15802,7 +15812,7 @@ var ComplianceReporter = class {
15802
15812
  return {
15803
15813
  key: `0x${keyHex}`,
15804
15814
  path: "m/0",
15805
- hash: `0x${bytesToHex28(hashBytes)}`
15815
+ hash: `0x${bytesToHex29(hashBytes)}`
15806
15816
  };
15807
15817
  }
15808
15818
  return viewingKey;
@@ -16184,7 +16194,7 @@ var ComplianceReporter = class {
16184
16194
 
16185
16195
  // src/compliance/conditional.ts
16186
16196
  import { sha256 as sha25615 } from "@noble/hashes/sha256";
16187
- import { bytesToHex as bytesToHex29, hexToBytes as hexToBytes18, randomBytes as randomBytes14 } from "@noble/hashes/utils";
16197
+ import { bytesToHex as bytesToHex30, hexToBytes as hexToBytes18, randomBytes as randomBytes14 } from "@noble/hashes/utils";
16188
16198
  import { xchacha20poly1305 as xchacha20poly13053 } from "@noble/ciphers/chacha.js";
16189
16199
  var ConditionalDisclosure = class {
16190
16200
  /**
@@ -16260,10 +16270,10 @@ var ConditionalDisclosure = class {
16260
16270
  ]);
16261
16271
  const commitmentHash = sha25615(commitmentData);
16262
16272
  return {
16263
- encryptedKey: "0x" + bytesToHex29(encryptedKey),
16264
- nonce: "0x" + bytesToHex29(nonce),
16273
+ encryptedKey: "0x" + bytesToHex30(encryptedKey),
16274
+ nonce: "0x" + bytesToHex30(nonce),
16265
16275
  revealAfter: revealAfterSeconds,
16266
- verificationCommitment: "0x" + bytesToHex29(commitmentHash),
16276
+ verificationCommitment: "0x" + bytesToHex30(commitmentHash),
16267
16277
  encryptionCommitment: params.commitment,
16268
16278
  type
16269
16279
  };
@@ -16344,7 +16354,7 @@ var ConditionalDisclosure = class {
16344
16354
  const encryptedData = hexToBytes18(timeLock.encryptedKey.slice(2));
16345
16355
  const cipher = xchacha20poly13053(encryptionKey, nonce);
16346
16356
  const decryptedBytes = cipher.decrypt(encryptedData);
16347
- const viewingKey = "0x" + bytesToHex29(decryptedBytes);
16357
+ const viewingKey = "0x" + bytesToHex30(decryptedBytes);
16348
16358
  return {
16349
16359
  unlocked: true,
16350
16360
  viewingKey
@@ -16432,12 +16442,12 @@ var ConditionalDisclosure = class {
16432
16442
  // src/compliance/conditional-threshold.ts
16433
16443
  import { secp256k1 as secp256k15 } from "@noble/curves/secp256k1";
16434
16444
  import { sha256 as sha25616 } from "@noble/hashes/sha256";
16435
- import { bytesToHex as bytesToHex30, hexToBytes as hexToBytes19 } from "@noble/hashes/utils";
16445
+ import { bytesToHex as bytesToHex31, hexToBytes as hexToBytes19 } from "@noble/hashes/utils";
16436
16446
  var CURVE_ORDER = secp256k15.CURVE.n;
16437
16447
 
16438
16448
  // src/compliance/threshold.ts
16439
16449
  import { sha256 as sha25617 } from "@noble/hashes/sha256";
16440
- import { bytesToHex as bytesToHex31, hexToBytes as hexToBytes20, randomBytes as randomBytes15 } from "@noble/hashes/utils";
16450
+ import { bytesToHex as bytesToHex32, hexToBytes as hexToBytes20, randomBytes as randomBytes15 } from "@noble/hashes/utils";
16441
16451
  var FIELD_PRIME = 2n ** 256n - 189n;
16442
16452
  var ThresholdViewingKey = class {
16443
16453
  /**
@@ -16680,7 +16690,7 @@ var ThresholdViewingKey = class {
16680
16690
  static createCommitment(secret, coefficients) {
16681
16691
  const data = [secret, ...coefficients].map((c) => c.toString(16).padStart(64, "0")).join("");
16682
16692
  const hash2 = sha25617(hexToBytes20(data));
16683
- return bytesToHex31(hash2);
16693
+ return bytesToHex32(hash2);
16684
16694
  }
16685
16695
  /**
16686
16696
  * Encode share as string: "x:y:len:commitment"
@@ -16806,7 +16816,7 @@ var ThresholdViewingKey = class {
16806
16816
  import { sha256 as sha25618 } from "@noble/hashes/sha256";
16807
16817
  import { sha512 as sha5122 } from "@noble/hashes/sha512";
16808
16818
  import { hmac as hmac2 } from "@noble/hashes/hmac";
16809
- import { bytesToHex as bytesToHex32, utf8ToBytes as utf8ToBytes4 } from "@noble/hashes/utils";
16819
+ import { bytesToHex as bytesToHex33, utf8ToBytes as utf8ToBytes4 } from "@noble/hashes/utils";
16810
16820
  var AuditorType = /* @__PURE__ */ ((AuditorType2) => {
16811
16821
  AuditorType2[AuditorType2["PRIMARY"] = 0] = "PRIMARY";
16812
16822
  AuditorType2[AuditorType2["REGULATORY"] = 1] = "REGULATORY";
@@ -16916,9 +16926,9 @@ var AuditorKeyDerivation = class {
16916
16926
  currentKey = new Uint8Array(derived.key);
16917
16927
  chainCode = new Uint8Array(derived.chainCode);
16918
16928
  }
16919
- const keyHex = `0x${bytesToHex32(currentKey)}`;
16929
+ const keyHex = `0x${bytesToHex33(currentKey)}`;
16920
16930
  const hashBytes = sha25618(currentKey);
16921
- const hash2 = `0x${bytesToHex32(hashBytes)}`;
16931
+ const hash2 = `0x${bytesToHex33(hashBytes)}`;
16922
16932
  const viewingKey = {
16923
16933
  key: keyHex,
16924
16934
  path,
@@ -17002,9 +17012,9 @@ var AuditorKeyDerivation = class {
17002
17012
  for (const auditorType of uniqueTypes) {
17003
17013
  const derived = this.deriveChildKey(commonKey, commonChainCode, auditorType);
17004
17014
  try {
17005
- const keyHex = `0x${bytesToHex32(derived.key)}`;
17015
+ const keyHex = `0x${bytesToHex33(derived.key)}`;
17006
17016
  const hashBytes = sha25618(derived.key);
17007
- const hash2 = `0x${bytesToHex32(hashBytes)}`;
17017
+ const hash2 = `0x${bytesToHex33(hashBytes)}`;
17008
17018
  const path = this.derivePath(auditorType, account);
17009
17019
  const viewingKey = {
17010
17020
  key: keyHex,
@@ -17128,7 +17138,7 @@ var AuditorKeyDerivation = class {
17128
17138
  import { sha256 as sha25619 } from "@noble/hashes/sha256";
17129
17139
  import { hmac as hmac3 } from "@noble/hashes/hmac";
17130
17140
  import { sha512 as sha5123 } from "@noble/hashes/sha512";
17131
- import { bytesToHex as bytesToHex33, hexToBytes as hexToBytes22, utf8ToBytes as utf8ToBytes5 } from "@noble/hashes/utils";
17141
+ import { bytesToHex as bytesToHex34, hexToBytes as hexToBytes22, utf8ToBytes as utf8ToBytes5 } from "@noble/hashes/utils";
17132
17142
  var AttestationSchema = /* @__PURE__ */ ((AttestationSchema2) => {
17133
17143
  AttestationSchema2["RANGE_KYC_V1"] = "range-kyc-v1";
17134
17144
  AttestationSchema2["RANGE_ACCREDITED_INVESTOR"] = "range-accredited-investor";
@@ -17369,9 +17379,9 @@ var AttestationGatedDisclosure = class {
17369
17379
  const derived = hmac3(sha5123, masterKeyBytes, derivationData);
17370
17380
  const keyBytes = derived.slice(0, 32);
17371
17381
  try {
17372
- const key = `0x${bytesToHex33(keyBytes)}`;
17382
+ const key = `0x${bytesToHex34(keyBytes)}`;
17373
17383
  const hashBytes = sha25619(keyBytes);
17374
- const hash2 = `0x${bytesToHex33(hashBytes)}`;
17384
+ const hash2 = `0x${bytesToHex34(hashBytes)}`;
17375
17385
  return {
17376
17386
  key,
17377
17387
  path: `${this.config.masterViewingKey.path}/sas/${attestation.uid.slice(0, 8)}`,
@@ -17462,7 +17472,7 @@ async function verifyAttestationSignature(attestation, options = {}) {
17462
17472
  }
17463
17473
  const signedMessage = constructAttestationMessage(attestation);
17464
17474
  try {
17465
- const { ed25519: ed2551910 } = await import("@noble/curves/ed25519");
17475
+ const { ed25519: ed2551912 } = await import("@noble/curves/ed25519");
17466
17476
  const signatureBytes = hexToBytes22(
17467
17477
  attestation.signature.startsWith("0x") ? attestation.signature.slice(2) : attestation.signature
17468
17478
  );
@@ -17470,7 +17480,7 @@ async function verifyAttestationSignature(attestation, options = {}) {
17470
17480
  issuerPublicKey.startsWith("0x") ? issuerPublicKey.slice(2) : issuerPublicKey
17471
17481
  );
17472
17482
  const messageBytes = utf8ToBytes5(signedMessage);
17473
- return ed2551910.verify(signatureBytes, messageBytes, publicKeyBytes);
17483
+ return ed2551912.verify(signatureBytes, messageBytes, publicKeyBytes);
17474
17484
  } catch (error) {
17475
17485
  console.warn(`[Range SAS] Signature verification error: ${error}`);
17476
17486
  return false;
@@ -17626,10 +17636,10 @@ async function fetchWalletAttestations(walletAddress, options = {}) {
17626
17636
 
17627
17637
  // src/compliance/fireblocks.ts
17628
17638
  import { sha256 as sha25620 } from "@noble/hashes/sha256";
17629
- import { bytesToHex as bytesToHex34, hexToBytes as hexToBytes23 } from "@noble/hashes/utils";
17639
+ import { bytesToHex as bytesToHex35, hexToBytes as hexToBytes23 } from "@noble/hashes/utils";
17630
17640
 
17631
17641
  // src/auction/sealed-bid.ts
17632
- import { randomBytes as randomBytes16, bytesToHex as bytesToHex35 } from "@noble/hashes/utils";
17642
+ import { randomBytes as randomBytes16, bytesToHex as bytesToHex36 } from "@noble/hashes/utils";
17633
17643
  var SealedBidAuction = class {
17634
17644
  /**
17635
17645
  * Create a sealed bid for an auction
@@ -17850,7 +17860,7 @@ var SealedBidAuction = class {
17850
17860
  * ```
17851
17861
  */
17852
17862
  revealBid(bid, amount, salt) {
17853
- const saltHex = `0x${bytesToHex35(salt)}`;
17863
+ const saltHex = `0x${bytesToHex36(salt)}`;
17854
17864
  const isValid = this.verifyBid({
17855
17865
  commitment: bid.commitment,
17856
17866
  amount,
@@ -18337,7 +18347,7 @@ function createSealedBidAuction() {
18337
18347
  // src/governance/private-vote.ts
18338
18348
  import { sha256 as sha25621 } from "@noble/hashes/sha256";
18339
18349
  import { hkdf as hkdf3 } from "@noble/hashes/hkdf";
18340
- import { bytesToHex as bytesToHex36, hexToBytes as hexToBytes24, randomBytes as randomBytes17, utf8ToBytes as utf8ToBytes6 } from "@noble/hashes/utils";
18350
+ import { bytesToHex as bytesToHex37, hexToBytes as hexToBytes24, randomBytes as randomBytes17, utf8ToBytes as utf8ToBytes6 } from "@noble/hashes/utils";
18341
18351
  import { xchacha20poly1305 as xchacha20poly13054 } from "@noble/ciphers/chacha.js";
18342
18352
  var VOTE_ENCRYPTION_DOMAIN = "SIP-PRIVATE-VOTE-ENCRYPTION-V1";
18343
18353
  var NONCE_SIZE2 = 24;
@@ -18387,9 +18397,9 @@ var PrivateVoting = class {
18387
18397
  const ciphertext = cipher.encrypt(plaintext);
18388
18398
  const keyHash = sha25621(hexToBytes24(encryptionKey.slice(2)));
18389
18399
  return {
18390
- ciphertext: `0x${bytesToHex36(ciphertext)}`,
18391
- nonce: `0x${bytesToHex36(nonce)}`,
18392
- encryptionKeyHash: `0x${bytesToHex36(keyHash)}`,
18400
+ ciphertext: `0x${bytesToHex37(ciphertext)}`,
18401
+ nonce: `0x${bytesToHex37(nonce)}`,
18402
+ encryptionKeyHash: `0x${bytesToHex37(keyHash)}`,
18393
18403
  proposalId,
18394
18404
  voter,
18395
18405
  timestamp: voteData.timestamp
@@ -18436,7 +18446,7 @@ var PrivateVoting = class {
18436
18446
  const derivedKey = this.deriveEncryptionKey(decryptionKey, vote.proposalId);
18437
18447
  try {
18438
18448
  const keyHash = sha25621(hexToBytes24(decryptionKey.slice(2)));
18439
- const expectedKeyHash = `0x${bytesToHex36(keyHash)}`;
18449
+ const expectedKeyHash = `0x${bytesToHex37(keyHash)}`;
18440
18450
  if (vote.encryptionKeyHash !== expectedKeyHash) {
18441
18451
  throw new CryptoError(
18442
18452
  "Decryption key hash mismatch - this key cannot decrypt this vote",
@@ -18698,8 +18708,8 @@ var PrivateVoting = class {
18698
18708
  const blindingBytes = hexToBytes24(blinding.slice(2));
18699
18709
  const ciphertext = cipher.encrypt(blindingBytes);
18700
18710
  encryptedBlindings[choice] = {
18701
- ciphertext: `0x${bytesToHex36(ciphertext)}`,
18702
- nonce: `0x${bytesToHex36(nonce)}`
18711
+ ciphertext: `0x${bytesToHex37(ciphertext)}`,
18712
+ nonce: `0x${bytesToHex37(nonce)}`
18703
18713
  };
18704
18714
  } finally {
18705
18715
  secureWipe(derivedKey);
@@ -18807,7 +18817,7 @@ var PrivateVoting = class {
18807
18817
  reconstructedKey[j] ^= shareBytes[j];
18808
18818
  }
18809
18819
  }
18810
- const reconstructedKeyHex = `0x${bytesToHex36(reconstructedKey)}`;
18820
+ const reconstructedKeyHex = `0x${bytesToHex37(reconstructedKey)}`;
18811
18821
  const results = {};
18812
18822
  for (const [choice, commitmentPoint] of Object.entries(tally.tallies)) {
18813
18823
  const encBlinding = tally.encryptedBlindings[choice];
@@ -18828,7 +18838,7 @@ var PrivateVoting = class {
18828
18838
  const ciphertextBytes = hexToBytes24(encBlinding.ciphertext.slice(2));
18829
18839
  const cipher = xchacha20poly13054(derivedKey, nonceBytes);
18830
18840
  const blindingBytes = cipher.decrypt(ciphertextBytes);
18831
- blindingFactor = `0x${bytesToHex36(blindingBytes)}`;
18841
+ blindingFactor = `0x${bytesToHex37(blindingBytes)}`;
18832
18842
  } catch (e) {
18833
18843
  throw new CryptoError(
18834
18844
  "failed to decrypt blinding factor",
@@ -19049,8 +19059,9 @@ function createPrivateVoting() {
19049
19059
 
19050
19060
  // src/nft/private-nft.ts
19051
19061
  import { sha256 as sha25622 } from "@noble/hashes/sha256";
19062
+ import { ed25519 as ed255192 } from "@noble/curves/ed25519";
19052
19063
  import { secp256k1 as secp256k16 } from "@noble/curves/secp256k1";
19053
- import { bytesToHex as bytesToHex37, hexToBytes as hexToBytes25 } from "@noble/hashes/utils";
19064
+ import { bytesToHex as bytesToHex38, hexToBytes as hexToBytes25 } from "@noble/hashes/utils";
19054
19065
  var PrivateNFT = class {
19055
19066
  /**
19056
19067
  * Create a private ownership record for an NFT
@@ -19141,9 +19152,9 @@ var PrivateNFT = class {
19141
19152
  const signature = secp256k16.sign(messageHash, privateKeyBytes);
19142
19153
  const zkProof = {
19143
19154
  type: "ownership",
19144
- proof: `0x${bytesToHex37(signature.toCompactRawBytes())}`,
19155
+ proof: `0x${bytesToHex38(signature.toCompactRawBytes())}`,
19145
19156
  publicInputs: [
19146
- `0x${bytesToHex37(messageHash)}`
19157
+ `0x${bytesToHex38(messageHash)}`
19147
19158
  ]
19148
19159
  };
19149
19160
  const stealthHashBytes = sha25622(hexToBytes25(ownership.ownerStealth.address.slice(2)));
@@ -19152,7 +19163,7 @@ var PrivateNFT = class {
19152
19163
  tokenId: ownership.tokenId,
19153
19164
  challenge,
19154
19165
  proof: zkProof,
19155
- stealthHash: `0x${bytesToHex37(stealthHashBytes)}`,
19166
+ stealthHash: `0x${bytesToHex38(stealthHashBytes)}`,
19156
19167
  timestamp: Date.now()
19157
19168
  };
19158
19169
  } catch (e) {
@@ -19298,7 +19309,7 @@ var PrivateNFT = class {
19298
19309
  nftContract: nft.nftContract,
19299
19310
  tokenId: nft.tokenId,
19300
19311
  newOwnerStealth,
19301
- previousOwnerHash: `0x${bytesToHex37(previousOwnerHashBytes)}`,
19312
+ previousOwnerHash: `0x${bytesToHex38(previousOwnerHashBytes)}`,
19302
19313
  chain: nft.chain,
19303
19314
  timestamp: Date.now()
19304
19315
  };
@@ -19365,8 +19376,9 @@ var PrivateNFT = class {
19365
19376
  );
19366
19377
  }
19367
19378
  const ownedNFTs = [];
19368
- const scanKeyHex = `0x${bytesToHex37(scanKey)}`;
19369
- const viewingKeyHex = `0x${bytesToHex37(viewingKey)}`;
19379
+ const viewingKeyHex = `0x${bytesToHex38(viewingKey)}`;
19380
+ const ed25519SpendingPubHex = `0x${bytesToHex38(ed255192.getPublicKey(scanKey))}`;
19381
+ const secp256k1SpendingPubHex = `0x${bytesToHex38(secp256k16.getPublicKey(scanKey, true))}`;
19370
19382
  for (const transfer of transfers) {
19371
19383
  try {
19372
19384
  if (!transfer || typeof transfer !== "object") {
@@ -19379,14 +19391,14 @@ var PrivateNFT = class {
19379
19391
  if (isEd25519Chain(transfer.chain)) {
19380
19392
  isOwned = checkEd25519StealthAddress(
19381
19393
  transfer.newOwnerStealth,
19382
- scanKeyHex,
19383
- viewingKeyHex
19394
+ viewingKeyHex,
19395
+ ed25519SpendingPubHex
19384
19396
  );
19385
19397
  } else {
19386
19398
  isOwned = checkStealthAddress(
19387
19399
  transfer.newOwnerStealth,
19388
- scanKeyHex,
19389
- viewingKeyHex
19400
+ viewingKeyHex,
19401
+ secp256k1SpendingPubHex
19390
19402
  );
19391
19403
  }
19392
19404
  if (isOwned) {
@@ -20804,7 +20816,7 @@ function createMockSolanaAdapter(config = {}) {
20804
20816
 
20805
20817
  // src/wallet/solana/privacy-adapter.ts
20806
20818
  import { sha256 as sha25623 } from "@noble/hashes/sha2";
20807
- import { ed25519 as ed255192 } from "@noble/curves/ed25519";
20819
+ import { ed25519 as ed255193 } from "@noble/curves/ed25519";
20808
20820
  var ED25519_ORDER = BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed");
20809
20821
 
20810
20822
  // src/wallet/ethereum/adapter.ts
@@ -21381,7 +21393,7 @@ function createEthereumAdapter(config) {
21381
21393
  // src/wallet/ethereum/privacy-adapter.ts
21382
21394
  import { sha256 as sha25625 } from "@noble/hashes/sha2";
21383
21395
  import { secp256k1 as secp256k18 } from "@noble/curves/secp256k1";
21384
- import { keccak_256 } from "@noble/hashes/sha3";
21396
+ import { keccak_256 as keccak_2562 } from "@noble/hashes/sha3";
21385
21397
 
21386
21398
  // src/chains/ethereum/stealth.ts
21387
21399
  import { secp256k1 as secp256k17 } from "@noble/curves/secp256k1";
@@ -21902,9 +21914,9 @@ import { WalletErrorCode as WalletErrorCode14 } from "@sip-protocol/types";
21902
21914
  import { WalletErrorCode as WalletErrorCode15 } from "@sip-protocol/types";
21903
21915
 
21904
21916
  // src/wallet/near/adapter.ts
21905
- import { ed25519 as ed255193 } from "@noble/curves/ed25519";
21917
+ import { ed25519 as ed255194 } from "@noble/curves/ed25519";
21906
21918
  import { sha256 as sha25626 } from "@noble/hashes/sha2";
21907
- import { bytesToHex as bytesToHex39, hexToBytes as hexToBytes27 } from "@noble/hashes/utils";
21919
+ import { bytesToHex as bytesToHex40, hexToBytes as hexToBytes27 } from "@noble/hashes/utils";
21908
21920
  import { WalletErrorCode as WalletErrorCode16 } from "@sip-protocol/types";
21909
21921
 
21910
21922
  // src/chains/near/constants.ts
@@ -22020,11 +22032,11 @@ function deriveNEARStealthPrivateKey(stealthAddress, spendingPrivateKey, viewing
22020
22032
  viewingPrivateKey
22021
22033
  );
22022
22034
  }
22023
- function checkNEARStealthAddress(stealthAddress, spendingPrivateKey, viewingPrivateKey) {
22035
+ function checkNEARStealthAddress(stealthAddress, viewingPrivateKey, spendingPublicKey) {
22024
22036
  return checkEd25519StealthAddress(
22025
22037
  stealthAddress,
22026
- spendingPrivateKey,
22027
- viewingPrivateKey
22038
+ viewingPrivateKey,
22039
+ spendingPublicKey
22028
22040
  );
22029
22041
  }
22030
22042
  function ed25519PublicKeyToImplicitAccount(publicKey) {
@@ -22109,12 +22121,12 @@ var ED25519_ORDER2 = 2n ** 252n + 27742317777372353535851937790883648493n;
22109
22121
 
22110
22122
  // src/wallet/near/wallet-selector.ts
22111
22123
  import { sha256 as sha25627 } from "@noble/hashes/sha2";
22112
- import { bytesToHex as bytesToHex41, hexToBytes as hexToBytes29 } from "@noble/hashes/utils";
22113
- import { ed25519 as ed255195 } from "@noble/curves/ed25519";
22124
+ import { bytesToHex as bytesToHex42, hexToBytes as hexToBytes29 } from "@noble/hashes/utils";
22125
+ import { ed25519 as ed255196 } from "@noble/curves/ed25519";
22114
22126
 
22115
22127
  // src/chains/near/implicit-account.ts
22116
- import { ed25519 as ed255194 } from "@noble/curves/ed25519";
22117
- import { bytesToHex as bytesToHex40, hexToBytes as hexToBytes28 } from "@noble/hashes/utils";
22128
+ import { ed25519 as ed255195 } from "@noble/curves/ed25519";
22129
+ import { bytesToHex as bytesToHex41, hexToBytes as hexToBytes28 } from "@noble/hashes/utils";
22118
22130
 
22119
22131
  // src/chains/near/types.ts
22120
22132
  function parseAnnouncement(memo) {
@@ -22153,13 +22165,13 @@ function createAnnouncementMemo(ephemeralPublicKey, viewTag) {
22153
22165
 
22154
22166
  // src/wallet/near/my-near-wallet.ts
22155
22167
  import { sha256 as sha25628 } from "@noble/hashes/sha2";
22156
- import { bytesToHex as bytesToHex42 } from "@noble/hashes/utils";
22157
- import { ed25519 as ed255196 } from "@noble/curves/ed25519";
22168
+ import { bytesToHex as bytesToHex43 } from "@noble/hashes/utils";
22169
+ import { ed25519 as ed255197 } from "@noble/curves/ed25519";
22158
22170
 
22159
22171
  // src/wallet/near/meteor-wallet.ts
22160
22172
  import { sha256 as sha25629 } from "@noble/hashes/sha2";
22161
- import { bytesToHex as bytesToHex43 } from "@noble/hashes/utils";
22162
- import { ed25519 as ed255197 } from "@noble/curves/ed25519";
22173
+ import { bytesToHex as bytesToHex44 } from "@noble/hashes/utils";
22174
+ import { ed25519 as ed255198 } from "@noble/curves/ed25519";
22163
22175
 
22164
22176
  // src/wallet/hardware/types.ts
22165
22177
  var DerivationPath = {
@@ -22440,7 +22452,7 @@ var LedgerWalletAdapter = class extends BaseWalletAdapter {
22440
22452
  */
22441
22453
  async loadTransport() {
22442
22454
  try {
22443
- const module = await import("./TransportWebUSB-YQMAGJAJ.mjs");
22455
+ const module = await import("./TransportWebUSB-2KITI5HD.mjs");
22444
22456
  return module.default;
22445
22457
  } catch {
22446
22458
  throw new HardwareWalletError(
@@ -22771,7 +22783,7 @@ function createLedgerAdapter(config) {
22771
22783
  // src/wallet/hardware/ledger-privacy.ts
22772
22784
  import { secp256k1 as secp256k19 } from "@noble/curves/secp256k1";
22773
22785
  import { sha256 as sha25630 } from "@noble/hashes/sha256";
22774
- import { bytesToHex as bytesToHex44, hexToBytes as hexToBytes30 } from "@noble/hashes/utils";
22786
+ import { bytesToHex as bytesToHex45, hexToBytes as hexToBytes30 } from "@noble/hashes/utils";
22775
22787
  import { WalletErrorCode as WalletErrorCode18 } from "@sip-protocol/types";
22776
22788
 
22777
22789
  // src/wallet/hardware/trezor.ts
@@ -23214,7 +23226,7 @@ function createTrezorAdapter(config) {
23214
23226
 
23215
23227
  // src/wallet/hardware/mock.ts
23216
23228
  import { WalletErrorCode as WalletErrorCode20 } from "@sip-protocol/types";
23217
- import { bytesToHex as bytesToHex45, randomBytes as randomBytes18 } from "@noble/hashes/utils";
23229
+ import { bytesToHex as bytesToHex46, randomBytes as randomBytes18 } from "@noble/hashes/utils";
23218
23230
  var MockLedgerAdapter = class extends BaseWalletAdapter {
23219
23231
  chain;
23220
23232
  name = "mock-ledger";
@@ -23461,13 +23473,13 @@ var MockLedgerAdapter = class extends BaseWalletAdapter {
23461
23473
  generateMockAddress(index) {
23462
23474
  const bytes = randomBytes18(20);
23463
23475
  bytes[0] = index;
23464
- return `0x${bytesToHex45(bytes)}`;
23476
+ return `0x${bytesToHex46(bytes)}`;
23465
23477
  }
23466
23478
  generateMockPublicKey(index) {
23467
23479
  const bytes = randomBytes18(33);
23468
23480
  bytes[0] = 2;
23469
23481
  bytes[1] = index;
23470
- return `0x${bytesToHex45(bytes)}`;
23482
+ return `0x${bytesToHex46(bytes)}`;
23471
23483
  }
23472
23484
  generateMockSignature(data) {
23473
23485
  const sig = new Uint8Array(65);
@@ -23476,7 +23488,7 @@ var MockLedgerAdapter = class extends BaseWalletAdapter {
23476
23488
  sig[32 + i] = (data[i % data.length] ?? 0) ^ i * 11;
23477
23489
  }
23478
23490
  sig[64] = 27;
23479
- return `0x${bytesToHex45(sig)}`;
23491
+ return `0x${bytesToHex46(sig)}`;
23480
23492
  }
23481
23493
  delay(ms) {
23482
23494
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -23667,13 +23679,13 @@ var MockTrezorAdapter = class extends BaseWalletAdapter {
23667
23679
  generateMockAddress(index) {
23668
23680
  const bytes = randomBytes18(20);
23669
23681
  bytes[0] = index + 100;
23670
- return `0x${bytesToHex45(bytes)}`;
23682
+ return `0x${bytesToHex46(bytes)}`;
23671
23683
  }
23672
23684
  generateMockPublicKey(index) {
23673
23685
  const bytes = randomBytes18(33);
23674
23686
  bytes[0] = 3;
23675
23687
  bytes[1] = index + 100;
23676
- return `0x${bytesToHex45(bytes)}`;
23688
+ return `0x${bytesToHex46(bytes)}`;
23677
23689
  }
23678
23690
  generateMockSignature(data) {
23679
23691
  const sig = new Uint8Array(65);
@@ -23682,7 +23694,7 @@ var MockTrezorAdapter = class extends BaseWalletAdapter {
23682
23694
  sig[32 + i] = (data[i % data.length] ?? 0) ^ i * 17;
23683
23695
  }
23684
23696
  sig[64] = 28;
23685
- return `0x${bytesToHex45(sig)}`;
23697
+ return `0x${bytesToHex46(sig)}`;
23686
23698
  }
23687
23699
  delay(ms) {
23688
23700
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -24307,8 +24319,8 @@ var SolanaNoirVerifier = class {
24307
24319
  }
24308
24320
  async hashBytes(bytes) {
24309
24321
  const { sha256: sha25635 } = await import("@noble/hashes/sha256");
24310
- const { bytesToHex: bytesToHex56 } = await import("@noble/hashes/utils");
24311
- return bytesToHex56(sha25635(bytes));
24322
+ const { bytesToHex: bytesToHex57 } = await import("@noble/hashes/utils");
24323
+ return bytesToHex57(sha25635(bytes));
24312
24324
  }
24313
24325
  hexToBytes(hex) {
24314
24326
  const h = hex.startsWith("0x") ? hex.slice(2) : hex;
@@ -24352,7 +24364,7 @@ import {
24352
24364
  Transaction as Transaction2,
24353
24365
  SystemProgram
24354
24366
  } from "@solana/web3.js";
24355
- import { bytesToHex as bytesToHex46 } from "@noble/hashes/utils";
24367
+ import { bytesToHex as bytesToHex47 } from "@noble/hashes/utils";
24356
24368
  var JITO_BLOCK_ENGINES = {
24357
24369
  mainnet: {
24358
24370
  amsterdam: "https://amsterdam.mainnet.block-engine.jito.wtf/api/v1",
@@ -24472,7 +24484,7 @@ var JitoRelayer = class {
24472
24484
  }
24473
24485
  const signatures = bundleTransactions.map((tx) => {
24474
24486
  if (tx instanceof VersionedTransaction2) {
24475
- return bytesToHex46(tx.signatures[0]);
24487
+ return bytesToHex47(tx.signatures[0]);
24476
24488
  } else {
24477
24489
  return tx.signature?.toString() ?? "";
24478
24490
  }
@@ -24511,7 +24523,7 @@ var JitoRelayer = class {
24511
24523
  const bundleId = await this.sendBundle([serializedTx]);
24512
24524
  let signature;
24513
24525
  if (request.transaction instanceof VersionedTransaction2) {
24514
- signature = bytesToHex46(request.transaction.signatures[0]);
24526
+ signature = bytesToHex47(request.transaction.signatures[0]);
24515
24527
  } else {
24516
24528
  signature = request.transaction.signature?.toString() ?? "";
24517
24529
  }
@@ -24734,11 +24746,11 @@ function createMainnetRelayer(rpcUrl) {
24734
24746
  }
24735
24747
 
24736
24748
  // src/chains/near/commitment.ts
24737
- import { ed25519 as ed255198 } from "@noble/curves/ed25519";
24749
+ import { ed25519 as ed255199 } from "@noble/curves/ed25519";
24738
24750
  import { sha256 as sha25631 } from "@noble/hashes/sha2";
24739
- import { bytesToHex as bytesToHex47, randomBytes as randomBytes19 } from "@noble/hashes/utils";
24751
+ import { bytesToHex as bytesToHex48, randomBytes as randomBytes19 } from "@noble/hashes/utils";
24740
24752
  var H_DOMAIN = "SIP-NEAR-PEDERSEN-GENERATOR-H-v1";
24741
- var G = ed255198.ExtendedPoint.BASE;
24753
+ var G = ed255199.ExtendedPoint.BASE;
24742
24754
  var ED25519_ORDER3 = 2n ** 252n + 27742317777372353535851937790883648493n;
24743
24755
  var ED25519_COFACTOR = 8n;
24744
24756
  var MAX_NEAR_AMOUNT = 2n ** 128n - 1n;
@@ -24750,12 +24762,12 @@ function generateH() {
24750
24762
  const input = new TextEncoder().encode(`${H_DOMAIN}:${counter}`);
24751
24763
  const hashBytes = sha25631(input);
24752
24764
  try {
24753
- const rawPoint = ed255198.ExtendedPoint.fromHex(hashBytes);
24765
+ const rawPoint = ed255199.ExtendedPoint.fromHex(hashBytes);
24754
24766
  const point = rawPoint.multiply(ED25519_COFACTOR);
24755
- if (!point.equals(ed255198.ExtendedPoint.ZERO)) {
24767
+ if (!point.equals(ed255199.ExtendedPoint.ZERO)) {
24756
24768
  const gBytes = G.toRawBytes();
24757
24769
  const hBytes = point.toRawBytes();
24758
- if (bytesToHex47(gBytes) !== bytesToHex47(hBytes)) {
24770
+ if (bytesToHex48(gBytes) !== bytesToHex48(hBytes)) {
24759
24771
  return point;
24760
24772
  }
24761
24773
  }
@@ -24824,14 +24836,14 @@ function commitNEAR(value, blinding) {
24824
24836
  }
24825
24837
  const rScalarBytes = bigIntToBytes(rScalar, 32);
24826
24838
  return {
24827
- commitment: `0x${bytesToHex47(C.toRawBytes())}`,
24828
- blinding: `0x${bytesToHex47(rScalarBytes)}`
24839
+ commitment: `0x${bytesToHex48(C.toRawBytes())}`,
24840
+ blinding: `0x${bytesToHex48(rScalarBytes)}`
24829
24841
  };
24830
24842
  }
24831
24843
  function verifyOpeningNEAR(commitment, value, blinding) {
24832
24844
  try {
24833
24845
  const commitmentBytes = hexToBytes31(commitment.slice(2));
24834
- const C = ed255198.ExtendedPoint.fromHex(commitmentBytes);
24846
+ const C = ed255199.ExtendedPoint.fromHex(commitmentBytes);
24835
24847
  const blindingBytes = hexToBytes31(blinding.slice(2));
24836
24848
  const rScalar = bytesToBigInt(blindingBytes) % ED25519_ORDER3;
24837
24849
  let expected;
@@ -24907,18 +24919,18 @@ function addCommitmentsNEAR(c1, c2) {
24907
24919
  let point1;
24908
24920
  let point2;
24909
24921
  try {
24910
- point1 = ed255198.ExtendedPoint.fromHex(hexToBytes31(c1.slice(2)));
24922
+ point1 = ed255199.ExtendedPoint.fromHex(hexToBytes31(c1.slice(2)));
24911
24923
  } catch {
24912
24924
  throw new ValidationError("must be a valid ed25519 point", "c1");
24913
24925
  }
24914
24926
  try {
24915
- point2 = ed255198.ExtendedPoint.fromHex(hexToBytes31(c2.slice(2)));
24927
+ point2 = ed255199.ExtendedPoint.fromHex(hexToBytes31(c2.slice(2)));
24916
24928
  } catch {
24917
24929
  throw new ValidationError("must be a valid ed25519 point", "c2");
24918
24930
  }
24919
24931
  const sum = point1.add(point2);
24920
24932
  return {
24921
- commitment: `0x${bytesToHex47(sum.toRawBytes())}`
24933
+ commitment: `0x${bytesToHex48(sum.toRawBytes())}`
24922
24934
  };
24923
24935
  }
24924
24936
  function subtractCommitmentsNEAR(c1, c2) {
@@ -24931,23 +24943,23 @@ function subtractCommitmentsNEAR(c1, c2) {
24931
24943
  let point1;
24932
24944
  let point2;
24933
24945
  try {
24934
- point1 = ed255198.ExtendedPoint.fromHex(hexToBytes31(c1.slice(2)));
24946
+ point1 = ed255199.ExtendedPoint.fromHex(hexToBytes31(c1.slice(2)));
24935
24947
  } catch {
24936
24948
  throw new ValidationError("must be a valid ed25519 point", "c1");
24937
24949
  }
24938
24950
  try {
24939
- point2 = ed255198.ExtendedPoint.fromHex(hexToBytes31(c2.slice(2)));
24951
+ point2 = ed255199.ExtendedPoint.fromHex(hexToBytes31(c2.slice(2)));
24940
24952
  } catch {
24941
24953
  throw new ValidationError("must be a valid ed25519 point", "c2");
24942
24954
  }
24943
24955
  const diff = point1.subtract(point2);
24944
- if (diff.equals(ed255198.ExtendedPoint.ZERO)) {
24956
+ if (diff.equals(ed255199.ExtendedPoint.ZERO)) {
24945
24957
  return {
24946
24958
  commitment: "0x" + "00".repeat(32)
24947
24959
  };
24948
24960
  }
24949
24961
  return {
24950
- commitment: `0x${bytesToHex47(diff.toRawBytes())}`
24962
+ commitment: `0x${bytesToHex48(diff.toRawBytes())}`
24951
24963
  };
24952
24964
  }
24953
24965
  function addBlindingsNEAR(b1, b2) {
@@ -24963,7 +24975,7 @@ function addBlindingsNEAR(b1, b2) {
24963
24975
  const b2Scalar = bytesToBigInt(b2Bytes);
24964
24976
  const sum = (b1Scalar + b2Scalar) % ED25519_ORDER3;
24965
24977
  const sumBytes = bigIntToBytes(sum, 32);
24966
- return `0x${bytesToHex47(sumBytes)}`;
24978
+ return `0x${bytesToHex48(sumBytes)}`;
24967
24979
  }
24968
24980
  function subtractBlindingsNEAR(b1, b2) {
24969
24981
  if (!isValidHex(b1)) {
@@ -24978,12 +24990,12 @@ function subtractBlindingsNEAR(b1, b2) {
24978
24990
  const b2Scalar = bytesToBigInt(b2Bytes);
24979
24991
  const diff = (b1Scalar - b2Scalar + ED25519_ORDER3) % ED25519_ORDER3;
24980
24992
  const diffBytes = bigIntToBytes(diff, 32);
24981
- return `0x${bytesToHex47(diffBytes)}`;
24993
+ return `0x${bytesToHex48(diffBytes)}`;
24982
24994
  }
24983
24995
  function getGeneratorsNEAR() {
24984
24996
  return {
24985
- G: `0x${bytesToHex47(G.toRawBytes())}`,
24986
- H: `0x${bytesToHex47(H.toRawBytes())}`
24997
+ G: `0x${bytesToHex48(G.toRawBytes())}`,
24998
+ H: `0x${bytesToHex48(H.toRawBytes())}`
24987
24999
  };
24988
25000
  }
24989
25001
  function generateBlindingNEAR() {
@@ -24993,15 +25005,15 @@ function generateBlindingNEAR() {
24993
25005
  return generateBlindingNEAR();
24994
25006
  }
24995
25007
  const scalarBytes = bigIntToBytes(scalar, 32);
24996
- return `0x${bytesToHex47(scalarBytes)}`;
25008
+ return `0x${bytesToHex48(scalarBytes)}`;
24997
25009
  }
24998
25010
 
24999
25011
  // src/chains/near/viewing-key.ts
25000
- import { ed25519 as ed255199 } from "@noble/curves/ed25519";
25012
+ import { ed25519 as ed2551910 } from "@noble/curves/ed25519";
25001
25013
  import { sha256 as sha25632 } from "@noble/hashes/sha256";
25002
25014
  import { hmac as hmac4 } from "@noble/hashes/hmac";
25003
25015
  import { hkdf as hkdf4 } from "@noble/hashes/hkdf";
25004
- import { bytesToHex as bytesToHex48, hexToBytes as hexToBytes32, randomBytes as randomBytes20, utf8ToBytes as utf8ToBytes7 } from "@noble/hashes/utils";
25016
+ import { bytesToHex as bytesToHex49, hexToBytes as hexToBytes32, randomBytes as randomBytes20, utf8ToBytes as utf8ToBytes7 } from "@noble/hashes/utils";
25005
25017
  import { xchacha20poly1305 as xchacha20poly13055 } from "@noble/ciphers/chacha.js";
25006
25018
  var VIEWING_KEY_CONTEXT = "SIP-NEAR-viewing-key-v1";
25007
25019
  var ENCRYPTION_DOMAIN2 = "SIP-NEAR-VIEWING-KEY-ENCRYPTION-V1";
@@ -25028,12 +25040,12 @@ function generateNEARViewingKeyFromSpending(spendingPrivateKey, label) {
25028
25040
  utf8ToBytes7(VIEWING_KEY_CONTEXT),
25029
25041
  spendingBytes
25030
25042
  );
25031
- const viewingPublicBytes = ed255199.getPublicKey(viewingPrivateBytes);
25043
+ const viewingPublicBytes = ed2551910.getPublicKey(viewingPrivateBytes);
25032
25044
  const hashBytes = sha25632(viewingPublicBytes);
25033
25045
  return {
25034
- privateKey: `0x${bytesToHex48(viewingPrivateBytes)}`,
25035
- publicKey: `0x${bytesToHex48(viewingPublicBytes)}`,
25036
- hash: `0x${bytesToHex48(hashBytes)}`,
25046
+ privateKey: `0x${bytesToHex49(viewingPrivateBytes)}`,
25047
+ publicKey: `0x${bytesToHex49(viewingPublicBytes)}`,
25048
+ hash: `0x${bytesToHex49(hashBytes)}`,
25037
25049
  label,
25038
25050
  createdAt: Date.now()
25039
25051
  };
@@ -25045,12 +25057,12 @@ function generateNEARViewingKeyFromSpending(spendingPrivateKey, label) {
25045
25057
  function generateRandomNEARViewingKey(label) {
25046
25058
  const privateBytes = randomBytes20(32);
25047
25059
  try {
25048
- const publicBytes = ed255199.getPublicKey(privateBytes);
25060
+ const publicBytes = ed2551910.getPublicKey(privateBytes);
25049
25061
  const hashBytes = sha25632(publicBytes);
25050
25062
  return {
25051
- privateKey: `0x${bytesToHex48(privateBytes)}`,
25052
- publicKey: `0x${bytesToHex48(publicBytes)}`,
25053
- hash: `0x${bytesToHex48(hashBytes)}`,
25063
+ privateKey: `0x${bytesToHex49(privateBytes)}`,
25064
+ publicKey: `0x${bytesToHex49(publicBytes)}`,
25065
+ hash: `0x${bytesToHex49(hashBytes)}`,
25054
25066
  label,
25055
25067
  createdAt: Date.now()
25056
25068
  };
@@ -25073,7 +25085,7 @@ function computeNEARViewingKeyHash(viewingPublicKey) {
25073
25085
  );
25074
25086
  }
25075
25087
  const hashBytes = sha25632(publicBytes);
25076
- return `0x${bytesToHex48(hashBytes)}`;
25088
+ return `0x${bytesToHex49(hashBytes)}`;
25077
25089
  }
25078
25090
  function computeNEARViewingKeyHashFromPrivate(viewingPrivateKey) {
25079
25091
  if (!viewingPrivateKey || !viewingPrivateKey.startsWith("0x")) {
@@ -25090,9 +25102,9 @@ function computeNEARViewingKeyHashFromPrivate(viewingPrivateKey) {
25090
25102
  );
25091
25103
  }
25092
25104
  try {
25093
- const publicBytes = ed255199.getPublicKey(privateBytes);
25105
+ const publicBytes = ed2551910.getPublicKey(privateBytes);
25094
25106
  const hashBytes = sha25632(publicBytes);
25095
- return `0x${bytesToHex48(hashBytes)}`;
25107
+ return `0x${bytesToHex49(hashBytes)}`;
25096
25108
  } finally {
25097
25109
  secureWipe(privateBytes);
25098
25110
  }
@@ -25141,7 +25153,7 @@ function importNEARViewingKey(exported) {
25141
25153
  }
25142
25154
  const privateBytes = hexToBytes32(exported.privateKey.slice(2));
25143
25155
  try {
25144
- const derivedPublic = `0x${bytesToHex48(ed255199.getPublicKey(privateBytes))}`;
25156
+ const derivedPublic = `0x${bytesToHex49(ed2551910.getPublicKey(privateBytes))}`;
25145
25157
  if (derivedPublic !== exported.publicKey) {
25146
25158
  throw new ValidationError(
25147
25159
  "Public key does not match private key",
@@ -25176,8 +25188,8 @@ function encryptForNEARViewing(data, viewingKey) {
25176
25188
  const cipher = xchacha20poly13055(encKey, nonce);
25177
25189
  const ciphertext = cipher.encrypt(plaintext);
25178
25190
  return {
25179
- ciphertext: `0x${bytesToHex48(ciphertext)}`,
25180
- nonce: `0x${bytesToHex48(nonce)}`,
25191
+ ciphertext: `0x${bytesToHex49(ciphertext)}`,
25192
+ nonce: `0x${bytesToHex49(nonce)}`,
25181
25193
  viewingKeyHash: viewingKey.hash
25182
25194
  };
25183
25195
  } finally {
@@ -25248,12 +25260,12 @@ function deriveNEARChildViewingKey(parentKey, childPath, label) {
25248
25260
  const parentBytes = hexToBytes32(parentKey.privateKey.slice(2));
25249
25261
  try {
25250
25262
  const childBytes = hmac4(sha25632, utf8ToBytes7(childPath), parentBytes);
25251
- const publicBytes = ed255199.getPublicKey(childBytes);
25263
+ const publicBytes = ed2551910.getPublicKey(childBytes);
25252
25264
  const hashBytes = sha25632(publicBytes);
25253
25265
  const result = {
25254
- privateKey: `0x${bytesToHex48(childBytes)}`,
25255
- publicKey: `0x${bytesToHex48(publicBytes)}`,
25256
- hash: `0x${bytesToHex48(hashBytes)}`,
25266
+ privateKey: `0x${bytesToHex49(childBytes)}`,
25267
+ publicKey: `0x${bytesToHex49(publicBytes)}`,
25268
+ hash: `0x${bytesToHex49(hashBytes)}`,
25257
25269
  label: label ?? `${parentKey.label ?? "Key"}/${childPath}`,
25258
25270
  createdAt: Date.now()
25259
25271
  };
@@ -25278,8 +25290,8 @@ function getNEARViewingPublicKey(viewingPrivateKey) {
25278
25290
  );
25279
25291
  }
25280
25292
  try {
25281
- const publicBytes = ed255199.getPublicKey(privateBytes);
25282
- return `0x${bytesToHex48(publicBytes)}`;
25293
+ const publicBytes = ed2551910.getPublicKey(privateBytes);
25294
+ return `0x${bytesToHex49(publicBytes)}`;
25283
25295
  } finally {
25284
25296
  secureWipe(privateBytes);
25285
25297
  }
@@ -25316,7 +25328,7 @@ function validateNEARViewingKey(viewingKey) {
25316
25328
  }
25317
25329
  const privateBytes = hexToBytes32(viewingKey.privateKey.slice(2));
25318
25330
  try {
25319
- const derivedPublic = `0x${bytesToHex48(ed255199.getPublicKey(privateBytes))}`;
25331
+ const derivedPublic = `0x${bytesToHex49(ed2551910.getPublicKey(privateBytes))}`;
25320
25332
  if (derivedPublic !== viewingKey.publicKey) {
25321
25333
  throw new ValidationError(
25322
25334
  "publicKey does not match privateKey",
@@ -25330,7 +25342,11 @@ function validateNEARViewingKey(viewingKey) {
25330
25342
  }
25331
25343
 
25332
25344
  // src/chains/near/resolver.ts
25333
- import { bytesToHex as bytesToHex49, hexToBytes as hexToBytes33 } from "@noble/hashes/utils";
25345
+ import { ed25519 as ed2551911 } from "@noble/curves/ed25519";
25346
+ import { bytesToHex as bytesToHex50, hexToBytes as hexToBytes33 } from "@noble/hashes/utils";
25347
+ function nearSpendingPublicFromPrivate(spendingPrivateKey) {
25348
+ return `0x${bytesToHex50(ed2551911.getPublicKey(hexToBytes33(spendingPrivateKey.slice(2))))}`;
25349
+ }
25334
25350
  function createNEARAnnouncementCache() {
25335
25351
  const entries = [];
25336
25352
  return {
@@ -25576,11 +25592,11 @@ var NEARStealthScanner = class {
25576
25592
  try {
25577
25593
  const isMatch = checkNEARStealthAddress(
25578
25594
  stealthAddressToCheck,
25579
- recipient.spendingPrivateKey,
25580
- recipient.viewingPrivateKey
25595
+ recipient.viewingPrivateKey,
25596
+ nearSpendingPublicFromPrivate(recipient.spendingPrivateKey)
25581
25597
  );
25582
25598
  if (isMatch) {
25583
- const stealthAddress = isImplicitAccount(announcement.stealthAddress) ? announcement.stealthAddress : bytesToHex49(hexToBytes33(stealthPublicKey.slice(2)));
25599
+ const stealthAddress = isImplicitAccount(announcement.stealthAddress) ? announcement.stealthAddress : bytesToHex50(hexToBytes33(stealthPublicKey.slice(2)));
25584
25600
  let amount = metadata?.amount ?? 0n;
25585
25601
  if (amount === 0n && isImplicitAccount(stealthAddress)) {
25586
25602
  try {
@@ -25662,8 +25678,8 @@ var NEARStealthScanner = class {
25662
25678
  try {
25663
25679
  return checkNEARStealthAddress(
25664
25680
  stealthAddressToCheck,
25665
- spendingPrivateKey,
25666
- viewingPrivateKey
25681
+ viewingPrivateKey,
25682
+ nearSpendingPublicFromPrivate(spendingPrivateKey)
25667
25683
  );
25668
25684
  } catch {
25669
25685
  return false;
@@ -25703,8 +25719,8 @@ var NEARStealthScanner = class {
25703
25719
  try {
25704
25720
  const isMatch = checkNEARStealthAddress(
25705
25721
  stealthAddressToCheck,
25706
- recipient.spendingPrivateKey,
25707
- recipient.viewingPrivateKey
25722
+ recipient.viewingPrivateKey,
25723
+ nearSpendingPublicFromPrivate(recipient.spendingPrivateKey)
25708
25724
  );
25709
25725
  if (isMatch) {
25710
25726
  matches.set(announcement.stealthAddress, recipient.label);
@@ -27940,7 +27956,7 @@ function createPrivacyLogger(moduleName, config = {}) {
27940
27956
  }
27941
27957
 
27942
27958
  // src/privacy-backends/privacycash.ts
27943
- import { randomBytes as randomBytes21, bytesToHex as bytesToHex50 } from "@noble/hashes/utils";
27959
+ import { randomBytes as randomBytes21, bytesToHex as bytesToHex51 } from "@noble/hashes/utils";
27944
27960
  var privacyCashLogger = createPrivacyLogger("PrivacyCash");
27945
27961
  var DEFAULT_ANONYMITY_SET = 50;
27946
27962
  var BASE_COST_LAMPORTS = BigInt(1e7);
@@ -27976,7 +27992,7 @@ import {
27976
27992
  InvalidAmountError,
27977
27993
  InvalidAddressError
27978
27994
  } from "@radr/shadowwire";
27979
- import { bytesToHex as bytesToHex51 } from "@noble/hashes/utils";
27995
+ import { bytesToHex as bytesToHex52 } from "@noble/hashes/utils";
27980
27996
  var SHADOWWIRE_TOKEN_MINTS = {
27981
27997
  SOL: "So11111111111111111111111111111111111111112",
27982
27998
  USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
@@ -28006,8 +28022,14 @@ var SHADOWWIRE_TOKEN_MINTS = {
28006
28022
  // Placeholder - USD1 stablecoin
28007
28023
  AOL: "AOLexampleaddress11111111111111111111111111",
28008
28024
  // Placeholder
28009
- IQLABS: "IQLABSexampleaddress111111111111111111111"
28025
+ IQLABS: "IQLABSexampleaddress111111111111111111111",
28010
28026
  // Placeholder - IQ Labs token
28027
+ // Added in @radr/shadowwire@1.1.15 — real mints verified against the package's TOKEN_MINTS
28028
+ SANA: "5dpN5wMH8j8au29Rp91qn4WfNq6t6xJfcjQNcFeDJ8Ct",
28029
+ POKI: "6vK6cL9C66Bsqw7SC2hcCdkgm1UKBDUE6DCYJ4kubonk",
28030
+ RAIN: "3iC63FgnB7EhcPaiSaC51UkVweeBDkqu17SaRyy2pump",
28031
+ HOSICO: "Dx2bQe2UPv4k3BmcW8G2KhaL5oKsxduM5XxLSV3Sbonk",
28032
+ SKR: "SKRbvo6Gf7GondiT3BbTfuRDPqLWei4j2Qy2NPGZhW3"
28011
28033
  };
28012
28034
  var MINT_TO_SYMBOL = Object.fromEntries(
28013
28035
  Object.entries(SHADOWWIRE_TOKEN_MINTS).map(([symbol, mint]) => [mint, symbol])
@@ -28040,7 +28062,7 @@ import {
28040
28062
  PublicKey as PublicKey4,
28041
28063
  Transaction as Transaction3
28042
28064
  } from "@solana/web3.js";
28043
- import { bytesToHex as bytesToHex52 } from "@noble/hashes/utils";
28065
+ import { bytesToHex as bytesToHex53 } from "@noble/hashes/utils";
28044
28066
  var magicBlockLogger = createPrivacyLogger("MagicBlock");
28045
28067
 
28046
28068
  // src/privacy-backends/cspl-types.ts
@@ -28729,7 +28751,7 @@ var CSPLClient = class {
28729
28751
 
28730
28752
  // src/privacy-backends/private-swap.ts
28731
28753
  import { sha256 as sha25633 } from "@noble/hashes/sha256";
28732
- import { bytesToHex as bytesToHex53 } from "@noble/hashes/utils";
28754
+ import { bytesToHex as bytesToHex54 } from "@noble/hashes/utils";
28733
28755
 
28734
28756
  // src/privacy-backends/cspl-token.ts
28735
28757
  var CSPLTokenService = class {
@@ -31434,7 +31456,7 @@ function createProductionConfig(defaults) {
31434
31456
  // src/sync/oblivious.ts
31435
31457
  import { sha256 as sha25634 } from "@noble/hashes/sha2";
31436
31458
  import { hmac as hmac5 } from "@noble/hashes/hmac";
31437
- import { bytesToHex as bytesToHex54, hexToBytes as hexToBytes34, randomBytes as randomBytes22, utf8ToBytes as utf8ToBytes8 } from "@noble/hashes/utils";
31459
+ import { bytesToHex as bytesToHex55, hexToBytes as hexToBytes34, randomBytes as randomBytes22, utf8ToBytes as utf8ToBytes8 } from "@noble/hashes/utils";
31438
31460
  var DEFAULT_SYNC_CONFIG = {
31439
31461
  maxBatchSize: 1e3,
31440
31462
  timeoutMs: 3e4,
@@ -31474,7 +31496,7 @@ function deriveObliviousNullifier(noteCommitment, spendingKey, syncRandomness) {
31474
31496
  message.set(syncRandomness.value, domain.length + commitmentBytes.length);
31475
31497
  const nullifierBytes = hmac5(sha25634, keyBytes, message);
31476
31498
  return {
31477
- nullifier: `0x${bytesToHex54(nullifierBytes)}`,
31499
+ nullifier: `0x${bytesToHex55(nullifierBytes)}`,
31478
31500
  epoch: syncRandomness.epoch,
31479
31501
  chainId: "default"
31480
31502
  // Will be set by caller
@@ -31492,7 +31514,7 @@ function deriveTraditionalNullifier(noteCommitment, spendingKey) {
31492
31514
  );
31493
31515
  try {
31494
31516
  const nullifierBytes = hmac5(sha25634, keyBytes, commitmentBytes);
31495
- return `0x${bytesToHex54(nullifierBytes)}`;
31517
+ return `0x${bytesToHex55(nullifierBytes)}`;
31496
31518
  } finally {
31497
31519
  secureWipe(keyBytes);
31498
31520
  }
@@ -31548,11 +31570,11 @@ function createTimeWindowedKey(masterViewingKey, startTime, endTime, epochDurati
31548
31570
  const keyHash = sha25634(derivedKey);
31549
31571
  secureWipe(keyBytes);
31550
31572
  return {
31551
- viewingKey: `0x${bytesToHex54(derivedKey)}`,
31573
+ viewingKey: `0x${bytesToHex55(derivedKey)}`,
31552
31574
  windowStart: startTime,
31553
31575
  windowEnd: endTime,
31554
31576
  epochs,
31555
- hash: `0x${bytesToHex54(keyHash)}`
31577
+ hash: `0x${bytesToHex55(keyHash)}`
31556
31578
  };
31557
31579
  }
31558
31580
  function isNoteInWindow(_note, _windowedKey) {
@@ -31578,7 +31600,7 @@ var ObliviousSyncError = class extends Error {
31578
31600
  };
31579
31601
 
31580
31602
  // src/sync/mock-provider.ts
31581
- import { bytesToHex as bytesToHex55, randomBytes as randomBytes23 } from "@noble/hashes/utils";
31603
+ import { bytesToHex as bytesToHex56, randomBytes as randomBytes23 } from "@noble/hashes/utils";
31582
31604
  var DEFAULT_MOCK_CONFIG = {
31583
31605
  chains: ["ethereum", "solana", "near"],
31584
31606
  latencyMs: 100,
@@ -31675,7 +31697,7 @@ var MockObliviousSyncProvider = class {
31675
31697
  merkleProofs,
31676
31698
  syncHeight: this.config.blockHeight,
31677
31699
  timestamp: Date.now(),
31678
- queryHash: `0x${bytesToHex55(randomBytes23(32))}`
31700
+ queryHash: `0x${bytesToHex56(randomBytes23(32))}`
31679
31701
  };
31680
31702
  }
31681
31703
  async getCurrentHeight(chainId) {
@@ -31756,23 +31778,23 @@ var MockObliviousSyncProvider = class {
31756
31778
  generateMockNote(blockRange) {
31757
31779
  const blockNumber = blockRange.startBlock + BigInt(Math.floor(Math.random() * Number(blockRange.endBlock - blockRange.startBlock)));
31758
31780
  return {
31759
- commitment: `0x${bytesToHex55(randomBytes23(32))}`,
31760
- encryptedData: `0x${bytesToHex55(randomBytes23(128))}`,
31781
+ commitment: `0x${bytesToHex56(randomBytes23(32))}`,
31782
+ encryptedData: `0x${bytesToHex56(randomBytes23(128))}`,
31761
31783
  blockNumber,
31762
- txHash: `0x${bytesToHex55(randomBytes23(32))}`,
31784
+ txHash: `0x${bytesToHex56(randomBytes23(32))}`,
31763
31785
  chainId: blockRange.chainId
31764
31786
  };
31765
31787
  }
31766
31788
  generateMockMerkleProof(leaf) {
31767
31789
  const siblings = [];
31768
31790
  for (let i = 0; i < 20; i++) {
31769
- siblings.push(`0x${bytesToHex55(randomBytes23(32))}`);
31791
+ siblings.push(`0x${bytesToHex56(randomBytes23(32))}`);
31770
31792
  }
31771
31793
  return {
31772
31794
  leaf,
31773
31795
  siblings,
31774
31796
  index: BigInt(Math.floor(Math.random() * 1e6)),
31775
- root: `0x${bytesToHex55(randomBytes23(32))}`
31797
+ root: `0x${bytesToHex56(randomBytes23(32))}`
31776
31798
  };
31777
31799
  }
31778
31800
  };
@@ -33421,7 +33443,7 @@ export {
33421
33443
  supportsWASMBulkMemory,
33422
33444
  checkMobileWASMCompatibility,
33423
33445
  hexToBytes7 as hexToBytes,
33424
- bytesToHex10 as bytesToHex,
33446
+ bytesToHex11 as bytesToHex,
33425
33447
  isBrowser,
33426
33448
  supportsWebWorkers,
33427
33449
  supportsSharedArrayBuffer,