Skip to content

Commit

Permalink
Merge pull request #17 from ava-labs/erc721ts
Browse files Browse the repository at this point in the history
Add script to read tokenURI from deployed NFT.
  • Loading branch information
cgcardona authored Jul 19, 2021
2 parents 6a6cc2f + 3a26b06 commit d54ae34
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"test": "npx hardhat test",
"deploy": "npx hardhat run scripts/deploy.ts",
"erc20": "npx hardhat run scripts/erc20.ts",
"erc721": "npx hardhat run scripts/erc721.ts --network mainnet",
"storage": "npx hardhat run scripts/storage.ts",
"send-avax-wallet-signer": "npx hardhat run scripts/sendAvaxWalletSigner.ts",
"send-avax-json-provider": "npx hardhat run scripts/sendAvaxJSONProvider.ts",
Expand Down
18 changes: 18 additions & 0 deletions scripts/erc721.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Contract } from "ethers"
import { ethers } from "hardhat"
import { abi } from "../artifacts/contracts/ERC721.sol/NFT.json"

const coinAddr: string = "0xe304EDd5C4e590e2b8ce08b9625597FF38192D71"
const main = async (): Promise<any> => {
const contract: Contract = new Contract(coinAddr, abi, ethers.provider)
const tokenID: number = 395
const tokenURI = await contract.tokenURI(tokenID)
console.log(tokenURI)
}

main()
.then(() => process.exit(0))
.catch(error => {
console.error(error)
process.exit(1)
})
5 changes: 5 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"resolveJsonModule": true
}
}

0 comments on commit d54ae34

Please sign in to comment.