diff --git a/.iyarc b/.iyarc index abbf0e189d26..e69de29bb2d1 100644 --- a/.iyarc +++ b/.iyarc @@ -1,3 +0,0 @@ -# ReDoS vulnerability, no impact to this application, and fix not backported yet to the versions we use - -GHSA-c2qf-rxjj-qqgw diff --git a/app/components/Nav/Main/RootRPCMethodsUI.js b/app/components/Nav/Main/RootRPCMethodsUI.js index 086d3c3a61f7..310fa254e2e6 100644 --- a/app/components/Nav/Main/RootRPCMethodsUI.js +++ b/app/components/Nav/Main/RootRPCMethodsUI.js @@ -25,7 +25,7 @@ import { getIsSwapApproveOrSwapTransaction, isApprovalTransaction, } from '../../../util/transactions'; -import { BN } from 'ethereumjs-util'; +import BN from 'bnjs4'; import Logger from '../../../util/Logger'; import TransactionTypes from '../../../core/TransactionTypes'; import { swapsUtils } from '@metamask/swaps-controller'; diff --git a/app/components/UI/AccountFromToInfoCard/AddressFrom.tsx b/app/components/UI/AccountFromToInfoCard/AddressFrom.tsx index 8efc38182137..bc021cbf2f80 100644 --- a/app/components/UI/AccountFromToInfoCard/AddressFrom.tsx +++ b/app/components/UI/AccountFromToInfoCard/AddressFrom.tsx @@ -1,4 +1,4 @@ -import { toChecksumAddress } from 'ethereumjs-util'; +import { toChecksumAddress } from '@ethereumjs/util'; import React, { useEffect, useState } from 'react'; import { View } from 'react-native'; import { useSelector } from 'react-redux'; diff --git a/app/components/UI/AddCustomCollectible/index.tsx b/app/components/UI/AddCustomCollectible/index.tsx index be364abd6c8c..810dedb9f4dd 100644 --- a/app/components/UI/AddCustomCollectible/index.tsx +++ b/app/components/UI/AddCustomCollectible/index.tsx @@ -10,7 +10,7 @@ import { import { fontStyles } from '../../../styles/common'; import Engine from '../../../core/Engine'; import { strings } from '../../../../locales/i18n'; -import { isValidAddress } from 'ethereumjs-util'; +import { isValidAddress } from '@ethereumjs/util'; import ActionView from '../ActionView'; import { isSmartContractAddress } from '../../../util/transactions'; import Device from '../../../util/device'; diff --git a/app/components/UI/AddCustomToken/index.js b/app/components/UI/AddCustomToken/index.js index f764d4f07057..2fc7d1163bc2 100644 --- a/app/components/UI/AddCustomToken/index.js +++ b/app/components/UI/AddCustomToken/index.js @@ -12,7 +12,7 @@ import { fontStyles } from '../../../styles/common'; import Engine from '../../../core/Engine'; import PropTypes from 'prop-types'; import { strings } from '../../../../locales/i18n'; -import { isValidAddress } from 'ethereumjs-util'; +import { isValidAddress } from '@ethereumjs/util'; import { isSmartContractAddress } from '../../../util/transactions'; import { MetaMetricsEvents } from '../../../core/Analytics'; diff --git a/app/components/UI/ApprovalTagUrl/ApprovalTagUrl.tsx b/app/components/UI/ApprovalTagUrl/ApprovalTagUrl.tsx index 126f3132b170..9565fc4b885e 100644 --- a/app/components/UI/ApprovalTagUrl/ApprovalTagUrl.tsx +++ b/app/components/UI/ApprovalTagUrl/ApprovalTagUrl.tsx @@ -1,4 +1,4 @@ -import { toChecksumAddress } from 'ethereumjs-util'; +import { toChecksumAddress } from '@ethereumjs/util'; import React, { useEffect, useMemo, useState } from 'react'; import { useSelector } from 'react-redux'; diff --git a/app/components/UI/AssetOverview/AboutAsset/AboutAsset.tsx b/app/components/UI/AssetOverview/AboutAsset/AboutAsset.tsx index 0c15bc3115db..d60eda5ea122 100644 --- a/app/components/UI/AssetOverview/AboutAsset/AboutAsset.tsx +++ b/app/components/UI/AssetOverview/AboutAsset/AboutAsset.tsx @@ -1,4 +1,4 @@ -import { zeroAddress } from 'ethereumjs-util'; +import { zeroAddress } from '@ethereumjs/util'; import React from 'react'; import { DimensionValue, View } from 'react-native'; import SkeletonPlaceholder from 'react-native-skeleton-placeholder'; diff --git a/app/components/UI/AssetOverview/AssetOverview.test.tsx b/app/components/UI/AssetOverview/AssetOverview.test.tsx index 039d04128489..182c02f4522f 100644 --- a/app/components/UI/AssetOverview/AssetOverview.test.tsx +++ b/app/components/UI/AssetOverview/AssetOverview.test.tsx @@ -1,6 +1,6 @@ import React from 'react'; import AssetOverview from './AssetOverview'; -import { zeroAddress } from 'ethereumjs-util'; +import { zeroAddress } from '@ethereumjs/util'; import renderWithProvider from '../../../util/test/renderWithProvider'; import { backgroundState } from '../../../util/test/initial-root-state'; import { NetworkController } from '@metamask/network-controller'; diff --git a/app/components/UI/AssetOverview/AssetOverview.tsx b/app/components/UI/AssetOverview/AssetOverview.tsx index d6266bfbd575..242cfde63e49 100644 --- a/app/components/UI/AssetOverview/AssetOverview.tsx +++ b/app/components/UI/AssetOverview/AssetOverview.tsx @@ -1,4 +1,4 @@ -import { zeroAddress } from 'ethereumjs-util'; +import { zeroAddress } from '@ethereumjs/util'; import React, { useCallback, useEffect } from 'react'; import { Platform, TouchableOpacity, View } from 'react-native'; import { useDispatch, useSelector } from 'react-redux'; diff --git a/app/components/UI/AssetOverview/TokenDetails/TokenDetails.tsx b/app/components/UI/AssetOverview/TokenDetails/TokenDetails.tsx index 476ab6539538..d53f915234aa 100644 --- a/app/components/UI/AssetOverview/TokenDetails/TokenDetails.tsx +++ b/app/components/UI/AssetOverview/TokenDetails/TokenDetails.tsx @@ -1,4 +1,4 @@ -import { zeroAddress } from 'ethereumjs-util'; +import { zeroAddress } from '@ethereumjs/util'; import React, { useState } from 'react'; import { View } from 'react-native'; import { useSelector } from 'react-redux'; diff --git a/app/components/UI/ConfirmAddAsset/ConfirmAddAsset.test.tsx b/app/components/UI/ConfirmAddAsset/ConfirmAddAsset.test.tsx index ed1a2f5fdc3a..b3109f95aa86 100644 --- a/app/components/UI/ConfirmAddAsset/ConfirmAddAsset.test.tsx +++ b/app/components/UI/ConfirmAddAsset/ConfirmAddAsset.test.tsx @@ -7,7 +7,7 @@ import renderWithProvider, { import useBalance from '../Ramp/hooks/useBalance'; import { toTokenMinimalUnit } from '../../../util/number'; import { fireEvent } from '@testing-library/react-native'; -import { BN } from 'ethereumjs-util'; +import BN4 from 'bnjs4'; import { RootState } from '../../../reducers'; import { mockNetworkState } from '../../../util/test/network'; import { CHAIN_IDS } from '@metamask/transaction-controller'; @@ -48,7 +48,7 @@ jest.mock('../../../util/navigation/navUtils', () => ({ const mockUseBalanceInitialValue: Partial> = { balanceFiat: '$27.02', - balanceBN: toTokenMinimalUnit('5.36385', 18) as BN, + balanceBN: toTokenMinimalUnit('5.36385', 18) as BN4, }; const mockUseBalanceValues: Partial> = { diff --git a/app/components/UI/PaymentRequest/AssetList/index.tsx b/app/components/UI/PaymentRequest/AssetList/index.tsx index d3e5975e2a37..d01e61259884 100644 --- a/app/components/UI/PaymentRequest/AssetList/index.tsx +++ b/app/components/UI/PaymentRequest/AssetList/index.tsx @@ -6,7 +6,7 @@ import { fontStyles } from '../../../../styles/common'; import Identicon from '../../Identicon'; import NetworkMainAssetLogo from '../../NetworkMainAssetLogo'; import { useSelector } from 'react-redux'; -import { toChecksumAddress } from 'ethereumjs-util'; +import { toChecksumAddress } from '@ethereumjs/util'; import { useTheme } from '../../../../util/theme'; import { selectTokenList } from '../../../../selectors/tokenListController'; diff --git a/app/components/UI/Ramp/Views/BuildQuote/BuildQuote.test.tsx b/app/components/UI/Ramp/Views/BuildQuote/BuildQuote.test.tsx index 9fb61eadebcf..0a1eaf582210 100644 --- a/app/components/UI/Ramp/Views/BuildQuote/BuildQuote.test.tsx +++ b/app/components/UI/Ramp/Views/BuildQuote/BuildQuote.test.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { Limits, Payment } from '@consensys/on-ramp-sdk'; import { act, fireEvent, screen } from '@testing-library/react-native'; -import { BN } from 'ethereumjs-util'; +import type BN4 from 'bnjs4'; import { renderScreen } from '../../../../../util/test/renderWithProvider'; import BuildQuote from './BuildQuote'; import useRegions from '../../hooks/useRegions'; @@ -191,7 +191,7 @@ jest.mock('../../../../hooks/useAddressBalance/useAddressBalance', () => const mockUseBalanceInitialValue: Partial> = { balanceFiat: '$27.02', - balanceBN: toTokenMinimalUnit('5.36385', 18) as BN, + balanceBN: toTokenMinimalUnit('5.36385', 18) as BN4, }; let mockUseBalanceValues: Partial> = { @@ -242,7 +242,7 @@ const mockUseGasPriceEstimationInitialValue: ReturnType< estimatedGasFee: toTokenMinimalUnit( '0.01', mockUseRampSDKInitialValues.selectedAsset?.decimals || 18, - ) as BN, + ) as BN4, }; let mockUseGasPriceEstimationValue: ReturnType = @@ -669,7 +669,7 @@ describe('BuildQuote View', () => { mockUseBalanceValues.balanceBN = toTokenMinimalUnit( '5', mockUseRampSDKValues.selectedAsset?.decimals || 18, - ) as BN; + ) as BN4; render(BuildQuote); const initialAmount = '0'; const overBalanceAmout = '6'; @@ -688,7 +688,7 @@ describe('BuildQuote View', () => { mockUseBalanceValues.balanceBN = toTokenMinimalUnit( '1', mockUseRampSDKValues.selectedAsset?.decimals || 18, - ) as BN; + ) as BN4; const symbol = mockUseRampSDKValues.selectedAsset?.symbol; fireEvent.press(getByRoleButton(`${initialAmount} ${symbol}`)); fireEvent.press(getByRoleButton('25%')); @@ -719,13 +719,13 @@ describe('BuildQuote View', () => { balanceBN: toTokenMinimalUnit( '1', mockUseRampSDKValues.selectedAsset?.decimals || 18, - ) as BN, + ) as BN4, }; mockUseGasPriceEstimationValue = { estimatedGasFee: toTokenMinimalUnit( '0.27', mockUseRampSDKValues.selectedAsset?.decimals || 18, - ) as BN, + ) as BN4, }; const symbol = mockUseRampSDKValues.selectedAsset?.symbol; fireEvent.press(getByRoleButton(`${initialAmount} ${symbol}`)); @@ -752,13 +752,13 @@ describe('BuildQuote View', () => { balanceBN: toTokenMinimalUnit( '1', mockUseRampSDKValues.selectedAsset?.decimals || 18, - ) as BN, + ) as BN4, }; mockUseGasPriceEstimationValue = { estimatedGasFee: toTokenMinimalUnit( '0.27', mockUseRampSDKValues.selectedAsset?.decimals || 18, - ) as BN, + ) as BN4, }; const symbol = mockUseRampSDKValues.selectedAsset?.symbol; fireEvent.press(getByRoleButton(`${initialAmount} ${symbol}`)); diff --git a/app/components/UI/Ramp/Views/BuildQuote/BuildQuote.tsx b/app/components/UI/Ramp/Views/BuildQuote/BuildQuote.tsx index 04727253c4be..565210a8e3d9 100644 --- a/app/components/UI/Ramp/Views/BuildQuote/BuildQuote.tsx +++ b/app/components/UI/Ramp/Views/BuildQuote/BuildQuote.tsx @@ -12,7 +12,7 @@ import Animated, { withTiming, } from 'react-native-reanimated'; import { useNavigation } from '@react-navigation/native'; -import { BN } from 'ethereumjs-util'; +import BN4 from 'bnjs4'; import { useRampSDK } from '../../sdk'; import usePaymentMethods from '../../hooks/usePaymentMethods'; @@ -104,7 +104,7 @@ const BuildQuote = () => { const [amountFocused, setAmountFocused] = useState(false); const [amount, setAmount] = useState('0'); const [amountNumber, setAmountNumber] = useState(0); - const [amountBNMinimalUnit, setAmountBNMinimalUnit] = useState(); + const [amountBNMinimalUnit, setAmountBNMinimalUnit] = useState(); const [error, setError] = useState(null); const keyboardHeight = useRef(1000); const keypadOffset = useSharedValue(1000); @@ -341,7 +341,7 @@ const BuildQuote = () => { setAmountNumber(valueAsNumber); if (isSell) { setAmountBNMinimalUnit( - toTokenMinimalUnit(`${value}`, selectedAsset?.decimals ?? 0) as BN, + toTokenMinimalUnit(`${value}`, selectedAsset?.decimals ?? 0) as BN4, ); } }, @@ -356,8 +356,8 @@ const BuildQuote = () => { } else { const percentage = value * 100; const amountPercentage = balanceBN - ?.mul(new BN(percentage)) - .div(new BN(100)); + ?.mul(new BN4(percentage)) + .div(new BN4(100)); if (!amountPercentage) { return; @@ -698,7 +698,7 @@ const BuildQuote = () => { value: quickAmount, label: currentFiatCurrency?.denomSymbol + quickAmount.toString(), })) ?? []; - } else if (balanceBN && !balanceBN.isZero() && maxSellAmount?.gt(new BN(0))) { + } else if (balanceBN && !balanceBN.isZero() && maxSellAmount?.gt(new BN4(0))) { quickAmounts = [ { value: 0.25, label: '25%' }, { value: 0.5, label: '50%' }, diff --git a/app/components/UI/Ramp/Views/SendTransaction/SendTransaction.tsx b/app/components/UI/Ramp/Views/SendTransaction/SendTransaction.tsx index ac4927aa503e..a0197dad4a26 100644 --- a/app/components/UI/Ramp/Views/SendTransaction/SendTransaction.tsx +++ b/app/components/UI/Ramp/Views/SendTransaction/SendTransaction.tsx @@ -2,7 +2,7 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { ImageSourcePropType, View } from 'react-native'; import { useDispatch, useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; -import { BN } from 'ethereumjs-util'; +import BN4 from 'bnjs4'; import { SellOrder } from '@consensys/on-ramp-sdk/dist/API'; import { TransactionParams, @@ -132,7 +132,7 @@ function SendTransaction() { setIsConfirming(true); let transactionParams: TransactionParams; const amount = addHexPrefix( - new BN( + new BN4( toTokenMinimalUnit( orderData.cryptoAmount || '0', orderData.cryptoCurrency.decimals, diff --git a/app/components/UI/Ramp/hooks/useBalance.ts b/app/components/UI/Ramp/hooks/useBalance.ts index 4c2e52afecb6..93d9ee02ff82 100644 --- a/app/components/UI/Ramp/hooks/useBalance.ts +++ b/app/components/UI/Ramp/hooks/useBalance.ts @@ -1,5 +1,4 @@ import { useSelector } from 'react-redux'; -import { hexToBN } from '@metamask/controller-utils'; import { NATIVE_ADDRESS } from '../../../../constants/on-ramp'; import { selectAccountsByChainId } from '../../../../selectors/accountTrackerController'; import { @@ -13,6 +12,7 @@ import { selectChainId } from '../../../../selectors/networkController'; import { safeToChecksumAddress } from '../../../../util/address'; import { balanceToFiat, + hexToBN, renderFromTokenMinimalUnit, renderFromWei, toHexadecimal, diff --git a/app/components/UI/Ramp/hooks/useGasPriceEstimation.ts b/app/components/UI/Ramp/hooks/useGasPriceEstimation.ts index 6c9565b94f6f..f0c6b69ad825 100644 --- a/app/components/UI/Ramp/hooks/useGasPriceEstimation.ts +++ b/app/components/UI/Ramp/hooks/useGasPriceEstimation.ts @@ -5,7 +5,7 @@ import { type GasFeeController as GasFeeControllerType, } from '@metamask/gas-fee-controller'; -import { BN } from 'ethereumjs-util'; +import BN from 'bnjs4'; import Engine from '../../../../core/Engine'; import { decGWEIToHexWEI } from '../../../../util/conversions'; import { selectGasFeeControllerState } from '../../../../selectors/gasFeeController'; diff --git a/app/components/UI/Ramp/hooks/useIntentAmount.ts b/app/components/UI/Ramp/hooks/useIntentAmount.ts index 7b024731c3db..6d5aaf6f474b 100644 --- a/app/components/UI/Ramp/hooks/useIntentAmount.ts +++ b/app/components/UI/Ramp/hooks/useIntentAmount.ts @@ -1,5 +1,5 @@ import { useEffect } from 'react'; -import { type BN } from 'ethereumjs-util'; +import type BN from 'bnjs4'; import { useRampSDK } from '../sdk'; import parseAmount from '../utils/parseAmount'; import { toTokenMinimalUnit } from '../../../../util/number'; diff --git a/app/components/UI/Stake/Views/StakeInputView/StakeInputView.test.tsx b/app/components/UI/Stake/Views/StakeInputView/StakeInputView.test.tsx index a44c0971a53f..515b3b7decf4 100644 --- a/app/components/UI/Stake/Views/StakeInputView/StakeInputView.test.tsx +++ b/app/components/UI/Stake/Views/StakeInputView/StakeInputView.test.tsx @@ -4,7 +4,7 @@ import StakeInputView from './StakeInputView'; import { renderScreen } from '../../../../../util/test/renderWithProvider'; import Routes from '../../../../../constants/navigation/Routes'; import { backgroundState } from '../../../../../util/test/initial-root-state'; -import { BN } from 'ethereumjs-util'; +import BN5 from 'bnjs5'; import { Stake } from '../../sdk/stakeSdkProvider'; import { ChainId, PooledStakingContract } from '@metamask/stake-sdk'; import { Contract } from 'ethers'; @@ -53,7 +53,7 @@ jest.mock('../../../../../selectors/currencyRateController.ts', () => ({ selectCurrentCurrency: jest.fn(() => 'USD'), })); -const mockBalanceBN = new BN('1500000000000000000'); +const mockBalanceBN = new BN5('1500000000000000000'); const mockPooledStakingContractService: PooledStakingContract = { chainId: ChainId.ETHEREUM, diff --git a/app/components/UI/Stake/Views/UnstakeInputView/UnstakeInputView.tsx b/app/components/UI/Stake/Views/UnstakeInputView/UnstakeInputView.tsx index c109940d3a54..e374615f767c 100644 --- a/app/components/UI/Stake/Views/UnstakeInputView/UnstakeInputView.tsx +++ b/app/components/UI/Stake/Views/UnstakeInputView/UnstakeInputView.tsx @@ -1,6 +1,6 @@ import { useNavigation } from '@react-navigation/native'; import React, { useCallback, useEffect } from 'react'; -import { BN } from 'ethereumjs-util'; +import BN4 from 'bnjs4'; import UnstakeInputViewBanner from './UnstakeBanner'; import { strings } from '../../../../../../locales/i18n'; import Button, { @@ -40,7 +40,7 @@ const UnstakeInputView = () => { handleAmountPress, handleKeypadChange, conversionRate, - } = useStakingInputHandlers(new BN(stakeBalance)); + } = useStakingInputHandlers(new BN4(stakeBalance)); const stakeBalanceInEth = renderFromWei(stakeBalance, 5); const stakeBalanceFiatNumber = weiToFiatNumber(stakeBalance, conversionRate); diff --git a/app/components/UI/Stake/components/StakingBalance/StakingBalance.tsx b/app/components/UI/Stake/components/StakingBalance/StakingBalance.tsx index 8884688694b9..bc5eaa2f892a 100644 --- a/app/components/UI/Stake/components/StakingBalance/StakingBalance.tsx +++ b/app/components/UI/Stake/components/StakingBalance/StakingBalance.tsx @@ -25,7 +25,7 @@ import { strings } from '../../../../../../locales/i18n'; import { renderFromWei } from '../../../../../util/number'; import { getTimeDifferenceFromNow } from '../../../../../util/date'; import { filterExitRequests } from './utils'; -import { BN } from 'ethereumjs-util'; +import BN4 from 'bnjs4'; import bn from 'bignumber.js'; import { CommonPercentageInputUnits, @@ -63,8 +63,8 @@ const StakingBalance = () => { renderFromWei( claimableRequests.reduce( (acc, { claimedAssets }) => - claimedAssets ? acc.add(new BN(claimedAssets)) : acc, - new BN(0), + claimedAssets ? acc.add(new BN4(claimedAssets)) : acc, + new BN4(0), ), ), [claimableRequests], diff --git a/app/components/UI/Stake/hooks/useStakingInput.ts b/app/components/UI/Stake/hooks/useStakingInput.ts index d9d233d19af3..8ed4f7dbab56 100644 --- a/app/components/UI/Stake/hooks/useStakingInput.ts +++ b/app/components/UI/Stake/hooks/useStakingInput.ts @@ -1,4 +1,4 @@ -import { BN } from 'ethereumjs-util'; +import BN4 from 'bnjs4'; import { useState, useMemo, useCallback } from 'react'; import { useSelector } from 'react-redux'; import { @@ -16,15 +16,15 @@ import { } from '../../../../util/number'; import { strings } from '../../../../../locales/i18n'; -const useStakingInputHandlers = (balance: BN) => { +const useStakingInputHandlers = (balance: BN4) => { const [amountEth, setAmountEth] = useState('0'); - const [amountWei, setAmountWei] = useState(new BN(0)); + const [amountWei, setAmountWei] = useState(new BN4(0)); const [estimatedAnnualRewards, setEstimatedAnnualRewards] = useState('-'); - const isNonZeroAmount = useMemo(() => amountWei.gt(new BN(0)), [amountWei]); + const isNonZeroAmount = useMemo(() => amountWei.gt(new BN4(0)), [amountWei]); const isOverMaximum = useMemo(() => { - const additionalFundsRequired = amountWei.sub(balance || new BN(0)); - return isNonZeroAmount && additionalFundsRequired.gt(new BN(0)); + const additionalFundsRequired = amountWei.sub(balance || new BN4(0)); + return isNonZeroAmount && additionalFundsRequired.gt(new BN4(0)); }, [amountWei, balance, isNonZeroAmount]); const [fiatAmount, setFiatAmount] = useState('0'); @@ -90,7 +90,7 @@ const useStakingInputHandlers = (balance: BN) => { ({ value }: { value: number }) => { if (!balance) return; const percentage = value * 100; - const amountPercentage = balance.mul(new BN(percentage)).div(new BN(100)); + const amountPercentage = balance.mul(new BN4(percentage)).div(new BN4(100)); const newAmountString = fromTokenMinimalUnitString( amountPercentage.toString(10), diff --git a/app/components/UI/Swaps/QuotesView.js b/app/components/UI/Swaps/QuotesView.js index 982759f89c0d..47b02c0ad943 100644 --- a/app/components/UI/Swaps/QuotesView.js +++ b/app/components/UI/Swaps/QuotesView.js @@ -1,6 +1,6 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react'; import PropTypes from 'prop-types'; -import Eth from 'ethjs-query'; +import Eth from '@metamask/ethjs-query'; import { View, StyleSheet, diff --git a/app/components/UI/Swaps/components/TokenSelectModal.js b/app/components/UI/Swaps/components/TokenSelectModal.js index ac620379b1b8..0a390a2b97aa 100644 --- a/app/components/UI/Swaps/components/TokenSelectModal.js +++ b/app/components/UI/Swaps/components/TokenSelectModal.js @@ -16,7 +16,7 @@ import Icon from 'react-native-vector-icons/Ionicons'; import FAIcon from 'react-native-vector-icons/FontAwesome5'; import Fuse from 'fuse.js'; import { connect } from 'react-redux'; -import { isValidAddress } from 'ethereumjs-util'; +import { isValidAddress } from '@ethereumjs/util'; import Device from '../../../../util/device'; import { diff --git a/app/components/UI/Tokens/TokenList/PortfolioBalance/index.test.tsx b/app/components/UI/Tokens/TokenList/PortfolioBalance/index.test.tsx index e1e1f6943769..680d81843003 100644 --- a/app/components/UI/Tokens/TokenList/PortfolioBalance/index.test.tsx +++ b/app/components/UI/Tokens/TokenList/PortfolioBalance/index.test.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { fireEvent } from '@testing-library/react-native'; -import { BN } from 'ethereumjs-util'; +import BN5 from 'bnjs5'; import renderWithProvider from '../../../../../util/test/renderWithProvider'; import { backgroundState } from '../../../../../util/test/initial-root-state'; import AppConstants from '../../../../../../app/core/AppConstants'; @@ -70,9 +70,9 @@ const initialState = { }, TokenBalancesController: { contractBalances: { - '0x00': new BN(2), - '0x01': new BN(2), - '0x02': new BN(0), + '0x00': new BN5(2), + '0x01': new BN5(2), + '0x02': new BN5(0), }, }, }, diff --git a/app/components/UI/Tokens/TokenList/TokenListItem/index.tsx b/app/components/UI/Tokens/TokenList/TokenListItem/index.tsx index 7ab0ad470d59..11cc931c6fde 100644 --- a/app/components/UI/Tokens/TokenList/TokenListItem/index.tsx +++ b/app/components/UI/Tokens/TokenList/TokenListItem/index.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { View } from 'react-native'; import { Hex } from '@metamask/utils'; -import { zeroAddress } from 'ethereumjs-util'; +import { zeroAddress } from '@ethereumjs/util'; import { useSelector } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; import useTokenBalancesController from '../../../../hooks/useTokenBalancesController/useTokenBalancesController'; diff --git a/app/components/UI/Tokens/index.test.tsx b/app/components/UI/Tokens/index.test.tsx index 9b6efd926124..c03241ba315d 100644 --- a/app/components/UI/Tokens/index.test.tsx +++ b/app/components/UI/Tokens/index.test.tsx @@ -2,7 +2,7 @@ import React from 'react'; // eslint-disable-next-line @typescript-eslint/no-shadow import { fireEvent, waitFor } from '@testing-library/react-native'; import Tokens from './'; -import { BN } from 'ethereumjs-util'; +import BN5 from 'bnjs5'; import renderWithProvider from '../../../util/test/renderWithProvider'; import { createStackNavigator } from '@react-navigation/stack'; import { getAssetTestId } from '../../../../wdio/screen-objects/testIDs/Screens/WalletView.testIds'; @@ -74,9 +74,9 @@ const initialState = { }, TokenBalancesController: { contractBalances: { - '0x00': new BN(2), - '0x01': new BN(2), - '0x02': new BN(0), + '0x00': new BN5(2), + '0x01': new BN5(2), + '0x02': new BN5(0), }, }, }, @@ -213,7 +213,7 @@ describe('Tokens', () => { }, TokenBalancesController: { contractBalances: { - '0x02': new BN(1), + '0x02': new BN5(1), }, }, }, diff --git a/app/components/UI/TransactionElement/utils.js b/app/components/UI/TransactionElement/utils.js index 22b0e5620058..634e76b92229 100644 --- a/app/components/UI/TransactionElement/utils.js +++ b/app/components/UI/TransactionElement/utils.js @@ -27,7 +27,7 @@ import { TRANSACTION_TYPES, calculateEIP1559GasFeeHexes, } from '../../../util/transactions'; -import { toChecksumAddress } from 'ethereumjs-util'; +import { toChecksumAddress } from '@ethereumjs/util'; import { swapsUtils } from '@metamask/swaps-controller'; import { isSwapsNativeAsset } from '../Swaps/utils'; import { toLowerCaseEquals } from '../../../util/general'; diff --git a/app/components/Views/QRScanner/index.tsx b/app/components/Views/QRScanner/index.tsx index 0c4f2d50f8fa..dc837c6c639e 100644 --- a/app/components/Views/QRScanner/index.tsx +++ b/app/components/Views/QRScanner/index.tsx @@ -4,7 +4,7 @@ 'use strict'; import { useNavigation } from '@react-navigation/native'; import { parse } from 'eth-url-parser'; -import { isValidAddress } from 'ethereumjs-util'; +import { isValidAddress } from '@ethereumjs/util'; import React, { useCallback, useRef } from 'react'; import { Alert, Image, InteractionManager, View, Linking } from 'react-native'; import Text, { diff --git a/app/components/Views/Settings/Contacts/ContactForm/index.js b/app/components/Views/Settings/Contacts/ContactForm/index.js index 3c1e3b575f94..2c204599fcbb 100644 --- a/app/components/Views/Settings/Contacts/ContactForm/index.js +++ b/app/components/Views/Settings/Contacts/ContactForm/index.js @@ -13,7 +13,7 @@ import PropTypes from 'prop-types'; import { getEditableOptions } from '../../../../UI/Navbar'; import StyledButton from '../../../../UI/StyledButton'; import Engine from '../../../../../core/Engine'; -import { toChecksumAddress } from 'ethereumjs-util'; +import { toChecksumAddress } from '@ethereumjs/util'; import { connect } from 'react-redux'; import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'; import { strings } from '../../../../../../locales/i18n'; diff --git a/app/components/Views/Settings/NotificationsSettings/AccountsList.test.tsx b/app/components/Views/Settings/NotificationsSettings/AccountsList.test.tsx index aa3d30a0ee7a..1826241f40fa 100644 --- a/app/components/Views/Settings/NotificationsSettings/AccountsList.test.tsx +++ b/app/components/Views/Settings/NotificationsSettings/AccountsList.test.tsx @@ -6,7 +6,7 @@ import { Account } from '../../../../components/hooks/useAccounts/useAccounts.ty import { MOCK_ACCOUNTS_CONTROLLER_STATE } from '../../../../util/test/accountsControllerTestUtils'; import { Hex } from '@metamask/utils'; import { KeyringTypes } from '@metamask/keyring-controller'; -import { toChecksumAddress } from 'ethereumjs-util'; +import { toChecksumAddress } from '@ethereumjs/util'; import { RootState } from '../../../../reducers'; import { backgroundState } from '../../../../util/test/initial-root-state'; diff --git a/app/components/Views/confirmations/Approval/components/TransactionEditor/index.js b/app/components/Views/confirmations/Approval/components/TransactionEditor/index.js index 5e607dfbef88..8b5259f606d3 100644 --- a/app/components/Views/confirmations/Approval/components/TransactionEditor/index.js +++ b/app/components/Views/confirmations/Approval/components/TransactionEditor/index.js @@ -9,7 +9,8 @@ import { renderFromWei, toHexadecimal, } from '../../../../../../util/number'; -import { isValidAddress, BN, addHexPrefix } from 'ethereumjs-util'; +import { isValidAddress, addHexPrefix } from '@ethereumjs/util'; +import BN from 'bnjs4'; import { strings } from '../../../../../../../locales/i18n'; import { connect } from 'react-redux'; import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'; diff --git a/app/components/Views/confirmations/Send/index.js b/app/components/Views/confirmations/Send/index.js index fdfaf8e6f95f..b5944de9243c 100644 --- a/app/components/Views/confirmations/Send/index.js +++ b/app/components/Views/confirmations/Send/index.js @@ -17,7 +17,7 @@ import { fromWei, fromTokenMinimalUnit, } from '../../../../util/number'; -import { toChecksumAddress } from 'ethereumjs-util'; +import { toChecksumAddress } from '@ethereumjs/util'; import { strings } from '../../../../../locales/i18n'; import { getTransactionOptionsTitle } from '../../../UI/Navbar'; import { connect } from 'react-redux'; diff --git a/app/components/Views/confirmations/SendFlow/Amount/index.js b/app/components/Views/confirmations/SendFlow/Amount/index.js index f2bd09ddc3a9..7b8837653214 100644 --- a/app/components/Views/confirmations/SendFlow/Amount/index.js +++ b/app/components/Views/confirmations/SendFlow/Amount/index.js @@ -60,7 +60,6 @@ import CollectibleMedia from '../../../../UI/CollectibleMedia'; import collectiblesTransferInformation from '../../../../../util/collectibles-transfer'; import { strings } from '../../../../../../locales/i18n'; import Device from '../../../../../util/device'; -import { BN } from 'ethereumjs-util'; import { MetaMetricsEvents } from '../../../../../core/Analytics'; import dismissKeyboard from 'react-native/Libraries/Utilities/dismissKeyboard'; import NetworkMainAssetLogo from '../../../../UI/NetworkMainAssetLogo'; @@ -893,7 +892,7 @@ class Amount extends PureComponent { const balanceBN = hexToBN(accounts[selectedAddress].balance); const realMaxValue = balanceBN.sub(estimatedTotalGas); const maxValue = - balanceBN.isZero() || realMaxValue.isNeg() ? new BN(0) : realMaxValue; + balanceBN.isZero() || realMaxValue.isNeg() ? hexToBN('0x0') : realMaxValue; if (internalPrimaryCurrencyIsCrypto) { input = fromWei(maxValue); } else { diff --git a/app/components/Views/confirmations/SendFlow/Confirm/index.js b/app/components/Views/confirmations/SendFlow/Confirm/index.js index 7fe1fda6d762..fb876cbb790b 100644 --- a/app/components/Views/confirmations/SendFlow/Confirm/index.js +++ b/app/components/Views/confirmations/SendFlow/Confirm/index.js @@ -11,7 +11,7 @@ import { import { connect } from 'react-redux'; import { getSendFlowTitle } from '../../../../UI/Navbar'; import PropTypes from 'prop-types'; -import Eth from 'ethjs-query'; +import Eth from '@metamask/ethjs-query'; import { renderFromWei, renderFromTokenMinimalUnit, diff --git a/app/components/Views/confirmations/SendFlow/Confirm/validation.test.ts b/app/components/Views/confirmations/SendFlow/Confirm/validation.test.ts index e9ed1b98278d..8da1c4c3ac3e 100644 --- a/app/components/Views/confirmations/SendFlow/Confirm/validation.test.ts +++ b/app/components/Views/confirmations/SendFlow/Confirm/validation.test.ts @@ -1,4 +1,4 @@ -import { BN } from 'ethereumjs-util'; +import BN from 'bnjs4'; import { validateSufficientBalance, validateSufficientTokenBalance } from './validation'; import { renderFromWei, hexToBN } from '../../../../../util/number'; import { diff --git a/app/components/Views/confirmations/SendFlow/Confirm/validation.ts b/app/components/Views/confirmations/SendFlow/Confirm/validation.ts index 884c939441ed..461ffd62e966 100644 --- a/app/components/Views/confirmations/SendFlow/Confirm/validation.ts +++ b/app/components/Views/confirmations/SendFlow/Confirm/validation.ts @@ -4,7 +4,7 @@ import { decodeTransferData, } from '../../../../../util/transactions'; import { strings } from '../../../../../../locales/i18n'; -import { BN } from 'ethereumjs-util'; +import type BN4 from 'bnjs4'; interface SelectedAsset { address: string; @@ -13,8 +13,8 @@ interface SelectedAsset { } export const generateInsufficientBalanceMessage = ( - weiBalance: BN, - transactionValue: BN, + weiBalance: BN4, + transactionValue: BN4, ticker: string, ) => { const amount = renderFromWei(transactionValue.sub(weiBalance)); @@ -25,7 +25,7 @@ export const generateInsufficientBalanceMessage = ( }); }; -export const validateBalance = (weiBalance: BN, transactionValue: BN) => +export const validateBalance = (weiBalance: BN4, transactionValue: BN4) => !weiBalance.gte(transactionValue) || weiBalance.isZero(); export const validateSufficientTokenBalance = ( @@ -49,8 +49,8 @@ export const validateSufficientTokenBalance = ( }; export const validateSufficientBalance = ( - weiBalance: BN, - totalTransactionValue: BN, + weiBalance: BN4, + totalTransactionValue: BN4, ticker: string, ) => { if (validateBalance(weiBalance, totalTransactionValue)) { diff --git a/app/components/Views/confirmations/SendFlow/SendTo/index.js b/app/components/Views/confirmations/SendFlow/SendTo/index.js index 3a17526ccf57..33c76e83d26a 100644 --- a/app/components/Views/confirmations/SendFlow/SendTo/index.js +++ b/app/components/Views/confirmations/SendFlow/SendTo/index.js @@ -2,7 +2,7 @@ import React, { Fragment, PureComponent } from 'react'; import { View, ScrollView, Alert, Platform, BackHandler } from 'react-native'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; -import { toChecksumAddress } from 'ethereumjs-util'; +import { toChecksumAddress } from '@ethereumjs/util'; import { SafeAreaView } from 'react-native-safe-area-context'; import Icon from 'react-native-vector-icons/FontAwesome'; import AddressList from '../AddressList'; diff --git a/app/components/Views/confirmations/components/ApproveTransactionHeader/ApproveTransactionHeader.tsx b/app/components/Views/confirmations/components/ApproveTransactionHeader/ApproveTransactionHeader.tsx index 6db2535f4e92..a2011fb3e9b2 100644 --- a/app/components/Views/confirmations/components/ApproveTransactionHeader/ApproveTransactionHeader.tsx +++ b/app/components/Views/confirmations/components/ApproveTransactionHeader/ApproveTransactionHeader.tsx @@ -1,4 +1,4 @@ -import { toChecksumAddress } from 'ethereumjs-util'; +import { toChecksumAddress } from '@ethereumjs/util'; import React, { useEffect, useState } from 'react'; import { View } from 'react-native'; import { useSelector } from 'react-redux'; diff --git a/app/components/Views/confirmations/components/ApproveTransactionReview/AddNickname/index.tsx b/app/components/Views/confirmations/components/ApproveTransactionReview/AddNickname/index.tsx index c8778157382d..a7cb11b85cff 100644 --- a/app/components/Views/confirmations/components/ApproveTransactionReview/AddNickname/index.tsx +++ b/app/components/Views/confirmations/components/ApproveTransactionReview/AddNickname/index.tsx @@ -7,7 +7,7 @@ import EthereumAddress from '../../../../../UI/EthereumAddress'; import Engine from '../../../../../../core/Engine'; import { MetaMetricsEvents } from '../../../../../../core/Analytics'; -import { toChecksumAddress } from 'ethereumjs-util'; +import { toChecksumAddress } from '@ethereumjs/util'; import { connect } from 'react-redux'; import StyledButton from '../../../../../UI/StyledButton'; import Text from '../../../../../../component-library/components/Texts/Text'; diff --git a/app/components/Views/confirmations/components/ApproveTransactionReview/index.js b/app/components/Views/confirmations/components/ApproveTransactionReview/index.js index 3d51f439938e..249031cf7afa 100644 --- a/app/components/Views/confirmations/components/ApproveTransactionReview/index.js +++ b/app/components/Views/confirmations/components/ApproveTransactionReview/index.js @@ -6,7 +6,7 @@ import { Linking, ScrollView, } from 'react-native'; -import Eth from 'ethjs-query'; +import Eth from '@metamask/ethjs-query'; import ActionView, { ConfirmButtonState } from '../../../../UI/ActionView'; import PropTypes from 'prop-types'; import { getApproveNavbar } from '../../../../UI/Navbar'; diff --git a/app/components/Views/confirmations/components/TransactionReview/index.js b/app/components/Views/confirmations/components/TransactionReview/index.js index 369e3764d3ae..48fc2914b780 100644 --- a/app/components/Views/confirmations/components/TransactionReview/index.js +++ b/app/components/Views/confirmations/components/TransactionReview/index.js @@ -1,5 +1,5 @@ +import Eth from '@metamask/ethjs-query'; import { withNavigation } from '@react-navigation/compat'; -import Eth from 'ethjs-query'; import PropTypes from 'prop-types'; import React, { PureComponent } from 'react'; import { Animated, ScrollView, StyleSheet, View } from 'react-native'; diff --git a/app/components/Views/confirmations/hooks/useAccountInfo.ts b/app/components/Views/confirmations/hooks/useAccountInfo.ts index d07991f2f7d7..7617fd789658 100644 --- a/app/components/Views/confirmations/hooks/useAccountInfo.ts +++ b/app/components/Views/confirmations/hooks/useAccountInfo.ts @@ -1,4 +1,4 @@ -import { toChecksumAddress } from 'ethereumjs-util'; +import { toChecksumAddress } from '@ethereumjs/util'; import { useMemo } from 'react'; import { useSelector } from 'react-redux'; diff --git a/app/components/hooks/useAccounts/useAccounts.test.ts b/app/components/hooks/useAccounts/useAccounts.test.ts index 0deff05f17be..d905f775fda8 100644 --- a/app/components/hooks/useAccounts/useAccounts.test.ts +++ b/app/components/hooks/useAccounts/useAccounts.test.ts @@ -1,6 +1,6 @@ import { renderHook, act } from '@testing-library/react-hooks'; import { KeyringTypes } from '@metamask/keyring-controller'; -import { toChecksumAddress } from 'ethereumjs-util'; +import { toChecksumAddress } from '@ethereumjs/util'; import useAccounts from './useAccounts'; import { backgroundState } from '../../../util/test/initial-root-state'; import { MOCK_ACCOUNTS_CONTROLLER_STATE } from '../../../util/test/accountsControllerTestUtils'; diff --git a/app/components/hooks/useAddressBalance/useAddressBalance.test.tsx b/app/components/hooks/useAddressBalance/useAddressBalance.test.tsx index f3f8592d8a8f..769ce5db0678 100644 --- a/app/components/hooks/useAddressBalance/useAddressBalance.test.tsx +++ b/app/components/hooks/useAddressBalance/useAddressBalance.test.tsx @@ -8,7 +8,7 @@ import { Asset } from './useAddressBalance.types'; import useAddressBalance from './useAddressBalance'; import backgroundState from '../../../util/test/initial-root-state'; import { createMockAccountsControllerState } from '../../../util/test/accountsControllerTestUtils'; -import { BN } from 'ethereumjs-util'; +import type BN5 from 'bnjs5'; const MOCK_ADDRESS_1 = '0x0'; const MOCK_ADDRESS_2 = '0x1'; @@ -65,7 +65,7 @@ describe('useAddressBalance', () => { address: string, selectedAddress: string, networkClientId?: string | undefined, - ) => Promise; + ) => Promise; beforeEach(() => { mockGetERC20BalanceOf = jest .fn() diff --git a/app/components/hooks/useAddressBalance/useAddressBalance.ts b/app/components/hooks/useAddressBalance/useAddressBalance.ts index af95e0187e32..109f51945761 100644 --- a/app/components/hooks/useAddressBalance/useAddressBalance.ts +++ b/app/components/hooks/useAddressBalance/useAddressBalance.ts @@ -1,6 +1,7 @@ import { ERC1155, ERC721 } from '@metamask/controller-utils'; import { useEffect, useState } from 'react'; import { useSelector } from 'react-redux'; +import BN4 from 'bnjs4'; import Engine from '../../../core/Engine'; import { getTicker } from '../../../util/transactions'; @@ -77,7 +78,6 @@ const useAddressBalance = ( if (!address) { return; } - let fromAccBalance; if ( !asset || @@ -94,7 +94,7 @@ const useAddressBalance = ( return; } if (selectedAddress === address && contractBalances[contractAddress]) { - fromAccBalance = `${renderFromTokenMinimalUnit( + const fromAccBalance = `${renderFromTokenMinimalUnit( contractBalances[contractAddress] ? contractBalances[contractAddress] : '0', @@ -105,15 +105,16 @@ const useAddressBalance = ( (async () => { try { const { AssetsContractController } = Engine.context; - fromAccBalance = await AssetsContractController.getERC20BalanceOf( + const fromAccBalance = await AssetsContractController.getERC20BalanceOf( contractAddress, address, ); - fromAccBalance = `${renderFromTokenMinimalUnit( - fromAccBalance || '0', + const addrBalance = `${renderFromTokenMinimalUnit( + // This is to work around incompatibility between bn.js v4/v5 - should be removed when migration to v5 is complete + new BN4(fromAccBalance?.toString() || '0x0', 16), decimals, )} ${symbol}`; - setAddressBalance(fromAccBalance); + setAddressBalance(addrBalance); } catch (exp) { console.error(`Error in trying to fetch token balance - ${exp}`); } diff --git a/app/components/hooks/useExistingAddress.ts b/app/components/hooks/useExistingAddress.ts index e1d8c93cf0db..eed811baffdf 100644 --- a/app/components/hooks/useExistingAddress.ts +++ b/app/components/hooks/useExistingAddress.ts @@ -1,4 +1,4 @@ -import { toChecksumAddress } from 'ethereumjs-util'; +import { toChecksumAddress } from '@ethereumjs/util'; import { useSelector } from 'react-redux'; import { selectChainId } from '../../selectors/networkController'; diff --git a/app/components/hooks/useTokenBalance.tsx b/app/components/hooks/useTokenBalance.tsx index 8962c9ce352f..f4d84786a613 100644 --- a/app/components/hooks/useTokenBalance.tsx +++ b/app/components/hooks/useTokenBalance.tsx @@ -1,6 +1,6 @@ import { useState, useEffect, Dispatch, SetStateAction } from 'react'; import Engine from '../../core/Engine'; -import { BN } from 'ethereumjs-util'; +import type BN4 from 'bnjs4'; /** * Hook to handle the balance of ERC20 tokens @@ -12,12 +12,12 @@ import { BN } from 'ethereumjs-util'; const useTokenBalance = ( requestedTokenAddress: string, userCurrentAddress: string, -): [BN | null, boolean, boolean] => { +): [BN4 | null, boolean, boolean] => { // This hook should be only used with ERC20 tokens const [tokenBalance, setTokenBalance]: [ - BN | null, - Dispatch>, - ] = useState(null); + BN4 | null, + Dispatch>, + ] = useState(null); const [loading, setLoading]: [boolean, Dispatch>] = useState(true); const [error, setError]: [boolean, Dispatch>] = @@ -31,7 +31,7 @@ const useTokenBalance = ( userAddress: string, ): Promise => { AssetsContractController.getERC20BalanceOf(tokenAddress, userAddress) - .then((balance: BN) => setTokenBalance(balance)) + .then((balance: BN4) => setTokenBalance(balance)) .catch(() => setError(true)) .finally(() => setLoading(false)); }; diff --git a/app/components/hooks/useTokenBalancesController/useTokenBalancesController.test.tsx b/app/components/hooks/useTokenBalancesController/useTokenBalancesController.test.tsx index b575c66c4cc8..aaf33d56db3b 100644 --- a/app/components/hooks/useTokenBalancesController/useTokenBalancesController.test.tsx +++ b/app/components/hooks/useTokenBalancesController/useTokenBalancesController.test.tsx @@ -4,7 +4,7 @@ import { Provider } from 'react-redux'; import { createStore, Store } from 'redux'; import { act, render, waitFor } from '@testing-library/react-native'; import useTokenBalancesController from './useTokenBalancesController'; -import { BN } from 'ethereumjs-util'; +import BN4 from 'bnjs4'; import { cloneDeep } from 'lodash'; import { backgroundState } from '../../../util/test/initial-root-state'; @@ -15,7 +15,7 @@ const mockInitialState = { ...backgroundState, TokenBalancesController: { contractBalances: { - '0x326836cc6cd09B5aa59B81A7F72F25FcC0136b95': new BN(0x2a), + '0x326836cc6cd09B5aa59B81A7F72F25FcC0136b95': new BN4(0x2a), }, }, }, @@ -104,7 +104,7 @@ describe('useTokenBalancesController()', () => { testStore.dispatch({ type: 'add-balances', value: { - '0x326836cc6cd09B5aa59B81A7F72F25FcC0136b96': new BN(0x539), + '0x326836cc6cd09B5aa59B81A7F72F25FcC0136b96': new BN4(0x539), }, }); }); @@ -122,7 +122,7 @@ describe('useTokenBalancesController()', () => { testStore.dispatch({ type: 'add-balances', value: { - '0x326836cc6cd09B5aa59B81A7F72F25FcC0136b95': new BN(0x2a), + '0x326836cc6cd09B5aa59B81A7F72F25FcC0136b95': new BN4(0x2a), }, }); }); diff --git a/app/constants/transaction.ts b/app/constants/transaction.ts index 92bde7b16483..38612646e437 100644 --- a/app/constants/transaction.ts +++ b/app/constants/transaction.ts @@ -1,4 +1,4 @@ -import { BN } from 'ethereumjs-util'; +import BN from 'bnjs4'; // Transaction Status export const TX_UNAPPROVED = 'unapproved'; diff --git a/app/core/BackgroundBridge/BackgroundBridge.js b/app/core/BackgroundBridge/BackgroundBridge.js index 5051d77cbd5a..4d252f20819b 100644 --- a/app/core/BackgroundBridge/BackgroundBridge.js +++ b/app/core/BackgroundBridge/BackgroundBridge.js @@ -28,7 +28,7 @@ import { SubjectType } from '@metamask/permission-controller'; const createFilterMiddleware = require('eth-json-rpc-filters'); const createSubscriptionManager = require('eth-json-rpc-filters/subscriptionManager'); -const providerAsMiddleware = require('eth-json-rpc-middleware/providerAsMiddleware'); +const providerAsMiddleware = require('eth-json-rpc-middleware/dist/providerAsMiddleware'); const pump = require('pump'); // eslint-disable-next-line import/no-nodejs-modules const EventEmitter = require('events').EventEmitter; diff --git a/app/core/Engine.test.js b/app/core/Engine.test.js index b21f4c5ce912..4ea788fd4d7f 100644 --- a/app/core/Engine.test.js +++ b/app/core/Engine.test.js @@ -1,6 +1,6 @@ import Engine from './Engine'; import { backgroundState } from '../util/test/initial-root-state'; -import { zeroAddress } from 'ethereumjs-util'; +import { zeroAddress } from '@ethereumjs/util'; import { createMockAccountsControllerState } from '../util/test/accountsControllerTestUtils'; import { mockNetworkState } from '../util/test/network'; diff --git a/app/core/Engine.ts b/app/core/Engine.ts index 89ede70f472d..4c157063217a 100644 --- a/app/core/Engine.ts +++ b/app/core/Engine.ts @@ -231,7 +231,7 @@ import { selectShouldUseSmartTransaction } from '../selectors/smartTransactionsC import { selectSwapsChainFeatureFlags } from '../reducers/swaps'; import { SmartTransactionStatuses } from '@metamask/smart-transactions-controller/dist/types'; import { submitSmartTransactionHook } from '../util/smart-transactions/smart-publish-hook'; -import { zeroAddress } from 'ethereumjs-util'; +import { zeroAddress } from '@ethereumjs/util'; import { ApprovalType, toChecksumHexAddress } from '@metamask/controller-utils'; import { ExtendedControllerMessenger } from './ExtendedControllerMessenger'; import EthQuery from '@metamask/eth-query'; diff --git a/app/core/RPCMethods/wallet_watchAsset.ts b/app/core/RPCMethods/wallet_watchAsset.ts index 09e7dea54706..75a9597e388f 100644 --- a/app/core/RPCMethods/wallet_watchAsset.ts +++ b/app/core/RPCMethods/wallet_watchAsset.ts @@ -10,7 +10,7 @@ import { TOKEN_NOT_VALID, } from '../../constants/error'; import { selectChainId } from '../../selectors/networkController'; -import { isValidAddress } from 'ethereumjs-util'; +import { isValidAddress } from '@ethereumjs/util'; import { JsonRpcRequest, PendingJsonRpcResponse } from 'json-rpc-engine'; import { toChecksumHexAddress } from '@metamask/controller-utils'; diff --git a/app/core/SanitizationMiddleware.ts b/app/core/SanitizationMiddleware.ts index a7eb92f9291e..f1c001c60738 100644 --- a/app/core/SanitizationMiddleware.ts +++ b/app/core/SanitizationMiddleware.ts @@ -1,5 +1,5 @@ import { JsonRpcMiddleware, JsonRpcRequest } from 'json-rpc-engine'; -import { addHexPrefix } from 'ethereumjs-util'; +import { addHexPrefix } from '@ethereumjs/util'; // We use this to clean any custom params from the txParams // TODO: Update this to allow `blockhash` (used by `eth_getLogs`) and EIP-1559 diff --git a/app/core/Snaps/SnapBridge.ts b/app/core/Snaps/SnapBridge.ts index 5a9c468dc65f..ba5ae8fd3943 100644 --- a/app/core/Snaps/SnapBridge.ts +++ b/app/core/Snaps/SnapBridge.ts @@ -24,7 +24,7 @@ import { SubjectType } from '@metamask/permission-controller'; const ObjectMultiplex = require('@metamask/object-multiplex'); const createFilterMiddleware = require('eth-json-rpc-filters'); const createSubscriptionManager = require('eth-json-rpc-filters/subscriptionManager'); -const providerAsMiddleware = require('eth-json-rpc-middleware/providerAsMiddleware'); +const providerAsMiddleware = require('eth-json-rpc-middleware/dist/providerAsMiddleware'); const pump = require('pump'); interface ISnapBridgeProps { diff --git a/app/lib/ens-ipfs/resolver.js b/app/lib/ens-ipfs/resolver.js index 2eb3b24944a4..6df0b72b34ae 100644 --- a/app/lib/ens-ipfs/resolver.js +++ b/app/lib/ens-ipfs/resolver.js @@ -1,6 +1,6 @@ import namehash from 'eth-ens-namehash'; -import Eth from 'ethjs-query'; -import EthContract from 'ethjs-contract'; +import Eth from '@metamask/ethjs-query'; +import EthContract from '@metamask/ethjs-contract'; import registryAbi from './contracts/registry'; import resolverAbi from './contracts/resolver'; import contentHash from 'content-hash'; diff --git a/app/store/migrations/029.ts b/app/store/migrations/029.ts index af4f1ebf1ba1..058ae0deaed4 100644 --- a/app/store/migrations/029.ts +++ b/app/store/migrations/029.ts @@ -2,8 +2,7 @@ import { toHex } from '@metamask/controller-utils'; import { Hex, hasProperty, isObject } from '@metamask/utils'; import { regex } from '../../../app/util/regex'; -//@ts-expect-error - This error is expected, but ethereumjs-util exports this function -import { isHexString } from 'ethereumjs-util'; +import { isHexString } from '@ethereumjs/util'; import { TransactionParams } from '@metamask/transaction-controller'; import { captureException } from '@sentry/react-native'; import { @@ -466,7 +465,7 @@ export default async function migrate(stateAsync: unknown) { if (Array.isArray(transactionControllerState.transactions)) { transactionControllerState.transactions.forEach( (transaction: TransactionParams, index: number) => { - if (transaction && !isHexString(transaction.chainId)) { + if (transaction && !isHexString(transaction.chainId || '')) { if ( Array.isArray(transactionControllerState.transactions) && isObject(transactionControllerState.transactions[index]) diff --git a/app/store/migrations/031.ts b/app/store/migrations/031.ts index ba4b06ca1192..db3181e91d25 100644 --- a/app/store/migrations/031.ts +++ b/app/store/migrations/031.ts @@ -1,3 +1,4 @@ +import { isHexString } from '@ethereumjs/util'; import { hasProperty, isObject } from '@metamask/utils'; import { captureException } from '@sentry/react-native'; import { @@ -6,8 +7,6 @@ import { TokensControllerState, } from '@metamask/assets-controllers'; import { toHex } from '@metamask/controller-utils'; -//@ts-expect-error - This error is expected, but ethereumjs-util exports this function -import { isHexString } from 'ethereumjs-util'; /** * This migration is to address the users that were impacted by the tokens missing on their wallet diff --git a/app/util/address/index.ts b/app/util/address/index.ts index d34f848d1950..4bc8fae543a7 100644 --- a/app/util/address/index.ts +++ b/app/util/address/index.ts @@ -3,9 +3,8 @@ import { isValidAddress, addHexPrefix, isValidChecksumAddress, - //@ts-expect-error - This error is expected, but ethereumjs-util exports this function isHexPrefixed, -} from 'ethereumjs-util'; +} from '@ethereumjs/util'; import punycode from 'punycode/punycode'; import ExtendedKeyringTypes from '../../constants/keyringTypes'; import Engine from '../../core/Engine'; diff --git a/app/util/checkAddress.ts b/app/util/checkAddress.ts index 74c1d994a58b..d770690e0186 100644 --- a/app/util/checkAddress.ts +++ b/app/util/checkAddress.ts @@ -1,5 +1,5 @@ import type { AddressBookControllerState } from '@metamask/address-book-controller'; -import { toChecksumAddress } from 'ethereumjs-util'; +import { toChecksumAddress } from '@ethereumjs/util'; /** * Check whether the recipient of the given transaction is included in diff --git a/app/util/confirmation/transactions.test.ts b/app/util/confirmation/transactions.test.ts index 1c124ff1fd68..1bda3144e944 100644 --- a/app/util/confirmation/transactions.test.ts +++ b/app/util/confirmation/transactions.test.ts @@ -1,4 +1,4 @@ -import { BN } from 'ethereumjs-util'; +import BN from 'bnjs4'; import { buildTransactionParams } from './transactions'; import { GAS_ESTIMATE_TYPES } from '@metamask/gas-fee-controller'; import { TransactionEnvelopeType } from '@metamask/transaction-controller'; diff --git a/app/util/conversion/index.js b/app/util/conversion/index.js index 4046c7277244..7888331237ce 100644 --- a/app/util/conversion/index.js +++ b/app/util/conversion/index.js @@ -22,8 +22,9 @@ */ import BigNumber from 'bignumber.js'; +import BN from 'bnjs4'; -import { stripHexPrefix, BN } from 'ethereumjs-util'; +import { stripHexPrefix } from '@ethereumjs/util'; // Big Number Constants const BIG_NUMBER_WEI_MULTIPLIER = new BigNumber('1000000000000000000'); diff --git a/app/util/custom-gas/index.js b/app/util/custom-gas/index.js index 3583b88fab3c..b8c611c6be9d 100644 --- a/app/util/custom-gas/index.js +++ b/app/util/custom-gas/index.js @@ -1,4 +1,4 @@ -import { BN } from 'ethereumjs-util'; +import BN from 'bnjs4'; import { renderFromWei, weiToFiat, toWei, conversionUtil } from '../number'; import { strings } from '../../../locales/i18n'; import TransactionTypes from '../../core/TransactionTypes'; diff --git a/app/util/dappTransactions/index.test.ts b/app/util/dappTransactions/index.test.ts index f4c625d0518b..150e559b98db 100644 --- a/app/util/dappTransactions/index.test.ts +++ b/app/util/dappTransactions/index.test.ts @@ -1,4 +1,4 @@ -import { BN } from 'ethereumjs-util'; +import BN from 'bnjs4'; import { strings } from '../../../locales/i18n'; import Engine from '../../core/Engine'; diff --git a/app/util/dappTransactions/index.ts b/app/util/dappTransactions/index.ts index d2d93d8fd74e..fa5314cd9e3c 100644 --- a/app/util/dappTransactions/index.ts +++ b/app/util/dappTransactions/index.ts @@ -4,8 +4,7 @@ import Engine from '../../core/Engine'; import TransactionTypes from '../../core/TransactionTypes'; import { toLowerCaseEquals } from '../general'; import { strings } from '../../../locales/i18n'; -import { BN } from 'ethereumjs-util'; -import { lt } from '../lodash'; +import BN4 from 'bnjs4'; import { estimateGas as controllerEstimateGas } from '../transaction-controller'; interface opts { @@ -25,8 +24,8 @@ interface Transaction { data: string; ensRecipient: string | undefined; from: string; - gas: BN; - gasPrice: BN; + gas: BN4; + gasPrice: BN4; id: string; nonce: string | undefined; origin: string; @@ -97,7 +96,7 @@ export const estimateGas = async ( * @returns {string} - String containing error message whether the Ether transaction amount is valid or not */ export const validateEtherAmount = ( - value: BN, + value: BN4, from: string, allowEmpty = true, ): string | undefined => { @@ -122,14 +121,15 @@ interface ContractBalances { * @returns {string} - String containing error message whether the Ether transaction amount is valid or not */ export const validateTokenAmount = async ( - value: BN, - gas: BN, + value: BN4, + gas: BN4, from: string, selectedAsset: SelectedAsset, selectedAddress: string, contractBalances: ContractBalances, allowEmpty = true, ): Promise => { + console.error('HELLO', { value, contractBalances, allowEmpty }); if (!allowEmpty) { const checksummedFrom = safeToChecksumAddress(from) || ''; @@ -146,31 +146,33 @@ export const validateTokenAmount = async ( } // If user trying to send a token that doesn't own, validate balance querying contract // If it fails, skip validation - let contractBalanceForAddress: BN | undefined | number; + let contractBalanceForAddress: BN4 | undefined; if (selectedAddress === from && contractBalances[selectedAsset.address]) { contractBalanceForAddress = hexToBN( contractBalances[selectedAsset.address].toString(), ); + console.error('FOO', { contractBalanceForAddress }); } else { try { const { AssetsContractController } = Engine.context; - contractBalanceForAddress = - await AssetsContractController.getERC20BalanceOf( + contractBalanceForAddress = new BN4( + (await AssetsContractController.getERC20BalanceOf( selectedAsset.address, checksummedFrom, - ); + )).toString(16)); + console.error('BAR', { contractBalanceForAddress }); } catch (e) { + console.error('BARCATCH', { e }); // Don't validate balance if error } } - if (value && !isBN(value)) return strings('transaction.invalid_amount'); - const validateAssetAmount = - contractBalanceForAddress && - lt( - contractBalanceForAddress as unknown as number, - value as unknown as number, - ); - if (validateAssetAmount) return strings('transaction.insufficient'); + if (value && !isBN(value)) { + return strings('transaction.invalid_amount'); + } + console.error('ZUP', { contractBalanceForAddress, value }); + if (contractBalanceForAddress?.lt(value)) { + return strings('transaction.insufficient'); + } } }; @@ -216,10 +218,10 @@ export const validateAmount = async ( const { value, from, gas, selectedAsset } = transaction; const validations: Validations = { - ETH: () => validateEtherAmount(value as unknown as BN, from, allowEmpty), + ETH: () => validateEtherAmount(value as unknown as BN4, from, allowEmpty), ERC20: async () => await validateTokenAmount( - value as unknown as BN, + value as unknown as BN4, gas, from, selectedAsset, @@ -276,8 +278,8 @@ type setTransactionObjectType = ( * @param {function} setTransactionObject - Sets any attribute in transaction object */ export const handleGasFeeSelection = ( - gasLimit: BN, - gasPrice: BN, + gasLimit: BN4, + gasPrice: BN4, setTransactionObject: setTransactionObjectType, ): void => { const transactionObject = { @@ -297,5 +299,5 @@ export const handleGetGasLimit = async ( ): Promise => { if (!Object.keys(transaction.selectedAsset).length) return; const { gas } = await estimateGas({}, transaction); - setTransactionObject({ gas: hexToBN(gas) as BN }); + setTransactionObject({ gas: hexToBN(gas) as BN4 }); }; diff --git a/app/util/notifications/hooks/useSwitchNotifications.test.tsx b/app/util/notifications/hooks/useSwitchNotifications.test.tsx index 87b230724042..735f45db1a1e 100644 --- a/app/util/notifications/hooks/useSwitchNotifications.test.tsx +++ b/app/util/notifications/hooks/useSwitchNotifications.test.tsx @@ -3,7 +3,7 @@ /* eslint-disable import/no-namespace */ import createMockStore from 'redux-mock-store'; import { act, renderHook } from '@testing-library/react-hooks'; -import { toChecksumAddress } from 'ethereumjs-util'; +import { toChecksumAddress } from '@ethereumjs/util'; import React from 'react'; import { Provider } from 'react-redux'; import { updateAccountState } from '../../../core/redux/slices/notifications'; diff --git a/app/util/number/index.js b/app/util/number/index.js index a4ce4d98e05b..c26ac6c8b791 100644 --- a/app/util/number/index.js +++ b/app/util/number/index.js @@ -1,20 +1,17 @@ /** * Collection of utility functions for consistent formatting and conversion */ -import { BN, stripHexPrefix } from 'ethereumjs-util'; +import { stripHexPrefix } from '@ethereumjs/util'; +import BN4 from 'bnjs4'; import { utils as ethersUtils } from 'ethers'; -import convert from 'ethjs-unit'; -import { - BNToHex, - hexToBN as controllerHexToBN, -} from '@metamask/controller-utils'; +import convert from '@metamask/ethjs-unit'; +import { add0x, remove0x } from '@metamask/utils'; import numberToBN from 'number-to-bn'; import BigNumber from 'bignumber.js'; import currencySymbols from '../currency-symbols.json'; import { isZero } from '../lodash'; import { regex } from '../regex'; -export { BNToHex }; // Big Number Constants const BIG_NUMBER_WEI_MULTIPLIER = new BigNumber('1000000000000000000'); @@ -30,8 +27,20 @@ const BIG_NUMBER_ETH_MULTIPLIER = new BigNumber('1'); */ export const hexToBN = (inputHex) => typeof inputHex !== 'string' - ? new BN(inputHex, 16) - : controllerHexToBN(inputHex); + ? new BN4(inputHex, 16) + : (inputHex ? new BN4(remove0x(inputHex), 16) : new BN4(0)); + +/** + * Converts a BN object to a hex string with a '0x' prefix. + * + * @param inputBn - BN instance to convert to a hex string. + * @returns A '0x'-prefixed hex string. + */ +// TODO: Either fix this lint violation or explain why it's necessary to ignore. +// eslint-disable-next-line @typescript-eslint/naming-convention +export function BNToHex(inputBn) { + return add0x(inputBn.toString(16)); +} // Setter Maps const toBigNumber = { @@ -55,7 +64,7 @@ const toSpecifiedDenomination = { const baseChange = { hex: (n) => n.toString(16), dec: (n) => new BigNumber(n).toString(10), - BN: (n) => new BN(n.toString(16)), + BN: (n) => new BN4(n.toString(16)), }; /** @@ -107,7 +116,7 @@ export function fromTokenMinimalUnit( minimalInput = isRounding ? Number(minimalInput) : minimalInput; const prefixedInput = addHexPrefix(minimalInput.toString(16)); let minimal = safeNumberToBN(prefixedInput); - const negative = minimal.lt(new BN(0)); + const negative = minimal.lt(new BN4(0)); const base = toBN(Math.pow(10, decimals).toString()); if (negative) { @@ -151,7 +160,7 @@ export function fromTokenMinimalUnitString(minimalInput, decimals) { /** * Converts some unit to token minimal unit * - * @param {number|string|BN} tokenValue - Value to convert + * @param {number|string|BN4} tokenValue - Value to convert * @param {number} decimals - Unit to convert from, ether by default * @returns {Object} - BN instance containing the new number */ @@ -196,19 +205,19 @@ export function toTokenMinimalUnit(tokenValue, decimals) { while (fraction.length < decimals) { fraction += '0'; } - whole = new BN(whole); - fraction = new BN(fraction); + whole = new BN4(whole); + fraction = new BN4(fraction); let tokenMinimal = whole.mul(base).add(fraction); if (negative) { tokenMinimal = tokenMinimal.mul(negative); } - return new BN(tokenMinimal.toString(10), 10); + return new BN4(tokenMinimal.toString(10), 10); } /** * Converts some token minimal unit to render format string, showing 5 decimals * - * @param {Number|String|BN} tokenValue - Token value to convert + * @param {Number|String|BN4} tokenValue - Token value to convert * @param {Number} decimals - Token decimals to convert * @param {Number} decimalsToShow - Decimals to 5 * @returns {String} - Number of token minimal unit, in render format @@ -304,7 +313,7 @@ export function fiatNumberToTokenMinimalUnit( /** * Converts wei to render format string, showing 5 decimals * - * @param {Number|String|BN} value - Wei to convert + * @param {Number|String|BN4} value - Wei to convert * @param {Number} decimalsToShow - Decimals to 5 * @returns {String} - Number of token minimal unit, in render format * If value is less than 5 precision decimals will show '< 0.00001' @@ -343,7 +352,7 @@ export function calcTokenValueToSend(value, decimals) { * @returns {boolean} - True if the value is a BN instance */ export function isBN(value) { - return BN.isBN(value); + return BN4.isBN(value); } /** @@ -367,7 +376,7 @@ export function isDecimal(value) { * @returns {Object} - BN instance */ export function toBN(value) { - return new BN(value); + return new BN4(value); } /** @@ -408,9 +417,9 @@ export const isNumberScientificNotationWhenString = (value) => { /** * Converts some unit to wei * - * @param {number|string|BN} value - Value to convert + * @param {number|string|BN4} value - Value to convert * @param {string} unit - Unit to convert from, ether by default - * @returns {BN} - BN instance containing the new number + * @returns {BN4} - BN instance containing the new number */ export function toWei(value, unit = 'ether') { // check the posibilty to convert to BN @@ -424,7 +433,7 @@ export function toWei(value, unit = 'ether') { /** * Converts some unit to Gwei * - * @param {number|string|BN} value - Value to convert + * @param {number|string|BN4} value - Value to convert * @param {string} unit - Unit to convert from, ether by default * @returns {Object} - BN instance containing the new number */ @@ -435,7 +444,7 @@ export function toGwei(value, unit = 'ether') { /** * Converts some unit to Gwei and return it in render format * - * @param {number|string|BN} value - Value to convert + * @param {number|string|BN4} value - Value to convert * @param {string} unit - Unit to convert from, ether by default * @returns {string} - String instance containing the renderable number */ @@ -450,7 +459,7 @@ export function renderToGwei(value, unit = 'ether') { * Converts wei expressed as a BN instance into a human-readable fiat string * TODO: wei should be a BN instance, but we're not sure if it's always the case // - * @param {number | BN} wei - BN corresponding to an amount of wei + * @param {number | BN4} wei - BN corresponding to an amount of wei * @param {number | null} conversionRate - ETH to current currency conversion rate * @param {string} currencyCode - Current currency code to display * @returns {string} - Currency-formatted string @@ -528,7 +537,7 @@ export function addCurrencySymbol( /** * Converts wei expressed as a BN instance into a human-readable fiat string * - * @param {number|string|BN} wei - BN corresponding to an amount of wei + * @param {number|string|BN4} wei - BN corresponding to an amount of wei * @param {number} conversionRate - ETH to current currency conversion rate * @param {Number} decimalsToShow - Decimals to 5 * @returns {Number} - The converted balance diff --git a/app/util/number/index.test.ts b/app/util/number/index.test.ts index 436f18c0c29f..db8904ef7a91 100644 --- a/app/util/number/index.test.ts +++ b/app/util/number/index.test.ts @@ -1,4 +1,5 @@ -import { BN } from 'ethereumjs-util'; +import BN4 from 'bnjs4'; +import BN5 from 'bnjs5'; import { addCurrencySymbol, @@ -39,7 +40,7 @@ import { describe('Number utils :: BNToHex', () => { it('BNToHex', () => { - expect(BNToHex(new BN('1337'))).toEqual('0x539'); + expect(BNToHex(new BN5('1337'))).toEqual('0x539'); }); }); @@ -53,7 +54,7 @@ describe('Number utils :: fromWei', () => { }); it('fromWei using BN number', () => { - expect(fromWei(new BN('1337'))).toEqual('0.000000000000001337'); + expect(fromWei(new BN4('1337'))).toEqual('0.000000000000001337'); }); }); @@ -87,19 +88,19 @@ describe('Number utils :: toWei', () => { expect(() => toWei('1.337e-15')).toThrow(Error); }); - // bn.js do not support decimals, so tests here only cover integers + // bnjs4 do not support decimals, so tests here only cover integers it('toWei using BN number', () => { - expect(toWei(new BN(1337)).toString()).toEqual('1337000000000000000000'); + expect(toWei(new BN4(1337)).toString()).toEqual('1337000000000000000000'); // Tests for expected limitations of BN.js // BN.js do not support decimals - expect(toWei(new BN(1.337e-15)).toString()).toEqual('0'); + expect(toWei(new BN4(1.337e-15)).toString()).toEqual('0'); // BN.js do not support such big numbers - expect(() => toWei(new BN(1.337e18))).toThrow(Error); - expect(() => toWei(new BN(1337000000000000000))).toThrow(Error); + expect(() => toWei(new BN4(1.337e18))).toThrow(Error); + expect(() => toWei(new BN4(1337000000000000000))).toThrow(Error); // For some reason this returns 8338418000000000000000000 wei - expect(toWei(new BN('1.337e18'))).not.toEqual( + expect(toWei(new BN4('1.337e18'))).not.toEqual( '1337000000000000000000000000000000000', ); }); @@ -119,9 +120,9 @@ describe('Number utils :: fromTokenMinimalUnit', () => { }); it('fromTokenMinimalUnit using BN number', () => { - expect(fromTokenMinimalUnit(new BN('1337'), 6)).toEqual('0.001337'); - expect(fromTokenMinimalUnit(new BN('1337'), 0)).toEqual('1337'); - expect(fromTokenMinimalUnit(new BN('1337'), 18)).toEqual( + expect(fromTokenMinimalUnit(new BN4('1337'), 6)).toEqual('0.001337'); + expect(fromTokenMinimalUnit(new BN4('1337'), 0)).toEqual('1337'); + expect(fromTokenMinimalUnit(new BN4('1337'), 18)).toEqual( '0.000000000000001337', ); }); @@ -134,24 +135,24 @@ describe('Number utils :: fromTokenMinimalUnit', () => { }); it('rounds number by default', () => { - expect(fromTokenMinimalUnit(new BN('1000000000000000000'), 18)).toEqual( + expect(fromTokenMinimalUnit(new BN4('1000000000000000000'), 18)).toEqual( '1', ); - expect(fromTokenMinimalUnit(new BN('10000000000000000000'), 18)).toEqual( + expect(fromTokenMinimalUnit(new BN4('10000000000000000000'), 18)).toEqual( '10', ); - expect(fromTokenMinimalUnit(new BN('100000000000000000000'), 18)).toEqual( + expect(fromTokenMinimalUnit(new BN4('100000000000000000000'), 18)).toEqual( '100', ); - expect(fromTokenMinimalUnit(new BN('1000000000000000000000'), 18)).toEqual( + expect(fromTokenMinimalUnit(new BN4('1000000000000000000000'), 18)).toEqual( '1000', ); - expect(fromTokenMinimalUnit(new BN('10000000000000000000000'), 18)).toEqual( + expect(fromTokenMinimalUnit(new BN4('10000000000000000000000'), 18)).toEqual( '10000', ); // test decimal greater than 30,000 - expect(fromTokenMinimalUnit(new BN('50000000000000000000000'), 18)).toEqual( + expect(fromTokenMinimalUnit(new BN4('50000000000000000000000'), 18)).toEqual( '49999.999999999995805696', ); @@ -163,24 +164,24 @@ describe('Number utils :: fromTokenMinimalUnit', () => { it('does not round number if isRounding is false', () => { expect( - fromTokenMinimalUnit(new BN('1000000000000000000'), 18, false), + fromTokenMinimalUnit(new BN4('1000000000000000000'), 18, false), ).toEqual('1'); expect( - fromTokenMinimalUnit(new BN('10000000000000000000'), 18, false), + fromTokenMinimalUnit(new BN4('10000000000000000000'), 18, false), ).toEqual('10'); expect( - fromTokenMinimalUnit(new BN('100000000000000000000'), 18, false), + fromTokenMinimalUnit(new BN4('100000000000000000000'), 18, false), ).toEqual('100'); expect( - fromTokenMinimalUnit(new BN('1000000000000000000000'), 18, false), + fromTokenMinimalUnit(new BN4('1000000000000000000000'), 18, false), ).toEqual('1000'); expect( - fromTokenMinimalUnit(new BN('10000000000000000000000'), 18, false), + fromTokenMinimalUnit(new BN4('10000000000000000000000'), 18, false), ).toEqual('10000'); // test decimal greater than 30,000 expect( - fromTokenMinimalUnit(new BN('50000000000000000000000'), 18, false), + fromTokenMinimalUnit(new BN4('50000000000000000000000'), 18, false), ).toEqual('50000'); // test decimal less than 1e-14 @@ -281,67 +282,67 @@ describe('Number utils :: fromTokenMinimalUnitString', () => { }); it('fromTokenMinimalUnitString using BN number', () => { - expect(fromTokenMinimalUnitString(new BN('1337').toString(10), 6)).toEqual( + expect(fromTokenMinimalUnitString(new BN4('1337').toString(10), 6)).toEqual( '0.001337', ); - expect(fromTokenMinimalUnitString(new BN('1337').toString(10), 0)).toEqual( + expect(fromTokenMinimalUnitString(new BN4('1337').toString(10), 0)).toEqual( '1337', ); - expect(fromTokenMinimalUnitString(new BN('1337').toString(10), 18)).toEqual( + expect(fromTokenMinimalUnitString(new BN4('1337').toString(10), 18)).toEqual( '0.000000000000001337', ); - expect(fromTokenMinimalUnitString(new BN('123456').toString(), 5)).toEqual( + expect(fromTokenMinimalUnitString(new BN4('123456').toString(), 5)).toEqual( '1.23456', ); - expect(fromTokenMinimalUnitString(new BN('123456').toString(), 5)).toEqual( + expect(fromTokenMinimalUnitString(new BN4('123456').toString(), 5)).toEqual( '1.23456', ); expect( - fromTokenMinimalUnitString(new BN('1234560000000000000').toString(), 18), + fromTokenMinimalUnitString(new BN4('1234560000000000000').toString(), 18), ).toEqual('1.23456'); expect( - fromTokenMinimalUnitString(new BN('1000000000000000000').toString(), 18), + fromTokenMinimalUnitString(new BN4('1000000000000000000').toString(), 18), ).toEqual('1'); - expect(fromTokenMinimalUnitString(new BN('1').toString(), 18)).toEqual( + expect(fromTokenMinimalUnitString(new BN4('1').toString(), 18)).toEqual( '0.000000000000000001', ); - expect(fromTokenMinimalUnitString(new BN('0').toString(), 18)).toEqual('0'); + expect(fromTokenMinimalUnitString(new BN4('0').toString(), 18)).toEqual('0'); expect( - fromTokenMinimalUnitString(new BN('123456789').toString(), 5), + fromTokenMinimalUnitString(new BN4('123456789').toString(), 5), ).toEqual('1234.56789'); expect( fromTokenMinimalUnitString( - new BN('1234567890000000000987654321').toString(), + new BN4('1234567890000000000987654321').toString(), 18, ), ).toEqual('1234567890.000000000987654321'); expect( fromTokenMinimalUnitString( - new BN('10000000000000000000000000000001').toString(), + new BN4('10000000000000000000000000000001').toString(), 18, ), ).toEqual('10000000000000.000000000000000001'); expect( fromTokenMinimalUnitString( - new BN('10000000000000000000000000000000').toString(), + new BN4('10000000000000000000000000000000').toString(), 18, ), ).toEqual('10000000000000'); expect( - fromTokenMinimalUnitString(new BN('3900229504248293869').toString(), 18), + fromTokenMinimalUnitString(new BN4('3900229504248293869').toString(), 18), ).toEqual('3.900229504248293869'); expect( fromTokenMinimalUnitString( - new BN('92836465327282987373728723').toString(), + new BN4('92836465327282987373728723').toString(), 18, ), ).toEqual('92836465.327282987373728723'); expect( - fromTokenMinimalUnitString(new BN('6123512631253').toString(), 16), + fromTokenMinimalUnitString(new BN4('6123512631253').toString(), 16), ).toEqual('0.0006123512631253'); expect( fromTokenMinimalUnitString( - new BN('92836465327282987373728723').toString(), + new BN4('92836465327282987373728723').toString(), 0, ), ).toEqual('92836465327282987373728723'); @@ -350,20 +351,20 @@ describe('Number utils :: fromTokenMinimalUnitString', () => { describe('Number utils :: toTokenMinimalUnit', () => { it('toTokenMinimalUnit using number', () => { - expect(toTokenMinimalUnit(1337, 6)).toEqual(new BN('1337000000', 10)); - expect(toTokenMinimalUnit(1337, 0)).toEqual(new BN('1337')); - expect(toTokenMinimalUnit(1337.1, 1)).toEqual(new BN('13371')); + expect(toTokenMinimalUnit(1337, 6)).toEqual(new BN4('1337000000', 10)); + expect(toTokenMinimalUnit(1337, 0)).toEqual(new BN4('1337')); + expect(toTokenMinimalUnit(1337.1, 1)).toEqual(new BN4('13371')); }); it('toTokenMinimalUnit using string', () => { - expect(toTokenMinimalUnit('1337', 6)).toEqual(new BN('1337000000')); - expect(toTokenMinimalUnit('1337', 0)).toEqual(new BN('1337')); - expect(toTokenMinimalUnit('1337.1', 2)).toEqual(new BN('133710')); + expect(toTokenMinimalUnit('1337', 6)).toEqual(new BN4('1337000000')); + expect(toTokenMinimalUnit('1337', 0)).toEqual(new BN4('1337')); + expect(toTokenMinimalUnit('1337.1', 2)).toEqual(new BN4('133710')); }); it('toTokenMinimalUnit using BN number', () => { - expect(toTokenMinimalUnit(new BN('1337'), 0)).toEqual(new BN('1337')); - expect(toTokenMinimalUnit(new BN('1337'), 6)).toEqual(new BN('1337000000')); + expect(toTokenMinimalUnit(new BN4('1337'), 0)).toEqual(new BN4('1337')); + expect(toTokenMinimalUnit(new BN4('1337'), 6)).toEqual(new BN4('1337000000')); }); it('toTokenMinimalUnit using invalid inputs', () => { @@ -389,10 +390,10 @@ describe('Number utils :: renderFromTokenMinimalUnit', () => { }); it('renderFromTokenMinimalUnit using BN number', () => { - expect(renderFromTokenMinimalUnit(new BN('1337'), 0)).toEqual('1337'); - expect(renderFromTokenMinimalUnit(new BN('1337'), 6)).toEqual('0.00134'); - expect(renderFromTokenMinimalUnit(new BN('1337'), 10)).toEqual('< 0.00001'); - expect(renderFromTokenMinimalUnit(new BN('0'), 10)).toEqual('0'); + expect(renderFromTokenMinimalUnit(new BN4('1337'), 0)).toEqual('1337'); + expect(renderFromTokenMinimalUnit(new BN4('1337'), 6)).toEqual('0.00134'); + expect(renderFromTokenMinimalUnit(new BN4('1337'), 10)).toEqual('< 0.00001'); + expect(renderFromTokenMinimalUnit(new BN4('0'), 10)).toEqual('0'); }); }); @@ -410,9 +411,9 @@ describe('Number utils :: renderFromWei', () => { }); it('renderFromWei using BN number', () => { - expect(renderFromWei(new BN('133700000000000000'))).toEqual('0.1337'); - expect(renderFromWei(new BN('1337'))).toEqual('< 0.00001'); - expect(renderFromWei(new BN('0'))).toEqual('0'); + expect(renderFromWei(new BN4('133700000000000000'))).toEqual('0.1337'); + expect(renderFromWei(new BN4('1337'))).toEqual('< 0.00001'); + expect(renderFromWei(new BN4('0'))).toEqual('0'); }); }); @@ -478,9 +479,9 @@ describe('Number utils :: localizeLargeNumber', () => { describe('Number utils :: calcTokenValueToSend', () => { it('calcTokenValueToSend', () => { - expect(calcTokenValueToSend(new BN(1337), 0)).toEqual('539'); - expect(calcTokenValueToSend(new BN(1337), 9)).toEqual('1374b68fa00'); - expect(calcTokenValueToSend(new BN(1337), 18)).toEqual( + expect(calcTokenValueToSend(new BN4(1337), 0)).toEqual('539'); + expect(calcTokenValueToSend(new BN4(1337), 9)).toEqual('1374b68fa00'); + expect(calcTokenValueToSend(new BN4(1337), 18)).toEqual( '487a9a304539440000', ); }); @@ -491,7 +492,7 @@ describe('Number utils :: hexToBN', () => { expect(hexToBN('0x539').toNumber()).toBe(1337); }); it('should handle non string values', () => { - const newBN = new BN(1); + const newBN = new BN4(1); expect(hexToBN(newBN)).toBe(newBN); }); }); @@ -500,7 +501,7 @@ describe('Number utils :: isBN', () => { it('isBN', () => { const notABN = '0x539'; expect(isBN(notABN)).toEqual(false); - expect(isBN(new BN(1337))).toEqual(true); + expect(isBN(new BN4(1337))).toEqual(true); }); }); @@ -697,7 +698,7 @@ describe('Number utils :: safeNumberToBN', () => { const result: any = safeNumberToBN('1650000007.7'); // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - const expected: any = new BN('1650000007'); + const expected: any = new BN4('1650000007'); expect(result.words[0]).toEqual(expected.words[0]); expect(result.words[1]).toEqual(expected.words[1]); expect(result.negative).toEqual(expected.negative); @@ -710,7 +711,7 @@ describe('Number utils :: safeNumberToBN', () => { const result: any = safeNumberToBN(1650000007.7); // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - const expected: any = new BN('1650000007'); + const expected: any = new BN4('1650000007'); expect(result.words[0]).toEqual(expected.words[0]); expect(result.words[1]).toEqual(expected.words[1]); expect(result.negative).toEqual(expected.negative); @@ -723,7 +724,7 @@ describe('Number utils :: safeNumberToBN', () => { const result: any = safeNumberToBN('16500'); // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - const expected: any = new BN('16500'); + const expected: any = new BN4('16500'); expect(result.words[0]).toEqual(expected.words[0]); expect(result.words[1]).toEqual(expected.words[1]); expect(result.negative).toEqual(expected.negative); @@ -736,7 +737,7 @@ describe('Number utils :: safeNumberToBN', () => { const result: any = safeNumberToBN(16500); // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - const expected: any = new BN('16500'); + const expected: any = new BN4('16500'); expect(result.words[0]).toEqual(expected.words[0]); expect(result.words[1]).toEqual(expected.words[1]); expect(result.negative).toEqual(expected.negative); @@ -749,7 +750,7 @@ describe('Number utils :: safeNumberToBN', () => { const result: any = safeNumberToBN('-1650000007.7'); // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - const expected: any = new BN('-1650000007'); + const expected: any = new BN4('-1650000007'); expect(result.words[0]).toEqual(expected.words[0]); expect(result.words[1]).toEqual(expected.words[1]); expect(result.negative).toEqual(expected.negative); @@ -762,7 +763,7 @@ describe('Number utils :: safeNumberToBN', () => { const result: any = safeNumberToBN(-1650000007.7); // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - const expected: any = new BN('-1650000007'); + const expected: any = new BN4('-1650000007'); expect(result.words[0]).toEqual(expected.words[0]); expect(result.words[1]).toEqual(expected.words[1]); expect(result.negative).toEqual(expected.negative); @@ -775,7 +776,7 @@ describe('Number utils :: safeNumberToBN', () => { const result: any = safeNumberToBN('-16500'); // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - const expected: any = new BN('-16500'); + const expected: any = new BN4('-16500'); expect(result.words[0]).toEqual(expected.words[0]); expect(result.words[1]).toEqual(expected.words[1]); expect(result.negative).toEqual(expected.negative); @@ -788,7 +789,7 @@ describe('Number utils :: safeNumberToBN', () => { const result: any = safeNumberToBN(-16500); // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - const expected: any = new BN('-16500'); + const expected: any = new BN4('-16500'); expect(result.words[0]).toEqual(expected.words[0]); expect(result.words[1]).toEqual(expected.words[1]); expect(result.negative).toEqual(expected.negative); @@ -801,7 +802,7 @@ describe('Number utils :: safeNumberToBN', () => { const result: any = safeNumberToBN('75BCD15'); // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - const expected: any = new BN('123456789'); + const expected: any = new BN4('123456789'); expect(result.words[0]).toEqual(expected.words[0]); expect(result.words[1]).toEqual(expected.words[1]); expect(result.negative).toEqual(expected.negative); @@ -814,7 +815,7 @@ describe('Number utils :: safeNumberToBN', () => { const result: any = safeNumberToBN('0x75BCD15'); // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - const expected: any = new BN('123456789'); + const expected: any = new BN4('123456789'); expect(result.words[0]).toEqual(expected.words[0]); expect(result.words[1]).toEqual(expected.words[1]); expect(result.negative).toEqual(expected.negative); @@ -827,7 +828,7 @@ describe('Number utils :: safeNumberToBN', () => { const result: any = safeNumberToBN('-75BCD15'); // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - const expected: any = new BN('-123456789'); + const expected: any = new BN4('-123456789'); expect(result.words[0]).toEqual(expected.words[0]); expect(result.words[1]).toEqual(expected.words[1]); expect(result.negative).toEqual(expected.negative); @@ -840,7 +841,7 @@ describe('Number utils :: safeNumberToBN', () => { const result: any = safeNumberToBN('-0x75BCD15'); // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - const expected: any = new BN('-123456789'); + const expected: any = new BN4('-123456789'); expect(result.words[0]).toEqual(expected.words[0]); expect(result.words[1]).toEqual(expected.words[1]); expect(result.negative).toEqual(expected.negative); @@ -853,7 +854,7 @@ describe('Number utils :: safeNumberToBN', () => { const result: any = safeNumberToBN('0'); // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - const expected: any = new BN('0'); + const expected: any = new BN4('0'); expect(result.words[0]).toEqual(expected.words[0]); expect(result.words[1]).toEqual(expected.words[1]); expect(result.negative).toEqual(expected.negative); @@ -866,7 +867,7 @@ describe('Number utils :: safeNumberToBN', () => { const result: any = safeNumberToBN('0x0'); // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - const expected: any = new BN('0'); + const expected: any = new BN4('0'); expect(result.words[0]).toEqual(expected.words[0]); expect(result.words[1]).toEqual(expected.words[1]); expect(result.negative).toEqual(expected.negative); @@ -879,7 +880,7 @@ describe('Number utils :: safeNumberToBN', () => { const result: any = safeNumberToBN('0xNaN'); // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - const expected: any = new BN('0'); + const expected: any = new BN4('0'); expect(result.words[0]).toEqual(expected.words[0]); expect(result.words[1]).toEqual(expected.words[1]); expect(result.negative).toEqual(expected.negative); @@ -892,7 +893,7 @@ describe('Number utils :: safeNumberToBN', () => { const result: any = safeNumberToBN(NaN); // TODO: Replace "any" with type // eslint-disable-next-line @typescript-eslint/no-explicit-any - const expected: any = new BN('0'); + const expected: any = new BN4('0'); expect(result.words[0]).toEqual(expected.words[0]); expect(result.words[1]).toEqual(expected.words[1]); expect(result.negative).toEqual(expected.negative); @@ -1053,7 +1054,7 @@ describe('Number utils :: formatValueToMatchTokenDecimals', () => { describe('Number utils :: safeBNToHex', () => { it('returns hex string', () => { - expect(safeBNToHex(new BN('255'))).toBe('0xff'); + expect(safeBNToHex(new BN4('255'))).toBe('0xff'); }); it.each([undefined, null])( diff --git a/app/util/transaction-reducer-helpers.ts b/app/util/transaction-reducer-helpers.ts index 562fa6db9a7a..769b4ae05e09 100644 --- a/app/util/transaction-reducer-helpers.ts +++ b/app/util/transaction-reducer-helpers.ts @@ -1,5 +1,5 @@ import { SecurityAlertResponse } from '@metamask/transaction-controller'; -import { BN } from 'ethereumjs-util'; +import type BN from 'bnjs4'; interface TxMeta { data?: string; diff --git a/app/util/transactions/index.js b/app/util/transactions/index.js index 71614e75e976..c36a2e925e1b 100644 --- a/app/util/transactions/index.js +++ b/app/util/transactions/index.js @@ -1,4 +1,5 @@ -import { addHexPrefix, toChecksumAddress, BN } from 'ethereumjs-util'; +import { addHexPrefix, toChecksumAddress } from '@ethereumjs/util'; +import BN from 'bnjs4'; import { rawEncode, rawDecode } from 'ethereumjs-abi'; import BigNumber from 'bignumber.js'; import humanizeDuration from 'humanize-duration'; diff --git a/app/util/transactions/index.test.ts b/app/util/transactions/index.test.ts index 2f8415f8871d..ecd22930f908 100644 --- a/app/util/transactions/index.test.ts +++ b/app/util/transactions/index.test.ts @@ -1,5 +1,5 @@ import { swapsUtils } from '@metamask/swaps-controller'; -import { BN } from 'ethereumjs-util'; +import BN from 'bnjs4'; /* eslint-disable-next-line import/no-namespace */ import * as controllerUtilsModule from '@metamask/controller-utils'; @@ -1082,7 +1082,7 @@ describe('Transactions utils :: isApprovalTransaction', () => { }); describe('Transactions utils :: getTransactionReviewActionKey', () => { - const transaction = { to: '0xContractAddress' }; + const transaction = { to: '0xdeadbeef1234' }; const chainId = '1'; it('returns `Unknown Method` review action key when transaction action key exists', async () => { const expectedReviewActionKey = 'Unknown Method'; diff --git a/e2e/specs/ramps/offramp.spec.js b/e2e/specs/ramps/offramp.spec.js index d990ed0993ba..0af763e1fc64 100644 --- a/e2e/specs/ramps/offramp.spec.js +++ b/e2e/specs/ramps/offramp.spec.js @@ -32,7 +32,7 @@ const PaymentMethods = { DEBIT_OR_CREDIT: 'Debit or Credit', INSTANT_ACH_BANK_TRANSFER: 'Insant ACH Bank Transfer', ACH_BANK_TRANSFER: 'ACH Bank Transfer', -} +}; describe(SmokeAssets('Off-Ramp'), () => { beforeAll(async () => { @@ -67,7 +67,7 @@ describe(SmokeAssets('Off-Ramp'), () => { await SelectRegionView.tapRegionOption(Regions.CALIFORNIA); await SelectRegionView.tapContinueButton(); await SelectPaymentMethodView.tapPaymentMethodOption(PaymentMethods.DEBIT_OR_CREDIT); - await SelectPaymentMethodView.tapContinueButton(); + await SelectPaymentMethodView.tapContinueButton(); await Assertions.checkIfVisible(BuildQuoteView.amountToSellLabel); await Assertions.checkIfVisible(BuildQuoteView.getQuotesButton); }); diff --git a/package.json b/package.json index 7ce3e5e67fe1..36862e175f44 100644 --- a/package.json +++ b/package.json @@ -135,6 +135,7 @@ }, "dependencies": { "@consensys/on-ramp-sdk": "1.28.5", + "@ethereumjs/util": "^8.1.0", "@keystonehq/bc-ur-registry-eth": "^0.19.1", "@keystonehq/metamask-airgapped-keyring": "^0.13.1", "@keystonehq/ur-decoder": "^0.12.2", @@ -153,6 +154,9 @@ "@metamask/eth-sig-util": "^7.0.2", "@metamask/eth-snap-keyring": "^4.3.3", "@metamask/etherscan-link": "^2.0.0", + "@metamask/ethjs-contract": "^0.4.1", + "@metamask/ethjs-query": "^0.7.1", + "@metamask/ethjs-unit": "^0.3.0", "@metamask/gas-fee-controller": "^18.0.0", "@metamask/key-tree": "^9.0.0", "@metamask/keyring-api": "^8.1.0", @@ -225,6 +229,8 @@ "axios": "^1.6.8", "base-64": "1.0.0", "bignumber.js": "^9.0.1", + "bnjs4": "npm:bn.js@^4.12.0", + "bnjs5": "npm:bn.js@^5.2.1", "buffer": "6.0.3", "cockatiel": "^3.1.2", "compare-versions": "^3.6.0", @@ -237,15 +243,12 @@ "eth-block-tracker": "^7.0.1", "eth-ens-namehash": "2.0.8", "eth-json-rpc-filters": "4.2.2", - "eth-json-rpc-middleware": "4.3.0", + "eth-json-rpc-filters": "^5.1.0", + "eth-json-rpc-middleware": "^7.0.1", "eth-url-parser": "1.0.4", - "ethereumjs-abi": "0.6.6", - "ethereumjs-util": "6.1.0", + "ethereumjs-abi": "^0.6.8", "ethers": "^5.0.14", - "ethjs-contract": "0.2.3", "ethjs-ens": "2.0.1", - "ethjs-query": "0.3.8", - "ethjs-unit": "0.1.6", "eventemitter2": "^6.4.9", "events": "3.0.0", "fuse.js": "3.4.4", @@ -254,7 +257,7 @@ "humanize-duration": "^3.27.2", "is-url": "^1.2.4", "json-rpc-engine": "^6.1.0", - "json-rpc-middleware-stream": "3.0.0", + "json-rpc-middleware-stream": "^4.2.2", "lodash": "^4.17.21", "lottie-ios": "3.4.1", "lottie-react-native": "5.1.5", @@ -392,6 +395,8 @@ "@testing-library/react": "14.0.0", "@testing-library/react-hooks": "^8.0.1", "@testing-library/react-native": "12.1.2", + "@types/bnjs4": "npm:@types/bn.js@^4.11.6", + "@types/bnjs5": "npm:@types/bn.js@^5.1.6", "@types/crypto-js": "^4.1.1", "@types/enzyme": "^3.10.12", "@types/eth-url-parser": "^1.0.0", @@ -556,9 +561,6 @@ "detox": true, "detox>bunyan>dtrace-provider": false, "eciesjs>secp256k1": true, - "ethereumjs-util>keccak": true, - "ethereumjs-util>secp256k1": true, - "ethjs-query>babel-runtime>core-js": false, "ganache>@trufflesuite/bigint-buffer": false, "ganache>bufferutil": false, "ganache>keccak": true, diff --git a/patches/@metamask+ethjs-contract+0.4.1.patch b/patches/@metamask+ethjs-contract+0.4.1.patch new file mode 100644 index 000000000000..1c8b36e6eb56 --- /dev/null +++ b/patches/@metamask+ethjs-contract+0.4.1.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/@metamask/ethjs-contract/package.json b/node_modules/@metamask/ethjs-contract/package.json +index 4991d59..8343099 100644 +--- a/node_modules/@metamask/ethjs-contract/package.json ++++ b/node_modules/@metamask/ethjs-contract/package.json +@@ -194,7 +194,7 @@ + "rpc" + ], + "license": "MIT", +- "main": "lib/index.js", ++ "main": "src/index.js", + "name": "@metamask/ethjs-contract", + "peerDependencies": { + "@babel/runtime": "^7.0.0" diff --git a/patches/@metamask+ethjs-query+0.7.1.patch b/patches/@metamask+ethjs-query+0.7.1.patch new file mode 100644 index 000000000000..7447fe7212fa --- /dev/null +++ b/patches/@metamask+ethjs-query+0.7.1.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/@metamask/ethjs-query/package.json b/node_modules/@metamask/ethjs-query/package.json +index 14e1062..6860d86 100644 +--- a/node_modules/@metamask/ethjs-query/package.json ++++ b/node_modules/@metamask/ethjs-query/package.json +@@ -2,7 +2,7 @@ + "name": "@metamask/ethjs-query", + "version": "0.7.1", + "description": "A simple query layer for the Ethereum RPC.", +- "main": "lib/index.js", ++ "main": "src/index.js", + "files": [ + "dist", + "internals", diff --git a/patches/ethjs-contract+0.2.3.patch b/patches/ethjs-contract+0.2.3.patch deleted file mode 100644 index 0c16ee548609..000000000000 --- a/patches/ethjs-contract+0.2.3.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/node_modules/ethjs-contract/package.json b/node_modules/ethjs-contract/package.json -index 8e58ff5..470d00b 100644 ---- a/node_modules/ethjs-contract/package.json -+++ b/node_modules/ethjs-contract/package.json -@@ -197,7 +197,7 @@ - "lint-staged": { - "lint:eslint": "*.js" - }, -- "main": "lib/index.js", -+ "main": "src/index.js", - "name": "ethjs-contract", - "pre-commit": "build", - "repository": { diff --git a/patches/ethjs-query+0.3.8.patch b/patches/ethjs-query+0.3.8.patch deleted file mode 100644 index e50888451746..000000000000 --- a/patches/ethjs-query+0.3.8.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/node_modules/ethjs-query/package.json b/node_modules/ethjs-query/package.json -index fb82d51..503159c 100644 ---- a/node_modules/ethjs-query/package.json -+++ b/node_modules/ethjs-query/package.json -@@ -2,7 +2,7 @@ - "name": "ethjs-query", - "version": "0.3.8", - "description": "A simple query layer for the Ethereum RPC.", -- "main": "lib/index.js", -+ "main": "src/index.js", - "files": [ - "dist", - "internals", diff --git a/yarn.lock b/yarn.lock index 532ddd37cd18..5f98899f15dc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9443,9 +9443,23 @@ "@types/node" "*" "@types/bn.js@^5.1.0", "@types/bn.js@^5.1.5": - version "5.1.5" - resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.5.tgz#2e0dacdcce2c0f16b905d20ff87aedbc6f7b4bf0" - integrity sha512-V46N0zwKRF5Q00AZ6hWtN0T8gGmDUaUzLWQvHFo5yThtVwK/VCenFY3wXVbOvNfajEpsTfQM4IN9k/d6gUVX3A== + version "5.1.6" + resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.6.tgz#9ba818eec0c85e4d3c679518428afdf611d03203" + integrity sha512-Xh8vSwUeMKeYYrj3cX4lGQgFSF/N03r+tv4AiLl1SucqV+uTQpxRcnM8AkXKHwYP9ZPXOYXRr2KPXpVlIvqh9w== + dependencies: + "@types/node" "*" + +"@types/bnjs4@npm:@types/bn.js@^4.11.6": + version "4.11.6" + resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-4.11.6.tgz#c306c70d9358aaea33cd4eda092a742b9505967c" + integrity sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg== + dependencies: + "@types/node" "*" + +"@types/bnjs5@npm:@types/bn.js@^5.1.6": + version "5.1.6" + resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.6.tgz#9ba818eec0c85e4d3c679518428afdf611d03203" + integrity sha512-Xh8vSwUeMKeYYrj3cX4lGQgFSF/N03r+tv4AiLl1SucqV+uTQpxRcnM8AkXKHwYP9ZPXOYXRr2KPXpVlIvqh9w== dependencies: "@types/node" "*" @@ -11500,20 +11514,6 @@ abstract-leveldown@~0.12.1: dependencies: xtend "~3.0.0" -abstract-leveldown@~2.6.0: - version "2.6.3" - resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-2.6.3.tgz#1c5e8c6a5ef965ae8c35dfb3a8770c476b82c4b8" - integrity sha512-2++wDf/DYqkPR3o5tbfdhF96EfMApo1GpPfzOsR/ZYXdkSmELlvOOEAl9iKkRsktMPHdGjO4rtkBpf2I7TiTeA== - dependencies: - xtend "~4.0.0" - -abstract-leveldown@~2.7.1: - version "2.7.2" - resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-2.7.2.tgz#87a44d7ebebc341d59665204834c8b7e0932cc93" - integrity sha512-+OVvxH2rHVEhWLdbudP6p0+dNMXu8JA1CbhP19T8paTYAcX7oJ4OVjT+ZUVpv7mITxXHqDMej+GdqXBmXkw09w== - dependencies: - xtend "~4.0.0" - accepts@^1.3.5, accepts@^1.3.7, accepts@~1.3.5, accepts@~1.3.7, accepts@~1.3.8: version "1.3.8" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" @@ -12824,7 +12824,7 @@ astral-regex@^2.0.0: resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== -async-eventemitter@0.2.4, async-eventemitter@^0.2.2: +async-eventemitter@0.2.4: version "0.2.4" resolved "https://registry.yarnpkg.com/async-eventemitter/-/async-eventemitter-0.2.4.tgz#f5e7c8ca7d3e46aab9ec40a292baf686a0bafaca" integrity sha512-pd20BwL7Yt1zwDFy+8MX8F1+WCT8aQeKj0kQnTrH9WaeRETlRamVhD0JtRPmrV4GfOJ2F9CvdQkZeZhnh2TuHw== @@ -12882,12 +12882,7 @@ async-mutex@^0.5.0: dependencies: tslib "^2.4.0" -async@^1.4.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" - integrity sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo= - -async@^2.0.1, async@^2.1.2, async@^2.4.0, async@^2.6.0, async@^2.6.3, async@^2.6.4: +async@^2.4.0, async@^2.6.0, async@^2.6.3, async@^2.6.4: version "2.6.4" resolved "https://registry.yarnpkg.com/async/-/async-2.6.4.tgz#706b7ff6084664cd7eae713f6f965433b5504221" integrity sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA== @@ -13179,14 +13174,6 @@ babel-preset-jest@^29.6.3: babel-plugin-jest-hoist "^29.6.3" babel-preset-current-node-syntax "^1.0.0" -babel-runtime@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" - integrity sha512-ITKNuq2wKlW1fJg9sSW52eepoYgZBggvOAHC0u/CYu/qxQ9EVzThCgR69BnSXLHjy2f7SY5zaQ4yt7H9ZVxY2g== - dependencies: - core-js "^2.4.0" - regenerator-runtime "^0.11.0" - backo2@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/backo2/-/backo2-1.0.2.tgz#31ab1ac8b129363463e35b3ebb69f4dfcfba7947" @@ -13315,7 +13302,7 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== -bindings@^1.2.1, bindings@^1.5.0: +bindings@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== @@ -13376,11 +13363,21 @@ bn.js@5.2.1, bn.js@^5.0.0, bn.js@^5.1.2, bn.js@^5.2.0, bn.js@^5.2.1: resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== -bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.10.0, bn.js@^4.11.0, bn.js@^4.11.8, bn.js@^4.11.9: +bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.0, bn.js@^4.11.8, bn.js@^4.11.9: + version "4.12.0" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" + integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== + +"bnjs4@npm:bn.js@^4.12.0": version "4.12.0" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== +"bnjs5@npm:bn.js@^5.2.1": + version "5.2.1" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" + integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== + body-parser@1.20.3, body-parser@^1.15.2, body-parser@^1.18.2, body-parser@^1.19.0: version "1.20.3" resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.3.tgz#1953431221c6fb5cd63c4b36d53fab0928e548c6" @@ -14004,13 +14001,6 @@ charenc@0.0.2: resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" integrity sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA== -checkpoint-store@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/checkpoint-store/-/checkpoint-store-1.1.0.tgz#04e4cb516b91433893581e6d4601a78e9552ea06" - integrity sha1-BOTLUWuRQziTWB5tRgGnjpVS6gY= - dependencies: - functional-red-black-tree "^1.0.1" - cheerio-select@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cheerio-select/-/cheerio-select-2.1.0.tgz#4d8673286b8126ca2a8e42740d5e3c4884ae21b4" @@ -14773,7 +14763,7 @@ core-js-compat@^3.31.0, core-js-compat@^3.36.1: dependencies: browserslist "^4.23.0" -core-js@^2.4.0, core-js@^2.5.7, core-js@^2.6.5: +core-js@^2.5.7, core-js@^2.6.5: version "2.6.12" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec" integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== @@ -15487,13 +15477,6 @@ deferred-leveldown@~0.2.0: dependencies: abstract-leveldown "~0.12.1" -deferred-leveldown@~1.2.1: - version "1.2.2" - resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-1.2.2.tgz#3acd2e0b75d1669924bc0a4b642851131173e1eb" - integrity sha512-uukrWD2bguRtXilKt6cAWKyoXrTSMo5m7crUdLfWQmu8kIm88w3QZoUL+6nhpfKVmhHANER6Re3sKoNoZ3IKMA== - dependencies: - abstract-leveldown "~2.6.0" - define-data-property@^1.0.1, define-data-property@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e" @@ -17001,61 +16984,31 @@ eth-ens-namehash@^1.0.2: idna-uts46 "^1.0.1" js-sha3 "^0.5.7" -eth-json-rpc-errors@^1.0.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/eth-json-rpc-errors/-/eth-json-rpc-errors-1.1.1.tgz#148377ef55155585981c21ff574a8937f9d6991f" - integrity sha512-WT5shJ5KfNqHi9jOZD+ID8I1kuYWNrigtZat7GOQkvwo99f8SzAVaEcWhJUv656WiZOAg3P1RiJQANtUmDmbIg== - dependencies: - fast-safe-stringify "^2.0.6" - -eth-json-rpc-filters@4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/eth-json-rpc-filters/-/eth-json-rpc-filters-4.2.2.tgz#eb35e1dfe9357ace8a8908e7daee80b2cd60a10d" - integrity sha512-DGtqpLU7bBg63wPMWg1sCpkKCf57dJ+hj/k3zF26anXMzkmtSBDExL8IhUu7LUd34f0Zsce3PYNO2vV2GaTzaw== +eth-json-rpc-filters@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/eth-json-rpc-filters/-/eth-json-rpc-filters-5.1.0.tgz#f0c2aeaec2a45e2dc6ca1b9843d8e85447821427" + integrity sha512-fos+9xmoa1A2Ytsc9eYof17r81BjdJOUcGcgZn4K/tKdCCTb+a8ytEtwlu1op5qsXFDlgGmstTELFrDEc89qEQ== dependencies: "@metamask/safe-event-emitter" "^2.0.0" async-mutex "^0.2.6" - eth-json-rpc-middleware "^6.0.0" eth-query "^2.1.2" json-rpc-engine "^6.1.0" pify "^5.0.0" -eth-json-rpc-middleware@4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/eth-json-rpc-middleware/-/eth-json-rpc-middleware-4.3.0.tgz#d3e72efb60b6f601f022ce01384481eaed552b6b" - integrity sha512-Acr+FaIHB0oIV0nWrCvepQghgA3FzYFvnMDXdTUeHQvAX/G6ioMbw1exGJs+6HirRjJ+MmkZqaArphx+PTrRNQ== - dependencies: - btoa "^1.2.1" - clone "^2.1.1" - eth-json-rpc-errors "^1.0.1" - eth-query "^2.1.2" - eth-sig-util "^1.4.2" - ethereumjs-block "^1.6.0" - ethereumjs-tx "^1.3.7" - ethereumjs-util "^5.1.2" - ethereumjs-vm "^2.6.0" - fetch-ponyfill "^4.0.0" - json-rpc-engine "^5.1.3" - json-stable-stringify "^1.0.1" - pify "^3.0.0" - safe-event-emitter "^1.0.1" - -eth-json-rpc-middleware@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/eth-json-rpc-middleware/-/eth-json-rpc-middleware-6.0.0.tgz#4fe16928b34231a2537856f08a5ebbc3d0c31175" - integrity sha512-qqBfLU2Uq1Ou15Wox1s+NX05S9OcAEL4JZ04VZox2NS0U+RtCMjSxzXhLFWekdShUPZ+P8ax3zCO2xcPrp6XJQ== +eth-json-rpc-middleware@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/eth-json-rpc-middleware/-/eth-json-rpc-middleware-7.0.1.tgz#3b9d7f61ea8d86b112add1558432a51efa413f56" + integrity sha512-Z0Fg5spBzayjfLf7aTTaSZnzUhXE6wLWOWgdtX01LMigbttjSUbJxp23Z2jw5CavCnG8yEz9yQNHFQV2p2o/hQ== dependencies: + "@metamask/safe-event-emitter" "^2.0.0" btoa "^1.2.1" clone "^2.1.1" - eth-query "^2.1.2" - eth-rpc-errors "^3.0.0" + eth-rpc-errors "^4.0.3" eth-sig-util "^1.4.2" - ethereumjs-util "^5.1.2" - json-rpc-engine "^5.3.0" + json-rpc-engine "^6.1.0" json-stable-stringify "^1.0.1" node-fetch "^2.6.1" pify "^3.0.0" - safe-event-emitter "^1.0.1" eth-method-registry@^4.0.0: version "4.0.0" @@ -17080,14 +17033,7 @@ eth-query@^2.1.2: json-rpc-random-id "^1.0.0" xtend "^4.0.1" -eth-rpc-errors@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/eth-rpc-errors/-/eth-rpc-errors-3.0.0.tgz#d7b22653c70dbf9defd4ef490fd08fe70608ca10" - integrity sha512-iPPNHPrLwUlR9xCSYm7HHQjWBasor3+KZfRvwEWxMz3ca0yqnlBeJrnyphkGIXZ4J7AMAaOLmwy4AWhnxOiLxg== - dependencies: - fast-safe-stringify "^2.0.6" - -eth-rpc-errors@^4.0.2: +eth-rpc-errors@^4.0.2, eth-rpc-errors@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/eth-rpc-errors/-/eth-rpc-errors-4.0.3.tgz#6ddb6190a4bf360afda82790bb7d9d5e724f423a" integrity sha512-Z3ymjopaoft7JDoxZcEb3pwdGh7yiYMhOwm2doUt6ASXlMavpNlK6Cre0+IMl2VSGyEU9rkiperQhp5iRxn5Pg== @@ -17110,16 +17056,6 @@ eth-url-parser@1.0.4: bignumber.js "^7.2.1" qs "^6.5.2" -ethereum-common@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/ethereum-common/-/ethereum-common-0.2.0.tgz#13bf966131cce1eeade62a1b434249bb4cb120ca" - integrity sha512-XOnAR/3rntJgbCdGhqdaLIxDLWKLmsZOGhHdBKadEr6gEnJLH52k93Ou+TUdFaPN3hJc3isBZBal3U/XZ15abA== - -ethereum-common@^0.0.18: - version "0.0.18" - resolved "https://registry.yarnpkg.com/ethereum-common/-/ethereum-common-0.0.18.tgz#2fdc3576f232903358976eb39da783213ff9523f" - integrity sha512-EoltVQTRNg2Uy4o84qpa2aXymXDJhxm7eos/ACOg0DG4baAbMjhbdAEsx9GeE8sC3XCxnYvrrzZDH8D8MtA2iQ== - ethereum-cryptography@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" @@ -17156,87 +17092,14 @@ ethereum-ens-network-map@^1.0.0: resolved "https://registry.yarnpkg.com/ethereum-ens-network-map/-/ethereum-ens-network-map-1.0.2.tgz#4e27bad18dae7bd95d84edbcac2c9e739fc959b9" integrity sha512-5qwJ5n3YhjSpE6O/WEBXCAb2nagUgyagJ6C0lGUBWC4LjKp/rRzD+pwtDJ6KCiITFEAoX4eIrWOjRy0Sylq5Hg== -ethereumjs-abi@0.6.6: - version "0.6.6" - resolved "https://registry.yarnpkg.com/ethereumjs-abi/-/ethereumjs-abi-0.6.6.tgz#f8ba3413a98478173f5a00f7f1316819db1d09ec" - integrity sha512-w8KubDsA/+OAuqtIR9RGsMcoZ5nhM8vxwjJAJvEIY+clhxA3BHoLG3+ClYQaQhD0n3mlDt3U5rBrmSVJvI3c8A== - dependencies: - bn.js "^4.10.0" - ethereumjs-util "^5.0.0" - -"ethereumjs-abi@git+https://github.com/ethereumjs/ethereumjs-abi.git": +ethereumjs-abi@^0.6.8, "ethereumjs-abi@git+https://github.com/ethereumjs/ethereumjs-abi.git": version "0.6.8" resolved "git+https://github.com/ethereumjs/ethereumjs-abi.git#ee3994657fa7a427238e6ba92a84d0b529bbcde0" dependencies: bn.js "^4.11.8" ethereumjs-util "^6.0.0" -ethereumjs-account@^2.0.3: - version "2.0.5" - resolved "https://registry.yarnpkg.com/ethereumjs-account/-/ethereumjs-account-2.0.5.tgz#eeafc62de544cb07b0ee44b10f572c9c49e00a84" - integrity sha512-bgDojnXGjhMwo6eXQC0bY6UK2liSFUSMwwylOmQvZbSl/D7NXQ3+vrGO46ZeOgjGfxXmgIeVNDIiHw7fNZM4VA== - dependencies: - ethereumjs-util "^5.0.0" - rlp "^2.0.0" - safe-buffer "^5.1.1" - -ethereumjs-block@^1.6.0: - version "1.7.1" - resolved "https://registry.yarnpkg.com/ethereumjs-block/-/ethereumjs-block-1.7.1.tgz#78b88e6cc56de29a6b4884ee75379b6860333c3f" - integrity sha512-B+sSdtqm78fmKkBq78/QLKJbu/4Ts4P2KFISdgcuZUPDm9x+N7qgBPIIFUGbaakQh8bzuquiRVbdmvPKqbILRg== - dependencies: - async "^2.0.1" - ethereum-common "0.2.0" - ethereumjs-tx "^1.2.2" - ethereumjs-util "^5.0.0" - merkle-patricia-tree "^2.1.2" - -ethereumjs-block@~2.2.0: - version "2.2.2" - resolved "https://registry.yarnpkg.com/ethereumjs-block/-/ethereumjs-block-2.2.2.tgz#c7654be7e22df489fda206139ecd63e2e9c04965" - integrity sha512-2p49ifhek3h2zeg/+da6XpdFR3GlqY3BIEiqxGF8j9aSRIgkb7M1Ky+yULBKJOu8PAZxfhsYA+HxUk2aCQp3vg== - dependencies: - async "^2.0.1" - ethereumjs-common "^1.5.0" - ethereumjs-tx "^2.1.1" - ethereumjs-util "^5.0.0" - merkle-patricia-tree "^2.1.2" - -ethereumjs-common@^1.1.0, ethereumjs-common@^1.5.0: - version "1.5.2" - resolved "https://registry.yarnpkg.com/ethereumjs-common/-/ethereumjs-common-1.5.2.tgz#2065dbe9214e850f2e955a80e650cb6999066979" - integrity sha512-hTfZjwGX52GS2jcVO6E2sx4YuFnf0Fhp5ylo4pEPhEffNln7vS59Hr5sLnp3/QCazFLluuBZ+FZ6J5HTp0EqCA== - -ethereumjs-tx@^1.2.2, ethereumjs-tx@^1.3.7: - version "1.3.7" - resolved "https://registry.yarnpkg.com/ethereumjs-tx/-/ethereumjs-tx-1.3.7.tgz#88323a2d875b10549b8347e09f4862b546f3d89a" - integrity sha512-wvLMxzt1RPhAQ9Yi3/HKZTn0FZYpnsmQdbKYfUUpi4j1SEIcbkd9tndVjcPrufY3V7j2IebOpC00Zp2P/Ay2kA== - dependencies: - ethereum-common "^0.0.18" - ethereumjs-util "^5.0.0" - -ethereumjs-tx@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ethereumjs-tx/-/ethereumjs-tx-2.1.2.tgz#5dfe7688bf177b45c9a23f86cf9104d47ea35fed" - integrity sha512-zZEK1onCeiORb0wyCXUvg94Ve5It/K6GD1K+26KfFKodiBiS6d9lfCXlUKGBBdQ+bv7Day+JK0tj1K+BeNFRAw== - dependencies: - ethereumjs-common "^1.5.0" - ethereumjs-util "^6.0.0" - -ethereumjs-util@6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-6.1.0.tgz#e9c51e5549e8ebd757a339cc00f5380507e799c8" - integrity sha512-URESKMFbDeJxnAxPppnk2fN6Y3BIatn9fwn76Lm8bQlt+s52TpG8dN9M66MLPuRAiAOIqL3dfwqWJf0sd0fL0Q== - dependencies: - bn.js "^4.11.0" - create-hash "^1.1.2" - ethjs-util "0.1.6" - keccak "^1.0.2" - rlp "^2.0.0" - safe-buffer "^5.1.1" - secp256k1 "^3.0.1" - -ethereumjs-util@^5.0.0, ethereumjs-util@^5.1.1, ethereumjs-util@^5.1.2: +ethereumjs-util@^5.1.1: version "5.2.1" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-5.2.1.tgz#a833f0e5fca7e5b361384dc76301a721f537bf65" integrity sha512-v3kT+7zdyCm1HIqWlLNrHGqHGLpGYIhjeHxQjnDXjLT2FyGJDsd3LWMYUo7pAFRrk86CR3nUJfhC81CCoJNNGQ== @@ -17273,23 +17136,6 @@ ethereumjs-util@^7.0.10, ethereumjs-util@^7.0.8, ethereumjs-util@^7.1.2: ethereum-cryptography "^0.1.3" rlp "^2.2.4" -ethereumjs-vm@^2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/ethereumjs-vm/-/ethereumjs-vm-2.6.0.tgz#76243ed8de031b408793ac33907fb3407fe400c6" - integrity sha512-r/XIUik/ynGbxS3y+mvGnbOKnuLo40V5Mj1J25+HEO63aWYREIqvWeRO/hnROlMBE5WoniQmPmhiaN0ctiHaXw== - dependencies: - async "^2.1.2" - async-eventemitter "^0.2.2" - ethereumjs-account "^2.0.3" - ethereumjs-block "~2.2.0" - ethereumjs-common "^1.1.0" - ethereumjs-util "^6.0.0" - fake-merkle-patricia-tree "^1.0.1" - functional-red-black-tree "^1.0.1" - merkle-patricia-tree "^2.3.2" - rustbn.js "~0.2.0" - safe-buffer "^5.1.1" - ethereumjs-wallet@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/ethereumjs-wallet/-/ethereumjs-wallet-1.0.2.tgz#2c000504b4c71e8f3782dabe1113d192522e99b6" @@ -17358,17 +17204,6 @@ ethjs-abi@^0.2.0: js-sha3 "0.5.5" number-to-bn "1.7.0" -ethjs-contract@0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/ethjs-contract/-/ethjs-contract-0.2.3.tgz#f113ced8ed1c9c635b0b7ec71901340b64e8cded" - integrity sha512-fKsHm57wxwHrZhVlD8AHU2lC2G3c1fmvoEz15BpqIkuGWiTbjuvrQo2Avc+3EQpSsTFWNdyxC0h1WKRcn5kkyQ== - dependencies: - babel-runtime "^6.26.0" - ethjs-abi "0.2.0" - ethjs-filter "0.1.8" - ethjs-util "0.1.3" - js-sha3 "0.5.5" - ethjs-contract@^0.1.7: version "0.1.9" resolved "https://registry.yarnpkg.com/ethjs-contract/-/ethjs-contract-0.1.9.tgz#1c2766896a56d47ec1d6d661829c49cc38a5520a" @@ -17394,11 +17229,6 @@ ethjs-filter@0.1.5: resolved "https://registry.yarnpkg.com/ethjs-filter/-/ethjs-filter-0.1.5.tgz#0112af6017c24677e32b8fdeb20e6196019b7598" integrity sha512-ii+Av0Kv0mOzQSP2aBSWTeamTntWDXgHN0Sj1UnTpzYH+gQdJCvirsc0BO07MWcsk0kuLogITDOPVFFd7qcUMQ== -ethjs-filter@0.1.8: - version "0.1.8" - resolved "https://registry.yarnpkg.com/ethjs-filter/-/ethjs-filter-0.1.8.tgz#2b02726b820ed4dd3860614d185c0c0f7ed1747f" - integrity sha512-qTDPskDL2UadHwjvM8A+WG9HwM4/FoSY3p3rMJORkHltYcAuiQZd2otzOYKcL5w2Q3sbAkW/E3yt/FPFL/AVXA== - ethjs-format@0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/ethjs-format/-/ethjs-format-0.2.2.tgz#d73b3a605c2e1257079f7077fd5448e998ce0fcd" @@ -17411,28 +17241,6 @@ ethjs-format@0.2.2: number-to-bn "1.7.0" strip-hex-prefix "1.0.0" -ethjs-format@0.2.7: - version "0.2.7" - resolved "https://registry.yarnpkg.com/ethjs-format/-/ethjs-format-0.2.7.tgz#20c92f31c259a381588d069830d838b489774b86" - integrity sha512-uNYAi+r3/mvR3xYu2AfSXx5teP4ovy9z2FrRsblU+h2logsaIKZPi9V3bn3V7wuRcnG0HZ3QydgZuVaRo06C4Q== - dependencies: - bn.js "4.11.6" - ethjs-schema "0.2.1" - ethjs-util "0.1.3" - is-hex-prefixed "1.0.0" - number-to-bn "1.7.0" - strip-hex-prefix "1.0.0" - -ethjs-query@0.3.8: - version "0.3.8" - resolved "https://registry.yarnpkg.com/ethjs-query/-/ethjs-query-0.3.8.tgz#aa5af02887bdd5f3c78b3256d0f22ffd5d357490" - integrity sha512-/J5JydqrOzU8O7VBOwZKUWXxHDGr46VqNjBCJgBVNNda+tv7Xc8Y2uJc6aMHHVbeN3YOQ7YRElgIc0q1CI02lQ== - dependencies: - babel-runtime "^6.26.0" - ethjs-format "0.2.7" - ethjs-rpc "0.2.0" - promise-to-callback "^1.0.0" - ethjs-query@^0.2.4: version "0.2.9" resolved "https://registry.yarnpkg.com/ethjs-query/-/ethjs-query-0.2.9.tgz#a26e6b4f38699e92f34b2184e75c7894329c42f1" @@ -17446,13 +17254,6 @@ ethjs-rpc@0.1.5: resolved "https://registry.yarnpkg.com/ethjs-rpc/-/ethjs-rpc-0.1.5.tgz#099e22f27dc4c18b6978a485fc36b1b0f7969080" integrity sha512-RSqGrUjkA1UHl0d/FteGHFCv3spO/sA+lQHiIYIczYKE1nkM1Q2fKjiqssq+6LnYc+g3NWOBr4AIKQzXc8RQ1g== -ethjs-rpc@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/ethjs-rpc/-/ethjs-rpc-0.2.0.tgz#3d0011e32cfff156ed6147818c6fb8f801701b4c" - integrity sha512-RINulkNZTKnj4R/cjYYtYMnFFaBcVALzbtEJEONrrka8IeoarNB9Jbzn+2rT00Cv8y/CxAI+GgY1d0/i2iQeOg== - dependencies: - promise-to-callback "^1.0.0" - ethjs-schema@0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/ethjs-schema/-/ethjs-schema-0.1.5.tgz#59740e3b3977bcdbb9b11bc3068201e8aceabb0d" @@ -17463,14 +17264,6 @@ ethjs-schema@0.2.1: resolved "https://registry.yarnpkg.com/ethjs-schema/-/ethjs-schema-0.2.1.tgz#47e138920421453617069034684642e26bb310f4" integrity sha512-DXd8lwNrhT9sjsh/Vd2Z+4pfyGxhc0POVnLBUfwk5udtdoBzADyq+sK39dcb48+ZU+2VgtwHxtGWnLnCfmfW5g== -ethjs-unit@0.1.6: - version "0.1.6" - resolved "https://registry.yarnpkg.com/ethjs-unit/-/ethjs-unit-0.1.6.tgz#c665921e476e87bce2a9d588a6fe0405b2c41699" - integrity sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk= - dependencies: - bn.js "4.11.6" - number-to-bn "1.7.0" - ethjs-util@0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.3.tgz#dfd5ea4a400dc5e421a889caf47e081ada78bb55" @@ -17784,13 +17577,6 @@ extsprintf@^1.2.0: resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= -fake-merkle-patricia-tree@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/fake-merkle-patricia-tree/-/fake-merkle-patricia-tree-1.0.1.tgz#4b8c3acfb520afadf9860b1f14cd8ce3402cddd3" - integrity sha1-S4w6z7Ugr635hgsfFM2M40As3dM= - dependencies: - checkpoint-store "^1.1.0" - fancy-log@^1.3.2: version "1.3.3" resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.3.tgz#dbc19154f558690150a23953a0adbd035be45fc7" @@ -17969,13 +17755,6 @@ fecha@^4.2.0: resolved "https://registry.yarnpkg.com/fecha/-/fecha-4.2.3.tgz#4d9ccdbc61e8629b259fdca67e65891448d569fd" integrity sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw== -fetch-ponyfill@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/fetch-ponyfill/-/fetch-ponyfill-4.1.0.tgz#ae3ce5f732c645eab87e4ae8793414709b239893" - integrity sha1-rjzl9zLGReq4fkroeTQUcJsjmJM= - dependencies: - node-fetch "~1.7.1" - figures@^3.0.0, figures@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" @@ -18517,11 +18296,6 @@ function.prototype.name@^1.1.0, function.prototype.name@^1.1.2, function.prototy es-abstract "^1.22.1" functions-have-names "^1.2.3" -functional-red-black-tree@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" - integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= - functions-have-names@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" @@ -19613,11 +19387,6 @@ image-to-base64@^2.2.0: dependencies: node-fetch "^2.6.0" -immediate@^3.2.3: - version "3.3.0" - resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.3.0.tgz#1aef225517836bcdf7f2a2de2600c79ff0269266" - integrity sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q== - immediate@~3.0.5: version "3.0.6" resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" @@ -21144,14 +20913,6 @@ json-pointer@^0.6.2: dependencies: foreach "^2.0.4" -json-rpc-engine@^5.1.3, json-rpc-engine@^5.3.0: - version "5.4.0" - resolved "https://registry.yarnpkg.com/json-rpc-engine/-/json-rpc-engine-5.4.0.tgz#75758609d849e1dba1e09021ae473f3ab63161e5" - integrity sha512-rAffKbPoNDjuRnXkecTjnsE3xLLrb00rEkdgalINhaYVYIxDwWtvYBr9UFbhTvPB1B2qUOLoFd/cV6f4Q7mh7g== - dependencies: - eth-rpc-errors "^3.0.0" - safe-event-emitter "^1.0.1" - json-rpc-engine@^6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/json-rpc-engine/-/json-rpc-engine-6.1.0.tgz#bf5ff7d029e1c1bf20cb6c0e9f348dcd8be5a393" @@ -21160,15 +20921,7 @@ json-rpc-engine@^6.1.0: "@metamask/safe-event-emitter" "^2.0.0" eth-rpc-errors "^4.0.2" -json-rpc-middleware-stream@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/json-rpc-middleware-stream/-/json-rpc-middleware-stream-3.0.0.tgz#8540331d884f36b9e0ad31054cc68ac6b5a89b52" - integrity sha512-JmZmlehE0xF3swwORpLHny/GvW3MZxCsb2uFNBrn8TOqMqivzCfz232NSDLLOtIQlrPlgyEjiYpyzyOPFOzClw== - dependencies: - "@metamask/safe-event-emitter" "^2.0.0" - readable-stream "^2.3.3" - -json-rpc-middleware-stream@^4.2.1: +json-rpc-middleware-stream@^4.2.1, json-rpc-middleware-stream@^4.2.2: version "4.2.3" resolved "https://registry.yarnpkg.com/json-rpc-middleware-stream/-/json-rpc-middleware-stream-4.2.3.tgz#08340846ffaa2a60287930773546eb4b7f7dbba2" integrity sha512-4iFb0yffm5vo3eFKDbQgke9o17XBcLQ2c3sONrXSbcOLzP8LTojqo8hRGVgtJShhm5q4ZDSNq039fAx9o65E1w== @@ -21333,16 +21086,6 @@ keccak@3.0.2, keccak@^3.0.0: node-gyp-build "^4.2.0" readable-stream "^3.6.0" -keccak@^1.0.2: - version "1.4.0" - resolved "https://registry.yarnpkg.com/keccak/-/keccak-1.4.0.tgz#572f8a6dbee8e7b3aa421550f9e6408ca2186f80" - integrity sha512-eZVaCpblK5formjPjeTBik7TAg+pqnDrMHIffSvi9Lh7PQgM1+hSzakUeZFCk9DVVG0dacZJuaz2ntwlzZUIBw== - dependencies: - bindings "^1.2.1" - inherits "^2.0.3" - nan "^2.2.1" - safe-buffer "^5.1.0" - keygrip@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/keygrip/-/keygrip-1.1.0.tgz#871b1681d5e159c62a445b0c74b615e0917e7226" @@ -21508,11 +21251,6 @@ level-blobs@^0.1.7: once "^1.3.0" readable-stream "^1.0.26-4" -level-codec@~7.0.0: - version "7.0.1" - resolved "https://registry.yarnpkg.com/level-codec/-/level-codec-7.0.1.tgz#341f22f907ce0f16763f24bddd681e395a0fb8a7" - integrity sha512-Ua/R9B9r3RasXdRmOtd+t9TCOEIIlts+TN/7XTT2unhDaL6sJn83S3rUyljbr6lVtw49N3/yA0HHjpV6Kzb2aQ== - level-concat-iterator@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz#5235b1f744bc34847ed65a50548aa88d22e881cf" @@ -21520,20 +21258,6 @@ level-concat-iterator@^3.0.0: dependencies: catering "^2.1.0" -level-errors@^1.0.3: - version "1.1.2" - resolved "https://registry.yarnpkg.com/level-errors/-/level-errors-1.1.2.tgz#4399c2f3d3ab87d0625f7e3676e2d807deff404d" - integrity sha512-Sw/IJwWbPKF5Ai4Wz60B52yj0zYeqzObLh8k1Tk88jVmD51cJSKWSYpRyhVIvFzZdvsPqlH5wfhp/yxdsaQH4w== - dependencies: - errno "~0.1.1" - -level-errors@~1.0.3: - version "1.0.5" - resolved "https://registry.yarnpkg.com/level-errors/-/level-errors-1.0.5.tgz#83dbfb12f0b8a2516bdc9a31c4876038e227b859" - integrity sha512-/cLUpQduF6bNrWuAC4pwtUKA5t669pCsCi2XbmojG2tFeOr9j6ShtdDCtFFQO1DRt+EVZhx9gPzP9G2bUaG4ig== - dependencies: - errno "~0.1.1" - level-filesystem@^1.0.1: version "1.2.0" resolved "https://registry.yarnpkg.com/level-filesystem/-/level-filesystem-1.2.0.tgz#a00aca9919c4a4dfafdca6a8108d225aadff63b3" @@ -21568,16 +21292,6 @@ level-fix-range@~1.0.2: dependencies: string-range "~1.2" -level-iterator-stream@~1.3.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/level-iterator-stream/-/level-iterator-stream-1.3.1.tgz#e43b78b1a8143e6fa97a4f485eb8ea530352f2ed" - integrity sha1-5Dt4sagUPm+pek9IXrjqUwNS8u0= - dependencies: - inherits "^2.0.1" - level-errors "^1.0.3" - readable-stream "^1.0.33" - xtend "^4.0.0" - level-peek@1.0.6, level-peek@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/level-peek/-/level-peek-1.0.6.tgz#bec51c72a82ee464d336434c7c876c3fcbcce77f" @@ -21613,14 +21327,6 @@ level-transcoder@^1.0.1: buffer "^6.0.3" module-error "^1.0.1" -level-ws@0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/level-ws/-/level-ws-0.0.0.tgz#372e512177924a00424b0b43aef2bb42496d228b" - integrity sha1-Ny5RIXeSSgBCSwtDrvK7QkltIos= - dependencies: - readable-stream "~1.0.15" - xtend "~2.1.1" - leveldown@6.1.0: version "6.1.0" resolved "https://registry.yarnpkg.com/leveldown/-/leveldown-6.1.0.tgz#7ab1297706f70c657d1a72b31b40323aa612b9ee" @@ -21643,19 +21349,6 @@ levelup@^0.18.2: semver "~2.3.1" xtend "~3.0.0" -levelup@^1.2.1: - version "1.3.9" - resolved "https://registry.yarnpkg.com/levelup/-/levelup-1.3.9.tgz#2dbcae845b2bb2b6bea84df334c475533bbd82ab" - integrity sha512-VVGHfKIlmw8w1XqpGOAGwq6sZm2WwWLmlDcULkKWQXEA5EopA8OBNJ2Ck2v6bdk8HeEZSbCSEgzXadyQFm76sQ== - dependencies: - deferred-leveldown "~1.2.1" - level-codec "~7.0.0" - level-errors "~1.0.3" - level-iterator-stream "~1.3.0" - prr "~1.0.1" - semver "~5.4.1" - xtend "~4.0.0" - leven@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" @@ -22107,7 +21800,7 @@ lru-cache@^7.14.0, lru-cache@^7.14.1: resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.18.3.tgz#f793896e0fd0e954a59dfdd82f0773808df6aa89" integrity sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA== -ltgt@^2.1.3, ltgt@~2.2.0: +ltgt@^2.1.3: version "2.2.1" resolved "https://registry.yarnpkg.com/ltgt/-/ltgt-2.2.1.tgz#f35ca91c493f7b73da0e07495304f17b31f87ee5" integrity sha512-AI2r85+4MquTw9ZYqabu4nMwy9Oftlfa/e/52t9IjtfG+mGBbTNdAoZ3RQKLHR6r0wQnwZnPIEh/Ya6XTWAKNA== @@ -22256,18 +21949,6 @@ mem@^4.0.0: mimic-fn "^2.0.0" p-is-promise "^2.0.0" -memdown@^1.0.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/memdown/-/memdown-1.4.1.tgz#b4e4e192174664ffbae41361aa500f3119efe215" - integrity sha1-tOThkhdGZP+65BNhqlAPMRnv4hU= - dependencies: - abstract-leveldown "~2.7.1" - functional-red-black-tree "^1.0.1" - immediate "^3.2.3" - inherits "~2.0.1" - ltgt "~2.2.0" - safe-buffer "~5.1.1" - memfs@^3.4.1, memfs@^3.4.12: version "3.6.0" resolved "https://registry.yarnpkg.com/memfs/-/memfs-3.6.0.tgz#d7a2110f86f79dd950a8b6df6d57bc984aa185f6" @@ -22309,20 +21990,6 @@ merge2@^1.3.0, merge2@^1.4.1: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== -merkle-patricia-tree@^2.1.2, merkle-patricia-tree@^2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/merkle-patricia-tree/-/merkle-patricia-tree-2.3.2.tgz#982ca1b5a0fde00eed2f6aeed1f9152860b8208a" - integrity sha512-81PW5m8oz/pz3GvsAwbauj7Y00rqm81Tzad77tHBwU7pIAtN+TJnMSOJhxBKflSVYhptMMb9RskhqHqrSm1V+g== - dependencies: - async "^1.4.2" - ethereumjs-util "^5.0.0" - level-ws "0.0.0" - levelup "^1.2.1" - memdown "^1.0.0" - readable-stream "^2.0.0" - rlp "^2.0.0" - semaphore ">=1.0.1" - mersenne-twister@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/mersenne-twister/-/mersenne-twister-1.1.0.tgz#f916618ee43d7179efcf641bec4531eb9670978a" @@ -23098,7 +22765,7 @@ mz@^2.7.0: object-assign "^4.0.1" thenify-all "^1.0.0" -nan@^2.14.0, nan@^2.2.1: +nan@^2.14.0: version "2.20.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.20.0.tgz#08c5ea813dd54ed16e5bd6505bf42af4f7838ca3" integrity sha512-bk3gXBZDGILuuo/6sKtr0DQmSThYHLtNCdSdXk9YkxD/jK6X2vmCyyXBBxyqZ4XcnzTyYEAThfX3DCEnLf6igw== @@ -23252,7 +22919,7 @@ node-fetch-native@^1.4.0, node-fetch-native@^1.4.1: resolved "https://registry.yarnpkg.com/node-fetch-native/-/node-fetch-native-1.6.1.tgz#f95c74917d3cebc794cdae0cd2a9c7594aad0cb4" integrity sha512-bW9T/uJDPAJB2YNYEpWzE54U5O3MQidXsOyTfnbKYtTtFexRvGzb1waphBN4ZwP6EcIvYYEOwW0b72BpAqydTw== -node-fetch@2.6.7, node-fetch@^2.0.0, node-fetch@^2.2.0, node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.12, node-fetch@^2.6.7, node-fetch@^2.7.0, node-fetch@~1.7.1: +node-fetch@2.6.7, node-fetch@^2.0.0, node-fetch@^2.2.0, node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.12, node-fetch@^2.6.7, node-fetch@^2.7.0: version "2.6.7" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== @@ -23595,11 +23262,6 @@ object-keys@~0.2.0: indexof "~0.0.1" is "~0.2.6" -object-keys@~0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-0.4.0.tgz#28a6aae7428dd2c3a92f3d95f21335dd204e0336" - integrity sha1-KKaq50KN0sOpLz2V8hM13SBOAzY= - object.assign@^4.1.0, object.assign@^4.1.2, object.assign@^4.1.4, object.assign@^4.1.5: version "4.1.5" resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.5.tgz#3a833f9ab7fdb80fc9e8d2300c803d216d8fdbb0" @@ -26229,7 +25891,7 @@ readable-stream@2.3.7: string_decoder "~1.1.1" util-deprecate "~1.0.1" -readable-stream@^1.0.26-4, readable-stream@^1.0.31, readable-stream@^1.0.33: +readable-stream@^1.0.26-4, readable-stream@^1.0.31: version "1.1.14" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" integrity sha1-fPTFTvZI44EwhMY23SB54WbAgdk= @@ -26263,7 +25925,7 @@ readable-stream@^2.0.0, readable-stream@^2.0.2, readable-stream@^2.0.5, readable process "^0.11.10" string_decoder "^1.3.0" -readable-stream@~1.0.15, readable-stream@~1.0.26, readable-stream@~1.0.26-4, readable-stream@~1.0.31: +readable-stream@~1.0.26, readable-stream@~1.0.26-4, readable-stream@~1.0.31: version "1.0.34" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" integrity sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw= @@ -26442,7 +26104,7 @@ regenerator-runtime@0.13.9: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52" integrity sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA== -regenerator-runtime@^0.11.0, regenerator-runtime@^0.13.2, regenerator-runtime@^0.13.3, regenerator-runtime@^0.13.4, regenerator-runtime@^0.13.7, regenerator-runtime@^0.13.8: +regenerator-runtime@^0.13.2, regenerator-runtime@^0.13.3, regenerator-runtime@^0.13.4, regenerator-runtime@^0.13.7, regenerator-runtime@^0.13.8: version "0.13.11" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== @@ -26876,11 +26538,6 @@ run-parallel@^1.1.2, run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" -rustbn.js@~0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/rustbn.js/-/rustbn.js-0.2.0.tgz#8082cb886e707155fd1cb6f23bd591ab8d55d0ca" - integrity sha512-4VlvkRUuCJvr2J6Y0ImW7NvTCriMi7ErOAqWk1y69vAdoNIzCF3yPmgeNzx+RQTLEDFq5sHfscn1MwHxP9hNfA== - "rxjs@>= 6", rxjs@^7.5.5, rxjs@^7.8.1: version "7.8.1" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" @@ -26925,13 +26582,6 @@ safe-buffer@5.2.1, safe-buffer@>=5.1.0, safe-buffer@^5.0.1, safe-buffer@^5.1.0, resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== -safe-event-emitter@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/safe-event-emitter/-/safe-event-emitter-1.0.1.tgz#5b692ef22329ed8f69fdce607e50ca734f6f20af" - integrity sha512-e1wFe99A91XYYxoQbcq2ZJUWurxEyP8vfz7A7vuUe1s95q8r5ebraVaA1BukYJcpM6V16ugWoD9vngi8Ccu5fg== - dependencies: - events "^3.0.0" - safe-json-stringify@~1: version "1.2.0" resolved "https://registry.yarnpkg.com/safe-json-stringify/-/safe-json-stringify-1.2.0.tgz#356e44bc98f1f93ce45df14bcd7c01cda86e0afd" @@ -27014,7 +26664,7 @@ scrypt-js@3.0.1, scrypt-js@^3.0.0, scrypt-js@^3.0.1: resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== -secp256k1@3.8.1, secp256k1@^3.0.1: +secp256k1@3.8.1: version "3.8.1" resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-3.8.1.tgz#b62a62a882d6b16f9b51fe599c6b3a861e36c59f" integrity sha512-tArjQw2P0RTdY7QmkNehgp6TVvQXq6ulIhxv8gaH6YubKG/wxxAoNKcbuXjDhybbc+b2Ihc7e0xxiGN744UIiQ== @@ -27057,11 +26707,6 @@ selenium-webdriver@^3.6.0: tmp "0.0.30" xml2js "^0.4.17" -semaphore@>=1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/semaphore/-/semaphore-1.1.0.tgz#aaad8b86b20fe8e9b32b16dc2ee682a8cd26a8aa" - integrity sha512-O4OZEaNtkMd/K0i6js9SL+gqy0ZCBMgUvlSqHKi4IBdjhe7wB8pwztUk1BbZ1fmrvpwFrPbHzqd2w5pTcJH6LA== - semver-compare@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" @@ -27101,11 +26746,6 @@ semver@~5.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" integrity sha512-mfmm3/H9+67MCVix1h+IXTpDwL6710LyHuk7+cWC9T1mE0qz4iHhh6r4hU2wrIT9iTsAAC2XQRvfblL028cpLw== -semver@~5.4.1: - version "5.4.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" - integrity sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg== - send@0.18.0, send@0.19.0: version "0.19.0" resolved "https://registry.yarnpkg.com/send/-/send-0.19.0.tgz#bbc5a388c8ea6c048967049dbeac0e4a3f09d7f8" @@ -30096,13 +29736,6 @@ xtend@~2.0.4: is-object "~0.1.2" object-keys "~0.2.0" -xtend@~2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-2.1.2.tgz#6efecc2a4dad8e6962c4901b337ce7ba87b5d28b" - integrity sha1-bv7MKk2tjmlixJAbM3znuoe10os= - dependencies: - object-keys "~0.4.0" - xtend@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/xtend/-/xtend-3.0.0.tgz#5cce7407baf642cba7becda568111c493f59665a"