Skip to content

Instantly share code, notes, and snippets.

@anupam-io
Created April 11, 2021 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anupam-io/8a10ec60854d2205378c4a5a205df241 to your computer and use it in GitHub Desktop.
Save anupam-io/8a10ec60854d2205378c4a5a205df241 to your computer and use it in GitHub Desktop.
Loading ABI dynamically from contract address
rpcEndpoint = `...`;
addressURL = `...`;
const axios = require("axios");
const Web3 = require("web3");
var web3 = new Web3(new Web3.providers.HttpProvider(rpcEndpoint));
async function main() {
url =
`http://api-kovan.etherscan.io/api?module=contract&action=getabi&address=` +
addressURL +
`&format=raw`;
console.log("Get request at: ", url);
res = await axios.get(url);
console.log(res.data);
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment