[英]How to add a logo to an ERC20 token?
MetaMask 實現了EIP-747標准(目前在 2022 年 5 月未完成)及其wallet_watchAsset
方法來顯示自定義令牌徽標。
請注意,這不是每個令牌地址的集中式徽標數據庫,因此每個 MetaMask 實例理論上可以為同一令牌顯示不同的徽標。 並且用戶需要手動或通過確認由您的網絡應用程序片段打開的 MetaMask 彈出窗口來顯式添加徽標。
MetaMask 文檔中的代碼示例:
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
},
},
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.