If you're working with token contracts like ERC-20 or ERC-721, you can input the corresponding ABI JSON interface into your web3 instance to access contract data and call functions. Check if these functions return a value or encounter an error.
For more information, visit:
const myContract = new Contract(tokenInterface, contractAddress);
try {
const name = await myContract.methods.name().call();
} catch (error) {
// The contract may not have the 'name' function or public property
}
Note that certain token standards like ERC-721 may not mandate the presence of 'name' and 'symbol' fields within the contract.