@0xbow/privacy-pools-core-sdk 0.0.0-b21c14bf → 0.0.0-b21c14ef
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/esm/{fetchArtifacts.esm-5kCpsN7p.js → fetchArtifacts.esm-C_DNv-_D.js} +2 -2
- package/dist/esm/{fetchArtifacts.esm-5kCpsN7p.js.map → fetchArtifacts.esm-C_DNv-_D.js.map} +1 -1
- package/dist/esm/{fetchArtifacts.node-D3CgKqL6.js → fetchArtifacts.node-BBPNjgiT.js} +2 -2
- package/dist/esm/{fetchArtifacts.node-D3CgKqL6.js.map → fetchArtifacts.node-BBPNjgiT.js.map} +1 -1
- package/dist/esm/{index-D9IqqMR5.js → index-BxzIe_IR.js} +29 -69
- package/dist/esm/{index-D9IqqMR5.js.map → index-BxzIe_IR.js.map} +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/index.d.mts +6 -4
- package/dist/node/{fetchArtifacts.esm-QtpnYcTh.js → fetchArtifacts.esm-l-EDo53-.js} +2 -2
- package/dist/node/{fetchArtifacts.esm-QtpnYcTh.js.map → fetchArtifacts.esm-l-EDo53-.js.map} +1 -1
- package/dist/node/{fetchArtifacts.node-D1sU9ZdL.js → fetchArtifacts.node-DYwQHSF4.js} +2 -2
- package/dist/node/{fetchArtifacts.node-D1sU9ZdL.js.map → fetchArtifacts.node-DYwQHSF4.js.map} +1 -1
- package/dist/node/{index-B_UiKjJz.js → index-DGsIfUGw.js} +43 -19
- package/dist/node/index-DGsIfUGw.js.map +1 -0
- package/dist/node/index.mjs +1 -1
- package/dist/types/core/account.service.d.ts +6 -4
- package/dist/types/{fetchArtifacts.esm-D3oModKG.js → fetchArtifacts.esm-IMTIZwq7.js} +1 -1
- package/dist/types/{fetchArtifacts.node-sWEfGPaK.js → fetchArtifacts.node-BcXsBNCT.js} +1 -1
- package/dist/types/{index-BAX9sc8V.js → index-DbuAhDci.js} +42 -18
- package/dist/types/index.js +1 -1
- package/package.json +1 -1
- package/src/core/account.service.ts +27 -54
- package/src/core/contracts.service.ts +2 -6
- package/src/providers/blockchainProvider.ts +1 -3
- package/dist/node/index-B_UiKjJz.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FetchArtifact } from './index-
|
|
1
|
+
import { F as FetchArtifact } from './index-BxzIe_IR.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-
|
|
18
|
+
//# sourceMappingURL=fetchArtifacts.esm-C_DNv-_D.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchArtifacts.esm-
|
|
1
|
+
{"version":3,"file":"fetchArtifacts.esm-C_DNv-_D.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-
|
|
1
|
+
import { F as FetchArtifact } from './index-BxzIe_IR.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-
|
|
31
|
+
//# sourceMappingURL=fetchArtifacts.node-BBPNjgiT.js.map
|
package/dist/esm/{fetchArtifacts.node-D3CgKqL6.js.map → fetchArtifacts.node-BBPNjgiT.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchArtifacts.node-
|
|
1
|
+
{"version":3,"file":"fetchArtifacts.node-BBPNjgiT.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;;;;"}
|
|
@@ -45742,9 +45742,7 @@ class BlockchainProvider {
|
|
|
45742
45742
|
}
|
|
45743
45743
|
this.client = createPublicClient({
|
|
45744
45744
|
chain: mainnet,
|
|
45745
|
-
transport: http(rpcUrl,
|
|
45746
|
-
timeout: 20_000,
|
|
45747
|
-
}),
|
|
45745
|
+
transport: http(rpcUrl),
|
|
45748
45746
|
});
|
|
45749
45747
|
}
|
|
45750
45748
|
/** @inheritdoc */
|
|
@@ -45805,10 +45803,10 @@ const circuitToAsset = {
|
|
|
45805
45803
|
|
|
45806
45804
|
async function importFetchVersionedArtifact(isBrowser) {
|
|
45807
45805
|
if (isBrowser) {
|
|
45808
|
-
return import('./fetchArtifacts.esm-
|
|
45806
|
+
return import('./fetchArtifacts.esm-C_DNv-_D.js');
|
|
45809
45807
|
}
|
|
45810
45808
|
else {
|
|
45811
|
-
return import('./fetchArtifacts.node-
|
|
45809
|
+
return import('./fetchArtifacts.node-BBPNjgiT.js');
|
|
45812
45810
|
}
|
|
45813
45811
|
}
|
|
45814
45812
|
|
|
@@ -47970,16 +47968,12 @@ class ContractInteractionsService {
|
|
|
47970
47968
|
this.account = privateKeyToAccount(accountPrivateKey);
|
|
47971
47969
|
this.walletClient = createWalletClient({
|
|
47972
47970
|
chain: chain,
|
|
47973
|
-
transport: http(rpcUrl,
|
|
47974
|
-
timeout: 20_000,
|
|
47975
|
-
}),
|
|
47971
|
+
transport: http(rpcUrl),
|
|
47976
47972
|
account: this.account,
|
|
47977
47973
|
});
|
|
47978
47974
|
this.publicClient = createPublicClient({
|
|
47979
47975
|
chain: chain,
|
|
47980
|
-
transport: http(rpcUrl,
|
|
47981
|
-
timeout: 20_000,
|
|
47982
|
-
}),
|
|
47976
|
+
transport: http(rpcUrl),
|
|
47983
47977
|
});
|
|
47984
47978
|
this.entrypointAddress = entrypointAddress;
|
|
47985
47979
|
}
|
|
@@ -69801,71 +69795,43 @@ class AccountService {
|
|
|
69801
69795
|
* @param maxConcurrency - Maximum number of concurrent pool fetches (default: 5)
|
|
69802
69796
|
*
|
|
69803
69797
|
* @returns A map of pool scopes to their events
|
|
69804
|
-
*
|
|
69805
|
-
* @remarks
|
|
69806
|
-
* This method uses batched concurrency to prevent overwhelming RPC endpoints.
|
|
69807
|
-
* Only `maxConcurrency` pools will be fetched at a time, with each batch
|
|
69808
|
-
* completing before the next batch starts.
|
|
69809
69798
|
*/
|
|
69810
69799
|
async getEvents(pools, maxConcurrency = 5) {
|
|
69811
69800
|
const events = new Map();
|
|
69812
|
-
// Create tasks for
|
|
69801
|
+
// Create tasks for batched execution
|
|
69813
69802
|
const tasks = pools.map((pool) => async () => {
|
|
69814
69803
|
this.logger.info(`Fetching events for pool`, {
|
|
69815
69804
|
poolAddress: pool.address,
|
|
69816
69805
|
poolChainId: pool.chainId,
|
|
69817
69806
|
poolDeploymentBlock: pool.deploymentBlock,
|
|
69818
69807
|
});
|
|
69819
|
-
|
|
69820
|
-
|
|
69821
|
-
|
|
69822
|
-
|
|
69823
|
-
|
|
69824
|
-
|
|
69825
|
-
|
|
69826
|
-
|
|
69827
|
-
|
|
69828
|
-
|
|
69829
|
-
|
|
69830
|
-
ragequitEvents,
|
|
69831
|
-
};
|
|
69832
|
-
}
|
|
69833
|
-
catch (error) {
|
|
69834
|
-
// Capture the error and associate it with the pool scope
|
|
69835
|
-
return {
|
|
69836
|
-
success: false,
|
|
69837
|
-
scope: pool.scope,
|
|
69838
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
69839
|
-
};
|
|
69840
|
-
}
|
|
69808
|
+
const [depositEvents, withdrawalEvents, ragequitEvents] = await Promise.all([
|
|
69809
|
+
this.getDepositEvents(pool),
|
|
69810
|
+
this.getWithdrawalEvents(pool),
|
|
69811
|
+
this.getRagequitEvents(pool),
|
|
69812
|
+
]);
|
|
69813
|
+
return {
|
|
69814
|
+
scope: pool.scope,
|
|
69815
|
+
depositEvents,
|
|
69816
|
+
withdrawalEvents,
|
|
69817
|
+
ragequitEvents,
|
|
69818
|
+
};
|
|
69841
69819
|
});
|
|
69842
|
-
// Execute
|
|
69820
|
+
// Execute with concurrency control
|
|
69843
69821
|
const poolEventResults = await batchWithConcurrency(tasks, maxConcurrency);
|
|
69844
69822
|
for (const result of poolEventResults) {
|
|
69845
69823
|
if (result.status === "fulfilled") {
|
|
69846
|
-
const
|
|
69847
|
-
|
|
69848
|
-
|
|
69849
|
-
|
|
69850
|
-
|
|
69851
|
-
|
|
69852
|
-
});
|
|
69853
|
-
}
|
|
69854
|
-
else {
|
|
69855
|
-
// Handle error case
|
|
69856
|
-
this.logger.error(`Failed to fetch events for pool with scope ${value.scope}`, {
|
|
69857
|
-
error: value.error.message,
|
|
69858
|
-
});
|
|
69859
|
-
events.set(value.scope, {
|
|
69860
|
-
reason: value.error.message,
|
|
69861
|
-
scope: value.scope,
|
|
69862
|
-
});
|
|
69863
|
-
}
|
|
69824
|
+
const { scope, depositEvents, withdrawalEvents, ragequitEvents } = result.value;
|
|
69825
|
+
events.set(scope, {
|
|
69826
|
+
depositEvents,
|
|
69827
|
+
withdrawalEvents,
|
|
69828
|
+
ragequitEvents,
|
|
69829
|
+
});
|
|
69864
69830
|
}
|
|
69865
69831
|
else {
|
|
69866
|
-
|
|
69867
|
-
|
|
69868
|
-
|
|
69832
|
+
events.set(result.reason.details?.scope, {
|
|
69833
|
+
reason: result.reason.message,
|
|
69834
|
+
scope: result.reason.details?.scope,
|
|
69869
69835
|
});
|
|
69870
69836
|
}
|
|
69871
69837
|
}
|
|
@@ -70000,9 +69966,6 @@ class AccountService {
|
|
|
70000
69966
|
* 3. Processes withdrawal events and adds commitments to pool accounts
|
|
70001
69967
|
* 4. Processes ragequit events and adds ragequit to pool accounts
|
|
70002
69968
|
*
|
|
70003
|
-
* Concurrency control prevents overwhelming RPC endpoints by limiting the number of
|
|
70004
|
-
* simultaneous requests. Only `maxConcurrency` pools will be fetched at a time.
|
|
70005
|
-
*
|
|
70006
69969
|
* @returns The initialized AccountService instance and array of errors if any pool events fetching fails
|
|
70007
69970
|
*
|
|
70008
69971
|
* if any pool events fetching fails, the account will be initialized without the events for that pool
|
|
@@ -70013,10 +69976,7 @@ class AccountService {
|
|
|
70013
69976
|
static async initializeWithEvents(dataService, source, pools, maxConcurrency = 5) {
|
|
70014
69977
|
// Log the start of the history retrieval process
|
|
70015
69978
|
const logger = new Logger({ prefix: "Account" });
|
|
70016
|
-
logger.info(`Fetching events for pools
|
|
70017
|
-
poolLength: pools.length,
|
|
70018
|
-
maxConcurrency
|
|
70019
|
-
});
|
|
69979
|
+
logger.info(`Fetching events for pools`, { poolLength: pools.length });
|
|
70020
69980
|
// verify that pools don't contain duplicates based on scope
|
|
70021
69981
|
const uniqueScopes = new Set();
|
|
70022
69982
|
for (const pool of pools) {
|
|
@@ -70418,4 +70378,4 @@ class DataService {
|
|
|
70418
70378
|
}
|
|
70419
70379
|
|
|
70420
70380
|
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 };
|
|
70421
|
-
//# sourceMappingURL=index-
|
|
70381
|
+
//# sourceMappingURL=index-BxzIe_IR.js.map
|