https://github.com/pugson/abi-data
Grab your smart contract’s ABI as JSON from Etherscan. Supports multiple chains and testnets.
https://github.com/pugson/abi-data
arbitrum avalanche base bsc ethereum ethereum-contract optimism polygon wagmi
Last synced: 6 months ago
JSON representation
Grab your smart contract’s ABI as JSON from Etherscan. Supports multiple chains and testnets.
- Host: GitHub
- URL: https://github.com/pugson/abi-data
- Owner: pugson
- License: unlicense
- Created: 2023-02-12T14:27:04.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-16T21:44:13.000Z (about 1 year ago)
- Last Synced: 2024-11-23T00:24:53.544Z (7 months ago)
- Topics: arbitrum, avalanche, base, bsc, ethereum, ethereum-contract, optimism, polygon, wagmi
- Language: TypeScript
- Homepage: https://abidata.net
- Size: 544 KB
- Stars: 48
- Watchers: 4
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ABI Data — grab your smart contract’s ABI as JSON from Etherscan, Polygonscan, Arbiscan, BaseScan, BscScan, FTMScan, Snowtrace, GnosisScan

Fetch smart contract ABI JSON to use with wagmi and ethers.js in your app. Records are cached for 365 days, so after the initial request for a contract, the API will respond very quickly from the CDN. This is just a simple wrapper around various *scan APIs.
## General usage
Supported networks:
| Network name | Network ID |
|--------------------------|-----------------------|
| Ethereum Mainnet | none (default) |
| Ethereum Goerli Testnet | `goerli` |
| Ethereum Sepolia Testnet | `sepolia` |
| Avalanche Mainnet | `avalanche` |
| Avalanche Fuji Testnet | `avalancheFuji` |
| Arbitrum Mainnet | `arbitrum` |
| Arbitrum Goerli Testnet | `arbitrumGoerli` |
| Arbitrum Nova | `arbitrumNova` |
| Base Mainnet | `base` |
| Base Goerli Testnet | `baseGoerli` |
| BSC Mainnet | `bsc` |
| BSC Testnet | `bscTestnet` |
| Fantom Mainnet | `fantom` |
| Fantom Testnet | `fantomTestnet` |
| Polygon Mainnet | `polygon` |
| Polygon Mumbai Testnet | `polygonMumbai` |
| Polygon zkEVM | `polygonZkEvm` |
| Polygon zkEVM Testnet | `polygonZkEvmTestnet` |
| Optimism Mainnet | `optimism` |
| Optimism Goerli Testnet | `optimismGoerli` |
| Gnosis Mainnet | `gnosis` |```
https://abidata.net/?network=```
Examples:
- USDT on Ethereum Mainnet: https://abidata.net/0xdAC17F958D2ee523a2206206994597C13D831ec7
- Chainlink LINK token on Ethereum Sepolia: https://abidata.net/0x779877a7b0d9e8603169ddbd7836e478b4624789?network=sepolia## React usage example
```jsx
import { useState, useEffect } from "react";
import { useContractWrite, usePrepareContractWrite } from "wagmi";const contractAddress = "0xecb504d39723b0be0e3a9aa33d646642d1051ee1";
const useContractABI = (contractAddress) => {
const [contractABI, setContractABI] = useState(null);useEffect(() => {
const fetchContractABI = async () => {
const response = await fetch(`https://abidata.net/${contractAddress}`);
const json = await response.json();
setContractABI(json.abi);
};fetchContractABI();
}, [contractAddress]);return contractABI;
};function App() {
const contractABI = useContractABI(contractAddress);
const { config } = usePrepareContractWrite({
address: contractAddress,
abi: contractABI,
functionName: "feed",
});const { data, isLoading, isSuccess, write } = useContractWrite(config);
return (
write?.()}>
Feed
{isLoading &&Check Wallet}
{isSuccess &&Transaction: {JSON.stringify(data)}}
);
}
```## Development
This is a Next.js app.
First, run the development server:```bash
npm run dev
# or
yarn dev
# or
pnpm dev
```Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.