@pancakeswap/multicall 3.6.3 → 3.7.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/constants/contracts.d.ts.map +1 -1
- package/dist/getGasLimit.d.ts +2 -1
- package/dist/getGasLimit.d.ts.map +1 -1
- package/dist/index.js +36 -53
- package/dist/index.mjs +37 -54
- package/dist/multicall.d.ts +1 -1
- package/dist/multicall.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/constants/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAE9B,eAAO,MAAM,iBAAiB,EAAE;KAAG,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,OAAO;CAqB3D,CAAA;AAED,eAAO,MAAM,kBAAkB,+CAA+C,CAAA;AAE9E,eAAO,MAAM,oBAAoB,EAAE;KAChC,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,OAAO;
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/constants/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAE9B,eAAO,MAAM,iBAAiB,EAAE;KAAG,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,OAAO;CAqB3D,CAAA;AAED,eAAO,MAAM,kBAAkB,+CAA+C,CAAA;AAE9E,eAAO,MAAM,oBAAoB,EAAE;KAChC,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,OAAO;CAkB3B,CAAA"}
|
package/dist/getGasLimit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BigintIsh } from '@pancakeswap/sdk';
|
|
2
1
|
import { ChainId } from '@pancakeswap/chains';
|
|
2
|
+
import { BigintIsh } from '@pancakeswap/sdk';
|
|
3
3
|
import { PublicClient } from 'viem';
|
|
4
4
|
export type GetGasLimitParams = {
|
|
5
5
|
chainId: ChainId;
|
|
@@ -7,6 +7,7 @@ export type GetGasLimitParams = {
|
|
|
7
7
|
gasLimit?: BigintIsh;
|
|
8
8
|
maxGasLimit?: BigintIsh;
|
|
9
9
|
gasBuffer?: BigintIsh;
|
|
10
|
+
account?: `0x${string}`;
|
|
10
11
|
};
|
|
11
12
|
export declare function getDefaultGasLimit(chainId?: ChainId): bigint;
|
|
12
13
|
export declare function getDefaultGasBuffer(chainId?: ChainId): bigint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getGasLimit.d.ts","sourceRoot":"","sources":["../src/getGasLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"getGasLimit.d.ts","sourceRoot":"","sources":["../src/getGasLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAUnC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,CAAC,EAAE,YAAY,CAAA;IAGrB,QAAQ,CAAC,EAAE,SAAS,CAAA;IAGpB,WAAW,CAAC,EAAE,SAAS,CAAA;IAEvB,SAAS,CAAC,EAAE,SAAS,CAAA;IAGrB,OAAO,CAAC,EAAE,KAAK,MAAM,EAAE,CAAA;CACxB,CAAA;AAED,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,UAGnD;AAED,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,OAAO,UAGpD;AAED,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,iBAAiB,EAAE,SAAS,GAAG,QAAQ,CAAC,CAAA;AAEpF,wBAAsB,kBAAkB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,wBAAwB,mBAYrF;AAED,wBAAsB,WAAW,CAAC,EAChC,OAAO,EACP,QAAQ,EAAE,aAAa,EACvB,WAAW,EAAE,gBAA8C,EAC3D,SAAS,EAAE,cAA6C,EACxD,MAAM,GACP,EAAE,iBAAiB,mBAenB"}
|
package/dist/index.js
CHANGED
|
@@ -44,11 +44,12 @@ var MULTICALL3_ADDRESSES = {
|
|
|
44
44
|
[chains.ChainId.OPBNB_TESTNET]: MULTICALL3_ADDRESS,
|
|
45
45
|
[chains.ChainId.BASE_TESTNET]: MULTICALL3_ADDRESS,
|
|
46
46
|
[chains.ChainId.SCROLL_SEPOLIA]: MULTICALL3_ADDRESS,
|
|
47
|
-
[chains.ChainId.MONAD_TESTNET]: MULTICALL3_ADDRESS
|
|
47
|
+
[chains.ChainId.MONAD_TESTNET]: MULTICALL3_ADDRESS,
|
|
48
|
+
[chains.ChainId.SEPOLIA]: MULTICALL3_ADDRESS
|
|
48
49
|
};
|
|
49
50
|
var DEFAULT_BLOCK_CONFLICT_TOLERANCE = 0;
|
|
50
51
|
var BLOCK_CONFLICT_TOLERANCE = {
|
|
51
|
-
[chains.ChainId.BSC]:
|
|
52
|
+
[chains.ChainId.BSC]: 12,
|
|
52
53
|
[chains.ChainId.ETHEREUM]: 1,
|
|
53
54
|
[chains.ChainId.ARBITRUM_ONE]: 5,
|
|
54
55
|
[chains.ChainId.POLYGON_ZKEVM]: 1,
|
|
@@ -57,7 +58,7 @@ var BLOCK_CONFLICT_TOLERANCE = {
|
|
|
57
58
|
[chains.ChainId.BASE]: 3,
|
|
58
59
|
[chains.ChainId.OPBNB]: 3,
|
|
59
60
|
// Testnets
|
|
60
|
-
[chains.ChainId.BSC_TESTNET]:
|
|
61
|
+
[chains.ChainId.BSC_TESTNET]: 12,
|
|
61
62
|
[chains.ChainId.GOERLI]: 1,
|
|
62
63
|
[chains.ChainId.ARBITRUM_GOERLI]: 5,
|
|
63
64
|
[chains.ChainId.POLYGON_ZKEVM_TESTNET]: 1,
|
|
@@ -185,9 +186,17 @@ function getDefaultGasBuffer(chainId) {
|
|
|
185
186
|
return gasBufferOnChain !== void 0 ? gasBufferOnChain : DEFAULT_GAS_BUFFER;
|
|
186
187
|
}
|
|
187
188
|
async function getGasLimitOnChain({ chainId, client }) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
try {
|
|
190
|
+
if (!chainId || !client) {
|
|
191
|
+
return BigInt(getDefaultGasLimit(chainId));
|
|
192
|
+
}
|
|
193
|
+
const multicall = getMulticallContract({ chainId, client });
|
|
194
|
+
const gasLeft = await multicall.read.gasLeft();
|
|
195
|
+
return gasLeft;
|
|
196
|
+
} catch (error) {
|
|
197
|
+
console.warn("Failed to get gas limit from chain, using default:", error);
|
|
198
|
+
return BigInt(getDefaultGasLimit(chainId));
|
|
199
|
+
}
|
|
191
200
|
}
|
|
192
201
|
async function getGasLimit({
|
|
193
202
|
chainId,
|
|
@@ -199,7 +208,14 @@ async function getGasLimit({
|
|
|
199
208
|
const gasLimitOverride = gasLimitInput && toBigInt(gasLimitInput);
|
|
200
209
|
const maxGasLimit = toBigInt(maxGasLimitInput);
|
|
201
210
|
const gasBuffer = toBigInt(gasBufferInput);
|
|
202
|
-
|
|
211
|
+
let onChainGasLimit;
|
|
212
|
+
try {
|
|
213
|
+
onChainGasLimit = await getGasLimitOnChain({ chainId, client });
|
|
214
|
+
} catch (error) {
|
|
215
|
+
console.warn("Failed to fetch gas limit on chain:", error);
|
|
216
|
+
onChainGasLimit = void 0;
|
|
217
|
+
}
|
|
218
|
+
const gasLimit = gasLimitOverride || onChainGasLimit || maxGasLimit;
|
|
203
219
|
const minGasLimit = gasLimit < maxGasLimit ? gasLimit : maxGasLimit;
|
|
204
220
|
return minGasLimit - gasBuffer;
|
|
205
221
|
}
|
|
@@ -386,47 +402,6 @@ function abortInvariant(signal, message) {
|
|
|
386
402
|
function isViemAbortError(e) {
|
|
387
403
|
return e instanceof viem.BaseError && e.walk((err) => err instanceof viem.TimeoutError) instanceof viem.TimeoutError;
|
|
388
404
|
}
|
|
389
|
-
var stats = {};
|
|
390
|
-
var statsCalls = [];
|
|
391
|
-
var uniqTargets = /* @__PURE__ */ new Set();
|
|
392
|
-
var last = Date.now();
|
|
393
|
-
function logStatsInDev(calls, windowMs = 5e3) {
|
|
394
|
-
if (process.env.NODE_ENV !== "development") {
|
|
395
|
-
return;
|
|
396
|
-
}
|
|
397
|
-
statsCalls.push({
|
|
398
|
-
timestamp: Date.now(),
|
|
399
|
-
callNumber: calls.length,
|
|
400
|
-
targets: [...new Set(calls.map((call2) => call2.target))]
|
|
401
|
-
});
|
|
402
|
-
statsCalls = statsCalls.filter((call2) => call2.timestamp >= Date.now() - windowMs);
|
|
403
|
-
const now = Date.now();
|
|
404
|
-
for (const call2 of calls) {
|
|
405
|
-
const { target } = call2;
|
|
406
|
-
if (!uniqTargets.has(target)) {
|
|
407
|
-
console.log("target", call2.target);
|
|
408
|
-
uniqTargets.add(target);
|
|
409
|
-
}
|
|
410
|
-
const h = viem.keccak256(`0x${target}${call2.callData}`);
|
|
411
|
-
if (!stats[target]) {
|
|
412
|
-
stats[target] = { events: [], total: 0, uniq: 0 };
|
|
413
|
-
}
|
|
414
|
-
stats[target].events.push({ timestamp: now, hash: h });
|
|
415
|
-
}
|
|
416
|
-
const cutoff = now - windowMs;
|
|
417
|
-
for (const [target, stat] of Object.entries(stats)) {
|
|
418
|
-
stat.events = stat.events.filter((e) => e.timestamp >= cutoff);
|
|
419
|
-
stat.total = stat.events.length;
|
|
420
|
-
const uniqHashes = new Set(stat.events.map((e) => e.hash));
|
|
421
|
-
stat.uniq = uniqHashes.size;
|
|
422
|
-
}
|
|
423
|
-
const elapsed = Date.now() - last;
|
|
424
|
-
if (elapsed > 5e3) {
|
|
425
|
-
last = Date.now();
|
|
426
|
-
console.log(`Sliding call stats`, stats);
|
|
427
|
-
console.log(`history calls`, statsCalls);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
405
|
|
|
431
406
|
// src/getBlockConflictTolerance.ts
|
|
432
407
|
function getBlockConflictTolerance(chainId) {
|
|
@@ -441,9 +416,10 @@ async function multicallByGasLimit(calls, {
|
|
|
441
416
|
dropUnexecutedCalls,
|
|
442
417
|
signal,
|
|
443
418
|
retryFailedCallsWithGreaterLimit,
|
|
419
|
+
account,
|
|
420
|
+
blockConflictTolerance,
|
|
444
421
|
...rest
|
|
445
422
|
}) {
|
|
446
|
-
logStatsInDev(calls);
|
|
447
423
|
const gasLimit = await getGasLimit({
|
|
448
424
|
chainId,
|
|
449
425
|
gasBuffer,
|
|
@@ -455,7 +431,9 @@ async function multicallByGasLimit(calls, {
|
|
|
455
431
|
client,
|
|
456
432
|
chainId,
|
|
457
433
|
dropUnexecutedCalls,
|
|
458
|
-
signal
|
|
434
|
+
signal,
|
|
435
|
+
account,
|
|
436
|
+
blockConflictTolerance
|
|
459
437
|
});
|
|
460
438
|
if (!retryFailedCallsWithGreaterLimit) {
|
|
461
439
|
return callResult;
|
|
@@ -490,7 +468,9 @@ async function multicallByGasLimit(calls, {
|
|
|
490
468
|
client,
|
|
491
469
|
chainId,
|
|
492
470
|
dropUnexecutedCalls,
|
|
493
|
-
signal
|
|
471
|
+
signal,
|
|
472
|
+
account,
|
|
473
|
+
blockConflictTolerance
|
|
494
474
|
});
|
|
495
475
|
const resultsAfterRetry = [...result.results];
|
|
496
476
|
for (const [retryIndex, originalIndex] of failedCallIndexes.entries()) {
|
|
@@ -522,7 +502,8 @@ async function call(calls, params) {
|
|
|
522
502
|
gasBuffer = getDefaultGasBuffer(chainId),
|
|
523
503
|
blockConflictTolerance = getBlockConflictTolerance(chainId),
|
|
524
504
|
dropUnexecutedCalls = false,
|
|
525
|
-
signal
|
|
505
|
+
signal,
|
|
506
|
+
account
|
|
526
507
|
} = params;
|
|
527
508
|
if (!calls.length) {
|
|
528
509
|
return {
|
|
@@ -533,7 +514,9 @@ async function call(calls, params) {
|
|
|
533
514
|
abortInvariant(signal, "Multicall aborted");
|
|
534
515
|
const contract = getMulticallContract({ chainId, client });
|
|
535
516
|
try {
|
|
536
|
-
const { result } = await contract.simulate.multicallWithGasLimitation([calls, gasBuffer]
|
|
517
|
+
const { result } = await contract.simulate.multicallWithGasLimitation([calls, gasBuffer], {
|
|
518
|
+
account
|
|
519
|
+
});
|
|
537
520
|
const { results, lastSuccessIndex, blockNumber } = formatCallReturn(result);
|
|
538
521
|
if (lastSuccessIndex === calls.length - 1) {
|
|
539
522
|
return {
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChainId } from '@pancakeswap/chains';
|
|
2
|
-
import { getContract,
|
|
2
|
+
import { getContract, BaseError, TimeoutError } from 'viem';
|
|
3
3
|
|
|
4
4
|
// ../utils/toBigInt.ts
|
|
5
5
|
function toBigInt(num) {
|
|
@@ -42,11 +42,12 @@ var MULTICALL3_ADDRESSES = {
|
|
|
42
42
|
[ChainId.OPBNB_TESTNET]: MULTICALL3_ADDRESS,
|
|
43
43
|
[ChainId.BASE_TESTNET]: MULTICALL3_ADDRESS,
|
|
44
44
|
[ChainId.SCROLL_SEPOLIA]: MULTICALL3_ADDRESS,
|
|
45
|
-
[ChainId.MONAD_TESTNET]: MULTICALL3_ADDRESS
|
|
45
|
+
[ChainId.MONAD_TESTNET]: MULTICALL3_ADDRESS,
|
|
46
|
+
[ChainId.SEPOLIA]: MULTICALL3_ADDRESS
|
|
46
47
|
};
|
|
47
48
|
var DEFAULT_BLOCK_CONFLICT_TOLERANCE = 0;
|
|
48
49
|
var BLOCK_CONFLICT_TOLERANCE = {
|
|
49
|
-
[ChainId.BSC]:
|
|
50
|
+
[ChainId.BSC]: 12,
|
|
50
51
|
[ChainId.ETHEREUM]: 1,
|
|
51
52
|
[ChainId.ARBITRUM_ONE]: 5,
|
|
52
53
|
[ChainId.POLYGON_ZKEVM]: 1,
|
|
@@ -55,7 +56,7 @@ var BLOCK_CONFLICT_TOLERANCE = {
|
|
|
55
56
|
[ChainId.BASE]: 3,
|
|
56
57
|
[ChainId.OPBNB]: 3,
|
|
57
58
|
// Testnets
|
|
58
|
-
[ChainId.BSC_TESTNET]:
|
|
59
|
+
[ChainId.BSC_TESTNET]: 12,
|
|
59
60
|
[ChainId.GOERLI]: 1,
|
|
60
61
|
[ChainId.ARBITRUM_GOERLI]: 5,
|
|
61
62
|
[ChainId.POLYGON_ZKEVM_TESTNET]: 1,
|
|
@@ -183,9 +184,17 @@ function getDefaultGasBuffer(chainId) {
|
|
|
183
184
|
return gasBufferOnChain !== void 0 ? gasBufferOnChain : DEFAULT_GAS_BUFFER;
|
|
184
185
|
}
|
|
185
186
|
async function getGasLimitOnChain({ chainId, client }) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
try {
|
|
188
|
+
if (!chainId || !client) {
|
|
189
|
+
return BigInt(getDefaultGasLimit(chainId));
|
|
190
|
+
}
|
|
191
|
+
const multicall = getMulticallContract({ chainId, client });
|
|
192
|
+
const gasLeft = await multicall.read.gasLeft();
|
|
193
|
+
return gasLeft;
|
|
194
|
+
} catch (error) {
|
|
195
|
+
console.warn("Failed to get gas limit from chain, using default:", error);
|
|
196
|
+
return BigInt(getDefaultGasLimit(chainId));
|
|
197
|
+
}
|
|
189
198
|
}
|
|
190
199
|
async function getGasLimit({
|
|
191
200
|
chainId,
|
|
@@ -197,7 +206,14 @@ async function getGasLimit({
|
|
|
197
206
|
const gasLimitOverride = gasLimitInput && toBigInt(gasLimitInput);
|
|
198
207
|
const maxGasLimit = toBigInt(maxGasLimitInput);
|
|
199
208
|
const gasBuffer = toBigInt(gasBufferInput);
|
|
200
|
-
|
|
209
|
+
let onChainGasLimit;
|
|
210
|
+
try {
|
|
211
|
+
onChainGasLimit = await getGasLimitOnChain({ chainId, client });
|
|
212
|
+
} catch (error) {
|
|
213
|
+
console.warn("Failed to fetch gas limit on chain:", error);
|
|
214
|
+
onChainGasLimit = void 0;
|
|
215
|
+
}
|
|
216
|
+
const gasLimit = gasLimitOverride || onChainGasLimit || maxGasLimit;
|
|
201
217
|
const minGasLimit = gasLimit < maxGasLimit ? gasLimit : maxGasLimit;
|
|
202
218
|
return minGasLimit - gasBuffer;
|
|
203
219
|
}
|
|
@@ -384,47 +400,6 @@ function abortInvariant(signal, message) {
|
|
|
384
400
|
function isViemAbortError(e) {
|
|
385
401
|
return e instanceof BaseError && e.walk((err) => err instanceof TimeoutError) instanceof TimeoutError;
|
|
386
402
|
}
|
|
387
|
-
var stats = {};
|
|
388
|
-
var statsCalls = [];
|
|
389
|
-
var uniqTargets = /* @__PURE__ */ new Set();
|
|
390
|
-
var last = Date.now();
|
|
391
|
-
function logStatsInDev(calls, windowMs = 5e3) {
|
|
392
|
-
if (process.env.NODE_ENV !== "development") {
|
|
393
|
-
return;
|
|
394
|
-
}
|
|
395
|
-
statsCalls.push({
|
|
396
|
-
timestamp: Date.now(),
|
|
397
|
-
callNumber: calls.length,
|
|
398
|
-
targets: [...new Set(calls.map((call2) => call2.target))]
|
|
399
|
-
});
|
|
400
|
-
statsCalls = statsCalls.filter((call2) => call2.timestamp >= Date.now() - windowMs);
|
|
401
|
-
const now = Date.now();
|
|
402
|
-
for (const call2 of calls) {
|
|
403
|
-
const { target } = call2;
|
|
404
|
-
if (!uniqTargets.has(target)) {
|
|
405
|
-
console.log("target", call2.target);
|
|
406
|
-
uniqTargets.add(target);
|
|
407
|
-
}
|
|
408
|
-
const h = keccak256(`0x${target}${call2.callData}`);
|
|
409
|
-
if (!stats[target]) {
|
|
410
|
-
stats[target] = { events: [], total: 0, uniq: 0 };
|
|
411
|
-
}
|
|
412
|
-
stats[target].events.push({ timestamp: now, hash: h });
|
|
413
|
-
}
|
|
414
|
-
const cutoff = now - windowMs;
|
|
415
|
-
for (const [target, stat] of Object.entries(stats)) {
|
|
416
|
-
stat.events = stat.events.filter((e) => e.timestamp >= cutoff);
|
|
417
|
-
stat.total = stat.events.length;
|
|
418
|
-
const uniqHashes = new Set(stat.events.map((e) => e.hash));
|
|
419
|
-
stat.uniq = uniqHashes.size;
|
|
420
|
-
}
|
|
421
|
-
const elapsed = Date.now() - last;
|
|
422
|
-
if (elapsed > 5e3) {
|
|
423
|
-
last = Date.now();
|
|
424
|
-
console.log(`Sliding call stats`, stats);
|
|
425
|
-
console.log(`history calls`, statsCalls);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
403
|
|
|
429
404
|
// src/getBlockConflictTolerance.ts
|
|
430
405
|
function getBlockConflictTolerance(chainId) {
|
|
@@ -439,9 +414,10 @@ async function multicallByGasLimit(calls, {
|
|
|
439
414
|
dropUnexecutedCalls,
|
|
440
415
|
signal,
|
|
441
416
|
retryFailedCallsWithGreaterLimit,
|
|
417
|
+
account,
|
|
418
|
+
blockConflictTolerance,
|
|
442
419
|
...rest
|
|
443
420
|
}) {
|
|
444
|
-
logStatsInDev(calls);
|
|
445
421
|
const gasLimit = await getGasLimit({
|
|
446
422
|
chainId,
|
|
447
423
|
gasBuffer,
|
|
@@ -453,7 +429,9 @@ async function multicallByGasLimit(calls, {
|
|
|
453
429
|
client,
|
|
454
430
|
chainId,
|
|
455
431
|
dropUnexecutedCalls,
|
|
456
|
-
signal
|
|
432
|
+
signal,
|
|
433
|
+
account,
|
|
434
|
+
blockConflictTolerance
|
|
457
435
|
});
|
|
458
436
|
if (!retryFailedCallsWithGreaterLimit) {
|
|
459
437
|
return callResult;
|
|
@@ -488,7 +466,9 @@ async function multicallByGasLimit(calls, {
|
|
|
488
466
|
client,
|
|
489
467
|
chainId,
|
|
490
468
|
dropUnexecutedCalls,
|
|
491
|
-
signal
|
|
469
|
+
signal,
|
|
470
|
+
account,
|
|
471
|
+
blockConflictTolerance
|
|
492
472
|
});
|
|
493
473
|
const resultsAfterRetry = [...result.results];
|
|
494
474
|
for (const [retryIndex, originalIndex] of failedCallIndexes.entries()) {
|
|
@@ -520,7 +500,8 @@ async function call(calls, params) {
|
|
|
520
500
|
gasBuffer = getDefaultGasBuffer(chainId),
|
|
521
501
|
blockConflictTolerance = getBlockConflictTolerance(chainId),
|
|
522
502
|
dropUnexecutedCalls = false,
|
|
523
|
-
signal
|
|
503
|
+
signal,
|
|
504
|
+
account
|
|
524
505
|
} = params;
|
|
525
506
|
if (!calls.length) {
|
|
526
507
|
return {
|
|
@@ -531,7 +512,9 @@ async function call(calls, params) {
|
|
|
531
512
|
abortInvariant(signal, "Multicall aborted");
|
|
532
513
|
const contract = getMulticallContract({ chainId, client });
|
|
533
514
|
try {
|
|
534
|
-
const { result } = await contract.simulate.multicallWithGasLimitation([calls, gasBuffer]
|
|
515
|
+
const { result } = await contract.simulate.multicallWithGasLimitation([calls, gasBuffer], {
|
|
516
|
+
account
|
|
517
|
+
});
|
|
535
518
|
const { results, lastSuccessIndex, blockNumber } = formatCallReturn(result);
|
|
536
519
|
if (lastSuccessIndex === calls.length - 1) {
|
|
537
520
|
return {
|
package/dist/multicall.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export type CallByGasLimitParams = AbortControl & GetGasLimitParams & {
|
|
|
9
9
|
maxRetry?: number;
|
|
10
10
|
} | undefined;
|
|
11
11
|
};
|
|
12
|
-
export declare function multicallByGasLimit(calls: MulticallRequestWithGas[], { chainId, gasBuffer, client, dropUnexecutedCalls, signal, retryFailedCallsWithGreaterLimit, ...rest }: CallByGasLimitParams): Promise<CallResult>;
|
|
12
|
+
export declare function multicallByGasLimit(calls: MulticallRequestWithGas[], { chainId, gasBuffer, client, dropUnexecutedCalls, signal, retryFailedCallsWithGreaterLimit, account, blockConflictTolerance, ...rest }: CallByGasLimitParams): Promise<CallResult>;
|
|
13
13
|
export type SingleCallResult = {
|
|
14
14
|
result: string;
|
|
15
15
|
gasUsed: bigint;
|
package/dist/multicall.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multicall.d.ts","sourceRoot":"","sources":["../src/multicall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA8B,MAAM,iCAAiC,CAAA;
|
|
1
|
+
{"version":3,"file":"multicall.d.ts","sourceRoot":"","sources":["../src/multicall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA8B,MAAM,iCAAiC,CAAA;AAK1F,OAAO,EAAE,iBAAiB,EAAoC,MAAM,eAAe,CAAA;AAEnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAEjD,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAC7C,iBAAiB,GAAG;IAIlB,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAG/B,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAG7B,gCAAgC,CAAC,EAC7B;QACE,kBAAkB,EAAE,MAAM,CAAA;QAC1B,QAAQ,CAAC,EAAE,MAAM,CAAA;KAClB,GACD,SAAS,CAAA;CACd,CAAA;AAEH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,uBAAuB,EAAE,EAChC,EACE,OAAO,EACP,SAAwC,EACxC,MAAM,EACN,mBAAmB,EACnB,MAAM,EACN,gCAAgC,EAChC,OAAO,EACP,sBAAsB,EACtB,GAAG,IAAI,EACR,EAAE,oBAAoB,uBAmExB;AAOD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,gBAAgB,EAAE,CAAA;IAE3B,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG;IACzC,gBAAgB,EAAE,MAAM,CAAA;CACzB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pancakeswap/multicall",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
10
10
|
"module": "dist/index.mjs",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"viem": "
|
|
12
|
+
"viem": "2.31.3",
|
|
13
13
|
"@pancakeswap/chains": "0.5.2",
|
|
14
14
|
"@pancakeswap/sdk": "5.8.14"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"tsup": "^6.7.0",
|
|
18
18
|
"@pancakeswap/tsconfig": "0.0.0",
|
|
19
|
-
"@pancakeswap/utils": "
|
|
19
|
+
"@pancakeswap/utils": "7.0.0"
|
|
20
20
|
},
|
|
21
21
|
"exports": {
|
|
22
22
|
"./package.json": "./package.json",
|