{"_id":"@alfulinku/ethers-multicall-provider","name":"@alfulinku/ethers-multicall-provider","dist-tags":{"latest":"4.0.0"},"versions":{"4.0.0":{"name":"@alfulinku/ethers-multicall-provider","version":"4.0.0","description":"⚡🕰️ Drop-in solution to batch smart contract RPC calls in a single RPC query via Multicall!","main":"lib/index.js","scripts":{"build":"tsc --build ./tsconfig.build.json","prepare":"husky install","test:watch":"jest --watch","test":"jest --coverage --detectOpenHandles","typecheck":"tsc --noEmit","typechain":"typechain --target ethers-v6 --out-dir src/types 'abis/*.json'"},"repository":{"type":"git","url":"git+https://github.com/rubilmax/ethers-multicall-provider.git"},"license":"MIT","author":{"name":"Romain","email":"rmilon@gmail.com","url":"Rubilmax"},"engines":{"node":">=12.0"},"keywords":["ethers","multicall","provider","rpc","call","evm","smart contract"],"bugs":{"url":"https://github.com/rubilmax/ethers-multicall-provider/issues"},"homepage":"https://github.com/rubilmax/ethers-multicall-provider#readme","dependencies":{"ethers":"^6.0.0","lodash":"^4.17.0"},"devDependencies":{"@trivago/prettier-plugin-sort-imports":"^4.2.0","@typechain/ethers-v6":"^0.5.0","@types/jest":"^29.5.4","@types/lodash":"^4.14.197","@types/lodash.debounce":"^4.0.7","commitizen":"^4.3.0","conventional-changelog-conventionalcommits":"^6.1.0","cz-conventional-changelog":"^3.3.0","dotenv":"^16.3.1","husky":"^8.0.3","jest":"^29.6.4","lint-staged":"^14.0.1","prettier":"^2.8.8","ts-jest":"^29.1.1","typechain":"^8.3.1","typescript":"^5.1.6"},"peerDependencies":{"lodash":"^4.17.0"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"lint-staged":{"*.ts":"prettier"},"release":{"branches":["main"],"plugins":[["@semantic-release/commit-analyzer",{"preset":"conventionalcommits","releaseRules":[{"type":"build","scope":"deps","release":"patch"}]}],["@semantic-release/release-notes-generator",{"preset":"conventionalcommits","presetConfig":{"types":[{"type":"feat","section":"Features"},{"type":"fix","section":"Bug Fixes"},{"type":"build","section":"Dependencies and Other Build Updates","hidden":false}]}}],"@semantic-release/npm","@semantic-release/github"]},"jest":{"preset":"ts-jest","testEnvironment":"node","testTimeout":60000,"testMatch":["<rootDir>/test/**/*.spec.ts"],"collectCoverageFrom":["<rootDir>/src/**/*.ts","!<rootDir>/src/types/**/*.ts"],"transform":{"\\.tsx?$":["ts-jest",{"diagnostics":false,"isolatedModules":true}]}},"types":"./lib/index.d.ts","gitHead":"986dea42bd8b716c65a031a343b99c2a5cba0628","_id":"@alfulinku/ethers-multicall-provider@4.0.0","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-a0jLt1p2fZs2xtntengQTl6gFBHSP7MhJsU257LMjuYT6UYX773QJ3DEIGHTRRBCs2DPCZ02K7ybU10Pxv4V3A==","shasum":"daed7b4ca34af8facf598ce0f7d191fbd84edfc1","tarball":"https://registry.npmjs.org/@alfulinku/ethers-multicall-provider/-/ethers-multicall-provider-4.0.0.tgz","fileCount":25,"unpackedSize":91628,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCnju6QeyulHs7ZI3sFN/OyKi+G1jROV9FV2ubShuSu5gIgJO5sP6OiGeOYKZVnnDrOTnMOHpVkn21CZQMfMpECZdM="}]},"_npmUser":{"name":"alfulinku","email":"alfulinku@gmail.com"},"directories":{},"maintainers":[{"name":"alfulinku","email":"alfulinku@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ethers-multicall-provider_4.0.0_1695130544230_0.4769161075140178"},"_hasShrinkwrap":false}},"time":{"created":"2023-09-19T13:35:44.098Z","4.0.0":"2023-09-19T13:35:44.451Z","modified":"2023-09-19T13:35:44.745Z"},"maintainers":[{"name":"alfulinku","email":"alfulinku@gmail.com"}],"description":"⚡🕰️ Drop-in solution to batch smart contract RPC calls in a single RPC query via Multicall!","homepage":"https://github.com/rubilmax/ethers-multicall-provider#readme","keywords":["ethers","multicall","provider","rpc","call","evm","smart contract"],"repository":{"type":"git","url":"git+https://github.com/rubilmax/ethers-multicall-provider.git"},"author":{"name":"Romain","email":"rmilon@gmail.com","url":"Rubilmax"},"bugs":{"url":"https://github.com/rubilmax/ethers-multicall-provider/issues"},"license":"MIT","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> ⚡🚀 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 & Multicall3, enabling faster queries up to block #12_336_033 on mainnet\n- Natively supports 25+ EVM-compatible chains on which Multicall3 & 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-v5\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### Using ethers-v6\n\n```bash\nnpm install ethers-multicall-provider\n```\n\n```bash\nyarn add ethers-multicall-provider\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(() => \"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","readmeFilename":"README.md"}