MetaMask / MetaMask/metamask-mobile
[Bug]: Different big number libraries being used
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 1.7k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 669
Description
### Describe the bug
We have multiple BigNumber libraries in use right now, `bignumber.js`, `bn.js`, etc
You can see this from `app/util/number/index.js`
```
import { BN, stripHexPrefix } from 'ethereumjs-util';
import { utils as ethersUtils } from 'ethers';
import convert from 'ethjs-unit';
import {
BNToHex,
hexToBN as controllerHexToBN,
} from '@metamask/controller-utils';
import numberToBN from 'number-to-bn';
import BigNumber from 'bignumber.js';
```
Would be good to settle on a single library.
### Expected behavior
A singular BigNumber library should be used to prevent incompatibilities or strange/unexpected behavior from happening.
### Screenshots/Recordings
_No response_
### Steps to reproduce
n/a
### Error messages or log output
_No response_
### Version
7.24.0
### Build type
None
### Device
Android, iOS
### Operating system
iOS, Android
### Additional context
_No response_
### Severity
_No response_
Contributor guide
Research direction
Start with app/util/number/index.js and inventory how the listed BigNumber libraries are used across the project. Determine which single library can cover those conversions; done means the number utilities no longer mix incompatible BigNumber implementations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100