@0xbow/privacy-pools-core-sdk 1.0.4 → 1.1.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/esm/{fetchArtifacts.esm-C_DNv-_D.js → fetchArtifacts.esm-B6qveiM8.js} +2 -2
- package/dist/esm/{fetchArtifacts.esm-C_DNv-_D.js.map → fetchArtifacts.esm-B6qveiM8.js.map} +1 -1
- package/dist/esm/{fetchArtifacts.node-BBPNjgiT.js → fetchArtifacts.node-BPQQPsnb.js} +2 -2
- package/dist/esm/{fetchArtifacts.node-BBPNjgiT.js.map → fetchArtifacts.node-BPQQPsnb.js.map} +1 -1
- package/dist/esm/{index-BxzIe_IR.js → index-CRtEyHEf.js} +2884 -107
- package/dist/esm/index-CRtEyHEf.js.map +1 -0
- package/dist/esm/index.mjs +1 -1
- package/dist/index.d.mts +87 -14
- package/dist/node/{fetchArtifacts.esm-l-EDo53-.js → fetchArtifacts.esm-z-KXbilc.js} +2 -2
- package/dist/node/{fetchArtifacts.esm-l-EDo53-.js.map → fetchArtifacts.esm-z-KXbilc.js.map} +1 -1
- package/dist/node/{fetchArtifacts.node-DYwQHSF4.js → fetchArtifacts.node-DvqhqpW9.js} +2 -2
- package/dist/node/{fetchArtifacts.node-DYwQHSF4.js.map → fetchArtifacts.node-DvqhqpW9.js.map} +1 -1
- package/dist/node/{index-DGsIfUGw.js → index-BsmEKESv.js} +2884 -107
- package/dist/node/index-BsmEKESv.js.map +1 -0
- package/dist/node/index.mjs +1 -1
- package/dist/types/core/account.service.d.ts +8 -6
- package/dist/types/core/data.service.d.ts +28 -8
- package/dist/types/{fetchArtifacts.esm-IMTIZwq7.js → fetchArtifacts.esm-DF01Zpo3.js} +1 -1
- package/dist/types/{fetchArtifacts.node-BcXsBNCT.js → fetchArtifacts.node-BO6FBCAw.js} +1 -1
- package/dist/types/{index-DbuAhDci.js → index-CH7gk4sK.js} +2883 -106
- package/dist/types/index.js +1 -1
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/rateLimit.d.ts +51 -0
- package/package.json +4 -2
- package/src/core/account.service.ts +52 -39
- package/src/core/data.service.ts +324 -95
- package/src/types/index.ts +1 -0
- package/src/types/rateLimit.ts +66 -0
- package/dist/esm/index-BxzIe_IR.js.map +0 -1
- package/dist/node/index-DGsIfUGw.js.map +0 -1
- package/dist/types/utils/concurrency.d.ts +0 -15
- package/src/utils/concurrency.ts +0 -32
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Executes an array of promise-returning functions with a maximum concurrency limit.
|
|
3
|
-
* This prevents overwhelming RPC endpoints with too many concurrent requests.
|
|
4
|
-
*
|
|
5
|
-
* @param tasks - Array of functions that return promises
|
|
6
|
-
* @param maxConcurrency - Maximum number of concurrent executions (default: 5)
|
|
7
|
-
* @returns Promise that resolves to an array of settled results
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* const tasks = pools.map(pool => () => fetchPoolData(pool));
|
|
12
|
-
* const results = await batchWithConcurrency(tasks, 5);
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export declare function batchWithConcurrency<T>(tasks: (() => Promise<T>)[], maxConcurrency?: number): Promise<PromiseSettledResult<T>[]>;
|
package/src/utils/concurrency.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Executes an array of promise-returning functions with a maximum concurrency limit.
|
|
3
|
-
* This prevents overwhelming RPC endpoints with too many concurrent requests.
|
|
4
|
-
*
|
|
5
|
-
* @param tasks - Array of functions that return promises
|
|
6
|
-
* @param maxConcurrency - Maximum number of concurrent executions (default: 5)
|
|
7
|
-
* @returns Promise that resolves to an array of settled results
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* const tasks = pools.map(pool => () => fetchPoolData(pool));
|
|
12
|
-
* const results = await batchWithConcurrency(tasks, 5);
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export async function batchWithConcurrency<T>(
|
|
16
|
-
tasks: (() => Promise<T>)[],
|
|
17
|
-
maxConcurrency: number = 5
|
|
18
|
-
): Promise<PromiseSettledResult<T>[]> {
|
|
19
|
-
const results: PromiseSettledResult<T>[] = [];
|
|
20
|
-
|
|
21
|
-
// Process tasks in batches
|
|
22
|
-
for (let i = 0; i < tasks.length; i += maxConcurrency) {
|
|
23
|
-
const batch = tasks.slice(i, i + maxConcurrency);
|
|
24
|
-
const batchResults = await Promise.allSettled(
|
|
25
|
-
batch.map(task => task())
|
|
26
|
-
);
|
|
27
|
-
results.push(...batchResults);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return results;
|
|
31
|
-
}
|
|
32
|
-
|