I really don't get it how to view the result of a simple view function. I have the following function that needs to query the token URI for an ERC-721 contract:
export const getTokenURI = async (tokenContract, tokenId) => {
try {
const contractABI = [
"function tokenURI(uint256 _tokenId) returns (string memory)",
];
const contractObject = new ethers.Contract(
tokenContract,
contractABI,
signer
);
const result = await contractObject.tokenURI(tokenId);
console.log(result);
return result;
} catch (err) {
throw err;
}
};
This logs the payload on the screenshot below:
Now, the tokenURI
function returns a string of the URI, but I can't see it in the payload above. I suspect it is in the data
field, but then how to decode it?
Am I missing something fundamental here?