Skip to content

Commit da8f3d1

Browse files
Address PR review
1 parent 6179316 commit da8f3d1

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

ui/pages/confirmations/components/confirm/info/approve/hooks/use-approve-token-simulation.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import { useSelector } from 'react-redux';
77
import { calcTokenAmount } from '../../../../../../../../shared/lib/transactions-controller-utils';
88
import { getIntlLocale } from '../../../../../../../ducks/locale/locale';
99
import { formatAmount } from '../../../../simulation-details/formatAmount';
10-
import { UNLIMITED_THRESHOLD } from '../../constants';
1110
import { useDecodedTransactionData } from '../../hooks/useDecodedTransactionData';
11+
import { TOKEN_VALUE_UNLIMITED_THRESHOLD } from '../../shared/constants';
1212
import { useIsNFT } from './use-is-nft';
1313

1414
function isSpendingCapUnlimited(decodedSpendingCap: number) {
15-
return decodedSpendingCap >= UNLIMITED_THRESHOLD;
15+
return decodedSpendingCap >= TOKEN_VALUE_UNLIMITED_THRESHOLD;
1616
}
1717

1818
export const useApproveTokenSimulation = (

ui/pages/confirmations/components/confirm/info/constants.ts

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
export const HEX_ZERO = '0x0';
2+
3+
export const TOKEN_VALUE_UNLIMITED_THRESHOLD = 10 ** 15;

ui/pages/confirmations/components/confirm/info/typed-sign/typed-sign-v4-simulation/value-display/value-display.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
formatAmount,
2929
formatAmountMaxPrecision,
3030
} from '../../../../../simulation-details/formatAmount';
31-
import { UNLIMITED_THRESHOLD } from '../../../constants';
31+
import { TOKEN_VALUE_UNLIMITED_THRESHOLD } from '../../../shared/constants';
3232
import { getAmountColors } from '../../../utils';
3333

3434
type PermitSimulationValueDisplayParams = {
@@ -57,7 +57,7 @@ type PermitSimulationValueDisplayParams = {
5757
/** True if value is being debited to wallet */
5858
debit?: boolean;
5959

60-
/** Wether a large amount can be substituted by "Unlimited" */
60+
/** Whether a large amount can be substituted by "Unlimited" */
6161
canDisplayValueAsUnlimited?: boolean;
6262
};
6363

@@ -110,7 +110,8 @@ const PermitSimulationValueDisplay: React.FC<
110110
tokenValue: formatAmount('en-US', tokenAmount),
111111
tokenValueMaxPrecision: formatAmountMaxPrecision('en-US', tokenAmount),
112112
shouldShowUnlimitedValue:
113-
canDisplayValueAsUnlimited && Number(value) > UNLIMITED_THRESHOLD,
113+
canDisplayValueAsUnlimited &&
114+
Number(value) > TOKEN_VALUE_UNLIMITED_THRESHOLD,
114115
};
115116
}, [tokenDecimals, value]);
116117

0 commit comments

Comments
 (0)