-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
fix: Convert BN to hexadecimal when balance from chain is defined #3933
Conversation
…n the balance is defined
Wondering if we could expose a loading statement from this controller, for the client know when ethQuery is defined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah... this bug would have been caught if BNToHex
did not take any
as its argument. This is being addressed via #3717.
In any case, would you mind adding a test for this?
With regard to your question here, I think the proper pattern we should look into adopting is that controllers should not be initialized until a provider (and thus an |
## **Description** We were experiencing `undefined is not an object (evaluating 'inputBn.toString')` this warning multiple times when opening the app, because `this.ethQuery` it was not defined yet at the `AccountTrackerController` when . It was added a condition to only update the balance if it was possible to get balance from chain. Core PR: MetaMask/core#3933 ## **Related issues** Fixes: ## **Manual testing steps** 1. Open the app 2. Shouldn't have the warning `undefined is not an object (evaluating 'inputBn.toString')` 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** e Smoke E2E test builds: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/a075edf7-676e-4d24-8b0d-014890863b6d Regression E2E test builds: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/30f56c4e-3811-432c-83f0-139ea5b16ff5 ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've clearly explained what problem this PR is solving and how it is solved. - [ ] I've linked related issues - [x] I've included manual testing steps - [ ] I've included screenshots/recordings if applicable - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [ ] I’ve properly set the pull request status: - [ ] 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** - [x] 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.
this fix will be addressed in #3975. |
Explanation
Currently, we are trying to convert to hexadecimal a balance that is undefined because ethQuery is not initialized yet and we are not able to fetch the balance.
References
Changelog
@metamask/assets-controllers
refresh
function to only convert to hexadecimal if balance is definedChecklist