-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
diff --git a/dist/multicall.cjs b/dist/multicall.cjs | ||
index bf9aa5e86573fc1651f421cc0b64f5af121c3ab2..43a0531ed86cd3ee1774dcda3f990dd40f7f52de 100644 | ||
--- a/dist/multicall.cjs | ||
+++ b/dist/multicall.cjs | ||
@@ -342,9 +342,22 @@ const multicallOrFallback = async (calls, chainId, provider, maxCallsPerMultical | ||
return []; | ||
} | ||
const multicallAddress = MULTICALL_CONTRACT_BY_CHAINID[chainId]; | ||
- return await (multicallAddress | ||
- ? multicall(calls, multicallAddress, provider, maxCallsPerMulticall) | ||
- : fallback(calls, maxCallsParallel)); | ||
+ if (multicallAddress) { | ||
+ try { | ||
+ return await multicall(calls, multicallAddress, provider, maxCallsPerMulticall); | ||
+ } | ||
+ catch (error) { | ||
+ // Fallback only on revert | ||
+ // https://docs.ethers.org/v5/troubleshooting/errors/#help-CALL_EXCEPTION | ||
+ if (!error || | ||
+ typeof error !== 'object' || | ||
+ !('code' in error) || | ||
+ error.code !== 'CALL_EXCEPTION') { | ||
+ throw error; | ||
+ } | ||
+ } | ||
+ } | ||
+ return await fallback(calls, maxCallsParallel); | ||
}; | ||
exports.multicallOrFallback = multicallOrFallback; | ||
//# sourceMappingURL=multicall.cjs.map | ||
\ No newline at end of file | ||
diff --git a/dist/multicall.mjs b/dist/multicall.mjs | ||
index 8fbe0112303d5df1d868e0357a9d31e43a3b6cf9..860dfdbddd813659cb2be5f7faed5d4016db5966 100644 | ||
--- a/dist/multicall.mjs | ||
+++ b/dist/multicall.mjs | ||
@@ -339,8 +339,21 @@ export const multicallOrFallback = async (calls, chainId, provider, maxCallsPerM | ||
return []; | ||
} | ||
const multicallAddress = MULTICALL_CONTRACT_BY_CHAINID[chainId]; | ||
- return await (multicallAddress | ||
- ? multicall(calls, multicallAddress, provider, maxCallsPerMulticall) | ||
- : fallback(calls, maxCallsParallel)); | ||
+ if (multicallAddress) { | ||
+ try { | ||
+ return await multicall(calls, multicallAddress, provider, maxCallsPerMulticall); | ||
+ } | ||
+ catch (error) { | ||
+ // Fallback only on revert | ||
+ // https://docs.ethers.org/v5/troubleshooting/errors/#help-CALL_EXCEPTION | ||
+ if (!error || | ||
+ typeof error !== 'object' || | ||
+ !('code' in error) || | ||
+ error.code !== 'CALL_EXCEPTION') { | ||
+ throw error; | ||
+ } | ||
+ } | ||
+ } | ||
+ return await fallback(calls, maxCallsParallel); | ||
}; | ||
//# sourceMappingURL=multicall.mjs.map | ||
\ No newline at end of file |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.