@woof-software/contracts-tools-sdk-ethers 0.0.19 → 0.0.21
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/lib/config.d.ts
CHANGED
package/lib/config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_LOGS_BLOCKS_STEP, DEFAULT_LOGS_DELAY_MS, DEFAULT_MULTICALL_ALLOW_FAILURE, DEFAULT_MULTICALL_BATCH_DELAY_MS, DEFAULT_MULTICALL_MUTABLE_CALLS_BATCH_LIMIT, DEFAULT_MULTICALL_STATIC_CALLS_BATCH_LIMIT, DEFAULT_MULTICALL_WAIT_FOR_TXS, DEFAULT_MUTABLE_CALLS_TIMEOUT_MS, DEFAULT_PRIORITY_CALL_MULTIPLIER, DEFAULT_STATIC_CALLS_TIMEOUT_MS, DEFAULT_WAIT_CALLS_TIMEOUT_MS, MULTICALL_ADDRESS, } from "./constant.js";
|
|
1
|
+
import { DEFAULT_LOGS_BLOCKS_STEP, DEFAULT_LOGS_DELAY_MS, DEFAULT_MULTICALL_ALLOW_FAILURE, DEFAULT_MULTICALL_ASYNC_READ_BATCHES, DEFAULT_MULTICALL_BATCH_DELAY_MS, DEFAULT_MULTICALL_MUTABLE_CALLS_BATCH_LIMIT, DEFAULT_MULTICALL_STATIC_CALLS_BATCH_LIMIT, DEFAULT_MULTICALL_WAIT_FOR_TXS, DEFAULT_MUTABLE_CALLS_TIMEOUT_MS, DEFAULT_PRIORITY_CALL_MULTIPLIER, DEFAULT_STATIC_CALLS_TIMEOUT_MS, DEFAULT_WAIT_CALLS_TIMEOUT_MS, MULTICALL_ADDRESS, } from "./constant.js";
|
|
2
2
|
export const config = {
|
|
3
3
|
multicallUnit: {
|
|
4
4
|
address: MULTICALL_ADDRESS,
|
|
@@ -19,6 +19,7 @@ export const config = {
|
|
|
19
19
|
multiplier: DEFAULT_PRIORITY_CALL_MULTIPLIER,
|
|
20
20
|
},
|
|
21
21
|
batchDelayMs: DEFAULT_MULTICALL_BATCH_DELAY_MS,
|
|
22
|
+
maxAsyncReadBatches: DEFAULT_MULTICALL_ASYNC_READ_BATCHES,
|
|
22
23
|
},
|
|
23
24
|
contract: {
|
|
24
25
|
staticCalls: {
|
package/lib/constant.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare const DEFAULT_MULTICALL_ALLOW_FAILURE = false;
|
|
|
4
4
|
export declare const DEFAULT_MULTICALL_STATIC_CALLS_BATCH_LIMIT = 50;
|
|
5
5
|
export declare const DEFAULT_MULTICALL_MUTABLE_CALLS_BATCH_LIMIT = 10;
|
|
6
6
|
export declare const DEFAULT_MULTICALL_BATCH_DELAY_MS = 0;
|
|
7
|
+
export declare const DEFAULT_MULTICALL_ASYNC_READ_BATCHES = 1;
|
|
7
8
|
export declare const DEFAULT_PRIORITY_CALL_MULTIPLIER = 1.3;
|
|
8
9
|
export declare const DEFAULT_LOGS_BLOCKS_STEP = 5000;
|
|
9
10
|
export declare const DEFAULT_LOGS_DELAY_MS = 1000;
|
package/lib/constant.js
CHANGED
|
@@ -4,6 +4,7 @@ export const DEFAULT_MULTICALL_ALLOW_FAILURE = false;
|
|
|
4
4
|
export const DEFAULT_MULTICALL_STATIC_CALLS_BATCH_LIMIT = 50;
|
|
5
5
|
export const DEFAULT_MULTICALL_MUTABLE_CALLS_BATCH_LIMIT = 10;
|
|
6
6
|
export const DEFAULT_MULTICALL_BATCH_DELAY_MS = 0;
|
|
7
|
+
export const DEFAULT_MULTICALL_ASYNC_READ_BATCHES = 1;
|
|
7
8
|
export const DEFAULT_PRIORITY_CALL_MULTIPLIER = 1.3;
|
|
8
9
|
export const DEFAULT_LOGS_BLOCKS_STEP = 5000;
|
|
9
10
|
export const DEFAULT_LOGS_DELAY_MS = 1000;
|
|
@@ -39,6 +39,7 @@ export class MulticallUnit extends BaseContract {
|
|
|
39
39
|
waitForTxs: config.multicallUnit.waitForTxs,
|
|
40
40
|
waitCallsTimeoutMs: config.multicallUnit.waitCalls.timeoutMs,
|
|
41
41
|
batchDelayMs: config.multicallUnit.batchDelayMs,
|
|
42
|
+
maxAsyncReadBatches: config.multicallUnit.maxAsyncReadBatches,
|
|
42
43
|
...options,
|
|
43
44
|
};
|
|
44
45
|
}
|
|
@@ -133,13 +134,22 @@ export class MulticallUnit extends BaseContract {
|
|
|
133
134
|
await waitWithSignals(runOptions.batchDelayMs, runOptions.signals);
|
|
134
135
|
}
|
|
135
136
|
// Process static
|
|
136
|
-
|
|
137
|
+
const staticBatchSize = runOptions.maxStaticCallsStack;
|
|
138
|
+
const maxAsync = runOptions.maxAsyncReadBatches;
|
|
139
|
+
const staticBatches = [];
|
|
140
|
+
const staticIndexesBatches = [];
|
|
141
|
+
for (let i = 0; i < staticCalls.length; i += staticBatchSize) {
|
|
142
|
+
staticBatches.push(staticCalls.slice(i, i + staticBatchSize));
|
|
143
|
+
staticIndexesBatches.push(staticIndexes.slice(i, i + staticBatchSize));
|
|
144
|
+
}
|
|
145
|
+
for (let i = 0; i < staticBatches.length; i += maxAsync) {
|
|
137
146
|
checkSignals(runOptions.signals);
|
|
138
|
-
const
|
|
139
|
-
const
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
147
|
+
const batchGroup = staticBatches.slice(i, i + maxAsync);
|
|
148
|
+
const indexGroup = staticIndexesBatches.slice(i, i + maxAsync);
|
|
149
|
+
const results = await Promise.all(batchGroup.map((batch) => this.processStaticCalls(batch, runOptions)));
|
|
150
|
+
for (let j = 0; j < results.length; j++) {
|
|
151
|
+
this.saveResponse(results[j], indexGroup[j], tags);
|
|
152
|
+
}
|
|
143
153
|
await waitWithSignals(runOptions.batchDelayMs, runOptions.signals);
|
|
144
154
|
}
|
|
145
155
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@woof-software/contracts-tools-sdk-ethers",
|
|
3
3
|
"description": "Module simplify smart contract interactions and multicall3 aggregation on the Ethereum blockchain and other EVM-compatible networks.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.21",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/woof-compound/sandbox-sdks.git"
|