Created
January 27, 2022 17:37
-
-
Save itinance/e624fd41d6a184f0f9c66ba456c50208 to your computer and use it in GitHub Desktop.
Execute tokenURI-method on ERC721-contract
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
const ethers = require('ethers'); | |
const API_KEY = 'YOUR_INFURA_APIKEY'; | |
// The Contract interface | |
const abi = [ | |
"function tokenURI(uint256 _tokenId) external view returns (string)", | |
]; | |
// the contract interface | |
const contractAddress = "0x2f3ee0ace02c71bc82863a28633c0f983a5435bb"; | |
const network = 'rinkeby'; | |
const infuraProvider = new ethers.providers.InfuraProvider(network, API_KEY); | |
// We connect to the Contract using a Provider, so we will only | |
// have read-only access to the Contract | |
let contract = new ethers.Contract(contractAddress, abi, infuraProvider); | |
let currentValue = contract.tokenURI(1); | |
currentValue.then(console.log) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment