Skip to content
This repository was archived by the owner on Aug 3, 2026. It is now read-only.
This repository was archived by the owner on Aug 3, 2026. It is now read-only.

Improve wallet_getAssets #1498

Description

@joshieDo

Right now wallet_getAssets will make a multicall request per asset, including metadata and balance.

relay/src/rpc/relay.rs

Lines 2745 to 2752 in 07fa527

let (balance, decimals, name, symbol) = chain_provider
.multicall()
.add(erc20.balanceOf(request.account))
.add(erc20.decimals())
.add(erc20.name())
.add(erc20.symbol())
.aggregate()
.await?;

However this could be greatly improved by batching assets into one/many multicalls just for balanceOf and then using the following to get each asset metadata:

relay/src/asset.rs

Lines 62 to 71 in 07fa527

/// Lookup asset info for a given chain and a list of assets. It first checks the cache, and if
/// it cannot find it will query it from chain.
///
/// # Note:
/// Ensures that the returned map contains all the requested assets.
pub async fn get_asset_info_list<P: Provider>(
&self,
provider: &P,
assets: Vec<Asset>,
) -> Result<HashMap<Asset, AssetWithInfo>, RelayError> {

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions