-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersperf
Description
Right now wallet_getAssets will make a multicall request per asset, including metadata and balance.
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:
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> { |
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersperf