Untitled
unknown
plain_text
4 years ago
959 B
5
Indexable
const tokenAddress = '0xc852426f0fd87a2e33669ed485e3395e3c559952';
const tokenSymbol = 'METAPUL';
const tokenDecimals = 9;
const tokenImage = 'https://www.pulproject.com/wp-content/uploads/2021/11/Token-Logo-2.png';
try {
// wasAdded is a boolean. Like any RPC method, an error may be thrown.
const wasAdded = await ethereum.request({
method: 'wallet_watchAsset',
params: {
type: 'ERC20', // Initially only supports ERC20, but eventually more!
options: {
address: tokenAddress, // The address that the token is at.
symbol: tokenSymbol, // A ticker symbol or shorthand, up to 5 chars.
decimals: tokenDecimals, // The number of decimals in the token
image: tokenImage, // A string url of the token logo
},
},
});
if (wasAdded) {
console.log('Thanks for your interest!');
} else {
console.log('Your loss!');
}
} catch (error) {
console.log(error);
}Editor is loading...