I want to retrieve metadataURI
, but I got this error
cannot estimate gas; transaction may fail or may require manual gas limit (error={"reason":"processing response error","code":"SERVER_ERROR","body":"{\"jsonrpc\":\"2.0\",\"id\":61,\"error\":{\"code\":-32000,\"message\":\"execution reverted\"}}","error":{"code":-32000},"requestBody":"{\"method\":\"eth_call\",\"params\":[{\"to\":\"0x5fbdb2315678afecb367f032d93f642f64180aa3\",\"data\":\"0xc87b56dd0000000000000000000000000000000000000000000000000000000000000001\"},\"latest\"],\"id\":61,\"jsonrpc\":\"2.0\"}","requestMethod":"POST","url":"https://rpc-mumbai.maticvigil.com"}, method="call", transaction={"to":"0x5FbDB2315678afecb367f032d93F642f64180aa3","data":"0xc87b56dd0000000000000000000000000000000000000000000000000000000000000001","accessList":null}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.2.0)
Code
async function getNFT({contract, provider, tokenId}) {
console.log(tokenId)
console.log(contract)
const metadataURI = await contract.tokenURI(tokenId);
// const metadata = await fetchIPFSJSON(metadataURI);
// console.log('metadata: ', metadata)
// if (metadata.image) {
// metadata.image = makeGatewayURL(metadata.image);
// }
// return metadata;
}
Here my console log
contract.tokenURI(tokenId).call()