0xe742180B119E01c305136D8E4BE3B25Ed8B3185B
han0147 opened this issue · 1 comments
han0147 commented
function onApproveWatchAsset() {
// your approval callback implementation
}
function onDenyWatchAsset() {
// your denying callback implementation
}
function onError(message: string) {
// your error callback implementation
}
// Use wallet_watchAsset
ethereum.request({
method: "wallet_watchAsset",
params: {
type: "ERC20",
options: {
address: "0xcf664087a5bb0237a0bad6742852ec6c8d69a27a",
symbol: "WONE",
decimals: 18,
image:
"https://s2.coinmarketcap.com/static/img/coins/64x64/11696.png",
},
},
})
.then(response => {
const result : boolean = response as boolean
result ? onApproveWatchAsset() : onDenyWatchAsset()
})
.catch(err => onError(err.message));
han0147 commented
go