Skip to content

Commit 89a94d5

Browse files
committed
fix: use aggregate3 function to fetch balances for all accounts
1 parent 3c745eb commit 89a94d5

20 files changed

+3653
-643
lines changed

eslint-warning-thresholds.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,13 @@
5353
"import-x/order": 1
5454
},
5555
"packages/assets-controllers/src/Standards/ERC20Standard.test.ts": {
56-
"prettier/prettier": 1
56+
"jest/no-commented-out-tests": 1
5757
},
5858
"packages/assets-controllers/src/Standards/NftStandards/ERC721/ERC721Standard.ts": {
5959
"prettier/prettier": 1
6060
},
61-
"packages/assets-controllers/src/TokenBalancesController.ts": {
62-
"@typescript-eslint/prefer-readonly": 4,
63-
"jsdoc/check-tag-names": 4,
64-
"jsdoc/tag-lines": 11
61+
"packages/assets-controllers/src/TokenBalancesController.test.ts": {
62+
"no-empty-function": 1
6563
},
6664
"packages/assets-controllers/src/TokenDetectionController.test.ts": {
6765
"import-x/namespace": 11,
@@ -102,8 +100,8 @@
102100
"packages/assets-controllers/src/assetsUtil.ts": {
103101
"jsdoc/tag-lines": 2
104102
},
105-
"packages/assets-controllers/src/multi-chain-accounts-service/multi-chain-accounts.ts": {
106-
"jsdoc/tag-lines": 2
103+
"packages/assets-controllers/src/multi-chain-accounts-service/api-balance-fetcher.test.ts": {
104+
"@typescript-eslint/no-unused-vars": 1
107105
},
108106
"packages/assets-controllers/src/multicall.test.ts": {
109107
"@typescript-eslint/prefer-promise-reject-errors": 2

packages/assets-controllers/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
- Supports up to 300 calls per batch with automatic fallback to individual calls on unsupported chains
1616
- Returns organized balance data as nested maps for easy consumption by client applications
1717

18+
### Changed
19+
20+
- Improved `TokenBalancesController` performance with two-tier balance fetching strategy ([#6232](https://github.com/MetaMask/core/pull/6232))
21+
- Implements Accounts API as primary fetching method for supported networks (faster, more efficient)
22+
- Falls back to RPC calls using Multicall3's `aggregate3` for unsupported networks or API failures
23+
- Significantly reduces RPC calls from N individual requests to batched calls of up to 300 operations
24+
- Provides comprehensive network coverage with graceful degradation when services are unavailable
25+
1826
### Fixed
1927

2028
- Use a narrow selector when listening to `CurrencyRateController:stateChange` ([#6217](https://github.com/MetaMask/core/pull/6217))

packages/assets-controllers/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
"jest": "^27.5.1",
100100
"jest-environment-jsdom": "^27.5.1",
101101
"nock": "^13.3.1",
102+
"reselect": "^5.1.1",
102103
"sinon": "^9.2.4",
103104
"ts-jest": "^27.1.4",
104105
"typedoc": "^0.24.8",

0 commit comments

Comments
 (0)