@0xbow/privacy-pools-core-sdk 0.0.0-c42a71a3 → 0.0.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 (25) hide show
  1. package/dist/esm/{fetchArtifacts.esm-DhinGr0a.js → fetchArtifacts.esm-TV4yMbDL.js} +2 -2
  2. package/dist/esm/{fetchArtifacts.esm-DhinGr0a.js.map → fetchArtifacts.esm-TV4yMbDL.js.map} +1 -1
  3. package/dist/esm/{fetchArtifacts.node-BarT-ack.js → fetchArtifacts.node-DC_rCgt3.js} +2 -2
  4. package/dist/esm/{fetchArtifacts.node-BarT-ack.js.map → fetchArtifacts.node-DC_rCgt3.js.map} +1 -1
  5. package/dist/esm/{index-ynv4K_cq.js → index-Bw-RoJy9.js} +52 -43
  6. package/dist/esm/index-Bw-RoJy9.js.map +1 -0
  7. package/dist/esm/index.mjs +1 -1
  8. package/dist/node/{fetchArtifacts.esm-aY2Tx1qe.js → fetchArtifacts.esm-i9-c1RlE.js} +2 -2
  9. package/dist/node/{fetchArtifacts.esm-aY2Tx1qe.js.map → fetchArtifacts.esm-i9-c1RlE.js.map} +1 -1
  10. package/dist/node/{fetchArtifacts.node-CF90z74C.js → fetchArtifacts.node-C5OS73zV.js} +2 -2
  11. package/dist/node/{fetchArtifacts.node-CF90z74C.js.map → fetchArtifacts.node-C5OS73zV.js.map} +1 -1
  12. package/dist/node/{index-BgfrdIiJ.js → index-BogHNKL8.js} +52 -43
  13. package/dist/node/index-BogHNKL8.js.map +1 -0
  14. package/dist/node/index.mjs +1 -1
  15. package/dist/types/{fetchArtifacts.esm-s8imnxFN.js → fetchArtifacts.esm-CwvN5XjW.js} +1 -1
  16. package/dist/types/{fetchArtifacts.node-BwpGMlwi.js → fetchArtifacts.node-VEzDC3k8.js} +1 -1
  17. package/dist/types/{index-BZkN1dA8.js → index-CPuQ9H-0.js} +51 -42
  18. package/dist/types/index.js +1 -1
  19. package/package.json +1 -1
  20. package/src/core/account.service.ts +8 -4
  21. package/src/core/contracts.service.ts +14 -2
  22. package/src/core/data.service.ts +12 -6
  23. package/src/providers/blockchainProvider.ts +7 -1
  24. package/dist/esm/index-ynv4K_cq.js.map +0 -1
  25. package/dist/node/index-BgfrdIiJ.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { F as FetchArtifact } from './index-ynv4K_cq.js';
1
+ import { F as FetchArtifact } from './index-Bw-RoJy9.js';
2
2
  import 'viem/accounts';
3
3
  import 'buffer';
4
4
  import 'assert';
@@ -15,4 +15,4 @@ async function fetchVersionedArtifact(artifactUrl) {
15
15
  }
16
16
 
17
17
  export { fetchVersionedArtifact };
18
- //# sourceMappingURL=fetchArtifacts.esm-DhinGr0a.js.map
18
+ //# sourceMappingURL=fetchArtifacts.esm-TV4yMbDL.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchArtifacts.esm-DhinGr0a.js","sources":["../../src/circuits/fetchArtifacts.esm.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAEO,eAAe,sBAAsB,CAC1C,WAAgB,EAAA;AAEhB,IAAA,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC;AACpC,IAAA,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;AACtB,QAAA,MAAM,IAAI,aAAa,CAAC,WAAW,CAAC;;AAEtC,IAAA,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,WAAW,EAAE;AACpC,IAAA,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC;AAC7B;;;;"}
1
+ {"version":3,"file":"fetchArtifacts.esm-TV4yMbDL.js","sources":["../../src/circuits/fetchArtifacts.esm.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAEO,eAAe,sBAAsB,CAC1C,WAAgB,EAAA;AAEhB,IAAA,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC;AACpC,IAAA,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;AACtB,QAAA,MAAM,IAAI,aAAa,CAAC,WAAW,CAAC;;AAEtC,IAAA,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,WAAW,EAAE;AACpC,IAAA,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC;AAC7B;;;;"}
@@ -1,4 +1,4 @@
1
- import { F as FetchArtifact } from './index-ynv4K_cq.js';
1
+ import { F as FetchArtifact } from './index-Bw-RoJy9.js';
2
2
  import 'viem/accounts';
3
3
  import 'buffer';
4
4
  import 'assert';
@@ -28,4 +28,4 @@ async function fetchVersionedArtifact(artifactUrl) {
28
28
  }
29
29
 
30
30
  export { fetchVersionedArtifact };
31
- //# sourceMappingURL=fetchArtifacts.node-BarT-ack.js.map
31
+ //# sourceMappingURL=fetchArtifacts.node-DC_rCgt3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchArtifacts.node-BarT-ack.js","sources":["../../src/circuits/fetchArtifacts.node.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAEO,eAAe,sBAAsB,CAC1C,WAAgB,EAAA;AAEhB,IAAA,IAAI;QACF,MAAM,EAAE,GAAG,CAAC,MAAM,OAAO,IAAI,CAAC,EAAE,OAAO;QACvC,MAAM,WAAW,GAAoB,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;AACnE,YAAA,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,IAAI,KAAI;gBAC9C,IAAI,GAAG,EAAE;oBACP,MAAM,CAAC,GAAG,CAAC;;qBACN;oBACL,OAAO,CAAC,IAAI,CAAC;;AAEjB,aAAC,CAAC;AACJ,SAAC,CAAC;AACF,QAAA,MAAM,GAAG,GAAG,MAAM,WAAW;AAC7B,QAAA,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC;;IAC1B,OAAO,KAAK,EAAE;AACd,QAAA,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;AACpB,QAAA,MAAM,IAAI,aAAa,CAAC,WAAW,CAAC;;AAExC;;;;"}
1
+ {"version":3,"file":"fetchArtifacts.node-DC_rCgt3.js","sources":["../../src/circuits/fetchArtifacts.node.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAEO,eAAe,sBAAsB,CAC1C,WAAgB,EAAA;AAEhB,IAAA,IAAI;QACF,MAAM,EAAE,GAAG,CAAC,MAAM,OAAO,IAAI,CAAC,EAAE,OAAO;QACvC,MAAM,WAAW,GAAoB,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;AACnE,YAAA,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,IAAI,KAAI;gBAC9C,IAAI,GAAG,EAAE;oBACP,MAAM,CAAC,GAAG,CAAC;;qBACN;oBACL,OAAO,CAAC,IAAI,CAAC;;AAEjB,aAAC,CAAC;AACJ,SAAC,CAAC;AACF,QAAA,MAAM,GAAG,GAAG,MAAM,WAAW;AAC7B,QAAA,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC;;IAC1B,OAAO,KAAK,EAAE;AACd,QAAA,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;AACpB,QAAA,MAAM,IAAI,aAAa,CAAC,WAAW,CAAC;;AAExC;;;;"}
@@ -15061,19 +15061,10 @@ var __setModuleDefault = Object.create ? (function(o, v) {
15061
15061
  o["default"] = v;
15062
15062
  };
15063
15063
 
15064
- var ownKeys = function(o) {
15065
- ownKeys = Object.getOwnPropertyNames || function (o) {
15066
- var ar = [];
15067
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
15068
- return ar;
15069
- };
15070
- return ownKeys(o);
15071
- };
15072
-
15073
15064
  function __importStar(mod) {
15074
15065
  if (mod && mod.__esModule) return mod;
15075
15066
  var result = {};
15076
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
15067
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
15077
15068
  __setModuleDefault(result, mod);
15078
15069
  return result;
15079
15070
  }
@@ -15155,25 +15146,12 @@ function __disposeResources(env) {
15155
15146
  return next();
15156
15147
  }
15157
15148
 
15158
- function __rewriteRelativeImportExtension(path, preserveJsx) {
15159
- if (typeof path === "string" && /^\.\.?\//.test(path)) {
15160
- return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
15161
- return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
15162
- });
15163
- }
15164
- return path;
15165
- }
15166
-
15167
15149
  var tslib_es6 = {
15168
15150
  __extends: __extends,
15169
15151
  __assign: __assign,
15170
15152
  __rest: __rest,
15171
15153
  __decorate: __decorate,
15172
15154
  __param: __param,
15173
- __esDecorate: __esDecorate,
15174
- __runInitializers: __runInitializers,
15175
- __propKey: __propKey,
15176
- __setFunctionName: __setFunctionName,
15177
15155
  __metadata: __metadata,
15178
15156
  __awaiter: __awaiter,
15179
15157
  __generator: __generator,
@@ -15196,7 +15174,6 @@ var tslib_es6 = {
15196
15174
  __classPrivateFieldIn: __classPrivateFieldIn,
15197
15175
  __addDisposableResource: __addDisposableResource,
15198
15176
  __disposeResources: __disposeResources,
15199
- __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,
15200
15177
  };
15201
15178
 
15202
15179
  var tslib_es6$1 = /*#__PURE__*/Object.freeze({
@@ -15226,7 +15203,6 @@ var tslib_es6$1 = /*#__PURE__*/Object.freeze({
15226
15203
  __propKey: __propKey,
15227
15204
  __read: __read,
15228
15205
  __rest: __rest,
15229
- __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,
15230
15206
  __runInitializers: __runInitializers,
15231
15207
  __setFunctionName: __setFunctionName,
15232
15208
  __spread: __spread,
@@ -45096,9 +45072,9 @@ var hashingExports = requireHashing();
45096
45072
 
45097
45073
  /**
45098
45074
  * @module @zk-kit/utils
45099
- * @version 1.2.1
45075
+ * @version 1.4.1
45100
45076
  * @file Essential zero-knowledge utility library for JavaScript developers.
45101
- * @copyright Ethereum Foundation 2024
45077
+ * @copyright Ethereum Foundation 2025
45102
45078
  * @license MIT
45103
45079
  * @see [Github]{@link https://github.com/privacy-scaling-explorations/zk-kit/tree/main/packages/utils}
45104
45080
  */
@@ -45148,9 +45124,9 @@ function isArray(value) {
45148
45124
 
45149
45125
  /**
45150
45126
  * @module @zk-kit/utils
45151
- * @version 1.2.1
45127
+ * @version 1.4.1
45152
45128
  * @file Essential zero-knowledge utility library for JavaScript developers.
45153
- * @copyright Ethereum Foundation 2024
45129
+ * @copyright Ethereum Foundation 2025
45154
45130
  * @license MIT
45155
45131
  * @see [Github]{@link https://github.com/privacy-scaling-explorations/zk-kit/tree/main/packages/utils}
45156
45132
  */
@@ -45217,9 +45193,9 @@ function requireArray(parameterValue, parameterName) {
45217
45193
 
45218
45194
  /**
45219
45195
  * @module @zk-kit/lean-imt
45220
- * @version 2.2.2
45196
+ * @version 2.2.4
45221
45197
  * @file Lean Incremental Merkle tree implementation in TypeScript.
45222
- * @copyright Ethereum Foundation 2024
45198
+ * @copyright Ethereum Foundation 2025
45223
45199
  * @license MIT
45224
45200
  * @see [Github]{@link https://github.com/privacy-scaling-explorations/zk-kit/tree/main/packages/lean-imt}
45225
45201
  */
@@ -45350,7 +45326,7 @@ class LeanIMT {
45350
45326
  throw new Error("There are no leaves to add");
45351
45327
  }
45352
45328
  let startIndex = this.size >> 1;
45353
- this._nodes[0].push(...leaves);
45329
+ this._nodes[0] = this._nodes[0].concat(leaves);
45354
45330
  // Calculate how many tree levels will need to be added
45355
45331
  // using the number of leaves.
45356
45332
  const numberOfNewLevels = Math.ceil(Math.log2(this.size)) - this.depth;
@@ -45481,7 +45457,12 @@ class LeanIMT {
45481
45457
  }
45482
45458
  // The index might be different from the original index of the leaf, since
45483
45459
  // in some cases some siblings are not included (as explained above).
45484
- return { root: this.root, leaf, index: Number.parseInt(path.reverse().join(""), 2), siblings };
45460
+ return {
45461
+ root: this.root,
45462
+ leaf,
45463
+ index: path.length === 0 ? 0 : Number.parseInt(path.reverse().join(""), 2),
45464
+ siblings
45465
+ };
45485
45466
  }
45486
45467
  /**
45487
45468
  * It verifies a {@link LeanIMTMerkleProof} to confirm that a leaf indeed
@@ -45761,7 +45742,13 @@ class BlockchainProvider {
45761
45742
  }
45762
45743
  this.client = createPublicClient({
45763
45744
  chain: mainnet,
45764
- transport: http(rpcUrl),
45745
+ transport: http(rpcUrl, {
45746
+ timeout: 20_000, // 20 seconds timeout for RPC requests
45747
+ retryCount: 0, // Disable retries to prevent multiple timeout attempts
45748
+ fetchOptions: {
45749
+ signal: AbortSignal.timeout(20_000), // Explicit fetch timeout at 20 seconds
45750
+ },
45751
+ }),
45765
45752
  });
45766
45753
  }
45767
45754
  /** @inheritdoc */
@@ -45822,10 +45809,10 @@ const circuitToAsset = {
45822
45809
 
45823
45810
  async function importFetchVersionedArtifact(isBrowser) {
45824
45811
  if (isBrowser) {
45825
- return import('./fetchArtifacts.esm-DhinGr0a.js');
45812
+ return import('./fetchArtifacts.esm-TV4yMbDL.js');
45826
45813
  }
45827
45814
  else {
45828
- return import('./fetchArtifacts.node-BarT-ack.js');
45815
+ return import('./fetchArtifacts.node-DC_rCgt3.js');
45829
45816
  }
45830
45817
  }
45831
45818
 
@@ -47987,12 +47974,24 @@ class ContractInteractionsService {
47987
47974
  this.account = privateKeyToAccount(accountPrivateKey);
47988
47975
  this.walletClient = createWalletClient({
47989
47976
  chain: chain,
47990
- transport: http(rpcUrl),
47977
+ transport: http(rpcUrl, {
47978
+ timeout: 20_000, // 20 seconds timeout for RPC requests
47979
+ retryCount: 0, // Disable retries to prevent multiple timeout attempts
47980
+ fetchOptions: {
47981
+ signal: AbortSignal.timeout(20_000), // Explicit fetch timeout at 20 seconds
47982
+ },
47983
+ }),
47991
47984
  account: this.account,
47992
47985
  });
47993
47986
  this.publicClient = createPublicClient({
47994
47987
  chain: chain,
47995
- transport: http(rpcUrl),
47988
+ transport: http(rpcUrl, {
47989
+ timeout: 20_000, // 20 seconds timeout for RPC requests
47990
+ retryCount: 0, // Disable retries to prevent multiple timeout attempts
47991
+ fetchOptions: {
47992
+ signal: AbortSignal.timeout(20_000), // Explicit fetch timeout at 20 seconds
47993
+ },
47994
+ }),
47996
47995
  });
47997
47996
  this.entrypointAddress = entrypointAddress;
47998
47997
  }
@@ -69396,7 +69395,7 @@ class AccountService {
69396
69395
  */
69397
69396
  constructor(dataService, config) {
69398
69397
  this.dataService = dataService;
69399
- this.logger = new Logger({ prefix: "Account", level: LogLevel.DEBUG });
69398
+ this.logger = new Logger({ prefix: "Account" });
69400
69399
  if ("mnemonic" in config) {
69401
69400
  this.account = this._initializeAccount(config.mnemonic);
69402
69401
  }
@@ -69730,7 +69729,11 @@ class AccountService {
69730
69729
  });
69731
69730
  const depositMap = new Map();
69732
69731
  for (const event of depositEvents) {
69733
- depositMap.set(event.precommitment, event);
69732
+ const existingEvent = depositMap.get(event.precommitment);
69733
+ // If no existing event, or current event is older (earlier block), use current event
69734
+ if (!existingEvent || event.blockNumber < existingEvent.blockNumber) {
69735
+ depositMap.set(event.precommitment, event);
69736
+ }
69734
69737
  }
69735
69738
  return depositMap;
69736
69739
  }
@@ -69832,7 +69835,7 @@ class AccountService {
69832
69835
  *
69833
69836
  */
69834
69837
  _processDepositEvents(scope, depositEvents) {
69835
- const MAX_CONSECUTIVE_MISSES = 10; // Large enough to avoid and tx failures
69838
+ const MAX_CONSECUTIVE_MISSES = 10; // Large enough to avoid tx failures
69836
69839
  const foundIndices = new Set();
69837
69840
  let consecutiveMisses = 0;
69838
69841
  for (let index = BigInt(0);; index++) {
@@ -70185,7 +70188,13 @@ class DataService {
70185
70188
  throw new Error(`Missing RPC URL for chain ${config.chainId}`);
70186
70189
  }
70187
70190
  const client = createPublicClient({
70188
- transport: http(config.rpcUrl),
70191
+ transport: http(config.rpcUrl, {
70192
+ timeout: 20_000, // 20 seconds timeout for RPC requests
70193
+ retryCount: 0, // Disable retries to prevent multiple timeout attempts
70194
+ fetchOptions: {
70195
+ signal: AbortSignal.timeout(20_000), // Explicit fetch timeout at 20 seconds
70196
+ },
70197
+ }),
70189
70198
  });
70190
70199
  this.clients.set(config.chainId, client);
70191
70200
  }
@@ -70361,4 +70370,4 @@ class DataService {
70361
70370
  }
70362
70371
 
70363
70372
  export { AccountService as A, BlockchainProvider as B, CommitmentService as C, DataService as D, ErrorCode as E, FetchArtifact as F, InvalidRpcUrl as I, PrivacyPoolSDK as P, SDKError as S, WithdrawalService as W, generateDepositSecrets as a, generateWithdrawalSecrets as b, getCommitment as c, generateMerkleProof as d, bigintToHash as e, bigintToHex as f, generateMasterKeys as g, hashPrecommitment as h, calculateContext as i, Circuits as j, ContractInteractionsService as k, ProofError as l, ContractError as m, AccountError as n, CircuitName as o };
70364
- //# sourceMappingURL=index-ynv4K_cq.js.map
70373
+ //# sourceMappingURL=index-Bw-RoJy9.js.map