Created
April 11, 2021 06:10
-
-
Save anupam-io/8a10ec60854d2205378c4a5a205df241 to your computer and use it in GitHub Desktop.
Loading ABI dynamically from contract address
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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