wallet_getAssets
Returns the assets for an account.
Request
type Request = {
method: 'wallet_getAssets',
params: [{
/** Address of the account to get assets for. */
account: `0x${string}`,
/** Filter assets by chain. If not provided, all chains will be included. */
chainFilter?: Hex[],
/** Filter assets by type. If not provided, all asset types will be included. */
assetTypeFilter?: AssetType[],
/** Filter assets by name. If not provided, all assets will be included. */
assetFilter?: string[],
/** Filter assets by symbol. If not provided, all assets will be included. */
}]
}
Response
type Response = {
[chainId: Hex]: {
address: Address | null
balance: Hex
metadata: {
decimals: number
name: string
symbol: string
} | null
type: 'native' | 'erc20'
}[]
}
Example
import { Porto } from 'porto'
const { provider } = Porto.create()
const [account] = await provider.request({ method: 'eth_requestAccounts' })
const assets = await provider.request({
method: 'wallet_getAssets',
params: [{ account }],
})