Skip to content

chore: make networkClientId mandatory field in assetsContractController #5941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
2 changes: 1 addition & 1 deletion eslint-warning-thresholds.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"jsdoc/check-tag-names": 5
},
"packages/assets-controllers/src/AssetsContractController.test.ts": {
"import-x/order": 3
"import-x/order": 2
},
"packages/assets-controllers/src/AssetsContractController.ts": {
"jsdoc/check-tag-names": 2,
Expand Down
3 changes: 3 additions & 0 deletions packages/assets-controllers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- **BREAKING** Make `networkClientId` mandatory in `syncBalanceWithAddresses` fct in `AccountTrackerController` ([#5941](https://github.com/MetaMask/core/pull/5941))
- Removed `chainId` in constructor in `AssetsContractController` ([#5941](https://github.com/MetaMask/core/pull/5941))
- Make `networkClientId` mandatory field in all functions in `AssetsContractController` ([#5941](https://github.com/MetaMask/core/pull/5941))
- Bump `@metamask/controller-utils` to `^11.10.0` ([#5935](https://github.com/MetaMask/core/pull/5935))
- Add `getErc20Balances` function within `TokenBalancesController` to support fetching ERC-20 token balances for a given address and token list ([#5925](https://github.com/MetaMask/core/pull/5925))
- This modular service simplifies balance retrieval logic and can be reused across different parts of the controller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -672,10 +672,10 @@ describe('AccountTrackerController', () => {
mockedQuery
.mockReturnValueOnce(Promise.resolve('0x10'))
.mockReturnValueOnce(Promise.resolve('0x20'));
const result = await controller.syncBalanceWithAddresses([
ADDRESS_1,
ADDRESS_2,
]);
const result = await controller.syncBalanceWithAddresses(
[ADDRESS_1, ADDRESS_2],
'mainnet',
);
expect(result[ADDRESS_1].balance).toBe('0x10');
expect(result[ADDRESS_2].balance).toBe('0x20');
},
Expand All @@ -697,10 +697,10 @@ describe('AccountTrackerController', () => {
mockedQuery
.mockReturnValueOnce(Promise.resolve('0x10'))
.mockReturnValueOnce(Promise.resolve('0x20'));
const result = await controller.syncBalanceWithAddresses([
ADDRESS_1,
ADDRESS_2,
]);
const result = await controller.syncBalanceWithAddresses(
[ADDRESS_1, ADDRESS_2],
'mainnet',
);
expect(result[ADDRESS_1].balance).toBe('0x10');
expect(result[ADDRESS_2].balance).toBe('0x20');
expect(result[ADDRESS_1].stakedBalance).toBe('0x1');
Expand Down
4 changes: 2 additions & 2 deletions packages/assets-controllers/src/AccountTrackerController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,12 @@ export class AccountTrackerController extends StaticIntervalPollingController<Ac
* Sync accounts balances with some additional addresses.
*
* @param addresses - the additional addresses, may be hardware wallet addresses.
* @param networkClientId - Optional networkClientId to fetch a network client with.
* @param networkClientId - networkClientId to fetch a network client with.
* @returns accounts - addresses with synced balance
*/
async syncBalanceWithAddresses(
addresses: string[],
networkClientId?: NetworkClientId,
networkClientId: NetworkClientId,
): Promise<
Record<string, { balance: string; stakedBalance?: StakedBalance }>
> {
Expand Down
Loading
Loading