{"id":18369122,"url":"https://github.com/bitfancy/multicallwrapper","last_synced_at":"2025-04-10T19:39:45.140Z","repository":{"id":237689782,"uuid":"760151363","full_name":"BitFancy/MulticallWrapper","owner":"BitFancy","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-19T21:59:41.000Z","size":335,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-15T20:54:19.017Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BitFancy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-19T21:58:04.000Z","updated_at":"2024-10-26T20:14:19.000Z","dependencies_parsed_at":"2024-05-03T01:21:06.879Z","dependency_job_id":null,"html_url":"https://github.com/BitFancy/MulticallWrapper","commit_stats":null,"previous_names":["bitfancy/multicallwrapper"],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitFancy%2FMulticallWrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitFancy%2FMulticallWrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitFancy%2FMulticallWrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BitFancy%2FMulticallWrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BitFancy","download_url":"https://codeload.github.com/BitFancy/MulticallWrapper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281424,"owners_count":21077423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T23:28:31.032Z","updated_at":"2025-04-10T19:39:45.114Z","avatar_url":"https://github.com/BitFancy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ethers-multicall-provider\n\n[![npm package][npm-img]][npm-url]\n[![Build Status][build-img]][build-url]\n[![Downloads][downloads-img]][downloads-url]\n[![Issues][issues-img]][issues-url]\n[![Commitizen Friendly][commitizen-img]][commitizen-url]\n[![Semantic Release][semantic-release-img]][semantic-release-url]\n\n\u003e ⚡🚀 Call any set of functions from any set of smart contracts in a single RPC query, seamlessly using ethers' providers API!\n\nQuerying an RPC endpoint can be very costly (**100+ queries**) when loading data from multiple smart contracts.\nWith multicall, batch these queries into a single, on-chain query, without additional over-head!\n\n- Integrates both Multicall2 \u0026 Multicall3, enabling faster queries up to block #12_336_033 on mainnet\n- Natively supports 25+ EVM-compatible chains on which Multicall3 \u0026 Multicall2 are deployed\n- Enables 10x faster off-chain data queries, making UIs faster to render and reload\n- Built-in support for blockTag-specific contract calls, batching all calls made at the same block tag (if applicable)\n- Only fails specific failing smart contract calls when batching, which makes debugging as easy as with native ethers\n\n### `ethers-multicall-provider` is a drop-in solution batching ALL smart contract calls!\n\n```diff\n-  const provider = getDefaultProvider(\"...\");\n+  const provider = MulticallWrapper.wrap(getDefaultProvider(\"...\"));\n```\n\n---\n\n## Installation\n\n### Using ethers-v6\n\n```bash\nnpm install ethers-multicall-provider\n```\n\n```bash\nyarn add ethers-multicall-provider\n```\n\n### Using ethers-v5\n\n\u003e [!WARNING]  \n\u003e This version is deprecated and probably is not as efficient as with v6.\n\n```bash\nnpm install ethers-multicall-provider@3.1.2\n```\n\n```bash\nyarn add ethers-multicall-provider@3.1.2\n```\n\n---\n\n## Usage\n\nWrap any ethers provider using `MulticallWrapper.wrap` and use the wrapped provider anywhere you want to batch calls!\n\n```typescript\nimport { ethers } from \"ethers\";\nimport { MulticallWrapper } from \"ethers-multicall-provider\";\n\nconst provider = MulticallWrapper.wrap(getDefaultProvider(\"...\"));\n\nMulticallWrapper.isMulticallProvider(provider); // Returns true, only useful for type safety.\n\nlet uni = new ethers.Contract(\"0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984\", UniAbi, provider);\n\n// Calls performed simultaneously are automatically batched when using the multicall provider.\nPromise.all([\n  uni.name(),\n  uni.symbol(),\n  uni.decimals(),\n  uni.inexistantFunction().catch(() =\u003e \"default value\"),\n]).then(console.log);\n\n// When batching calls is no longer expected, just disable it.\nprovider.isMulticallEnabled = false;\n\n// Calls performed simultaneously will still perform 2 separate on-chain calls.\nPromise.all([uni.name(), uni.symbol()]).then(console.log);\n```\n\n## Limits\n\n### `msg.sender` override\n\nBecause calls are batched through the Multicall contract, all calls will inherently have the Multicall contract as `msg.sender`. This has no impact on most queries, because most of the time `msg.sender` is not used in view functions ; but it may introduce unexpected behaviors in specific smart contracts.\n\nTo circumvent this, just use the default ethers provider in places where you don't want `msg.sender` to be overriden.\n\n### Network cache\n\nStarting from `ethers-v6`, network is no longer cached in the provider, so that each RPC call first requests the network and updates the provider consequently. Using `ethers-multicall-provider`, the first network the provider is connected to is cached and can only be changed by calling `fetchNetwork()`.\n\n[build-img]: https://github.com/rubilmax/ethers-multicall-provider/actions/workflows/release.yml/badge.svg\n[build-url]: https://github.com/rubilmax/ethers-multicall-provider/actions/workflows/release.yml\n[downloads-img]: https://img.shields.io/npm/dt/ethers-multicall-provider\n[downloads-url]: https://www.npmtrends.com/ethers-multicall-provider\n[npm-img]: https://img.shields.io/npm/v/ethers-multicall-provider\n[npm-url]: https://www.npmjs.com/package/ethers-multicall-provider\n[issues-img]: https://img.shields.io/github/issues/rubilmax/ethers-multicall-provider\n[issues-url]: https://github.com/rubilmax/ethers-multicall-provider/issues\n[codecov-img]: https://codecov.io/gh/rubilmax/ethers-multicall-provider/branch/main/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/rubilmax/ethers-multicall-provider\n[semantic-release-img]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\n[semantic-release-url]: https://github.com/semantic-release/semantic-release\n[commitizen-img]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg\n[commitizen-url]: http://commitizen.github.io/cz-cli/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfancy%2Fmulticallwrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitfancy%2Fmulticallwrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfancy%2Fmulticallwrapper/lists"}