11147 님 안녕하세요
튜토리얼을 보시면 아래처럼 예제코드가 있습니다. 만들고 계신 bapp에 아래 코드를 원하시는 토큰 정보에 맞게 넣으시면 되겠습니다~ 혹시 아래 코드가 동작이 안 된다는 말씀이실까요?
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!')
}
}
)