watchAsset
Requests that the user tracks the token in their wallet. Returns a boolean indicating if the token was successfully added.
Usage
import { } from './client'
const = await .({
: 'ERC20',
: {
: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
: 18,
: 'WETH',
},
})Returns
boolean
Boolean indicating if the token was successfully added.
Parameters
type
- Type:
string
Token type.
import { , } from 'viem'
import { } from 'viem/chains'
export const = ({
: ,
: (.!),
})
// ---cut--
const = await .({
: 'ERC20',
: {
: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
: 18,
: 'WETH',
},
});options.address
- Type:
Address
The address of the token contract.
const = await .({
: 'ERC20',
: {
: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
: 18,
: 'WETH',
},
});options.decimals
- Type:
number
The number of token decimals.
const = await .({
: 'ERC20',
: {
: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
: 18,
: 'WETH',
},
});options.symbol
- Type:
string
A ticker symbol or shorthand, up to 11 characters.
const = await .({
: 'ERC20',
: {
: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
: 18,
: 'WETH',
}
})options.image
- Type:
string
A string url of the token logo.
const = await .({
: 'ERC20',
: {
: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
: 18,
: 'WETH',
: 'https://weth.com/icon.png',
}
})