{"_id":"@chanceprotocol/etherplex","name":"@chanceprotocol/etherplex","dist-tags":{"latest":"1.1.5"},"versions":{"1.1.5":{"name":"@chanceprotocol/etherplex","version":"1.1.5","description":"Multicall with Ethers.js","main":"dist/index.js","browser":"dist/index.js","types":"src/index.ts","repository":{"type":"git","url":"git+https://github.com/pooltogether/etherplex.git"},"author":{"name":"Brendan Asselstine","email":"brendan@chanceprotocol.us"},"license":"MIT","directories":{"lib":"dist","src":"src"},"dependencies":{"debug":"^4.1.1","lodash":"^4.17.15","lodash.merge":"^4.6.2","zen-observable-ts":"^0.8.20"},"peerDependencies":{"@ethersproject/abi":"^5.1.0","ethers":"^5.0.31"},"devDependencies":{"@ethersproject/abi":"^5.1.0","@types/jest":"^24.0.23","bufferutil":"^4.0.3","ethers":"^5.0.31","jest":"^24.9.0","jest-leak-detector":"^25.1.0","node-fetch":"^2.6.0","promise.allsettled":"^1.0.2","rollup":"^1.27.4","rollup-plugin-typescript":"^1.0.1","ts-jest":"^24.2.0","tslib":"^1.10.0","typedoc":"^0.15.3","typescript":"^3.7.2","utf-8-validate":"^5.0.4"},"scripts":{"test":"jest -w 1","dist":"rollup -c rollup.config.js","dist-clean":"rm -rf _virtual abis index.js typeDefs.js Call.js MulticallContract.js MulticallExecutor.js batch.js contract.js decodeCalls.js encodeCalls.js","watch":"rollup -w -c rollup.config.js","coverage":"jest --coverage --coverageReporters html","test-watch":"jest --watchAll","docs":"typedoc src"},"bugs":{"url":"https://github.com/pooltogether/etherplex/issues"},"homepage":"https://github.com/pooltogether/etherplex#readme","_id":"@chanceprotocol/etherplex@1.1.5","_integrity":"sha512-xHW7Ur0elKIqL1mEvbwITChhF6C4AsjxNb9+AkPTr4HGMQAwkMZyq74nTvSYqpehul2CHtW25N5TM675M0xKwg==","_resolved":"/tmp/56322b8e6f7452a3c1a73b6f2c30484e/chanceprotocol-etherplex-1.1.5.tgz","_from":"file:chanceprotocol-etherplex-1.1.5.tgz","_nodeVersion":"16.15.1","_npmVersion":"9.6.5","dist":{"integrity":"sha512-xHW7Ur0elKIqL1mEvbwITChhF6C4AsjxNb9+AkPTr4HGMQAwkMZyq74nTvSYqpehul2CHtW25N5TM675M0xKwg==","shasum":"fd87d962cd13c933085752d0bc06d5a74c998f15","tarball":"https://registry.npmjs.org/@chanceprotocol/etherplex/-/etherplex-1.1.5.tgz","fileCount":54,"unpackedSize":115704,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC0rfzMiyn4IaRGy8PfYnm4BKDfKgekc8GNAfotSQhieQIhAPhbXbvD9HxxmGEjcmBqlrjnsAbvLZnY1cFHTjIfPWUg"}]},"_npmUser":{"name":"chanceprotocol","email":"chance@netixsol.com"},"maintainers":[{"name":"chanceprotocol","email":"chance@netixsol.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/etherplex_1.1.5_1692257203452_0.1047642164642395"},"_hasShrinkwrap":false}},"time":{"created":"2023-08-17T07:26:43.372Z","1.1.5":"2023-08-17T07:26:43.675Z","modified":"2023-08-17T07:26:43.913Z"},"maintainers":[{"name":"chanceprotocol","email":"chance@netixsol.com"}],"description":"Multicall with Ethers.js","homepage":"https://github.com/pooltogether/etherplex#readme","repository":{"type":"git","url":"git+https://github.com/pooltogether/etherplex.git"},"author":{"name":"Brendan Asselstine","email":"brendan@chanceprotocol.us"},"bugs":{"url":"https://github.com/pooltogether/etherplex/issues"},"license":"MIT","readme":"# Etherplex\n\n[Ethers.js](https://github.com/ethers-io/ethers.js) + [Multicall](https://github.com/makerdao/multicall)\n\nBatch multiple Ethereum JSON RPC calls into a single RPC call.\n\nFeatures:\n\n- Uses the Multicall contract when available\n- Falls back to individual RPC requests when not available\n\n# Setup\n\n```bash\n$ yarn add @chanceprotocol/etherplex\n```\n\n# Usage\n\n1. First create a contract wrapper using the `contract` function\n2. Chain calls on the contract and pass the results into the `batch` function\n\n```javascript\nimport { ethers } from 'ethers'\nimport { batch, contract } from '@chanceprotocol/etherplex'\n\n// Assuming ERC20Abi is an ABI\n// Assume the DAI_ADDRESS and USDC_ADDRESS constants are Ethereum addresses\n\nlet daiContract = contract('Dai', ERC20Abi, DAI_ADDRESS)\n\n// Alternatively, you can just pass in an ethers.Contract instance\nlet ethersContract = new ethers.Contract(USDC_ADDRESS, ERC20Abi, provider)\nlet usdcContract = contract('Usdc', ethersContract)\n\nlet results = await batch(\n  ethers.getDefaultProvider(),\n  daiContract\n    .balanceOf(address)\n    .totalSupply(),\n  usdcContract\n    .balanceOf(address)\n    .totalSupply()\n)\n/*\nWill yield:\n\n{\n  Dai: {\n    'balanceOf(address)': [BigNumber],\n    balanceOf: [BigNumber],\n  },\n  Usdc: {\n    'balanceOf(address)': [BigNumber],\n    balanceOf: [BigNumber],\n  }\n}\n\n*/\n```\n","readmeFilename":"README.md"}