Registering Your Token

When a user opens their Kaikas, they are shown a variety of assets, including tokens. By default, Kaikas auto-detects some popular tokens and they are avaialbe for search. However for most tokens, the user will need to add the token themselves.

While it is possible for users to manually add token via Add Token button in Kaikas, the process can be cumbersome, and since the user has to type in the contract addresses, it is very error prone.

You can greatly improve the security and experience of users adding your token to their Kaikas by taking advantage of the wallet_watchAsset API.

Example

If you'd like to integrate suggesting a token into your own web app, you can follow this code snippet to implement it:

const tokenAddress = '0xd00981105e61274c8a5cd5a88fe7e037d935b513'
const tokenSymbol = 'TUT'
const tokenDecimals = 18
const tokenImage = 'http://placekitten.com/200/300'
‚Äč
klaytn.sendAsync(
{
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
}
},
id: Math.round(Math.random() * 100000)
},
(err, added) => {
if (added) {
console.log('Thanks for your interest!')
} else {
console.log('Your loss!')
}
}
)