Skip to content

Instantly share code, notes, and snippets.

@polluterofminds
Created January 13, 2022 16:10
Show Gist options
  • Save polluterofminds/3b197112c365ee0b2dcf85bdba3fc254 to your computer and use it in GitHub Desktop.
Save polluterofminds/3b197112c365ee0b2dcf85bdba3fc254 to your computer and use it in GitHub Desktop.
Get Token URI with Hardhat
const hre = require("hardhat");
async function main() {
try {
const Contract = await hre.ethers.getContractFactory("AvalancheNFTDrop");
const contract = await Contract.attach(
"YOUR CONTRACT ADDRESS" // The deployed contract address
);
const uri = await contract.tokenURI(1);
console.log("Token URI: ", uri);
} catch (error) {
console.log(error);
}
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment