From e00d1620108108955fb852be40aec213f1daffa7 Mon Sep 17 00:00:00 2001 From: legobt <6wbvkn0j@anonaddy.me> Date: Mon, 28 Oct 2024 06:42:10 +0000 Subject: [PATCH] deps: number-to-bn -> @metamask/number-to-bn --- app/util/number/index.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/util/number/index.js b/app/util/number/index.js index 831335468987..76dfef8ee347 100644 --- a/app/util/number/index.js +++ b/app/util/number/index.js @@ -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'; @@ -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') diff --git a/package.json b/package.json index e66c367fd260..9328583a4a90 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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",