Add networkClientId to DetectTokensController.detectNewTokens()
Description
Currently networkClientId token based polling in the DetectTokensController does not make the getBalancesInSingleCall contract call with the provider for the networkClientId. This is because networkClientId is not being passed from _executePoll to getBalancesInSingleCall.
This PR adds an optional networkClientId param to detectNewTokens which is used to:
- make
getBalancesInSingleCallcalls with the correct provider - override the chainId argument if also passed
Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/2097
Manual testing steps
Nothing should change as this does not affect the current single globally selected network flow and the multichain polling for this has not been integrated yet.
Screenshots/Recordings
Before
After
Pre-merge author checklist
- [x] I’ve followed MetaMask Coding Standards.
- [x] I've clearly explained what problem this PR is solving and how it is solved.
- [x] I've linked related issues
- [ ] I've included manual testing steps
- [ ] I've included screenshots/recordings if applicable
- [x] I’ve included tests if applicable
- [ ] I’ve documented my code using JSDoc format if applicable
- [x] I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
- [x] I’ve properly set the pull request status:
- [x] In case it's not yet "ready for review", I've set it to "draft".
- [ ] In case it's "ready for review", I've changed it from "draft" to "non-draft".
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.
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.
Codecov Report
Attention: 3 lines in your changes are missing coverage. Please review.
Comparison is base (
34df597) 68.54% compared to head (2cd0d7a) 68.54%.
| Files | Patch % | Lines |
|---|---|---|
| app/scripts/controllers/detect-tokens.js | 62.50% | 3 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## develop #22898 +/- ##
===========================================
- Coverage 68.54% 68.54% -0.00%
===========================================
Files 1088 1088
Lines 42900 42904 +4
Branches 11418 11419 +1
===========================================
+ Hits 29403 29405 +2
- Misses 13497 13499 +2
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Builds ready [2cd0d7a]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (989 ± 48 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 160 | 348 | 208 | 40 | 19 |
| domContentLoaded | 14 | 69 | 49 | 21 | 10 | ||
| load | 881 | 1278 | 989 | 99 | 48 | ||
| domInteractive | 14 | 69 | 49 | 21 | 10 |
Bundle size diffs [🚨 Warning! Bundle size has increased!]
- background: 47 Bytes (0.00%)
- ui: 0 Bytes (0.00%)
- common: 0 Bytes (0.00%)