const tokenAddress = '0x7f7F49B6128F7CB89BAaB704F6EA1662A270455b';
const tokenSymbol = 'Drax';
const tokenDecimals = 18;
async function addTokenFunction() {
try {
const wasAdded = await ethereum.request({
method: 'wallet_watchAsset',
params: {
type: 'ERC20',
options: {
address: tokenAddress,
symbol: tokenSymbol,
decimals: tokenDecimals,
image: tokenImage,
},
},
});
if (wasAdded) {
console.log('Thanks for your interest!');
} else {
console.log('HelloWorld Coin has not been added');
}
} catch (error) {
console.log(error);
}
}