mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-03-03 05:55:03 +01:00
chore: BigNumber wrapper
This commit is contained in:
committed by
Tomáš Klíma
parent
307d3c72d5
commit
d18ba9a879
@@ -23,8 +23,7 @@
|
||||
"@mobily/ts-belt": "^3.13.1",
|
||||
"@solana/web3.js": "^1.91.6",
|
||||
"@trezor/env-utils": "workspace:*",
|
||||
"@trezor/utils": "workspace:*",
|
||||
"bignumber.js": "^9.1.2"
|
||||
"@trezor/utils": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@trezor/blockchain-link-types": "workspace:*",
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import type {
|
||||
Utxo,
|
||||
Transaction,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
|
||||
import { BigNumber, BigNumberValue } from '@trezor/utils/src/bigNumber';
|
||||
import type {
|
||||
BlockfrostUtxos,
|
||||
BlockfrostTransaction,
|
||||
@@ -203,7 +202,7 @@ export const transformTransaction = (
|
||||
|
||||
let type: Transaction['type'];
|
||||
let targets: VinVout[] = [];
|
||||
let amount: BigNumber.Value =
|
||||
let amount: BigNumberValue =
|
||||
blockfrostTxData.txData.output_amount.find(b => b.unit === 'lovelace')?.quantity || '0';
|
||||
const fee = blockfrostTxData.txData.fees;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { A, D, F, pipe } from '@mobily/ts-belt';
|
||||
import BigNumber from 'bignumber.js';
|
||||
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { Target, TokenTransfer, Transaction } from '@trezor/blockchain-link-types/src';
|
||||
import { arrayPartition } from '@trezor/utils';
|
||||
import type {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
const getPublicKey = (address: string) => ({
|
||||
toString: () => address,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
|
||||
import { BigNumber, BigNumberValue } from '@trezor/utils/src/bigNumber';
|
||||
import { isNotUndefined, topologicalSort } from '@trezor/utils';
|
||||
import type { Transaction, EnhancedVinVout } from '@trezor/blockchain-link-types/src/common';
|
||||
import type { VinVout } from '@trezor/blockchain-link-types/src/blockbook';
|
||||
@@ -35,7 +34,7 @@ export const enhanceVinVout =
|
||||
isAccountOwned: isAccountOwned(addresses)(vinVout) || undefined,
|
||||
});
|
||||
|
||||
export const sumVinVout = (sum: BigNumber.Value, { value }: VinVout): BigNumber.Value =>
|
||||
export const sumVinVout = (sum: BigNumberValue, { value }: VinVout): BigNumberValue =>
|
||||
typeof value === 'string' ? new BigNumber(value || '0').plus(sum) : sum;
|
||||
|
||||
export const transformTarget = (target: VinVout, incoming: VinVout[]) => ({
|
||||
|
||||
@@ -83,7 +83,6 @@
|
||||
"@trezor/utils": "workspace:*",
|
||||
"@trezor/utxo-lib": "workspace:*",
|
||||
"@types/web": "^0.0.138",
|
||||
"bignumber.js": "^9.1.2",
|
||||
"events": "^3.3.0",
|
||||
"ripple-lib": "^1.10.1",
|
||||
"socks-proxy-agent": "6.1.1",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { discovery } from '@trezor/utxo-lib';
|
||||
import { sumVinVout } from '@trezor/blockchain-link-utils';
|
||||
import { Api, tryGetScripthash, getTransactions, discoverAddress, AddressHistory } from '../utils';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { RippleAPI, APIOptions } from 'ripple-lib';
|
||||
import { RippleError } from 'ripple-lib/dist/npm/common/errors';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { CustomError } from '@trezor/blockchain-link-types/src/constants/errors';
|
||||
import { MESSAGES, RESPONSES } from '@trezor/blockchain-link-types/src/constants';
|
||||
import { BaseWorker, CONTEXT, ContextType } from '../baseWorker';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Connection, Message, PublicKey } from '@solana/web3.js';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
const COMPUTE_BUDGET_PROGRAM_ID = 'ComputeBudget111111111111111111111111111111';
|
||||
const DEFAULT_COMPUTE_UNIT_PRICE_MICROLAMPORTS = 100_000; // micro-lamports, value taken from other wallets
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
"@trezor/blockchain-link-utils": "workspace:*",
|
||||
"@trezor/utils": "workspace:*",
|
||||
"@trezor/utxo-lib": "workspace:*",
|
||||
"bignumber.js": "^9.1.2",
|
||||
"cross-fetch": "^4.0.0",
|
||||
"events": "^3.3.0",
|
||||
"golomb": "1.2.0",
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
"@stellar/stellar-sdk": "^11.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"bignumber.js": "^9.1.2"
|
||||
"@trezor/utils": "workspace:*"
|
||||
},
|
||||
"scripts": {
|
||||
"lint:js": "yarn g:eslint '**/*.{ts,tsx,js}'",
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
MemoHash,
|
||||
MemoReturn,
|
||||
} from '@stellar/stellar-sdk';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
/**
|
||||
* Transforms Signer to TrezorConnect.StellarTransaction.Signer
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": { "outDir": "./libDev" },
|
||||
"include": ["."],
|
||||
"references": []
|
||||
"references": [{ "path": "../utils" }]
|
||||
}
|
||||
|
||||
@@ -4,5 +4,9 @@
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": ["./src"],
|
||||
"references": []
|
||||
"references": [
|
||||
{
|
||||
"path": "../utils"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -80,7 +80,6 @@
|
||||
"@trezor/transport": "workspace:*",
|
||||
"@trezor/utils": "workspace:*",
|
||||
"@trezor/utxo-lib": "workspace:*",
|
||||
"bignumber.js": "^9.1.2",
|
||||
"blakejs": "^1.2.1",
|
||||
"bs58": "^5.0.0",
|
||||
"bs58check": "^3.0.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// origin: https://github.com/trezor/connect/blob/develop/src/js/core/methods/tx/Fees.js
|
||||
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { Blockchain } from '../../backend/BlockchainLink';
|
||||
import type { CoinInfo, FeeLevel } from '../../types';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// origin: https://github.com/trezor/connect/blob/develop/src/js/core/methods/tx/TransactionComposer.js
|
||||
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { composeTx, ComposeOutput } from '@trezor/utxo-lib';
|
||||
import { FeeLevels } from './Fees';
|
||||
import { Blockchain } from '../../backend/BlockchainLink';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
import { Transaction as BitcoinJsTransaction } from '@trezor/utxo-lib';
|
||||
import { getSerializedPath } from '../../utils/pathUtils';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// origin: https://github.com/trezor/connect/blob/develop/src/js/core/methods/ComposeTransaction.js
|
||||
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { AbstractMethod } from '../core/AbstractMethod';
|
||||
import { ERRORS } from '../constants';
|
||||
import { UI, createUiMessage } from '../events';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/prefer-ts-expect-error */
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { TrezorError } from '../../../constants/errors';
|
||||
import { PROTO } from '../../../constants';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// origin: https://github.com/trezor/connect/blob/develop/src/js/core/methods/helpers/ethereumSignTypedData.js
|
||||
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { PROTO, ERRORS } from '../../constants';
|
||||
import { messageToHex } from '../../utils/formatUtils';
|
||||
import type { EthereumSignTypedDataTypes } from '../../types/api/ethereum';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// origin: https://github.com/trezor/connect/blob/develop/src/js/core/methods/SignTransaction.js
|
||||
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
import { AbstractMethod } from '../core/AbstractMethod';
|
||||
import { validateParams, getFirmwareRange } from './common/paramsValidator';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// origin: https://github.com/trezor/connect/blob/develop/src/js/utils/formatUtils.js
|
||||
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import type { CoinInfo } from '../types';
|
||||
|
||||
export const formatAmount = (n: string, coinInfo: CoinInfo) =>
|
||||
|
||||
@@ -77,7 +77,6 @@
|
||||
"@trezor/type-utils": "workspace:*",
|
||||
"@trezor/urls": "workspace:*",
|
||||
"@trezor/utils": "workspace:*",
|
||||
"bignumber.js": "^9.1.2",
|
||||
"bs58check": "^3.0.1",
|
||||
"date-fns": "^2.30.0",
|
||||
"dropbox": "^10.34.0",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { toWei } from 'web3-utils';
|
||||
|
||||
import TrezorConnect, { FeeLevel } from '@trezor/connect';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
import TrezorConnect, { SignedTransaction } from '@trezor/connect';
|
||||
import {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import styled from 'styled-components';
|
||||
import { Translation } from 'src/components/suite';
|
||||
import { Button, Tooltip } from '@trezor/components';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import {
|
||||
MIN_ETH_AMOUNT_FOR_STAKING,
|
||||
MIN_ETH_BALANCE_FOR_STAKING,
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
} from 'react';
|
||||
|
||||
import { Control, FieldValues, useController, UseControllerProps } from 'react-hook-form';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
import { Input, InputProps } from '@trezor/components';
|
||||
import { localizeNumber } from '@suite-common/wallet-utils';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ReactNode, forwardRef } from 'react';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { Translation } from 'src/components/suite';
|
||||
import { formatNetworkAmount, formatAmount, isTestnet } from '@suite-common/wallet-utils';
|
||||
import { BTC_LOCKTIME_VALUE } from '@suite-common/wallet-constants';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { forwardRef } from 'react';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
import { formatAmount, formatNetworkAmount, isTestnet } from '@suite-common/wallet-utils';
|
||||
import { selectDevice } from '@suite-common/wallet-core';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import styled, { useTheme } from 'styled-components';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { getFeeUnits, formatNetworkAmount, formatAmount, getFee } from '@suite-common/wallet-utils';
|
||||
import { Icon, CoinLogo, variables } from '@trezor/components';
|
||||
import { formatDuration, isFeatureFlagEnabled } from '@suite-common/suite-utils';
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
isTxFeePaid,
|
||||
roundTimestampToNearestPastHour,
|
||||
} from '@suite-common/wallet-utils';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { FormattedNftAmount } from 'src/components/suite/FormattedNftAmount';
|
||||
import { useSelector } from 'src/hooks/suite';
|
||||
import { selectLocalCurrency } from 'src/reducers/wallet/settingsReducer';
|
||||
|
||||
@@ -8,7 +8,7 @@ import { NetworkSymbol } from '@suite-common/wallet-config';
|
||||
import { useSelector } from 'src/hooks/suite';
|
||||
import { useUnstakeEthFormContext } from 'src/hooks/wallet/useUnstakeEthForm';
|
||||
import { selectSelectedAccount } from 'src/reducers/wallet/selectedAccountReducer';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { getAccountEverstakeStakingPool } from 'src/utils/wallet/stakingUtils';
|
||||
|
||||
const GreyP = styled(Paragraph)`
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import styled from 'styled-components';
|
||||
import {
|
||||
Control,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import styled, { css } from 'styled-components';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
import {
|
||||
formatNetworkAmount,
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
} from '@suite-common/wallet-utils';
|
||||
import { TransactionHeader } from './TransactionHeader';
|
||||
import { WalletAccountTransaction } from 'src/types/wallet';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { BlurWrapper } from './TransactionItemBlurWrapper';
|
||||
|
||||
const Wrapper = styled.span`
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { FiatValue, Translation } from 'src/components/suite';
|
||||
import {
|
||||
formatCardanoWithdrawal,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Bignumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { NotificationCard, Translation } from 'src/components/suite';
|
||||
import { formatNetworkAmount } from '@suite-common/wallet-utils';
|
||||
import type { Account } from 'src/types/wallet/index';
|
||||
@@ -10,8 +10,8 @@ interface XRPReserveProps {
|
||||
|
||||
export const XRPReserve = ({ account }: XRPReserveProps) => {
|
||||
if (account?.networkType !== 'ripple') return null;
|
||||
const bigBalance = new Bignumber(account.balance);
|
||||
const bigReserve = new Bignumber(account.misc.reserve);
|
||||
const bigBalance = new BigNumber(account.balance);
|
||||
const bigReserve = new BigNumber(account.misc.reserve);
|
||||
|
||||
return bigBalance.isLessThan(bigReserve) ? (
|
||||
<NotificationCard
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
export const MIN_ETH_AMOUNT_FOR_STAKING = new BigNumber(0.1);
|
||||
export const MIN_ETH_FOR_WITHDRAWALS = new BigNumber(0.03);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { AccountUtxo } from '@trezor/connect';
|
||||
|
||||
import { getUtxoOutpoint } from '@suite-common/wallet-utils';
|
||||
|
||||
@@ -54,7 +54,7 @@ import { networkToCryptoSymbol } from 'src/utils/wallet/coinmarket/cryptoSymbolU
|
||||
import { FiatCurrencyCode } from '@suite-common/suite-config';
|
||||
import { selectLocalCurrency } from 'src/reducers/wallet/settingsReducer';
|
||||
import { TokenAddress } from '@suite-common/wallet-types';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
export const ExchangeFormContext = createContext<ExchangeFormContextValues | null>(null);
|
||||
ExchangeFormContext.displayName = 'CoinmarketExchangeContext';
|
||||
|
||||
@@ -6,7 +6,7 @@ import type {
|
||||
import { useCoinmarketNavigation } from 'src/hooks/wallet/useCoinmarketNavigation';
|
||||
import { useSelector } from 'src/hooks/suite';
|
||||
import { Trade } from 'src/types/wallet/coinmarketCommonTypes';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { selectFiatRatesByFiatRateKey } from '@suite-common/wallet-core';
|
||||
import { getFiatRateKey } from '@suite-common/wallet-utils';
|
||||
import { FiatCurrencyCode } from '@suite-common/suite-config';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { createContext, useContext, useState, useEffect, useMemo } from 'react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { fromWei } from 'web3-utils';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
||||
import { useForm, useWatch } from 'react-hook-form';
|
||||
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import useDebounce from 'react-use/lib/useDebounce';
|
||||
|
||||
import {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MiddlewareAPI } from 'redux';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
import { getPhysicalDeviceCount } from '@suite-common/suite-utils';
|
||||
import {
|
||||
|
||||
@@ -2,7 +2,7 @@ import produce from 'immer';
|
||||
import { CARDANO_STAKING } from 'src/actions/wallet/constants';
|
||||
import { WalletAction } from 'src/types/wallet';
|
||||
import { CardanoNetwork, PendingStakeTx, PoolsResponse } from 'src/types/wallet/cardanoStaking';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
export interface State {
|
||||
pendingTx: PendingStakeTx[];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import produce from 'immer';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { memoizeWithArgs } from 'proxy-memoize';
|
||||
|
||||
import { getInputSize, getOutputSize, RoundPhase } from '@trezor/coinjoin';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { toWei } from 'web3-utils';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import type { State } from 'src/reducers/wallet/settingsReducer';
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Ethereum } from '@everstake/wallet-sdk';
|
||||
import { fromWei, numberToHex, toWei } from 'web3-utils';
|
||||
import { getEthereumEstimateFeeParams, sanitizeHex } from '@suite-common/wallet-utils';
|
||||
import TrezorConnect, { EthereumTransaction } from '@trezor/connect';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { ValidatorsQueue } from '@suite-common/wallet-core';
|
||||
|
||||
// Gas reserve ensuring txs are processed
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
isInteger,
|
||||
networkAmountToSatoshi,
|
||||
} from '@suite-common/wallet-utils';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { TranslationFunction } from 'src/hooks/suite/useTranslation';
|
||||
import { AmountLimits } from 'src/types/wallet/coinmarketCommonTypes';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { createHash } from 'crypto';
|
||||
import hoursToMilliseconds from 'date-fns/hoursToMilliseconds';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
CustomPaymentAmountKey,
|
||||
PaymentFrequencyAnnualCoefficient,
|
||||
} from 'src/constants/wallet/coinmarket/savings';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import type { PaymentFrequencyOption } from 'src/types/wallet/coinmarketCommonTypes';
|
||||
import { isDesktop } from '@trezor/env-utils';
|
||||
import { desktopApi } from '@trezor/suite-desktop-api';
|
||||
|
||||
@@ -3,7 +3,7 @@ import { resetTime } from '@suite-common/suite-utils';
|
||||
import { networks, type NetworkSymbol } from '@suite-common/wallet-config';
|
||||
import { Account } from '@suite-common/wallet-types';
|
||||
import { formatNetworkAmount } from '@suite-common/wallet-utils';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { differenceInMonths } from 'date-fns';
|
||||
|
||||
import { CommonAggregatedHistory, GraphData, GraphRange, GraphScale } from 'src/types/wallet/graph';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { AggregatedAccountHistory, AggregatedDashboardHistory } from 'src/types/wallet/graph';
|
||||
|
||||
export type ObjectType<T> = T extends 'account'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { fromUnixTime, getUnixTime, startOfMonth } from 'date-fns';
|
||||
|
||||
import {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Account, StakingPoolExtended } from '@suite-common/wallet-types';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { fromWei } from 'web3-utils';
|
||||
|
||||
export const getAccountEverstakeStakingPool = (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
import { Account, Rate, TokenAddress, RatesByKey } from '@suite-common/wallet-types';
|
||||
import { TokenInfo } from '@trezor/connect';
|
||||
|
||||
@@ -2,7 +2,7 @@ import { AssetFiatBalance } from '@suite-common/assets';
|
||||
import { AssetRow, AssetRowSkeleton } from './AssetRow';
|
||||
import { AssetTableHeader } from './AssetTableHeader';
|
||||
import { Network } from '@suite-common/wallet-config';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import styled from 'styled-components';
|
||||
import { spacingsPx } from '@trezor/theme';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import styled, { useTheme } from 'styled-components';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
import { Icon, Button, LoadingContent, Card } from '@trezor/components';
|
||||
import { selectCurrentFiatRates, selectDeviceSupportedNetworks } from '@suite-common/wallet-core';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCallback, useEffect } from 'react';
|
||||
import styled, { css } from 'styled-components';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
import { isZero, amountToSatoshi, getFiatRateKey } from '@suite-common/wallet-utils';
|
||||
import { useCoinmarketExchangeFormContext } from 'src/hooks/wallet/useCoinmarketExchangeForm';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import styled, { useTheme } from 'styled-components';
|
||||
|
||||
import { Button, variables, Icon, H3, Card } from '@trezor/components';
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Translation, AccountLabeling, FormattedCryptoAmount } from 'src/compone
|
||||
import { Button, Icon, Input, Paragraph, SelectBar, Tooltip, variables } from '@trezor/components';
|
||||
import { useCoinmarketExchangeOffersContext } from 'src/hooks/wallet/useCoinmarketExchangeOffers';
|
||||
import useDebounce from 'react-use/lib/useDebounce';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { FieldError } from 'react-hook-form';
|
||||
import { BottomText } from '@trezor/components/src/components/form/BottomText';
|
||||
import { TranslationKey } from '@suite-common/intl-types';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { FormattedNumber } from 'react-intl';
|
||||
import styled, { useTheme } from 'styled-components';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
import { useFormatters } from '@suite-common/formatters';
|
||||
import { Translation } from 'src/components/suite';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useEffect } from 'react';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { useCoinmarketSellFormContext } from 'src/hooks/wallet/useCoinmarketSellForm';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import styled from 'styled-components';
|
||||
import { NumberInput, Translation } from 'src/components/suite';
|
||||
import { useSendFormContext } from 'src/hooks/wallet';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { Input, Icon } from '@trezor/components';
|
||||
import { Translation } from 'src/components/suite';
|
||||
import { useSendFormContext } from 'src/hooks/wallet';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCallback } from 'react';
|
||||
import { Timestamp, TokenAddress, FiatRatesResult } from '@suite-common/wallet-types';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import styled from 'styled-components';
|
||||
import { Controller } from 'react-hook-form';
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Account } from 'src/types/wallet';
|
||||
import { Output } from '@suite-common/wallet-types';
|
||||
import { useDispatch, useSelector } from 'src/hooks/suite';
|
||||
import { updateFiatRatesThunk, selectCurrentFiatRates } from '@suite-common/wallet-core';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { Timestamp, TokenAddress } from '@suite-common/wallet-types';
|
||||
import { TooltipSymbol, Translation } from 'src/components/suite';
|
||||
import { NetworkSymbol, getNetworkFeatures } from '@suite-common/wallet-config';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback } from 'react';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import styled, { useTheme } from 'styled-components';
|
||||
|
||||
import { Icon, Warning, variables } from '@trezor/components';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { useTheme } from 'styled-components';
|
||||
import { Icon } from '@trezor/components';
|
||||
import { Translation } from 'src/components/suite';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import styled, { useTheme } from 'styled-components';
|
||||
import { Button, Card, Icon, variables } from '@trezor/components';
|
||||
import { spacingsPx } from '@trezor/theme';
|
||||
|
||||
@@ -2,7 +2,7 @@ import { FormattedCryptoAmount } from 'src/components/suite';
|
||||
import styled from 'styled-components';
|
||||
import { spacingsPx } from '@trezor/theme';
|
||||
import { Tooltip, variables } from '@trezor/components';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
const StyledFormattedCryptoAmount = styled(FormattedCryptoAmount)<{
|
||||
$isRewards?: boolean;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
export const useIsTxStatusShown = (totalPendingStake: BigNumber, accountDescriptor?: string) => {
|
||||
// Handling the edge case, when a user can witness sudden change of pending stake deposit to 0.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { FormattedDate } from 'react-intl';
|
||||
import styled from 'styled-components';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
import { variables } from '@trezor/components';
|
||||
import { zIndices } from '@trezor/theme';
|
||||
|
||||
@@ -3,7 +3,7 @@ import styled from 'styled-components';
|
||||
import { variables, Card, SkeletonRectangle } from '@trezor/components';
|
||||
import { HiddenPlaceholder, FormattedCryptoAmount, Sign } from 'src/components/suite';
|
||||
import { Account } from 'src/types/wallet';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
const Wrapper = styled(Card)`
|
||||
display: flex;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import styled from 'styled-components';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { Translation, HiddenPlaceholder, FormattedDate } from 'src/components/suite';
|
||||
import { Account } from 'src/types/wallet';
|
||||
|
||||
|
||||
@@ -35,5 +35,8 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"tsx": "^4.7.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"bignumber.js": "^9.1.2"
|
||||
}
|
||||
}
|
||||
|
||||
9
packages/utils/src/bigNumber.ts
Normal file
9
packages/utils/src/bigNumber.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import BN from 'bignumber.js';
|
||||
|
||||
export const BigNumber = BN.clone({
|
||||
// Set to the maximum value to avoid scientific notation
|
||||
EXPONENTIAL_AT: 1e9,
|
||||
});
|
||||
|
||||
export type BigNumber = BN;
|
||||
export type BigNumberValue = BN.Value;
|
||||
@@ -40,3 +40,4 @@ export * from './typedEventEmitter';
|
||||
export * from './urlToOnion';
|
||||
export * from './logs';
|
||||
export * from './logsManager';
|
||||
export * from './bigNumber';
|
||||
|
||||
@@ -12,6 +12,6 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@suite-common/wallet-config": "workspace:*",
|
||||
"bignumber.js": "^9.1.2"
|
||||
"@trezor/utils": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": { "outDir": "libDev" },
|
||||
"references": [{ "path": "../wallet-config" }]
|
||||
"references": [
|
||||
{ "path": "../wallet-config" },
|
||||
{ "path": "../../packages/utils" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"@suite-common/wallet-types": "workspace:*",
|
||||
"@suite-common/wallet-utils": "workspace:*",
|
||||
"@trezor/connect": "workspace:*",
|
||||
"bignumber.js": "^9.1.2",
|
||||
"@trezor/utils": "workspace:*",
|
||||
"date-fns": "^2.30.0",
|
||||
"react": "18.2.0",
|
||||
"react-intl": "^6.6.2",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { FormatNumberOptions } from '@formatjs/intl';
|
||||
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
import { makeFormatter } from '../makeFormatter';
|
||||
import { FormatterConfig } from '../types';
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
{ "path": "../wallet-core" },
|
||||
{ "path": "../wallet-types" },
|
||||
{ "path": "../wallet-utils" },
|
||||
{ "path": "../../packages/connect" }
|
||||
{ "path": "../../packages/connect" },
|
||||
{ "path": "../../packages/utils" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
"@suite-common/wallet-utils": "workspace:*",
|
||||
"@trezor/blockchain-link": "workspace:*",
|
||||
"@trezor/connect": "workspace:*",
|
||||
"bignumber.js": "^9.1.2",
|
||||
"@trezor/utils": "workspace:*",
|
||||
"date-fns": "^2.30.0",
|
||||
"react": "18.2.0",
|
||||
"react-redux": "8.0.7"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { A, D, G, pipe } from '@mobily/ts-belt';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { fromUnixTime, getUnixTime } from 'date-fns';
|
||||
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { FiatCurrencyCode } from '@suite-common/suite-config';
|
||||
import { NetworkSymbol, getNetworkType } from '@suite-common/wallet-config';
|
||||
import { formatNetworkAmount } from '@suite-common/wallet-utils';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { A, D, pipe } from '@mobily/ts-belt';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { differenceInMinutes, eachMinuteOfInterval, fromUnixTime, getUnixTime } from 'date-fns';
|
||||
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { FiatCurrencyCode } from '@suite-common/suite-config';
|
||||
import { getBlockbookSafeTime } from '@suite-common/suite-utils';
|
||||
import { NetworkSymbol } from '@suite-common/wallet-config';
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
{
|
||||
"path": "../../packages/blockchain-link"
|
||||
},
|
||||
{ "path": "../../packages/connect" }
|
||||
{ "path": "../../packages/connect" },
|
||||
{ "path": "../../packages/utils" }
|
||||
]
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
"@trezor/connect": "workspace:*",
|
||||
"@trezor/env-utils": "workspace:*",
|
||||
"@trezor/type-utils": "workspace:*",
|
||||
"@trezor/utils": "workspace:*",
|
||||
"bignumber.js": "^9.1.2"
|
||||
"@trezor/utils": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
|
||||
export type SignOperator = 'positive' | 'negative';
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
"@trezor/connect": "workspace:*",
|
||||
"@trezor/urls": "workspace:*",
|
||||
"@trezor/utils": "workspace:*",
|
||||
"bignumber.js": "^9.1.2",
|
||||
"date-fns": "^2.30.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
"@mobily/ts-belt": "^3.13.1",
|
||||
"@suite-common/wallet-config": "workspace:*",
|
||||
"@trezor/connect": "workspace:*",
|
||||
"@trezor/utils": "workspace:*",
|
||||
"bignumber.js": "^9.1.2"
|
||||
"@trezor/utils": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { AccountInfo, Response as ConnectResponse } from '@trezor/connect';
|
||||
|
||||
import { AccountBalanceHistory } from '../../types';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { NetworkSymbol } from '@suite-common/wallet-config';
|
||||
import { AccountTransaction, AccountInfo } from '@trezor/connect';
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import { AccountTransaction } from '@trezor/connect';
|
||||
import { NetworkSymbol, getNetworkType } from '@suite-common/wallet-config';
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
"@trezor/suite-analytics": "workspace:*",
|
||||
"@trezor/type-utils": "workspace:*",
|
||||
"@trezor/utils": "workspace:*",
|
||||
"bignumber.js": "^9.1.2",
|
||||
"date-fns": "^2.30.0",
|
||||
"proxy-memoize": "2.0.2",
|
||||
"web3-utils": "^4.2.3"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { G } from '@mobily/ts-belt';
|
||||
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import TrezorConnect, { FeeLevel, Params, SignTransaction } from '@trezor/connect';
|
||||
import { notificationsActions } from '@suite-common/toast-notifications';
|
||||
import {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { toWei } from 'web3-utils';
|
||||
import { G } from '@mobily/ts-belt';
|
||||
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import TrezorConnect, { FeeLevel, TokenInfo } from '@trezor/connect';
|
||||
import { notificationsActions } from '@suite-common/toast-notifications';
|
||||
import {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { G } from '@mobily/ts-belt';
|
||||
|
||||
import { BigNumber } from '@trezor/utils/src/bigNumber';
|
||||
import TrezorConnect, { FeeLevel, RipplePayment } from '@trezor/connect';
|
||||
import { notificationsActions } from '@suite-common/toast-notifications';
|
||||
import {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user