关于区块链:Metamask一键添加代币

7次阅读

共计 238 个字符,预计需要花费 1 分钟才能阅读完成。

不废话间接上代码

const address='xxx' // 代币地址
const symbol = 'xxx' // 代币名称 (个别都是英文大写)
const decimals = 18 // 写死 18
const image = 'xxx' // 代币图标
ethereum.request({
    method: 'wallet_watchAsset',
    params: {
        type: 'ERC20',
        options: {
            address,
            symbol,
            decimals,
            image 
        }
    }
})

以上就是一键增加代币代码,心愿对大家有帮忙

正文完
 0