@sip-protocol/sdk 0.8.1 → 0.9.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.
package/dist/browser.js CHANGED
@@ -18937,12 +18937,12 @@ async function createShieldedIntent(params, options) {
18937
18937
  "Using placeholder signatures for proof generation - NOT cryptographically valid"
18938
18938
  );
18939
18939
  } else {
18940
- const { secp256k1: secp256k112 } = await import("@noble/curves/secp256k1");
18941
- const publicKey = secp256k112.getPublicKey(effectiveSenderSecret, true);
18940
+ const { secp256k1: secp256k113 } = await import("@noble/curves/secp256k1");
18941
+ const publicKey = secp256k113.getPublicKey(effectiveSenderSecret, true);
18942
18942
  const senderAddressBytes = (0, import_sha2565.sha256)(publicKey);
18943
- const ownershipSig = secp256k112.sign(senderAddressBytes, effectiveSenderSecret);
18943
+ const ownershipSig = secp256k113.sign(senderAddressBytes, effectiveSenderSecret);
18944
18944
  effectiveOwnershipSig = ownershipSig.toCompactRawBytes();
18945
- const authSig = secp256k112.sign(intentHashBytes, effectiveSenderSecret);
18945
+ const authSig = secp256k113.sign(intentHashBytes, effectiveSenderSecret);
18946
18946
  effectiveAuthSig = authSig.toCompactRawBytes();
18947
18947
  }
18948
18948
  const fundingResult = await proofProvider.generateFundingProof({
@@ -40286,11 +40286,14 @@ function createEthereumAdapter(config) {
40286
40286
 
40287
40287
  // src/wallet/ethereum/privacy-adapter.ts
40288
40288
  var import_sha25 = require("@noble/hashes/sha2");
40289
- var import_secp256k111 = require("@noble/curves/secp256k1");
40289
+ var import_secp256k112 = require("@noble/curves/secp256k1");
40290
40290
  var import_sha33 = require("@noble/hashes/sha3");
40291
40291
 
40292
40292
  // src/chains/ethereum/stealth.ts
40293
+ var import_secp256k110 = require("@noble/curves/secp256k1");
40293
40294
  init_secp256k1();
40295
+ init_utils();
40296
+ init_validation();
40294
40297
  init_errors();
40295
40298
 
40296
40299
  // src/chains/ethereum/constants.ts
@@ -40812,7 +40815,7 @@ var import_types64 = require("@sip-protocol/types");
40812
40815
  // src/wallet/near/adapter.ts
40813
40816
  var import_ed2551912 = require("@noble/curves/ed25519");
40814
40817
  var import_sha26 = require("@noble/hashes/sha2");
40815
- var import_utils59 = require("@noble/hashes/utils");
40818
+ var import_utils60 = require("@noble/hashes/utils");
40816
40819
  var import_types66 = require("@sip-protocol/types");
40817
40820
 
40818
40821
  // src/chains/near/stealth.ts
@@ -41021,12 +41024,12 @@ var ED25519_ORDER5 = 2n ** 252n + 27742317777372353535851937790883648493n;
41021
41024
 
41022
41025
  // src/wallet/near/wallet-selector.ts
41023
41026
  var import_sha27 = require("@noble/hashes/sha2");
41024
- var import_utils61 = require("@noble/hashes/utils");
41027
+ var import_utils62 = require("@noble/hashes/utils");
41025
41028
  var import_ed2551914 = require("@noble/curves/ed25519");
41026
41029
 
41027
41030
  // src/chains/near/implicit-account.ts
41028
41031
  var import_ed2551913 = require("@noble/curves/ed25519");
41029
- var import_utils60 = require("@noble/hashes/utils");
41032
+ var import_utils61 = require("@noble/hashes/utils");
41030
41033
  init_errors();
41031
41034
  init_validation();
41032
41035
 
@@ -41067,12 +41070,12 @@ function createAnnouncementMemo2(ephemeralPublicKey, viewTag) {
41067
41070
 
41068
41071
  // src/wallet/near/my-near-wallet.ts
41069
41072
  var import_sha28 = require("@noble/hashes/sha2");
41070
- var import_utils62 = require("@noble/hashes/utils");
41073
+ var import_utils63 = require("@noble/hashes/utils");
41071
41074
  var import_ed2551915 = require("@noble/curves/ed25519");
41072
41075
 
41073
41076
  // src/wallet/near/meteor-wallet.ts
41074
41077
  var import_sha29 = require("@noble/hashes/sha2");
41075
- var import_utils63 = require("@noble/hashes/utils");
41078
+ var import_utils64 = require("@noble/hashes/utils");
41076
41079
  var import_ed2551916 = require("@noble/curves/ed25519");
41077
41080
 
41078
41081
  // src/wallet/hardware/types.ts
@@ -41683,9 +41686,9 @@ function createLedgerAdapter(config) {
41683
41686
  }
41684
41687
 
41685
41688
  // src/wallet/hardware/ledger-privacy.ts
41686
- var import_secp256k112 = require("@noble/curves/secp256k1");
41689
+ var import_secp256k113 = require("@noble/curves/secp256k1");
41687
41690
  var import_sha25628 = require("@noble/hashes/sha256");
41688
- var import_utils64 = require("@noble/hashes/utils");
41691
+ var import_utils65 = require("@noble/hashes/utils");
41689
41692
  var import_types70 = require("@sip-protocol/types");
41690
41693
 
41691
41694
  // src/wallet/hardware/trezor.ts
@@ -42128,7 +42131,7 @@ function createTrezorAdapter(config) {
42128
42131
 
42129
42132
  // src/wallet/hardware/mock.ts
42130
42133
  var import_types74 = require("@sip-protocol/types");
42131
- var import_utils65 = require("@noble/hashes/utils");
42134
+ var import_utils66 = require("@noble/hashes/utils");
42132
42135
  var MockLedgerAdapter = class extends BaseWalletAdapter {
42133
42136
  chain;
42134
42137
  name = "mock-ledger";
@@ -42373,15 +42376,15 @@ var MockLedgerAdapter = class extends BaseWalletAdapter {
42373
42376
  }
42374
42377
  }
42375
42378
  generateMockAddress(index) {
42376
- const bytes = (0, import_utils65.randomBytes)(20);
42379
+ const bytes = (0, import_utils66.randomBytes)(20);
42377
42380
  bytes[0] = index;
42378
- return `0x${(0, import_utils65.bytesToHex)(bytes)}`;
42381
+ return `0x${(0, import_utils66.bytesToHex)(bytes)}`;
42379
42382
  }
42380
42383
  generateMockPublicKey(index) {
42381
- const bytes = (0, import_utils65.randomBytes)(33);
42384
+ const bytes = (0, import_utils66.randomBytes)(33);
42382
42385
  bytes[0] = 2;
42383
42386
  bytes[1] = index;
42384
- return `0x${(0, import_utils65.bytesToHex)(bytes)}`;
42387
+ return `0x${(0, import_utils66.bytesToHex)(bytes)}`;
42385
42388
  }
42386
42389
  generateMockSignature(data) {
42387
42390
  const sig = new Uint8Array(65);
@@ -42390,7 +42393,7 @@ var MockLedgerAdapter = class extends BaseWalletAdapter {
42390
42393
  sig[32 + i] = (data[i % data.length] ?? 0) ^ i * 11;
42391
42394
  }
42392
42395
  sig[64] = 27;
42393
- return `0x${(0, import_utils65.bytesToHex)(sig)}`;
42396
+ return `0x${(0, import_utils66.bytesToHex)(sig)}`;
42394
42397
  }
42395
42398
  delay(ms) {
42396
42399
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -42579,15 +42582,15 @@ var MockTrezorAdapter = class extends BaseWalletAdapter {
42579
42582
  }
42580
42583
  }
42581
42584
  generateMockAddress(index) {
42582
- const bytes = (0, import_utils65.randomBytes)(20);
42585
+ const bytes = (0, import_utils66.randomBytes)(20);
42583
42586
  bytes[0] = index + 100;
42584
- return `0x${(0, import_utils65.bytesToHex)(bytes)}`;
42587
+ return `0x${(0, import_utils66.bytesToHex)(bytes)}`;
42585
42588
  }
42586
42589
  generateMockPublicKey(index) {
42587
- const bytes = (0, import_utils65.randomBytes)(33);
42590
+ const bytes = (0, import_utils66.randomBytes)(33);
42588
42591
  bytes[0] = 3;
42589
42592
  bytes[1] = index + 100;
42590
- return `0x${(0, import_utils65.bytesToHex)(bytes)}`;
42593
+ return `0x${(0, import_utils66.bytesToHex)(bytes)}`;
42591
42594
  }
42592
42595
  generateMockSignature(data) {
42593
42596
  const sig = new Uint8Array(65);
@@ -42596,7 +42599,7 @@ var MockTrezorAdapter = class extends BaseWalletAdapter {
42596
42599
  sig[32 + i] = (data[i % data.length] ?? 0) ^ i * 17;
42597
42600
  }
42598
42601
  sig[64] = 28;
42599
- return `0x${(0, import_utils65.bytesToHex)(sig)}`;
42602
+ return `0x${(0, import_utils66.bytesToHex)(sig)}`;
42600
42603
  }
42601
42604
  delay(ms) {
42602
42605
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -43258,7 +43261,7 @@ function createMainnetVerifier(config = {}) {
43258
43261
 
43259
43262
  // src/solana/jito-relayer.ts
43260
43263
  var import_web317 = require("@solana/web3.js");
43261
- var import_utils66 = require("@noble/hashes/utils");
43264
+ var import_utils67 = require("@noble/hashes/utils");
43262
43265
  var JITO_BLOCK_ENGINES = {
43263
43266
  mainnet: {
43264
43267
  amsterdam: "https://amsterdam.mainnet.block-engine.jito.wtf/api/v1",
@@ -43378,7 +43381,7 @@ var JitoRelayer = class {
43378
43381
  }
43379
43382
  const signatures = bundleTransactions.map((tx) => {
43380
43383
  if (tx instanceof import_web317.VersionedTransaction) {
43381
- return (0, import_utils66.bytesToHex)(tx.signatures[0]);
43384
+ return (0, import_utils67.bytesToHex)(tx.signatures[0]);
43382
43385
  } else {
43383
43386
  return tx.signature?.toString() ?? "";
43384
43387
  }
@@ -43417,7 +43420,7 @@ var JitoRelayer = class {
43417
43420
  const bundleId = await this.sendBundle([serializedTx]);
43418
43421
  let signature;
43419
43422
  if (request.transaction instanceof import_web317.VersionedTransaction) {
43420
- signature = (0, import_utils66.bytesToHex)(request.transaction.signatures[0]);
43423
+ signature = (0, import_utils67.bytesToHex)(request.transaction.signatures[0]);
43421
43424
  } else {
43422
43425
  signature = request.transaction.signature?.toString() ?? "";
43423
43426
  }
@@ -43642,7 +43645,7 @@ function createMainnetRelayer(rpcUrl) {
43642
43645
  // src/chains/near/commitment.ts
43643
43646
  var import_ed2551917 = require("@noble/curves/ed25519");
43644
43647
  var import_sha210 = require("@noble/hashes/sha2");
43645
- var import_utils67 = require("@noble/hashes/utils");
43648
+ var import_utils68 = require("@noble/hashes/utils");
43646
43649
  init_errors();
43647
43650
  init_validation();
43648
43651
  var H_DOMAIN3 = "SIP-NEAR-PEDERSEN-GENERATOR-H-v1";
@@ -43663,7 +43666,7 @@ function generateH3() {
43663
43666
  if (!point.equals(import_ed2551917.ed25519.ExtendedPoint.ZERO)) {
43664
43667
  const gBytes = G3.toRawBytes();
43665
43668
  const hBytes = point.toRawBytes();
43666
- if ((0, import_utils67.bytesToHex)(gBytes) !== (0, import_utils67.bytesToHex)(hBytes)) {
43669
+ if ((0, import_utils68.bytesToHex)(gBytes) !== (0, import_utils68.bytesToHex)(hBytes)) {
43667
43670
  return point;
43668
43671
  }
43669
43672
  }
@@ -43714,13 +43717,13 @@ function commitNEAR(value, blinding) {
43714
43717
  { curveOrder: ED25519_ORDER6.toString(16) }
43715
43718
  );
43716
43719
  }
43717
- const r = blinding ?? (0, import_utils67.randomBytes)(32);
43720
+ const r = blinding ?? (0, import_utils68.randomBytes)(32);
43718
43721
  if (r.length !== 32) {
43719
43722
  throw new ValidationError("must be 32 bytes", "blinding", { received: r.length });
43720
43723
  }
43721
43724
  const rScalar = bytesToBigInt4(r) % ED25519_ORDER6;
43722
43725
  if (rScalar === 0n) {
43723
- return commitNEAR(value, (0, import_utils67.randomBytes)(32));
43726
+ return commitNEAR(value, (0, import_utils68.randomBytes)(32));
43724
43727
  }
43725
43728
  let C;
43726
43729
  if (value === 0n) {
@@ -43732,8 +43735,8 @@ function commitNEAR(value, blinding) {
43732
43735
  }
43733
43736
  const rScalarBytes = bigIntToBytes4(rScalar, 32);
43734
43737
  return {
43735
- commitment: `0x${(0, import_utils67.bytesToHex)(C.toRawBytes())}`,
43736
- blinding: `0x${(0, import_utils67.bytesToHex)(rScalarBytes)}`
43738
+ commitment: `0x${(0, import_utils68.bytesToHex)(C.toRawBytes())}`,
43739
+ blinding: `0x${(0, import_utils68.bytesToHex)(rScalarBytes)}`
43737
43740
  };
43738
43741
  }
43739
43742
  function verifyOpeningNEAR(commitment, value, blinding) {
@@ -43826,7 +43829,7 @@ function addCommitmentsNEAR(c1, c2) {
43826
43829
  }
43827
43830
  const sum = point1.add(point2);
43828
43831
  return {
43829
- commitment: `0x${(0, import_utils67.bytesToHex)(sum.toRawBytes())}`
43832
+ commitment: `0x${(0, import_utils68.bytesToHex)(sum.toRawBytes())}`
43830
43833
  };
43831
43834
  }
43832
43835
  function subtractCommitmentsNEAR(c1, c2) {
@@ -43855,7 +43858,7 @@ function subtractCommitmentsNEAR(c1, c2) {
43855
43858
  };
43856
43859
  }
43857
43860
  return {
43858
- commitment: `0x${(0, import_utils67.bytesToHex)(diff.toRawBytes())}`
43861
+ commitment: `0x${(0, import_utils68.bytesToHex)(diff.toRawBytes())}`
43859
43862
  };
43860
43863
  }
43861
43864
  function addBlindingsNEAR(b1, b2) {
@@ -43871,7 +43874,7 @@ function addBlindingsNEAR(b1, b2) {
43871
43874
  const b2Scalar = bytesToBigInt4(b2Bytes);
43872
43875
  const sum = (b1Scalar + b2Scalar) % ED25519_ORDER6;
43873
43876
  const sumBytes = bigIntToBytes4(sum, 32);
43874
- return `0x${(0, import_utils67.bytesToHex)(sumBytes)}`;
43877
+ return `0x${(0, import_utils68.bytesToHex)(sumBytes)}`;
43875
43878
  }
43876
43879
  function subtractBlindingsNEAR(b1, b2) {
43877
43880
  if (!isValidHex(b1)) {
@@ -43886,22 +43889,22 @@ function subtractBlindingsNEAR(b1, b2) {
43886
43889
  const b2Scalar = bytesToBigInt4(b2Bytes);
43887
43890
  const diff = (b1Scalar - b2Scalar + ED25519_ORDER6) % ED25519_ORDER6;
43888
43891
  const diffBytes = bigIntToBytes4(diff, 32);
43889
- return `0x${(0, import_utils67.bytesToHex)(diffBytes)}`;
43892
+ return `0x${(0, import_utils68.bytesToHex)(diffBytes)}`;
43890
43893
  }
43891
43894
  function getGeneratorsNEAR() {
43892
43895
  return {
43893
- G: `0x${(0, import_utils67.bytesToHex)(G3.toRawBytes())}`,
43894
- H: `0x${(0, import_utils67.bytesToHex)(H3.toRawBytes())}`
43896
+ G: `0x${(0, import_utils68.bytesToHex)(G3.toRawBytes())}`,
43897
+ H: `0x${(0, import_utils68.bytesToHex)(H3.toRawBytes())}`
43895
43898
  };
43896
43899
  }
43897
43900
  function generateBlindingNEAR() {
43898
- const bytes = (0, import_utils67.randomBytes)(32);
43901
+ const bytes = (0, import_utils68.randomBytes)(32);
43899
43902
  const scalar = bytesToBigInt4(bytes) % ED25519_ORDER6;
43900
43903
  if (scalar === 0n) {
43901
43904
  return generateBlindingNEAR();
43902
43905
  }
43903
43906
  const scalarBytes = bigIntToBytes4(scalar, 32);
43904
- return `0x${(0, import_utils67.bytesToHex)(scalarBytes)}`;
43907
+ return `0x${(0, import_utils68.bytesToHex)(scalarBytes)}`;
43905
43908
  }
43906
43909
 
43907
43910
  // src/chains/near/viewing-key.ts
@@ -43909,7 +43912,7 @@ var import_ed2551918 = require("@noble/curves/ed25519");
43909
43912
  var import_sha25629 = require("@noble/hashes/sha256");
43910
43913
  var import_hmac7 = require("@noble/hashes/hmac");
43911
43914
  var import_hkdf5 = require("@noble/hashes/hkdf");
43912
- var import_utils68 = require("@noble/hashes/utils");
43915
+ var import_utils69 = require("@noble/hashes/utils");
43913
43916
  var import_chacha6 = require("@noble/ciphers/chacha.js");
43914
43917
  init_errors();
43915
43918
  init_validation();
@@ -43925,7 +43928,7 @@ function generateNEARViewingKeyFromSpending(spendingPrivateKey, label) {
43925
43928
  "spendingPrivateKey"
43926
43929
  );
43927
43930
  }
43928
- const spendingBytes = (0, import_utils68.hexToBytes)(spendingPrivateKey.slice(2));
43931
+ const spendingBytes = (0, import_utils69.hexToBytes)(spendingPrivateKey.slice(2));
43929
43932
  if (spendingBytes.length !== 32) {
43930
43933
  throw new ValidationError(
43931
43934
  "spendingPrivateKey must be 32 bytes",
@@ -43936,15 +43939,15 @@ function generateNEARViewingKeyFromSpending(spendingPrivateKey, label) {
43936
43939
  try {
43937
43940
  viewingPrivateBytes = (0, import_hmac7.hmac)(
43938
43941
  import_sha25629.sha256,
43939
- (0, import_utils68.utf8ToBytes)(VIEWING_KEY_CONTEXT3),
43942
+ (0, import_utils69.utf8ToBytes)(VIEWING_KEY_CONTEXT3),
43940
43943
  spendingBytes
43941
43944
  );
43942
43945
  const viewingPublicBytes = import_ed2551918.ed25519.getPublicKey(viewingPrivateBytes);
43943
43946
  const hashBytes = (0, import_sha25629.sha256)(viewingPublicBytes);
43944
43947
  return {
43945
- privateKey: `0x${(0, import_utils68.bytesToHex)(viewingPrivateBytes)}`,
43946
- publicKey: `0x${(0, import_utils68.bytesToHex)(viewingPublicBytes)}`,
43947
- hash: `0x${(0, import_utils68.bytesToHex)(hashBytes)}`,
43948
+ privateKey: `0x${(0, import_utils69.bytesToHex)(viewingPrivateBytes)}`,
43949
+ publicKey: `0x${(0, import_utils69.bytesToHex)(viewingPublicBytes)}`,
43950
+ hash: `0x${(0, import_utils69.bytesToHex)(hashBytes)}`,
43948
43951
  label,
43949
43952
  createdAt: Date.now()
43950
43953
  };
@@ -43954,14 +43957,14 @@ function generateNEARViewingKeyFromSpending(spendingPrivateKey, label) {
43954
43957
  }
43955
43958
  }
43956
43959
  function generateRandomNEARViewingKey(label) {
43957
- const privateBytes = (0, import_utils68.randomBytes)(32);
43960
+ const privateBytes = (0, import_utils69.randomBytes)(32);
43958
43961
  try {
43959
43962
  const publicBytes = import_ed2551918.ed25519.getPublicKey(privateBytes);
43960
43963
  const hashBytes = (0, import_sha25629.sha256)(publicBytes);
43961
43964
  return {
43962
- privateKey: `0x${(0, import_utils68.bytesToHex)(privateBytes)}`,
43963
- publicKey: `0x${(0, import_utils68.bytesToHex)(publicBytes)}`,
43964
- hash: `0x${(0, import_utils68.bytesToHex)(hashBytes)}`,
43965
+ privateKey: `0x${(0, import_utils69.bytesToHex)(privateBytes)}`,
43966
+ publicKey: `0x${(0, import_utils69.bytesToHex)(publicBytes)}`,
43967
+ hash: `0x${(0, import_utils69.bytesToHex)(hashBytes)}`,
43965
43968
  label,
43966
43969
  createdAt: Date.now()
43967
43970
  };
@@ -43976,7 +43979,7 @@ function computeNEARViewingKeyHash(viewingPublicKey) {
43976
43979
  "viewingPublicKey"
43977
43980
  );
43978
43981
  }
43979
- const publicBytes = (0, import_utils68.hexToBytes)(viewingPublicKey.slice(2));
43982
+ const publicBytes = (0, import_utils69.hexToBytes)(viewingPublicKey.slice(2));
43980
43983
  if (publicBytes.length !== 32) {
43981
43984
  throw new ValidationError(
43982
43985
  "viewingPublicKey must be 32 bytes",
@@ -43984,7 +43987,7 @@ function computeNEARViewingKeyHash(viewingPublicKey) {
43984
43987
  );
43985
43988
  }
43986
43989
  const hashBytes = (0, import_sha25629.sha256)(publicBytes);
43987
- return `0x${(0, import_utils68.bytesToHex)(hashBytes)}`;
43990
+ return `0x${(0, import_utils69.bytesToHex)(hashBytes)}`;
43988
43991
  }
43989
43992
  function computeNEARViewingKeyHashFromPrivate(viewingPrivateKey) {
43990
43993
  if (!viewingPrivateKey || !viewingPrivateKey.startsWith("0x")) {
@@ -43993,7 +43996,7 @@ function computeNEARViewingKeyHashFromPrivate(viewingPrivateKey) {
43993
43996
  "viewingPrivateKey"
43994
43997
  );
43995
43998
  }
43996
- const privateBytes = (0, import_utils68.hexToBytes)(viewingPrivateKey.slice(2));
43999
+ const privateBytes = (0, import_utils69.hexToBytes)(viewingPrivateKey.slice(2));
43997
44000
  if (privateBytes.length !== 32) {
43998
44001
  throw new ValidationError(
43999
44002
  "viewingPrivateKey must be 32 bytes",
@@ -44003,7 +44006,7 @@ function computeNEARViewingKeyHashFromPrivate(viewingPrivateKey) {
44003
44006
  try {
44004
44007
  const publicBytes = import_ed2551918.ed25519.getPublicKey(privateBytes);
44005
44008
  const hashBytes = (0, import_sha25629.sha256)(publicBytes);
44006
- return `0x${(0, import_utils68.bytesToHex)(hashBytes)}`;
44009
+ return `0x${(0, import_utils69.bytesToHex)(hashBytes)}`;
44007
44010
  } finally {
44008
44011
  secureWipe(privateBytes);
44009
44012
  }
@@ -44050,9 +44053,9 @@ function importNEARViewingKey(exported) {
44050
44053
  { expected: computedHash, received: exported.hash }
44051
44054
  );
44052
44055
  }
44053
- const privateBytes = (0, import_utils68.hexToBytes)(exported.privateKey.slice(2));
44056
+ const privateBytes = (0, import_utils69.hexToBytes)(exported.privateKey.slice(2));
44054
44057
  try {
44055
- const derivedPublic = `0x${(0, import_utils68.bytesToHex)(import_ed2551918.ed25519.getPublicKey(privateBytes))}`;
44058
+ const derivedPublic = `0x${(0, import_utils69.bytesToHex)(import_ed2551918.ed25519.getPublicKey(privateBytes))}`;
44056
44059
  if (derivedPublic !== exported.publicKey) {
44057
44060
  throw new ValidationError(
44058
44061
  "Public key does not match private key",
@@ -44071,10 +44074,10 @@ function importNEARViewingKey(exported) {
44071
44074
  };
44072
44075
  }
44073
44076
  function deriveEncryptionKey3(key, salt) {
44074
- const keyBytes = (0, import_utils68.hexToBytes)(key.slice(2));
44077
+ const keyBytes = (0, import_utils69.hexToBytes)(key.slice(2));
44075
44078
  try {
44076
- const hkdfSalt = salt ?? (0, import_utils68.utf8ToBytes)(ENCRYPTION_DOMAIN3);
44077
- return (0, import_hkdf5.hkdf)(import_sha25629.sha256, keyBytes, hkdfSalt, (0, import_utils68.utf8ToBytes)("encryption"), 32);
44079
+ const hkdfSalt = salt ?? (0, import_utils69.utf8ToBytes)(ENCRYPTION_DOMAIN3);
44080
+ return (0, import_hkdf5.hkdf)(import_sha25629.sha256, keyBytes, hkdfSalt, (0, import_utils69.utf8ToBytes)("encryption"), 32);
44078
44081
  } finally {
44079
44082
  secureWipe(keyBytes);
44080
44083
  }
@@ -44082,13 +44085,13 @@ function deriveEncryptionKey3(key, salt) {
44082
44085
  function encryptForNEARViewing(data, viewingKey) {
44083
44086
  const encKey = deriveEncryptionKey3(viewingKey.privateKey);
44084
44087
  try {
44085
- const nonce = (0, import_utils68.randomBytes)(NONCE_SIZE4);
44086
- const plaintext = (0, import_utils68.utf8ToBytes)(JSON.stringify(data));
44088
+ const nonce = (0, import_utils69.randomBytes)(NONCE_SIZE4);
44089
+ const plaintext = (0, import_utils69.utf8ToBytes)(JSON.stringify(data));
44087
44090
  const cipher = (0, import_chacha6.xchacha20poly1305)(encKey, nonce);
44088
44091
  const ciphertext = cipher.encrypt(plaintext);
44089
44092
  return {
44090
- ciphertext: `0x${(0, import_utils68.bytesToHex)(ciphertext)}`,
44091
- nonce: `0x${(0, import_utils68.bytesToHex)(nonce)}`,
44093
+ ciphertext: `0x${(0, import_utils69.bytesToHex)(ciphertext)}`,
44094
+ nonce: `0x${(0, import_utils69.bytesToHex)(nonce)}`,
44092
44095
  viewingKeyHash: viewingKey.hash
44093
44096
  };
44094
44097
  } finally {
@@ -44105,8 +44108,8 @@ function decryptWithNEARViewing(encrypted, viewingKey) {
44105
44108
  }
44106
44109
  const encKey = deriveEncryptionKey3(viewingKey.privateKey);
44107
44110
  try {
44108
- const ciphertext = (0, import_utils68.hexToBytes)(encrypted.ciphertext.slice(2));
44109
- const nonce = (0, import_utils68.hexToBytes)(encrypted.nonce.slice(2));
44111
+ const ciphertext = (0, import_utils69.hexToBytes)(encrypted.ciphertext.slice(2));
44112
+ const nonce = (0, import_utils69.hexToBytes)(encrypted.nonce.slice(2));
44110
44113
  if (nonce.length !== NONCE_SIZE4) {
44111
44114
  throw new ValidationError(
44112
44115
  `Invalid nonce length: ${nonce.length}. Expected: ${NONCE_SIZE4}`,
@@ -44156,15 +44159,15 @@ function deriveNEARChildViewingKey(parentKey, childPath, label) {
44156
44159
  if (!childPath || typeof childPath !== "string") {
44157
44160
  throw new ValidationError("childPath must be a non-empty string", "childPath");
44158
44161
  }
44159
- const parentBytes = (0, import_utils68.hexToBytes)(parentKey.privateKey.slice(2));
44162
+ const parentBytes = (0, import_utils69.hexToBytes)(parentKey.privateKey.slice(2));
44160
44163
  try {
44161
- const childBytes = (0, import_hmac7.hmac)(import_sha25629.sha256, (0, import_utils68.utf8ToBytes)(childPath), parentBytes);
44164
+ const childBytes = (0, import_hmac7.hmac)(import_sha25629.sha256, (0, import_utils69.utf8ToBytes)(childPath), parentBytes);
44162
44165
  const publicBytes = import_ed2551918.ed25519.getPublicKey(childBytes);
44163
44166
  const hashBytes = (0, import_sha25629.sha256)(publicBytes);
44164
44167
  const result = {
44165
- privateKey: `0x${(0, import_utils68.bytesToHex)(childBytes)}`,
44166
- publicKey: `0x${(0, import_utils68.bytesToHex)(publicBytes)}`,
44167
- hash: `0x${(0, import_utils68.bytesToHex)(hashBytes)}`,
44168
+ privateKey: `0x${(0, import_utils69.bytesToHex)(childBytes)}`,
44169
+ publicKey: `0x${(0, import_utils69.bytesToHex)(publicBytes)}`,
44170
+ hash: `0x${(0, import_utils69.bytesToHex)(hashBytes)}`,
44168
44171
  label: label ?? `${parentKey.label ?? "Key"}/${childPath}`,
44169
44172
  createdAt: Date.now()
44170
44173
  };
@@ -44181,7 +44184,7 @@ function getNEARViewingPublicKey(viewingPrivateKey) {
44181
44184
  "viewingPrivateKey"
44182
44185
  );
44183
44186
  }
44184
- const privateBytes = (0, import_utils68.hexToBytes)(viewingPrivateKey.slice(2));
44187
+ const privateBytes = (0, import_utils69.hexToBytes)(viewingPrivateKey.slice(2));
44185
44188
  if (privateBytes.length !== 32) {
44186
44189
  throw new ValidationError(
44187
44190
  "viewingPrivateKey must be 32 bytes",
@@ -44190,7 +44193,7 @@ function getNEARViewingPublicKey(viewingPrivateKey) {
44190
44193
  }
44191
44194
  try {
44192
44195
  const publicBytes = import_ed2551918.ed25519.getPublicKey(privateBytes);
44193
- return `0x${(0, import_utils68.bytesToHex)(publicBytes)}`;
44196
+ return `0x${(0, import_utils69.bytesToHex)(publicBytes)}`;
44194
44197
  } finally {
44195
44198
  secureWipe(privateBytes);
44196
44199
  }
@@ -44225,9 +44228,9 @@ function validateNEARViewingKey(viewingKey) {
44225
44228
  { expected: computedHash, received: viewingKey.hash }
44226
44229
  );
44227
44230
  }
44228
- const privateBytes = (0, import_utils68.hexToBytes)(viewingKey.privateKey.slice(2));
44231
+ const privateBytes = (0, import_utils69.hexToBytes)(viewingKey.privateKey.slice(2));
44229
44232
  try {
44230
- const derivedPublic = `0x${(0, import_utils68.bytesToHex)(import_ed2551918.ed25519.getPublicKey(privateBytes))}`;
44233
+ const derivedPublic = `0x${(0, import_utils69.bytesToHex)(import_ed2551918.ed25519.getPublicKey(privateBytes))}`;
44231
44234
  if (derivedPublic !== viewingKey.publicKey) {
44232
44235
  throw new ValidationError(
44233
44236
  "publicKey does not match privateKey",
@@ -44241,7 +44244,7 @@ function validateNEARViewingKey(viewingKey) {
44241
44244
  }
44242
44245
 
44243
44246
  // src/chains/near/resolver.ts
44244
- var import_utils69 = require("@noble/hashes/utils");
44247
+ var import_utils70 = require("@noble/hashes/utils");
44245
44248
  init_errors();
44246
44249
  init_validation();
44247
44250
  function createNEARAnnouncementCache() {
@@ -44493,7 +44496,7 @@ var NEARStealthScanner = class {
44493
44496
  recipient.viewingPrivateKey
44494
44497
  );
44495
44498
  if (isMatch) {
44496
- const stealthAddress = isImplicitAccount(announcement.stealthAddress) ? announcement.stealthAddress : (0, import_utils69.bytesToHex)((0, import_utils69.hexToBytes)(stealthPublicKey.slice(2)));
44499
+ const stealthAddress = isImplicitAccount(announcement.stealthAddress) ? announcement.stealthAddress : (0, import_utils70.bytesToHex)((0, import_utils70.hexToBytes)(stealthPublicKey.slice(2)));
44497
44500
  let amount = metadata?.amount ?? 0n;
44498
44501
  if (amount === 0n && isImplicitAccount(stealthAddress)) {
44499
44502
  try {
@@ -46868,7 +46871,7 @@ function createPrivacyLogger(moduleName, config = {}) {
46868
46871
  }
46869
46872
 
46870
46873
  // src/privacy-backends/privacycash.ts
46871
- var import_utils70 = require("@noble/hashes/utils");
46874
+ var import_utils71 = require("@noble/hashes/utils");
46872
46875
  var privacyCashLogger = createPrivacyLogger("PrivacyCash");
46873
46876
  var DEFAULT_ANONYMITY_SET = 50;
46874
46877
  var BASE_COST_LAMPORTS = BigInt(1e7);
@@ -46898,7 +46901,7 @@ var PRIVACYCASH_CAPABILITIES = {
46898
46901
 
46899
46902
  // src/privacy-backends/shadowwire.ts
46900
46903
  var import_shadowwire = require("@radr/shadowwire");
46901
- var import_utils71 = require("@noble/hashes/utils");
46904
+ var import_utils72 = require("@noble/hashes/utils");
46902
46905
  var SHADOWWIRE_TOKEN_MINTS = {
46903
46906
  SOL: "So11111111111111111111111111111111111111112",
46904
46907
  USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
@@ -46952,7 +46955,7 @@ var COST_PER_ENCRYPTED_INPUT_WEI = BigInt("1000000000000000");
46952
46955
  // src/privacy-backends/magicblock.ts
46953
46956
  var import_ephemeral_rollups_sdk = require("@magicblock-labs/ephemeral-rollups-sdk");
46954
46957
  var import_web318 = require("@solana/web3.js");
46955
- var import_utils72 = require("@noble/hashes/utils");
46958
+ var import_utils73 = require("@noble/hashes/utils");
46956
46959
  var magicBlockLogger = createPrivacyLogger("MagicBlock");
46957
46960
 
46958
46961
  // src/privacy-backends/cspl-types.ts
@@ -47642,7 +47645,7 @@ var CSPLClient = class {
47642
47645
 
47643
47646
  // src/privacy-backends/private-swap.ts
47644
47647
  var import_sha25630 = require("@noble/hashes/sha256");
47645
- var import_utils73 = require("@noble/hashes/utils");
47648
+ var import_utils74 = require("@noble/hashes/utils");
47646
47649
 
47647
47650
  // src/privacy-backends/cspl-token.ts
47648
47651
  var CSPLTokenService = class {
@@ -50353,7 +50356,7 @@ init_proxy();
50353
50356
  // src/sync/oblivious.ts
50354
50357
  var import_sha211 = require("@noble/hashes/sha2");
50355
50358
  var import_hmac8 = require("@noble/hashes/hmac");
50356
- var import_utils74 = require("@noble/hashes/utils");
50359
+ var import_utils75 = require("@noble/hashes/utils");
50357
50360
  init_secure_memory();
50358
50361
  var DEFAULT_SYNC_CONFIG = {
50359
50362
  maxBatchSize: 1e3,
@@ -50364,7 +50367,7 @@ var DEFAULT_SYNC_CONFIG = {
50364
50367
  parallelSync: true
50365
50368
  };
50366
50369
  function generateSyncRandomness(epoch, durationSeconds = DEFAULT_SYNC_CONFIG.epochDurationSeconds) {
50367
- const value = (0, import_utils74.randomBytes)(32);
50370
+ const value = (0, import_utils75.randomBytes)(32);
50368
50371
  const expiresAt = Date.now() + durationSeconds * 1e3;
50369
50372
  return {
50370
50373
  value,
@@ -50380,21 +50383,21 @@ function getCurrentEpoch(epochDurationSeconds = DEFAULT_SYNC_CONFIG.epochDuratio
50380
50383
  }
50381
50384
  var OBLIVIOUS_NULLIFIER_DOMAIN = "SIP-OBLIVIOUS-NULLIFIER-V1";
50382
50385
  function deriveObliviousNullifier(noteCommitment, spendingKey, syncRandomness) {
50383
- const commitmentBytes = (0, import_utils74.hexToBytes)(
50386
+ const commitmentBytes = (0, import_utils75.hexToBytes)(
50384
50387
  noteCommitment.startsWith("0x") ? noteCommitment.slice(2) : noteCommitment
50385
50388
  );
50386
- const keyBytes = (0, import_utils74.hexToBytes)(
50389
+ const keyBytes = (0, import_utils75.hexToBytes)(
50387
50390
  spendingKey.startsWith("0x") ? spendingKey.slice(2) : spendingKey
50388
50391
  );
50389
50392
  try {
50390
- const domain = (0, import_utils74.utf8ToBytes)(OBLIVIOUS_NULLIFIER_DOMAIN);
50393
+ const domain = (0, import_utils75.utf8ToBytes)(OBLIVIOUS_NULLIFIER_DOMAIN);
50391
50394
  const message = new Uint8Array(domain.length + commitmentBytes.length + syncRandomness.value.length);
50392
50395
  message.set(domain, 0);
50393
50396
  message.set(commitmentBytes, domain.length);
50394
50397
  message.set(syncRandomness.value, domain.length + commitmentBytes.length);
50395
50398
  const nullifierBytes = (0, import_hmac8.hmac)(import_sha211.sha256, keyBytes, message);
50396
50399
  return {
50397
- nullifier: `0x${(0, import_utils74.bytesToHex)(nullifierBytes)}`,
50400
+ nullifier: `0x${(0, import_utils75.bytesToHex)(nullifierBytes)}`,
50398
50401
  epoch: syncRandomness.epoch,
50399
50402
  chainId: "default"
50400
50403
  // Will be set by caller
@@ -50404,15 +50407,15 @@ function deriveObliviousNullifier(noteCommitment, spendingKey, syncRandomness) {
50404
50407
  }
50405
50408
  }
50406
50409
  function deriveTraditionalNullifier(noteCommitment, spendingKey) {
50407
- const commitmentBytes = (0, import_utils74.hexToBytes)(
50410
+ const commitmentBytes = (0, import_utils75.hexToBytes)(
50408
50411
  noteCommitment.startsWith("0x") ? noteCommitment.slice(2) : noteCommitment
50409
50412
  );
50410
- const keyBytes = (0, import_utils74.hexToBytes)(
50413
+ const keyBytes = (0, import_utils75.hexToBytes)(
50411
50414
  spendingKey.startsWith("0x") ? spendingKey.slice(2) : spendingKey
50412
50415
  );
50413
50416
  try {
50414
50417
  const nullifierBytes = (0, import_hmac8.hmac)(import_sha211.sha256, keyBytes, commitmentBytes);
50415
- return `0x${(0, import_utils74.bytesToHex)(nullifierBytes)}`;
50418
+ return `0x${(0, import_utils75.bytesToHex)(nullifierBytes)}`;
50416
50419
  } finally {
50417
50420
  secureWipe(keyBytes);
50418
50421
  }
@@ -50457,7 +50460,7 @@ function createTimeWindowedKey(masterViewingKey, startTime, endTime, epochDurati
50457
50460
  for (let e = startEpoch; e <= endEpoch; e++) {
50458
50461
  epochs.push(e);
50459
50462
  }
50460
- const keyBytes = (0, import_utils74.hexToBytes)(
50463
+ const keyBytes = (0, import_utils75.hexToBytes)(
50461
50464
  masterViewingKey.startsWith("0x") ? masterViewingKey.slice(2) : masterViewingKey
50462
50465
  );
50463
50466
  const windowData = new Uint8Array(16);
@@ -50468,11 +50471,11 @@ function createTimeWindowedKey(masterViewingKey, startTime, endTime, epochDurati
50468
50471
  const keyHash = (0, import_sha211.sha256)(derivedKey);
50469
50472
  secureWipe(keyBytes);
50470
50473
  return {
50471
- viewingKey: `0x${(0, import_utils74.bytesToHex)(derivedKey)}`,
50474
+ viewingKey: `0x${(0, import_utils75.bytesToHex)(derivedKey)}`,
50472
50475
  windowStart: startTime,
50473
50476
  windowEnd: endTime,
50474
50477
  epochs,
50475
- hash: `0x${(0, import_utils74.bytesToHex)(keyHash)}`
50478
+ hash: `0x${(0, import_utils75.bytesToHex)(keyHash)}`
50476
50479
  };
50477
50480
  }
50478
50481
  function isNoteInWindow(_note, _windowedKey) {
@@ -50498,7 +50501,7 @@ var ObliviousSyncError = class extends Error {
50498
50501
  };
50499
50502
 
50500
50503
  // src/sync/mock-provider.ts
50501
- var import_utils75 = require("@noble/hashes/utils");
50504
+ var import_utils76 = require("@noble/hashes/utils");
50502
50505
  var DEFAULT_MOCK_CONFIG = {
50503
50506
  chains: ["ethereum", "solana", "near"],
50504
50507
  latencyMs: 100,
@@ -50595,7 +50598,7 @@ var MockObliviousSyncProvider = class {
50595
50598
  merkleProofs,
50596
50599
  syncHeight: this.config.blockHeight,
50597
50600
  timestamp: Date.now(),
50598
- queryHash: `0x${(0, import_utils75.bytesToHex)((0, import_utils75.randomBytes)(32))}`
50601
+ queryHash: `0x${(0, import_utils76.bytesToHex)((0, import_utils76.randomBytes)(32))}`
50599
50602
  };
50600
50603
  }
50601
50604
  async getCurrentHeight(chainId) {
@@ -50676,23 +50679,23 @@ var MockObliviousSyncProvider = class {
50676
50679
  generateMockNote(blockRange) {
50677
50680
  const blockNumber = blockRange.startBlock + BigInt(Math.floor(Math.random() * Number(blockRange.endBlock - blockRange.startBlock)));
50678
50681
  return {
50679
- commitment: `0x${(0, import_utils75.bytesToHex)((0, import_utils75.randomBytes)(32))}`,
50680
- encryptedData: `0x${(0, import_utils75.bytesToHex)((0, import_utils75.randomBytes)(128))}`,
50682
+ commitment: `0x${(0, import_utils76.bytesToHex)((0, import_utils76.randomBytes)(32))}`,
50683
+ encryptedData: `0x${(0, import_utils76.bytesToHex)((0, import_utils76.randomBytes)(128))}`,
50681
50684
  blockNumber,
50682
- txHash: `0x${(0, import_utils75.bytesToHex)((0, import_utils75.randomBytes)(32))}`,
50685
+ txHash: `0x${(0, import_utils76.bytesToHex)((0, import_utils76.randomBytes)(32))}`,
50683
50686
  chainId: blockRange.chainId
50684
50687
  };
50685
50688
  }
50686
50689
  generateMockMerkleProof(leaf) {
50687
50690
  const siblings = [];
50688
50691
  for (let i = 0; i < 20; i++) {
50689
- siblings.push(`0x${(0, import_utils75.bytesToHex)((0, import_utils75.randomBytes)(32))}`);
50692
+ siblings.push(`0x${(0, import_utils76.bytesToHex)((0, import_utils76.randomBytes)(32))}`);
50690
50693
  }
50691
50694
  return {
50692
50695
  leaf,
50693
50696
  siblings,
50694
50697
  index: BigInt(Math.floor(Math.random() * 1e6)),
50695
- root: `0x${(0, import_utils75.bytesToHex)((0, import_utils75.randomBytes)(32))}`
50698
+ root: `0x${(0, import_utils76.bytesToHex)((0, import_utils76.randomBytes)(32))}`
50696
50699
  };
50697
50700
  }
50698
50701
  };
@@ -52270,7 +52273,7 @@ async function calculateFeeForSwap(contract, swapAmount, swapAmountUsd, sourceCh
52270
52273
  init_errors();
52271
52274
  var import_noir_js = require("@noir-lang/noir_js");
52272
52275
  var import_bb = require("@aztec/bb.js");
52273
- var import_secp256k113 = require("@noble/curves/secp256k1");
52276
+ var import_secp256k114 = require("@noble/curves/secp256k1");
52274
52277
  var import_funding_proof = __toESM(require_funding_proof());
52275
52278
  var import_validity_proof = __toESM(require_validity_proof());
52276
52279
  var import_fulfillment_proof = __toESM(require_fulfillment_proof());
@@ -52415,7 +52418,7 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
52415
52418
  * Derive secp256k1 public key coordinates from a private key
52416
52419
  */
52417
52420
  static derivePublicKey(privateKey) {
52418
- const uncompressedPubKey = import_secp256k113.secp256k1.getPublicKey(privateKey, false);
52421
+ const uncompressedPubKey = import_secp256k114.secp256k1.getPublicKey(privateKey, false);
52419
52422
  const x = Array.from(uncompressedPubKey.slice(1, 33));
52420
52423
  const y = Array.from(uncompressedPubKey.slice(33, 65));
52421
52424
  return { x, y };
@@ -53243,7 +53246,7 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
53243
53246
  return Array.from(hash2);
53244
53247
  }
53245
53248
  getPublicKeyCoordinates(privateKey) {
53246
- const uncompressedPubKey = import_secp256k113.secp256k1.getPublicKey(privateKey, false);
53249
+ const uncompressedPubKey = import_secp256k114.secp256k1.getPublicKey(privateKey, false);
53247
53250
  const x = Array.from(uncompressedPubKey.slice(1, 33));
53248
53251
  const y = Array.from(uncompressedPubKey.slice(33, 65));
53249
53252
  return { x, y };