Add Token

Request

This method allows developers to add a custom token to the token list of a MetaMask or WalletConnect wallet. This method is important to game developers, because many games have dozens or even hundreds of tokens, spanning beyond the list of tokens that MetaMask or other wallets are able to auto-detect.

Parameters

  • type : In the future, other standards will be supported

  • address : The address of the token contract

  • symbol: A ticker symbol or shorthand, up to 11 characters

  • decimals: The number of token decimals

  • image: A string url of the token logo

curl --location --request POST "localhost:9680/rpc" \
--header 'Content-Type: application/json' \
--data-raw '{
   "request":{
        "method": "wallet_watchAsset",
        "params": {
            "type": "ERC20",
            "options": {
                "address": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
                "symbol": "USDT",
                "decimals": 6,
                "image": "chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/images/contract/usdt.svg"
            }
        }
   },
   "chain":{
      "chainId":"1"
   }
}'

Response

true

Last updated