Skip to main content
All CollectionsDevelop with Core
Core API Calls: wallet_watchAsset
Core API Calls: wallet_watchAsset
A
Written by Ana
Updated this week

Requests that the user track the specified token in Core. Returns a boolean indicating if the token was successfully added. Once added, the token is indistinguishable from those added using legacy methods, such as a centralized registry. Introduced by EIP-747.

Params (2)

1. type (required)

string

Supports ERC-20, ERC-721, and ERC-1155 tokens. Support for ERC-721 and ERC-1155 tokens is experimental and currently only available on the extension (not on mobile). See MIP-1 and MIP proposal lifecycle for more information.

Allowed values: ERC20 ERC721 ERC1155

2. options (required)

address string (required)

The address of the token contract.

symbol string

A ticker symbol or shorthand, up to 11 characters (optional for ERC-20 tokens).

>= 2 characters<= 11 characters

decimals number

The number of token decimals (optional for ERC-20 tokens).

image string

A string URL of the token logo (optional for ERC-20 tokens).

tokenId string

The unique identifier of the NFT (required for ERC-721 and ERC-1155 tokens).

Result (WatchAssetResult)

true if the token was added, false otherwise.

boolean

Errors

Code

Message

-32602

Must specify address, symbol, and decimals.

-32602

Invalid symbol: not a string.

-32602

Invalid symbol '${symbol}': longer than 11 characters.

-32602

Invalid decimals '${decimals}': must be 0 <= 36.

-32602

Invalid address '${address}'.

-32602

Asset type is required.

-32602

Both address and tokenId are required.

-32602

Invalid address.

-32000

Suggested NFT is not owned by the selected account.

-32000

Suggested NFT of type ${standard} does not match received type ${type}.

-32002

Unable to verify ownership. Possibly because the standard is not supported or the user's currently selected network does not match the chain of the asset in question.

Examples

wallet_watchAsset ERC-20 example:

Request

await window.ethereum.request({
"method": "wallet_watchAsset",
"params": {
"type": "ERC20",
"options": {
"address": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
"symbol": "FOO",
"decimals": 18,
"image": "https://foo.io/token-image.svg"
}
}
});

Result

true

wallet_watchAsset ERC-721 example:

Request

await window.ethereum.request({
"method": "wallet_watchAsset",
"params": {
"type": "ERC721",
"options": {
"address": "0x123456789abcdef0123456789abcdef01234567",
"tokenId": "42"
}
}
});

Result

true

wallet_watchAsset ERC-721 example:

Request

await window.ethereum.request({
"method": "wallet_watchAsset",
"params": {
"type": "ERC1155",
"options": {
"address": "0xabcdef0123456789abcdef0123456789abcdef01",
"tokenId": "1337"
}
}
});

Result

true

For any additional questions, please view our other knowledge base articles or contact a Product Support team member via the chat button. Examples are for illustrative purposes only.

Did this answer your question?