@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
- export { n as AccountError, A as AccountService, B as BlockchainProvider, o as CircuitName, j as Circuits, C as CommitmentService, m as ContractError, k as ContractInteractionsService, D as DataService, E as ErrorCode, I as InvalidRpcUrl, P as PrivacyPoolSDK, l as ProofError, S as SDKError, W as WithdrawalService, e as bigintToHash, f as bigintToHex, i as calculateContext, a as generateDepositSecrets, g as generateMasterKeys, d as generateMerkleProof, b as generateWithdrawalSecrets, c as getCommitment, h as hashPrecommitment } from './index-ynv4K_cq.js';
1
+ export { n as AccountError, A as AccountService, B as BlockchainProvider, o as CircuitName, j as Circuits, C as CommitmentService, m as ContractError, k as ContractInteractionsService, D as DataService, E as ErrorCode, I as InvalidRpcUrl, P as PrivacyPoolSDK, l as ProofError, S as SDKError, W as WithdrawalService, e as bigintToHash, f as bigintToHex, i as calculateContext, a as generateDepositSecrets, g as generateMasterKeys, d as generateMerkleProof, b as generateWithdrawalSecrets, c as getCommitment, h as hashPrecommitment } from './index-Bw-RoJy9.js';
2
2
  import 'viem/accounts';
3
3
  import 'buffer';
4
4
  import 'assert';
@@ -1,4 +1,4 @@
1
- import { F as FetchArtifact } from './index-BgfrdIiJ.js';
1
+ import { F as FetchArtifact } from './index-BogHNKL8.js';
2
2
  import 'viem/accounts';
3
3
  import 'buffer';
4
4
  import 'http';
@@ -32,4 +32,4 @@ async function fetchVersionedArtifact(artifactUrl) {
32
32
  }
33
33
 
34
34
  export { fetchVersionedArtifact };
35
- //# sourceMappingURL=fetchArtifacts.esm-aY2Tx1qe.js.map
35
+ //# sourceMappingURL=fetchArtifacts.esm-i9-c1RlE.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchArtifacts.esm-aY2Tx1qe.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-i9-c1RlE.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-BgfrdIiJ.js';
1
+ import { F as FetchArtifact } from './index-BogHNKL8.js';
2
2
  import 'viem/accounts';
3
3
  import 'buffer';
4
4
  import 'http';
@@ -45,4 +45,4 @@ async function fetchVersionedArtifact(artifactUrl) {
45
45
  }
46
46
 
47
47
  export { fetchVersionedArtifact };
48
- //# sourceMappingURL=fetchArtifacts.node-CF90z74C.js.map
48
+ //# sourceMappingURL=fetchArtifacts.node-C5OS73zV.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchArtifacts.node-CF90z74C.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-C5OS73zV.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;;;;"}
@@ -15082,19 +15082,10 @@ var __setModuleDefault = Object.create ? (function(o, v) {
15082
15082
  o["default"] = v;
15083
15083
  };
15084
15084
 
15085
- var ownKeys = function(o) {
15086
- ownKeys = Object.getOwnPropertyNames || function (o) {
15087
- var ar = [];
15088
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
15089
- return ar;
15090
- };
15091
- return ownKeys(o);
15092
- };
15093
-
15094
15085
  function __importStar(mod) {
15095
15086
  if (mod && mod.__esModule) return mod;
15096
15087
  var result = {};
15097
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
15088
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
15098
15089
  __setModuleDefault(result, mod);
15099
15090
  return result;
15100
15091
  }
@@ -15176,25 +15167,12 @@ function __disposeResources(env) {
15176
15167
  return next();
15177
15168
  }
15178
15169
 
15179
- function __rewriteRelativeImportExtension(path, preserveJsx) {
15180
- if (typeof path === "string" && /^\.\.?\//.test(path)) {
15181
- return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
15182
- return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
15183
- });
15184
- }
15185
- return path;
15186
- }
15187
-
15188
15170
  var tslib_es6 = {
15189
15171
  __extends: __extends,
15190
15172
  __assign: __assign,
15191
15173
  __rest: __rest,
15192
15174
  __decorate: __decorate,
15193
15175
  __param: __param,
15194
- __esDecorate: __esDecorate,
15195
- __runInitializers: __runInitializers,
15196
- __propKey: __propKey,
15197
- __setFunctionName: __setFunctionName,
15198
15176
  __metadata: __metadata,
15199
15177
  __awaiter: __awaiter,
15200
15178
  __generator: __generator,
@@ -15217,7 +15195,6 @@ var tslib_es6 = {
15217
15195
  __classPrivateFieldIn: __classPrivateFieldIn,
15218
15196
  __addDisposableResource: __addDisposableResource,
15219
15197
  __disposeResources: __disposeResources,
15220
- __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,
15221
15198
  };
15222
15199
 
15223
15200
  var tslib_es6$1 = /*#__PURE__*/Object.freeze({
@@ -15247,7 +15224,6 @@ var tslib_es6$1 = /*#__PURE__*/Object.freeze({
15247
15224
  __propKey: __propKey,
15248
15225
  __read: __read,
15249
15226
  __rest: __rest,
15250
- __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,
15251
15227
  __runInitializers: __runInitializers,
15252
15228
  __setFunctionName: __setFunctionName,
15253
15229
  __spread: __spread,
@@ -50363,9 +50339,9 @@ var hashingExports = requireHashing();
50363
50339
 
50364
50340
  /**
50365
50341
  * @module @zk-kit/utils
50366
- * @version 1.2.1
50342
+ * @version 1.4.1
50367
50343
  * @file Essential zero-knowledge utility library for JavaScript developers.
50368
- * @copyright Ethereum Foundation 2024
50344
+ * @copyright Ethereum Foundation 2025
50369
50345
  * @license MIT
50370
50346
  * @see [Github]{@link https://github.com/privacy-scaling-explorations/zk-kit/tree/main/packages/utils}
50371
50347
  */
@@ -50415,9 +50391,9 @@ function isArray(value) {
50415
50391
 
50416
50392
  /**
50417
50393
  * @module @zk-kit/utils
50418
- * @version 1.2.1
50394
+ * @version 1.4.1
50419
50395
  * @file Essential zero-knowledge utility library for JavaScript developers.
50420
- * @copyright Ethereum Foundation 2024
50396
+ * @copyright Ethereum Foundation 2025
50421
50397
  * @license MIT
50422
50398
  * @see [Github]{@link https://github.com/privacy-scaling-explorations/zk-kit/tree/main/packages/utils}
50423
50399
  */
@@ -50484,9 +50460,9 @@ function requireArray(parameterValue, parameterName) {
50484
50460
 
50485
50461
  /**
50486
50462
  * @module @zk-kit/lean-imt
50487
- * @version 2.2.2
50463
+ * @version 2.2.4
50488
50464
  * @file Lean Incremental Merkle tree implementation in TypeScript.
50489
- * @copyright Ethereum Foundation 2024
50465
+ * @copyright Ethereum Foundation 2025
50490
50466
  * @license MIT
50491
50467
  * @see [Github]{@link https://github.com/privacy-scaling-explorations/zk-kit/tree/main/packages/lean-imt}
50492
50468
  */
@@ -50617,7 +50593,7 @@ class LeanIMT {
50617
50593
  throw new Error("There are no leaves to add");
50618
50594
  }
50619
50595
  let startIndex = this.size >> 1;
50620
- this._nodes[0].push(...leaves);
50596
+ this._nodes[0] = this._nodes[0].concat(leaves);
50621
50597
  // Calculate how many tree levels will need to be added
50622
50598
  // using the number of leaves.
50623
50599
  const numberOfNewLevels = Math.ceil(Math.log2(this.size)) - this.depth;
@@ -50748,7 +50724,12 @@ class LeanIMT {
50748
50724
  }
50749
50725
  // The index might be different from the original index of the leaf, since
50750
50726
  // in some cases some siblings are not included (as explained above).
50751
- return { root: this.root, leaf, index: Number.parseInt(path.reverse().join(""), 2), siblings };
50727
+ return {
50728
+ root: this.root,
50729
+ leaf,
50730
+ index: path.length === 0 ? 0 : Number.parseInt(path.reverse().join(""), 2),
50731
+ siblings
50732
+ };
50752
50733
  }
50753
50734
  /**
50754
50735
  * It verifies a {@link LeanIMTMerkleProof} to confirm that a leaf indeed
@@ -51028,7 +51009,13 @@ class BlockchainProvider {
51028
51009
  }
51029
51010
  this.client = createPublicClient({
51030
51011
  chain: mainnet,
51031
- transport: http(rpcUrl),
51012
+ transport: http(rpcUrl, {
51013
+ timeout: 20_000, // 20 seconds timeout for RPC requests
51014
+ retryCount: 0, // Disable retries to prevent multiple timeout attempts
51015
+ fetchOptions: {
51016
+ signal: AbortSignal.timeout(20_000), // Explicit fetch timeout at 20 seconds
51017
+ },
51018
+ }),
51032
51019
  });
51033
51020
  }
51034
51021
  /** @inheritdoc */
@@ -51089,10 +51076,10 @@ const circuitToAsset = {
51089
51076
 
51090
51077
  async function importFetchVersionedArtifact(isBrowser) {
51091
51078
  if (isBrowser) {
51092
- return import('./fetchArtifacts.esm-aY2Tx1qe.js');
51079
+ return import('./fetchArtifacts.esm-i9-c1RlE.js');
51093
51080
  }
51094
51081
  else {
51095
- return import('./fetchArtifacts.node-CF90z74C.js');
51082
+ return import('./fetchArtifacts.node-C5OS73zV.js');
51096
51083
  }
51097
51084
  }
51098
51085
 
@@ -53254,12 +53241,24 @@ class ContractInteractionsService {
53254
53241
  this.account = privateKeyToAccount(accountPrivateKey);
53255
53242
  this.walletClient = createWalletClient({
53256
53243
  chain: chain,
53257
- transport: http(rpcUrl),
53244
+ transport: http(rpcUrl, {
53245
+ timeout: 20_000, // 20 seconds timeout for RPC requests
53246
+ retryCount: 0, // Disable retries to prevent multiple timeout attempts
53247
+ fetchOptions: {
53248
+ signal: AbortSignal.timeout(20_000), // Explicit fetch timeout at 20 seconds
53249
+ },
53250
+ }),
53258
53251
  account: this.account,
53259
53252
  });
53260
53253
  this.publicClient = createPublicClient({
53261
53254
  chain: chain,
53262
- transport: http(rpcUrl),
53255
+ transport: http(rpcUrl, {
53256
+ timeout: 20_000, // 20 seconds timeout for RPC requests
53257
+ retryCount: 0, // Disable retries to prevent multiple timeout attempts
53258
+ fetchOptions: {
53259
+ signal: AbortSignal.timeout(20_000), // Explicit fetch timeout at 20 seconds
53260
+ },
53261
+ }),
53263
53262
  });
53264
53263
  this.entrypointAddress = entrypointAddress;
53265
53264
  }
@@ -76446,7 +76445,7 @@ class AccountService {
76446
76445
  */
76447
76446
  constructor(dataService, config) {
76448
76447
  this.dataService = dataService;
76449
- this.logger = new Logger({ prefix: "Account", level: LogLevel.DEBUG });
76448
+ this.logger = new Logger({ prefix: "Account" });
76450
76449
  if ("mnemonic" in config) {
76451
76450
  this.account = this._initializeAccount(config.mnemonic);
76452
76451
  }
@@ -76780,7 +76779,11 @@ class AccountService {
76780
76779
  });
76781
76780
  const depositMap = new Map();
76782
76781
  for (const event of depositEvents) {
76783
- depositMap.set(event.precommitment, event);
76782
+ const existingEvent = depositMap.get(event.precommitment);
76783
+ // If no existing event, or current event is older (earlier block), use current event
76784
+ if (!existingEvent || event.blockNumber < existingEvent.blockNumber) {
76785
+ depositMap.set(event.precommitment, event);
76786
+ }
76784
76787
  }
76785
76788
  return depositMap;
76786
76789
  }
@@ -76882,7 +76885,7 @@ class AccountService {
76882
76885
  *
76883
76886
  */
76884
76887
  _processDepositEvents(scope, depositEvents) {
76885
- const MAX_CONSECUTIVE_MISSES = 10; // Large enough to avoid and tx failures
76888
+ const MAX_CONSECUTIVE_MISSES = 10; // Large enough to avoid tx failures
76886
76889
  const foundIndices = new Set();
76887
76890
  let consecutiveMisses = 0;
76888
76891
  for (let index = BigInt(0);; index++) {
@@ -77235,7 +77238,13 @@ class DataService {
77235
77238
  throw new Error(`Missing RPC URL for chain ${config.chainId}`);
77236
77239
  }
77237
77240
  const client = createPublicClient({
77238
- transport: http(config.rpcUrl),
77241
+ transport: http(config.rpcUrl, {
77242
+ timeout: 20_000, // 20 seconds timeout for RPC requests
77243
+ retryCount: 0, // Disable retries to prevent multiple timeout attempts
77244
+ fetchOptions: {
77245
+ signal: AbortSignal.timeout(20_000), // Explicit fetch timeout at 20 seconds
77246
+ },
77247
+ }),
77239
77248
  });
77240
77249
  this.clients.set(config.chainId, client);
77241
77250
  }
@@ -77411,4 +77420,4 @@ class DataService {
77411
77420
  }
77412
77421
 
77413
77422
  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 };
77414
- //# sourceMappingURL=index-BgfrdIiJ.js.map
77423
+ //# sourceMappingURL=index-BogHNKL8.js.map