Skip to content

Commit

Permalink
deps: number-to-bn -> @metamask/number-to-bn
Browse files Browse the repository at this point in the history
  • Loading branch information
legobeat committed Oct 28, 2024
1 parent eb48de6 commit e00d162
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/util/number/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { stripHexPrefix } from 'ethereumjs-util';
import BN from 'bn.js';
import { utils as ethersUtils } from 'ethers';
import convert from '@metamask/ethjs-unit';
import numberToBN from '@metamask/number-to-bn';
import { add0x, remove0x } from '@metamask/utils';
import numberToBN from 'number-to-bn';
import BigNumber from 'bignumber.js';

import currencySymbols from '../currency-symbols.json';
Expand Down Expand Up @@ -377,7 +377,7 @@ export function isDecimal(value) {
*/
export function toBN(value) {
// TODO: Throw on NaN input
if (isNaN(value)) {
if (typeof value === 'number' && isNaN(value)) {
return new BN(0);
}
return value?.startsWith('0x')
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
"@metamask/message-signing-snap": "^0.3.3",
"@metamask/network-controller": "^21.0.0",
"@metamask/notification-services-controller": "^0.8.2",
"@metamask/number-to-bn": "^1.7.1",
"@metamask/permission-controller": "^11.0.0",
"@metamask/phishing-controller": "^12.0.3",
"@metamask/post-message-stream": "^8.0.0",
Expand Down Expand Up @@ -261,7 +262,6 @@
"lottie-react-native": "5.1.5",
"mockttp": "^3.15.2",
"multihashes": "0.4.14",
"number-to-bn": "1.7.0",
"path": "0.12.7",
"pbkdf2": "3.1.2",
"pify": "6.1.0",
Expand Down

0 comments on commit e00d162

Please sign in to comment.