{"id":15643322,"url":"https://github.com/rubilmax/ethers-multicall-provider","last_synced_at":"2025-04-04T09:06:08.923Z","repository":{"id":118269845,"uuid":"605575561","full_name":"Rubilmax/ethers-multicall-provider","owner":"Rubilmax","description":"⚡🕰️ Call any set of functions from any set of smart contracts in a single RPC query, seamlessly using ethers' providers API!","archived":false,"fork":false,"pushed_at":"2025-03-12T16:37:57.000Z","size":605,"stargazers_count":62,"open_issues_count":4,"forks_count":10,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T08:04:36.735Z","etag":null,"topics":["api","batch","call","contract","ethereum","ethers","multicall","performance","provider","query","smart","wrapper"],"latest_commit_sha":null,"homepage":"https://github.com/Rubilmax/ethers-multicall-provider","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/Rubilmax.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":"2023-02-23T13:00:32.000Z","updated_at":"2025-03-12T16:33:44.000Z","dependencies_parsed_at":"2025-01-09T01:18:15.367Z","dependency_job_id":null,"html_url":"https://github.com/Rubilmax/ethers-multicall-provider","commit_stats":{"total_commits":84,"total_committers":3,"mean_commits":28.0,"dds":0.0357142857142857,"last_synced_commit":"e80869ff4462ebd2e206c764aa93f42146c80362"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rubilmax%2Fethers-multicall-provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rubilmax%2Fethers-multicall-provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rubilmax%2Fethers-multicall-provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rubilmax%2Fethers-multicall-provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rubilmax","download_url":"https://codeload.github.com/Rubilmax/ethers-multicall-provider/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247149500,"owners_count":20891954,"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":["api","batch","call","contract","ethereum","ethers","multicall","performance","provider","query","smart","wrapper"],"created_at":"2024-10-03T12:00:14.849Z","updated_at":"2025-04-04T09:06:08.893Z","avatar_url":"https://github.com/Rubilmax.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\u003e [!WARNING]  \n\u003e Ethers made changes to their `Provider` \u0026 `Signer` classes throughout v6, that are breaking types. For versions `v6.7` to `v6.10`, use `ethers-multicall-provider@6.2.0`. For later versions, use `ethers-multicall-provider@6.3.0`.\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%2Frubilmax%2Fethers-multicall-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubilmax%2Fethers-multicall-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubilmax%2Fethers-multicall-provider/lists"}