Created
April 20, 2021 04:10
-
-
Save fukaoi/1013cbdd164dcd3343e2df3d9bbcc9ee to your computer and use it in GitHub Desktop.
fetch token url from smart contract at NFT toreka (NTX)
This file contains hidden or 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 Web3 = require('web3'); | |
const web3 = new Web3('https://mainnet.infura.io/v3/1835809e0e6a4de38eaf1f7afb51e0ec'); | |
const contractAddress = '0x34047D5d7F4C906998e0d9Def0d2Dc3B523d8398'; | |
const abi = [ | |
{ | |
"constant": true, | |
"inputs": [ | |
{ | |
"name": "_tokenId", | |
"type": "uint256" | |
} | |
], | |
"name": "tokenURI", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "string" | |
} | |
], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function", | |
}, | |
]; | |
const tokenId = 3767; | |
new web3.eth.Contract(abi, contractAddress).methods.tokenURI(tokenId).call().then(res => { | |
console.log(res); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment