Skip to content

Conversation

bergarces
Copy link
Contributor

@bergarces bergarces commented Oct 13, 2025

Description

Open in GitHub Codespaces

Changelog

CHANGELOG entry:

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot
Copy link
Collaborator

metamaskbot commented Oct 13, 2025

✨ Files requiring CODEOWNER review ✨

@MetaMask/confirmations (2 files, +0 -8)
  • 📁 ui/
    • 📁 pages/
      • 📁 confirmations/
        • 📁 confirmation/
          • 📁 stories/
            • 📄 util.js +0 -1
          • 📁 templates/
            • 📄 create-named-snap-account.test.js +0 -7

🧪 @MetaMask/qa (1 files, +0 -14)
  • 📁 test/
    • 📁 e2e/
      • 📄 fixture-builder.js +0 -14

useExternalServices: true,
// from core PreferencesController
isMultiAccountBalancesEnabled: true,
useMultiAccountBalanceChecker: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting them together as it'll be easier to remove one when we eventually migrate to the core PreferencesController. For now, and considering this PR is already big enough, we are keeping both.

*/
export function getKeyringControllerMessenger(
messenger: Messenger<AllowedActions, AllowedEvents>,
messenger: Messenger<never, never>,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was using the wrong types from a different controller. KeyringController does not require any AllowedActions or AllowedEvents

networkClientId,
);
},
includeStakedAssets: false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not part of this PR to include staked assets in the assets list. When we want to enable them, we can do so.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just moved the properties together so it's easier to refactor them when the time comes.

setUseMultiAccountBalanceChecker(val: boolean): void {
this.update((state) => {
state.useMultiAccountBalanceChecker = val;
state.isMultiAccountBalancesEnabled = val;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making sure isMultiAccountBalancesEnabled gets updated as well. Before this, it was always kept as true and not being used at all.


// clear accounts in AccountTrackerController
this.accountTrackerController.clearAccounts();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not being done in mobile.

// this.accountTrackerController.updateAccountByAddress({
// address: from,
// networkClientId,
// });
Copy link
Contributor Author

@bergarces bergarces Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no equivalent method in this version of the controller to update a specific account for a specific network.

  • refresh does not work with a specific account, but with the selected account, which is not good here as the transaction could be for any account in the wallet.
  • syncBalanceWithAddresses only returns the results, but it does not update the state.

We can either do:

  • Full refresh of all accounts for that network (unnecessarily expensive)
  • No refresh at all and wait for the balances to update on their own
  • Make changes to AccountTrackerController to support this feature


this.accountTrackerController.syncWithAddresses(addresses);
// TODO AccountTrackerController Migration: Review how this works before merging
// this.accountTrackerController.syncWithAddresses(addresses);
Copy link
Contributor Author

@bergarces bergarces Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no equivalent method for this currently.

Why do we want KeyringController state changes to update every single address balance? Mobile does not seem to be doing it.


// Updating accounts in this.accountTrackerController before starting UI syncing ensure that
// state has account balance before it is synced with UI
await this.accountTrackerController.updateAccountsAllActiveNetworks();
Copy link
Contributor Author

@bergarces bergarces Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very odd thing to do. The UI should be able to handle the default state of AccountTrackerController. Current testing shows that it does.

Do we want to do a full refresh and wait for the result before entering the UI?

At best, we should manage that within the UI, not force it here.

oldAccounts.concat(accounts.map((a) => a.address.toLowerCase())),
),
];
this.accountTrackerController.syncWithAddresses(accountsToTrack);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This uses the old addresses state and adds the accounts to the state for balance tracking after they appear in the page and before they've been confirmed.

We do not have an equivalent feature in the new AccountTrackerController.


export function getBlockGasLimit(state) {
return state.metamask.currentBlockGasLimit;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not being used or referenced anywhere.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants