I am having some trouble determining the owner of a specific token_id.
const fs = require('fs'); var jsonFile = "abi/ERC721.abi"; var abi = JSON.parse(fs.readFileSync(jsonFile)); const contractAddress = "<ERC721_address>"; const controller = new web3.eth.Contract(abi, contractAddress); const tokenId = web3.utils.keccak256(web3.utils.asciiToHex(<Thing>)); // On-chain contract, computes token_id as keccak(bytes("<Thing>")) console.log(controller.methods.ownerOf(token_id).call()) // Error: Returned error: execution reverted
When I run this code, I keep getting an error. Now, I am quite certain that this is happening because the contract doesn't like the data I am passing to the
ownerOf function, but I can't for the life of me figure out why.
Any help much appreciated.