Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: eth_call multicall aggregation #387

Merged
merged 5 commits into from
Apr 19, 2023
Merged

feat: eth_call multicall aggregation #387

merged 5 commits into from
Apr 19, 2023

Conversation

jxom
Copy link
Member

@jxom jxom commented Apr 18, 2023

Adds support for eth_call batch aggregation via multicall aggregate3.


PR-Codex overview

This PR introduces support for batch aggregation via multicall aggregate3, adds a new error type, and makes several updates and fixes across multiple files.

Detailed summary

  • Adds support for eth_call batch aggregation via multicall aggregate3
  • Adds ClientChainNotConfiguredError error type
  • Updates contract.ts exports
  • Updates promise and promise.test.ts files
  • Updates eip1193.ts
  • Updates .env.example
  • Updates index.ts and index.test.ts
  • Updates getEnsName.test.ts, getEnsText.test.ts, getEnsAddress.test.ts, getEnsResolver.test.ts, readContract.test.ts, estimateContractGas.test.ts, simulateContract.ts, and simulateContract.test.ts
  • Updates utils.ts
  • Updates chain.ts and chain.test.ts
  • Updates getContract.test.ts
  • Updates getContractError.ts
  • Updates createPublicClient.test.ts and createPublicClient.ts

The following files were skipped due to too many changes: src/clients/createPublicClient.ts, src/utils/promise/createBatchScheduler.ts, site/docs/clients/public.md, src/actions/public/call.ts, src/utils/promise/createBatchScheduler.test.ts, src/actions/public/call.test.ts

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}


PR-Codex overview

This PR introduces support for eth_call batch aggregation via multicall aggregate3. It also adds a new batch parameter to CallParameters to enable and configure the multicall feature.

Detailed summary

  • Added support for eth_call batch aggregation via multicall aggregate3.
  • Added a new batch parameter to CallParameters to enable and configure the multicall feature.
  • Added new batch-related options batchSize and wait to the batch.multicall object.
  • Created a new scheduleMulticall function to handle multicall requests.
  • Improved shouldPerformMulticall to only perform a scheduled multicall if the request has calldata, has a target address, is not the aggregate3 signature, and has no other properties.
  • Updated call to use shouldPerformMulticall and scheduleMulticall when appropriate.
  • Updated createPublicClient test to include the new batch parameter.

The following files were skipped due to too many changes: src/actions/public/call.test.ts, src/utils/promise/createBatchScheduler.test.ts

The code diff in this PR exceeds the max number of characters, so this overview may be incomplete.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@changeset-bot
Copy link

changeset-bot bot commented Apr 18, 2023

🦋 Changeset detected

Latest commit: b6a80fb

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Apr 18, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
viem ❌ Failed (Inspect) Apr 19, 2023 9:06pm
viem-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 19, 2023 9:06pm


const schedulerCache = new Map<number | string, SchedulerItem[]>()

export function createBatchScheduler<
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/codex what does this function do?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this function do?

@jxom This code snippet defines a TypeScript module that exports a function called createBatchScheduler. This function returns a batch scheduler that allows you to group multiple function calls and execute them together in a batch. The batch scheduler is useful when you have multiple function calls that can be combined into one call to improve performance.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you so smart

@github-actions
Copy link
Contributor

github-actions bot commented Apr 18, 2023

Size Change: +4.37 kB (+2%)

Total Size: 251 kB

Filename Size Change
dist/cjs/actions/public/call.js 1.49 kB +831 B (+126%) 🆘
dist/cjs/actions/public/simulateContract.js 545 B +8 B (+1%)
dist/cjs/chains.js 1.61 kB -370 B (-19%) 👏
dist/cjs/clients/createPublicClient.js 354 B +9 B (+3%)
dist/cjs/constants/index.js 378 B +37 B (+11%) ⚠️
dist/cjs/errors/chain.js 853 B +38 B (+5%) 🔍
dist/cjs/errors/contract.js 1.77 kB +11 B (+1%)
dist/cjs/errors/encoding.js 900 B +74 B (+9%) 🔍
dist/cjs/errors/index.js 2.12 kB +46 B (+2%)
dist/cjs/index.js 3.24 kB +21 B (+1%)
dist/cjs/utils/encoding/fromBytes.js 672 B +156 B (+30%) 🚨
dist/cjs/utils/encoding/fromHex.js 807 B +208 B (+35%) 🚨
dist/cjs/utils/encoding/toBytes.js 779 B +120 B (+18%) ⚠️
dist/cjs/utils/encoding/toHex.js 935 B +59 B (+7%) 🔍
dist/cjs/utils/errors/getContractError.js 590 B +40 B (+7%) 🔍
dist/cjs/utils/promise/index.js 323 B +37 B (+13%) ⚠️
dist/esm/actions/public/call.js 1.42 kB +833 B (+143%) 🆘
dist/esm/actions/public/simulateContract.js 472 B +12 B (+3%)
dist/esm/clients/createPublicClient.js 273 B +8 B (+3%)
dist/esm/constants/index.js 179 B +20 B (+13%) ⚠️
dist/esm/errors/chain.js 746 B +24 B (+3%)
dist/esm/errors/contract.js 1.64 kB +11 B (+1%)
dist/esm/errors/encoding.js 757 B +63 B (+9%) 🔍
dist/esm/errors/index.js 956 B +23 B (+2%)
dist/esm/index.js 1.33 kB +12 B (+1%)
dist/esm/utils/encoding/fromBytes.js 514 B +157 B (+44%) 🚨
dist/esm/utils/encoding/fromHex.js 656 B +193 B (+42%) 🚨
dist/esm/utils/encoding/toBytes.js 648 B +110 B (+20%) 🚨
dist/esm/utils/encoding/toHex.js 810 B +53 B (+7%) 🔍
dist/esm/utils/errors/getContractError.js 523 B +41 B (+9%) 🔍
dist/esm/utils/promise/index.js 150 B +26 B (+21%) 🚨
dist/cjs/constants/contract.js 167 B +167 B (new file) 🆕
dist/cjs/utils/promise/createBatchScheduler.js 626 B +626 B (new file) 🆕
dist/esm/constants/contract.js 104 B +104 B (new file) 🆕
dist/esm/utils/promise/createBatchScheduler.js 562 B +562 B (new file) 🆕
ℹ️ View Unchanged
Filename Size
dist/cjs/abi.js 322 B
dist/cjs/accounts/generateMnemonic.js 220 B
dist/cjs/accounts/generatePrivateKey.js 263 B
dist/cjs/accounts/hdKeyToAccount.js 369 B
dist/cjs/accounts/index.js 715 B
dist/cjs/accounts/mnemonicToAccount.js 296 B
dist/cjs/accounts/privateKeyToAccount.js 454 B
dist/cjs/accounts/toAccount.js 394 B
dist/cjs/accounts/types.js 124 B
dist/cjs/accounts/utils/index.js 366 B
dist/cjs/accounts/utils/parseAccount.js 225 B
dist/cjs/accounts/utils/publicKeyToAddress.js 290 B
dist/cjs/accounts/utils/sign.js 328 B
dist/cjs/accounts/utils/signatureToHex.js 313 B
dist/cjs/accounts/utils/signMessage.js 300 B
dist/cjs/accounts/utils/signTransaction.js 313 B
dist/cjs/accounts/utils/signTypedData.js 310 B
dist/cjs/accounts/wordlists/czech.js 222 B
dist/cjs/accounts/wordlists/english.js 223 B
dist/cjs/accounts/wordlists/french.js 223 B
dist/cjs/accounts/wordlists/italian.js 223 B
dist/cjs/accounts/wordlists/japanese.js 225 B
dist/cjs/accounts/wordlists/korean.js 223 B
dist/cjs/accounts/wordlists/simplifiedChinese.js 242 B
dist/cjs/accounts/wordlists/spanish.js 223 B
dist/cjs/accounts/wordlists/traditionalChinese.js 242 B
dist/cjs/actions/ens/getEnsAddress.js 638 B
dist/cjs/actions/ens/getEnsAvatar.js 388 B
dist/cjs/actions/ens/getEnsName.js 754 B
dist/cjs/actions/ens/getEnsResolver.js 573 B
dist/cjs/actions/ens/getEnsText.js 636 B
dist/cjs/actions/ens/index.js 321 B
dist/cjs/actions/getContract.js 962 B
dist/cjs/actions/index.js 1.42 kB
dist/cjs/actions/public/createBlockFilter.js 320 B
dist/cjs/actions/public/createContractEventFilter.js 523 B
dist/cjs/actions/public/createEventFilter.js 566 B
dist/cjs/actions/public/createPendingTransactionFilter.js 326 B
dist/cjs/actions/public/estimateContractGas.js 460 B
dist/cjs/actions/public/estimateGas.js 728 B
dist/cjs/actions/public/getBalance.js 344 B
dist/cjs/actions/public/getBlock.js 490 B
dist/cjs/actions/public/getBlockNumber.js 389 B
dist/cjs/actions/public/getBlockTransactionCount.js 409 B
dist/cjs/actions/public/getBytecode.js 365 B
dist/cjs/actions/public/getChainId.js 272 B
dist/cjs/actions/public/getFeeHistory.js 396 B
dist/cjs/actions/public/getFilterChanges.js 490 B
dist/cjs/actions/public/getFilterLogs.js 465 B
dist/cjs/actions/public/getGasPrice.js 232 B
dist/cjs/actions/public/getLogs.js 627 B
dist/cjs/actions/public/getStorageAt.js 354 B
dist/cjs/actions/public/getTransaction.js 546 B
dist/cjs/actions/public/getTransactionConfirmations.js 367 B
dist/cjs/actions/public/getTransactionCount.js 338 B
dist/cjs/actions/public/getTransactionReceipt.js 383 B
dist/cjs/actions/public/index.js 1.04 kB
dist/cjs/actions/public/multicall.js 864 B
dist/cjs/actions/public/readContract.js 447 B
dist/cjs/actions/public/uninstallFilter.js 232 B
dist/cjs/actions/public/waitForTransactionReceipt.js 1.04 kB
dist/cjs/actions/public/watchBlockNumber.js 870 B
dist/cjs/actions/public/watchBlocks.js 921 B
dist/cjs/actions/public/watchContractEvent.js 895 B
dist/cjs/actions/public/watchEvent.js 837 B
dist/cjs/actions/public/watchPendingTransactions.js 907 B
dist/cjs/actions/test/dropTransaction.js 236 B
dist/cjs/actions/test/getAutomine.js 218 B
dist/cjs/actions/test/getTxpoolContent.js 218 B
dist/cjs/actions/test/getTxpoolStatus.js 304 B
dist/cjs/actions/test/impersonateAccount.js 241 B
dist/cjs/actions/test/increaseTime.js 282 B
dist/cjs/actions/test/index.js 938 B
dist/cjs/actions/test/inspectTxpool.js 214 B
dist/cjs/actions/test/mine.js 298 B
dist/cjs/actions/test/removeBlockTimestampInterval.js 230 B
dist/cjs/actions/test/reset.js 265 B
dist/cjs/actions/test/revert.js 223 B
dist/cjs/actions/test/sendUnsignedTransaction.js 302 B
dist/cjs/actions/test/setAutomine.js 231 B
dist/cjs/actions/test/setBalance.js 293 B
dist/cjs/actions/test/setBlockGasLimit.js 287 B
dist/cjs/actions/test/setBlockTimestampInterval.js 247 B
dist/cjs/actions/test/setCode.js 240 B
dist/cjs/actions/test/setCoinbase.js 237 B
dist/cjs/actions/test/setIntervalMining.js 234 B
dist/cjs/actions/test/setLoggingEnabled.js 239 B
dist/cjs/actions/test/setMinGasPrice.js 289 B
dist/cjs/actions/test/setNextBlockBaseFeePerGas.js 300 B
dist/cjs/actions/test/setNextBlockTimestamp.js 290 B
dist/cjs/actions/test/setNonce.js 291 B
dist/cjs/actions/test/setRpcUrl.js 234 B
dist/cjs/actions/test/setStorageAt.js 329 B
dist/cjs/actions/test/snapshot.js 209 B
dist/cjs/actions/test/stopImpersonatingAccount.js 245 B
dist/cjs/actions/wallet/addChain.js 422 B
dist/cjs/actions/wallet/deployContract.js 316 B
dist/cjs/actions/wallet/getAddresses.js 283 B
dist/cjs/actions/wallet/getPermissions.js 222 B
dist/cjs/actions/wallet/index.js 545 B
dist/cjs/actions/wallet/requestAddresses.js 277 B
dist/cjs/actions/wallet/requestPermissions.js 228 B
dist/cjs/actions/wallet/sendTransaction.js 871 B
dist/cjs/actions/wallet/signMessage.js 422 B
dist/cjs/actions/wallet/signTypedData.js 700 B
dist/cjs/actions/wallet/switchChain.js 305 B
dist/cjs/actions/wallet/watchAsset.js 242 B
dist/cjs/actions/wallet/writeContract.js 341 B
dist/cjs/adapters/ethers.js 631 B
dist/cjs/clients/createClient.js 347 B
dist/cjs/clients/createTestClient.js 355 B
dist/cjs/clients/createWalletClient.js 424 B
dist/cjs/clients/decorators/index.js 269 B
dist/cjs/clients/decorators/public.js 648 B
dist/cjs/clients/decorators/test.js 595 B
dist/cjs/clients/decorators/wallet.js 385 B
dist/cjs/clients/index.js 395 B
dist/cjs/clients/transports/createTransport.js 307 B
dist/cjs/clients/transports/custom.js 341 B
dist/cjs/clients/transports/fallback.js 1.34 kB
dist/cjs/clients/transports/http.js 564 B
dist/cjs/clients/transports/index.js 323 B
dist/cjs/clients/transports/webSocket.js 840 B
dist/cjs/constants/abis.js 466 B
dist/cjs/constants/solidity.js 552 B
dist/cjs/constants/unit.js 198 B
dist/cjs/contract.js 626 B
dist/cjs/ens.js 363 B
dist/cjs/errors/abi.js 2.14 kB
dist/cjs/errors/account.js 422 B
dist/cjs/errors/address.js 300 B
dist/cjs/errors/base.js 623 B
dist/cjs/errors/block.js 372 B
dist/cjs/errors/data.js 363 B
dist/cjs/errors/ens.js 661 B
dist/cjs/errors/estimateGas.js 678 B
dist/cjs/errors/log.js 310 B
dist/cjs/errors/node.js 1.61 kB
dist/cjs/errors/request.js 688 B
dist/cjs/errors/rpc.js 1.5 kB
dist/cjs/errors/transaction.js 1.9 kB
dist/cjs/errors/transport.js 296 B
dist/cjs/errors/utils.js 256 B
dist/cjs/errors/version.js 149 B
dist/cjs/ethers.js 224 B
dist/cjs/public.js 627 B
dist/cjs/test.js 675 B
dist/cjs/types/account.js 125 B
dist/cjs/types/block.js 125 B
dist/cjs/types/chain.js 125 B
dist/cjs/types/contract.js 128 B
dist/cjs/types/eip1193.js 277 B
dist/cjs/types/ens.js 123 B
dist/cjs/types/fee.js 123 B
dist/cjs/types/filter.js 125 B
dist/cjs/types/formatter.js 127 B
dist/cjs/types/index.js 125 B
dist/cjs/types/log.js 124 B
dist/cjs/types/misc.js 124 B
dist/cjs/types/multicall.js 127 B
dist/cjs/types/rpc.js 123 B
dist/cjs/types/transaction.js 128 B
dist/cjs/types/transport.js 128 B
dist/cjs/types/typedData.js 128 B
dist/cjs/types/utils.js 124 B
dist/cjs/types/window.js 126 B
dist/cjs/utils/abi/decodeAbiParameters.js 1.53 kB
dist/cjs/utils/abi/decodeDeployData.js 465 B
dist/cjs/utils/abi/decodeErrorResult.js 587 B
dist/cjs/utils/abi/decodeEventLog.js 1.03 kB
dist/cjs/utils/abi/decodeFunctionData.js 522 B
dist/cjs/utils/abi/decodeFunctionResult.js 451 B
dist/cjs/utils/abi/encodeAbiParameters.js 1.7 kB
dist/cjs/utils/abi/encodeDeployData.js 470 B
dist/cjs/utils/abi/encodeErrorResult.js 538 B
dist/cjs/utils/abi/encodeEventTopics.js 768 B
dist/cjs/utils/abi/encodeFunctionData.js 520 B
dist/cjs/utils/abi/encodeFunctionResult.js 451 B
dist/cjs/utils/abi/encodePacked.js 859 B
dist/cjs/utils/abi/formatAbiItem.js 489 B
dist/cjs/utils/abi/formatAbiItemWithArgs.js 389 B
dist/cjs/utils/abi/getAbiItem.js 922 B
dist/cjs/utils/abi/index.js 650 B
dist/cjs/utils/accounts.js 262 B
dist/cjs/utils/address/getAddress.js 516 B
dist/cjs/utils/address/getContractAddress.js 570 B
dist/cjs/utils/address/index.js 343 B
dist/cjs/utils/address/isAddress.js 215 B
dist/cjs/utils/address/isAddressEqual.js 298 B
dist/cjs/utils/buildRequest.js 956 B
dist/cjs/utils/chain.js 397 B
dist/cjs/utils/contract/extractFunctionParts.js 463 B
dist/cjs/utils/contract/index.js 264 B
dist/cjs/utils/data/concat.js 381 B
dist/cjs/utils/data/index.js 426 B
dist/cjs/utils/data/isBytes.js 273 B
dist/cjs/utils/data/isHex.js 230 B
dist/cjs/utils/data/pad.js 580 B
dist/cjs/utils/data/size.js 240 B
dist/cjs/utils/data/slice.js 478 B
dist/cjs/utils/data/trim.js 399 B
dist/cjs/utils/encoding/fromRlp.js 914 B
dist/cjs/utils/encoding/index.js 544 B
dist/cjs/utils/encoding/toRlp.js 544 B
dist/cjs/utils/ens/avatar/index.js 216 B
dist/cjs/utils/ens/avatar/parseAvatarRecord.js 626 B
dist/cjs/utils/ens/avatar/utils.js 2.06 kB
dist/cjs/utils/ens/index.js 309 B
dist/cjs/utils/ens/labelhash.js 304 B
dist/cjs/utils/ens/namehash.js 408 B
dist/cjs/utils/ens/normalize.js 217 B
dist/cjs/utils/ens/packetToBytes.js 441 B
dist/cjs/utils/errors/getCallError.js 315 B
dist/cjs/utils/errors/getEstimateGasError.js 321 B
dist/cjs/utils/errors/getNodeError.js 679 B
dist/cjs/utils/errors/getTransactionError.js 317 B
dist/cjs/utils/errors/index.js 351 B
dist/cjs/utils/filters/createFilterRequestScope.js 332 B
dist/cjs/utils/formatters/block.js 508 B
dist/cjs/utils/formatters/extract.js 280 B
dist/cjs/utils/formatters/feeHistory.js 273 B
dist/cjs/utils/formatters/format.js 309 B
dist/cjs/utils/formatters/index.js 462 B
dist/cjs/utils/formatters/log.js 306 B
dist/cjs/utils/formatters/transaction.js 608 B
dist/cjs/utils/formatters/transactionReceipt.js 553 B
dist/cjs/utils/formatters/transactionRequest.js 402 B
dist/cjs/utils/hash/getEventSelector.js 210 B
dist/cjs/utils/hash/getFunctionSelector.js 238 B
dist/cjs/utils/hash/hashFunction.js 381 B
dist/cjs/utils/hash/index.js 307 B
dist/cjs/utils/hash/isHash.js 229 B
dist/cjs/utils/hash/keccak256.js 332 B
dist/cjs/utils/index.js 2.09 kB
dist/cjs/utils/observe.js 542 B
dist/cjs/utils/poll.js 384 B
dist/cjs/utils/promise/withCache.js 509 B
dist/cjs/utils/promise/withRetry.js 457 B
dist/cjs/utils/promise/withTimeout.js 422 B
dist/cjs/utils/regex.js 293 B
dist/cjs/utils/rpc.js 1.53 kB
dist/cjs/utils/signature/hashMessage.js 337 B
dist/cjs/utils/signature/hashTypedData.js 1.34 kB
dist/cjs/utils/signature/index.js 403 B
dist/cjs/utils/signature/recoverAddress.js 271 B
dist/cjs/utils/signature/recoverMessageAddress.js 265 B
dist/cjs/utils/signature/recoverPublicKey.js 441 B
dist/cjs/utils/signature/recoverTypedDataAddress.js 311 B
dist/cjs/utils/signature/verifyMessage.js 272 B
dist/cjs/utils/signature/verifyTypedData.js 327 B
dist/cjs/utils/stringify.js 258 B
dist/cjs/utils/transaction/assertRequest.js 521 B
dist/cjs/utils/transaction/assertTransaction.js 613 B
dist/cjs/utils/transaction/getSerializedTransactionType.js 377 B
dist/cjs/utils/transaction/getTransactionType.js 358 B
dist/cjs/utils/transaction/index.js 423 B
dist/cjs/utils/transaction/parseTransaction.js 1.47 kB
dist/cjs/utils/transaction/prepareRequest.js 835 B
dist/cjs/utils/transaction/serializeTransaction.js 1.01 kB
dist/cjs/utils/typedData.js 738 B
dist/cjs/utils/uid.js 316 B
dist/cjs/utils/unit/formatEther.js 258 B
dist/cjs/utils/unit/formatGwei.js 254 B
dist/cjs/utils/unit/formatUnits.js 360 B
dist/cjs/utils/unit/index.js 331 B
dist/cjs/utils/unit/parseEther.js 255 B
dist/cjs/utils/unit/parseGwei.js 255 B
dist/cjs/utils/unit/parseUnits.js 465 B
dist/cjs/utils/wait.js 197 B
dist/cjs/wallet.js 377 B
dist/cjs/window.js 143 B
dist/esm/abi.js 147 B
dist/esm/accounts/generateMnemonic.js 146 B
dist/esm/accounts/generatePrivateKey.js 182 B
dist/esm/accounts/hdKeyToAccount.js 286 B
dist/esm/accounts/index.js 320 B
dist/esm/accounts/mnemonicToAccount.js 214 B
dist/esm/accounts/privateKeyToAccount.js 367 B
dist/esm/accounts/toAccount.js 312 B
dist/esm/accounts/types.js 64 B
dist/esm/accounts/utils/index.js 171 B
dist/esm/accounts/utils/parseAccount.js 157 B
dist/esm/accounts/utils/publicKeyToAddress.js 209 B
dist/esm/accounts/utils/sign.js 248 B
dist/esm/accounts/utils/signatureToHex.js 231 B
dist/esm/accounts/utils/signMessage.js 212 B
dist/esm/accounts/utils/signTransaction.js 232 B
dist/esm/accounts/utils/signTypedData.js 222 B
dist/esm/accounts/wordlists/czech.js 107 B
dist/esm/accounts/wordlists/english.js 107 B
dist/esm/accounts/wordlists/french.js 106 B
dist/esm/accounts/wordlists/italian.js 109 B
dist/esm/accounts/wordlists/japanese.js 110 B
dist/esm/accounts/wordlists/korean.js 108 B
dist/esm/accounts/wordlists/simplifiedChinese.js 125 B
dist/esm/accounts/wordlists/spanish.js 109 B
dist/esm/accounts/wordlists/traditionalChinese.js 126 B
dist/esm/actions/ens/getEnsAddress.js 569 B
dist/esm/actions/ens/getEnsAvatar.js 307 B
dist/esm/actions/ens/getEnsName.js 669 B
dist/esm/actions/ens/getEnsResolver.js 492 B
dist/esm/actions/ens/getEnsText.js 564 B
dist/esm/actions/ens/index.js 142 B
dist/esm/actions/getContract.js 879 B
dist/esm/actions/index.js 604 B
dist/esm/actions/public/createBlockFilter.js 240 B
dist/esm/actions/public/createContractEventFilter.js 439 B
dist/esm/actions/public/createEventFilter.js 482 B
dist/esm/actions/public/createPendingTransactionFilter.js 246 B
dist/esm/actions/public/estimateContractGas.js 377 B
dist/esm/actions/public/estimateGas.js 654 B
dist/esm/actions/public/getBalance.js 272 B
dist/esm/actions/public/getBlock.js 412 B
dist/esm/actions/public/getBlockNumber.js 307 B
dist/esm/actions/public/getBlockTransactionCount.js 333 B
dist/esm/actions/public/getBytecode.js 291 B
dist/esm/actions/public/getChainId.js 194 B
dist/esm/actions/public/getFeeHistory.js 318 B
dist/esm/actions/public/getFilterChanges.js 410 B
dist/esm/actions/public/getFilterLogs.js 383 B
dist/esm/actions/public/getGasPrice.js 164 B
dist/esm/actions/public/getLogs.js 548 B
dist/esm/actions/public/getStorageAt.js 278 B
dist/esm/actions/public/getTransaction.js 457 B
dist/esm/actions/public/getTransactionConfirmations.js 283 B
dist/esm/actions/public/getTransactionCount.js 263 B
dist/esm/actions/public/getTransactionReceipt.js 300 B
dist/esm/actions/public/index.js 430 B
dist/esm/actions/public/multicall.js 794 B
dist/esm/actions/public/readContract.js 366 B
dist/esm/actions/public/uninstallFilter.js 164 B
dist/esm/actions/public/waitForTransactionReceipt.js 945 B
dist/esm/actions/public/watchBlockNumber.js 781 B
dist/esm/actions/public/watchBlocks.js 836 B
dist/esm/actions/public/watchContractEvent.js 793 B
dist/esm/actions/public/watchEvent.js 739 B
dist/esm/actions/public/watchPendingTransactions.js 818 B
dist/esm/actions/test/dropTransaction.js 170 B
dist/esm/actions/test/getAutomine.js 150 B
dist/esm/actions/test/getTxpoolContent.js 149 B
dist/esm/actions/test/getTxpoolStatus.js 228 B
dist/esm/actions/test/impersonateAccount.js 174 B
dist/esm/actions/test/increaseTime.js 205 B
dist/esm/actions/test/index.js 408 B
dist/esm/actions/test/inspectTxpool.js 146 B
dist/esm/actions/test/mine.js 221 B
dist/esm/actions/test/removeBlockTimestampInterval.js 162 B
dist/esm/actions/test/reset.js 198 B
dist/esm/actions/test/revert.js 156 B
dist/esm/actions/test/sendUnsignedTransaction.js 228 B
dist/esm/actions/test/setAutomine.js 163 B
dist/esm/actions/test/setBalance.js 218 B
dist/esm/actions/test/setBlockGasLimit.js 208 B
dist/esm/actions/test/setBlockTimestampInterval.js 180 B
dist/esm/actions/test/setCode.js 173 B
dist/esm/actions/test/setCoinbase.js 169 B
dist/esm/actions/test/setIntervalMining.js 168 B
dist/esm/actions/test/setLoggingEnabled.js 171 B
dist/esm/actions/test/setMinGasPrice.js 214 B
dist/esm/actions/test/setNextBlockBaseFeePerGas.js 226 B
dist/esm/actions/test/setNextBlockTimestamp.js 213 B
dist/esm/actions/test/setNonce.js 214 B
dist/esm/actions/test/setRpcUrl.js 165 B
dist/esm/actions/test/setStorageAt.js 254 B
dist/esm/actions/test/snapshot.js 140 B
dist/esm/actions/test/stopImpersonatingAccount.js 179 B
dist/esm/actions/wallet/addChain.js 353 B
dist/esm/actions/wallet/deployContract.js 238 B
dist/esm/actions/wallet/getAddresses.js 208 B
dist/esm/actions/wallet/getPermissions.js 157 B
dist/esm/actions/wallet/index.js 244 B
dist/esm/actions/wallet/requestAddresses.js 203 B
dist/esm/actions/wallet/requestPermissions.js 161 B
dist/esm/actions/wallet/sendTransaction.js 792 B
dist/esm/actions/wallet/signMessage.js 339 B
dist/esm/actions/wallet/signTypedData.js 626 B
dist/esm/actions/wallet/switchChain.js 227 B
dist/esm/actions/wallet/watchAsset.js 174 B
dist/esm/actions/wallet/writeContract.js 260 B
dist/esm/adapters/ethers.js 551 B
dist/esm/chains.js 1.15 kB
dist/esm/clients/createClient.js 273 B
dist/esm/clients/createTestClient.js 273 B
dist/esm/clients/createWalletClient.js 336 B
dist/esm/clients/decorators/index.js 117 B
dist/esm/clients/decorators/public.js 693 B
dist/esm/clients/decorators/test.js 604 B
dist/esm/clients/decorators/wallet.js 351 B
dist/esm/clients/index.js 173 B
dist/esm/clients/transports/createTransport.js 236 B
dist/esm/clients/transports/custom.js 264 B
dist/esm/clients/transports/fallback.js 1.24 kB
dist/esm/clients/transports/http.js 485 B
dist/esm/clients/transports/index.js 144 B
dist/esm/clients/transports/webSocket.js 758 B
dist/esm/constants/abis.js 392 B
dist/esm/constants/solidity.js 486 B
dist/esm/constants/unit.js 127 B
dist/esm/contract.js 297 B
dist/esm/ens.js 168 B
dist/esm/errors/abi.js 1.79 kB
dist/esm/errors/account.js 361 B
dist/esm/errors/address.js 245 B
dist/esm/errors/base.js 568 B
dist/esm/errors/block.js 317 B
dist/esm/errors/data.js 309 B
dist/esm/errors/ens.js 565 B
dist/esm/errors/estimateGas.js 614 B
dist/esm/errors/log.js 254 B
dist/esm/errors/node.js 1.46 kB
dist/esm/errors/request.js 585 B
dist/esm/errors/rpc.js 1.21 kB
dist/esm/errors/transaction.js 1.72 kB
dist/esm/errors/transport.js 224 B
dist/esm/errors/utils.js 162 B
dist/esm/errors/version.js 82 B
dist/esm/ethers.js 104 B
dist/esm/public.js 279 B
dist/esm/test.js 311 B
dist/esm/types/account.js 66 B
dist/esm/types/block.js 64 B
dist/esm/types/chain.js 64 B
dist/esm/types/contract.js 67 B
dist/esm/types/eip1193.js 234 B
dist/esm/types/ens.js 62 B
dist/esm/types/fee.js 62 B
dist/esm/types/filter.js 65 B
dist/esm/types/formatter.js 68 B
dist/esm/types/index.js 64 B
dist/esm/types/log.js 62 B
dist/esm/types/misc.js 63 B
dist/esm/types/multicall.js 68 B
dist/esm/types/rpc.js 62 B
dist/esm/types/transaction.js 70 B
dist/esm/types/transport.js 66 B
dist/esm/types/typedData.js 68 B
dist/esm/types/utils.js 64 B
dist/esm/types/window.js 65 B
dist/esm/utils/abi/decodeAbiParameters.js 1.44 kB
dist/esm/utils/abi/decodeDeployData.js 389 B
dist/esm/utils/abi/decodeErrorResult.js 496 B
dist/esm/utils/abi/decodeEventLog.js 952 B
dist/esm/utils/abi/decodeFunctionData.js 419 B
dist/esm/utils/abi/decodeFunctionResult.js 373 B
dist/esm/utils/abi/encodeAbiParameters.js 1.61 kB
dist/esm/utils/abi/encodeDeployData.js 389 B
dist/esm/utils/abi/encodeErrorResult.js 442 B
dist/esm/utils/abi/encodeEventTopics.js 679 B
dist/esm/utils/abi/encodeFunctionData.js 414 B
dist/esm/utils/abi/encodeFunctionResult.js 375 B
dist/esm/utils/abi/encodePacked.js 803 B
dist/esm/utils/abi/formatAbiItem.js 402 B
dist/esm/utils/abi/formatAbiItemWithArgs.js 309 B
dist/esm/utils/abi/getAbiItem.js 835 B
dist/esm/utils/abi/index.js 274 B
dist/esm/utils/accounts.js 127 B
dist/esm/utils/address/getAddress.js 414 B
dist/esm/utils/address/getContractAddress.js 450 B
dist/esm/utils/address/index.js 154 B
dist/esm/utils/address/isAddress.js 144 B
dist/esm/utils/address/isAddressEqual.js 220 B
dist/esm/utils/buildRequest.js 927 B
dist/esm/utils/chain.js 310 B
dist/esm/utils/contract/extractFunctionParts.js 364 B
dist/esm/utils/contract/index.js 117 B
dist/esm/utils/data/concat.js 295 B
dist/esm/utils/data/index.js 168 B
dist/esm/utils/data/isBytes.js 206 B
dist/esm/utils/data/isHex.js 163 B
dist/esm/utils/data/pad.js 489 B
dist/esm/utils/data/size.js 162 B
dist/esm/utils/data/slice.js 376 B
dist/esm/utils/data/trim.js 334 B
dist/esm/utils/encoding/fromRlp.js 833 B
dist/esm/utils/encoding/index.js 213 B
dist/esm/utils/encoding/toRlp.js 445 B
dist/esm/utils/ens/avatar/index.js 97 B
dist/esm/utils/ens/avatar/parseAvatarRecord.js 553 B
dist/esm/utils/ens/avatar/utils.js 1.94 kB
dist/esm/utils/ens/index.js 145 B
dist/esm/utils/ens/labelhash.js 227 B
dist/esm/utils/ens/namehash.js 324 B
dist/esm/utils/ens/normalize.js 138 B
dist/esm/utils/ens/packetToBytes.js 362 B
dist/esm/utils/errors/getCallError.js 237 B
dist/esm/utils/errors/getEstimateGasError.js 245 B
dist/esm/utils/errors/getNodeError.js 626 B
dist/esm/utils/errors/getTransactionError.js 243 B
dist/esm/utils/errors/index.js 164 B
dist/esm/utils/filters/createFilterRequestScope.js 268 B
dist/esm/utils/formatters/block.js 432 B
dist/esm/utils/formatters/extract.js 224 B
dist/esm/utils/formatters/feeHistory.js 206 B
dist/esm/utils/formatters/format.js 234 B
dist/esm/utils/formatters/index.js 204 B
dist/esm/utils/formatters/log.js 236 B
dist/esm/utils/formatters/transaction.js 532 B
dist/esm/utils/formatters/transactionReceipt.js 470 B
dist/esm/utils/formatters/transactionRequest.js 328 B
dist/esm/utils/hash/getEventSelector.js 132 B
dist/esm/utils/hash/getFunctionSelector.js 160 B
dist/esm/utils/hash/hashFunction.js 303 B
dist/esm/utils/hash/index.js 140 B
dist/esm/utils/hash/isHash.js 150 B
dist/esm/utils/hash/keccak256.js 249 B
dist/esm/utils/index.js 825 B
dist/esm/utils/observe.js 468 B
dist/esm/utils/poll.js 309 B
dist/esm/utils/promise/withCache.js 431 B
dist/esm/utils/promise/withRetry.js 382 B
dist/esm/utils/promise/withTimeout.js 358 B
dist/esm/utils/regex.js 224 B
dist/esm/utils/rpc.js 1.45 kB
dist/esm/utils/signature/hashMessage.js 250 B
dist/esm/utils/signature/hashTypedData.js 1.24 kB
dist/esm/utils/signature/index.js 179 B
dist/esm/utils/signature/recoverAddress.js 187 B
dist/esm/utils/signature/recoverMessageAddress.js 180 B
dist/esm/utils/signature/recoverPublicKey.js 357 B
dist/esm/utils/signature/recoverTypedDataAddress.js 223 B
dist/esm/utils/signature/verifyMessage.js 196 B
dist/esm/utils/signature/verifyTypedData.js 243 B
dist/esm/utils/stringify.js 195 B
dist/esm/utils/transaction/assertRequest.js 437 B
dist/esm/utils/transaction/assertTransaction.js 520 B
dist/esm/utils/transaction/getSerializedTransactionType.js 297 B
dist/esm/utils/transaction/getTransactionType.js 286 B
dist/esm/utils/transaction/index.js 196 B
dist/esm/utils/transaction/parseTransaction.js 1.36 kB
dist/esm/utils/transaction/prepareRequest.js 752 B
dist/esm/utils/transaction/serializeTransaction.js 926 B
dist/esm/utils/typedData.js 660 B
dist/esm/utils/uid.js 251 B
dist/esm/utils/unit/formatEther.js 172 B
dist/esm/utils/unit/formatGwei.js 172 B
dist/esm/utils/unit/formatUnits.js 298 B
dist/esm/utils/unit/index.js 139 B
dist/esm/utils/unit/parseEther.js 171 B
dist/esm/utils/unit/parseGwei.js 172 B
dist/esm/utils/unit/parseUnits.js 396 B
dist/esm/utils/wait.js 131 B
dist/esm/wallet.js 177 B
dist/esm/window.js 75 B

compressed-size-action

@jxom jxom marked this pull request as ready for review April 18, 2023 02:13
@jxom jxom changed the title wip – feat: eth_call multicall aggregation feat: eth_call multicall aggregation Apr 18, 2023
@codecov
Copy link

codecov bot commented Apr 18, 2023

Codecov Report

Merging #387 (2cbd516) into main (d197914) will increase coverage by 0.00%.
The diff coverage is 99.62%.

@@           Coverage Diff            @@
##             main     #387    +/-   ##
========================================
  Coverage   99.89%   99.90%            
========================================
  Files         265      267     +2     
  Lines       21811    22060   +249     
  Branches     1849     1891    +42     
========================================
+ Hits        21789    22038   +249     
+ Misses         20       19     -1     
- Partials        2        3     +1     
Impacted Files Coverage Δ
src/utils/errors/getContractError.ts 98.55% <88.88%> (-1.45%) ⬇️
src/actions/public/call.ts 100.00% <100.00%> (ø)
src/actions/public/simulateContract.ts 100.00% <100.00%> (ø)
src/clients/createPublicClient.ts 100.00% <100.00%> (ø)
src/constants/contract.ts 100.00% <100.00%> (ø)
src/constants/index.ts 100.00% <100.00%> (ø)
src/errors/chain.ts 100.00% <100.00%> (ø)
src/errors/contract.ts 96.20% <100.00%> (ø)
src/errors/index.ts 100.00% <100.00%> (ø)
src/index.ts 100.00% <100.00%> (ø)
... and 3 more

... and 2 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

wait,
shouldSplitBatch(args) {
const size = args.reduce((size, { data }) => size + (data.length - 2), 0)
return size > batchSize * 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is batchSize multiplied by 2?

Copy link
Member Author

@jxom jxom Apr 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting to hex size!

@@ -115,6 +115,7 @@ export async function simulateContract<
} as unknown as EncodeFunctionDataParameters<TAbi, TFunctionName>)
try {
const { data } = await call(client, {
batch: false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is batching okay for simulateContract? You can still pass in batch: true because it's not omitted from SimulateContractParameters (CallParameters).

image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no, it’s not okay. Good catch.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better to Pick<CallParameters, ...> versus Omit<CallParameters, ...>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some pretty nice utils we have here :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants