MetaMask / MetaMask/metamask-mobile
[Sentry] Error: [number-to-bn] while converting number "NaN" to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported.
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 1.7k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 669
Description
Sentry Issue: [METAMASK-MOBILE-2GPC](https://metamask.sentry.io/issues/5648466246/?referrer=github_integration)
```
Error: [number-to-bn] while converting number "NaN" to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported.
at ResultError (ses.cjs:7676:17)
at fromWei (app/util/number/index.js:103:18)
at e.renderToGwei (app/util/number/index.js:471:16)
at renderGwei (app/components/UI/TransactionElement/utils.js:94:12)
at decodeSwapsTx (app/components/UI/TransactionElement/utils.js:844:21)
...
(16 additional frame(s) were not displayed)
```
Contributor guide
Research direction
Start in app/components/UI/TransactionElement/utils.js at decodeSwapsTx and renderGwei, then trace the value into app/util/number/index.js at fromWei. Determine which transaction data produces NaN and how the conversion should handle it. Done means the invalid BN conversion no longer occurs for the affected swap transaction and the displayed value remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100