Package Exports
- etherscan-abi
- etherscan-abi/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (etherscan-abi) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
etherscan-abi
⏬🚀 Fetch the most up-to-date ABI of verified Smart Contracts (including proxy implementations) from Etherscan in seconds!
Usage
CLI
- Fetch the ABI of a contract from an address and save it to
abis/ContractName.json:
npx etherscan-abi 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984- Note that if a standard proxy is detected, the proxy's implementation ABI will automatically be fetched:
npx etherscan-abi 0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9- You can optionally provide a
targetdirectory path, an EtherscanapiKey(to bypass the default query rate limit), or specify anetworkon which to query the Smart Contract's source code (by name or chainId, decimal or hexadecimal):
npx etherscan-abi --target abis/uniswap/ \
--apiKey ... \
--network polygon \
0xb33EaAd8d922B1083446DC23f610c2567fB5180fJavascript
const { ethers } = require("ethers");
const { getContractAt } = require("etherscan-abi");
getContractAt(
"0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
new ethers.providers.JsonRpcProvider("...")
)
.then((uni) => uni.balanceOf("..."))
.then(console.log);Install
npm install etherscan-abiyarn add etherscan-abi