1
- import { Hex } from '@metamask/utils' ;
2
1
import { BigNumber } from 'bignumber.js' ;
2
+ import { Hex } from '@metamask/utils' ;
3
3
import React , { useMemo } from 'react' ;
4
4
import { useSelector } from 'react-redux' ;
5
+
5
6
import { TokenStandard } from '../../../../../../../../../shared/constants/transaction' ;
6
7
import { calcTokenAmount } from '../../../../../../../../../shared/lib/transactions-controller-utils' ;
7
8
import {
8
9
Box ,
9
10
Text ,
10
11
} from '../../../../../../../../components/component-library' ;
11
- import Tooltip from '../../../../../../../../components/ui/tooltip' ;
12
12
import {
13
13
BlockSize ,
14
14
BorderRadius ,
15
15
Display ,
16
16
JustifyContent ,
17
17
TextAlign ,
18
18
} from '../../../../../../../../helpers/constants/design-system' ;
19
+ import Tooltip from '../../../../../../../../components/ui/tooltip' ;
19
20
import { shortenString } from '../../../../../../../../helpers/utils/util' ;
20
- import { useI18nContext } from '../../../../../../../../hooks/useI18nContext' ;
21
21
import { selectConversionRateByChainId } from '../../../../../../../../selectors' ;
22
22
import { AssetPill } from '../../../../../simulation-details/asset-pill' ;
23
- import { IndividualFiatDisplay } from '../../../../../simulation-details/fiat-display' ;
24
23
import {
25
24
formatAmount ,
26
25
formatAmountMaxPrecision ,
27
26
} from '../../../../../simulation-details/formatAmount' ;
28
- import { UNLIMITED_THRESHOLD } from '../../../approve/hooks/use-approve-token-simulation ' ;
27
+ import { IndividualFiatDisplay } from '../../../../../simulation-details/fiat-display ' ;
29
28
import { getAmountColors } from '../../../utils' ;
30
29
31
30
const NATIVE_DECIMALS = 18 ;
@@ -50,24 +49,13 @@ const NativeValueDisplay: React.FC<PermitSimulationValueDisplayParams> = ({
50
49
credit,
51
50
debit,
52
51
} ) => {
53
- const t = useI18nContext ( ) ;
54
-
55
52
const conversionRate = useSelector ( ( state ) =>
56
53
selectConversionRateByChainId ( state , chainId ) ,
57
54
) ;
58
55
59
- const {
60
- fiatValue,
61
- tokenValue,
62
- tokenValueMaxPrecision,
63
- shouldShowUnlimitedValue,
64
- } = useMemo ( ( ) => {
56
+ const { fiatValue, tokenValue, tokenValueMaxPrecision } = useMemo ( ( ) => {
65
57
if ( ! value ) {
66
- return {
67
- tokenValue : null ,
68
- tokenValueMaxPrecision : null ,
69
- shouldShowUnlimitedValue : false ,
70
- } ;
58
+ return { tokenValue : null , tokenValueMaxPrecision : null } ;
71
59
}
72
60
73
61
const tokenAmount = calcTokenAmount ( value , NATIVE_DECIMALS ) ;
@@ -78,7 +66,6 @@ const NativeValueDisplay: React.FC<PermitSimulationValueDisplayParams> = ({
78
66
: undefined ,
79
67
tokenValue : formatAmount ( 'en-US' , tokenAmount ) ,
80
68
tokenValueMaxPrecision : formatAmountMaxPrecision ( 'en-US' , tokenAmount ) ,
81
- shouldShowUnlimitedValue : Number ( value ) > UNLIMITED_THRESHOLD ,
82
69
} ;
83
70
} , [ conversionRate , value ] ) ;
84
71
@@ -109,15 +96,13 @@ const NativeValueDisplay: React.FC<PermitSimulationValueDisplayParams> = ({
109
96
>
110
97
{ credit && '+ ' }
111
98
{ debit && '- ' }
112
- { shouldShowUnlimitedValue
113
- ? t ( 'unlimited' )
114
- : tokenValue !== null &&
115
- shortenString ( tokenValue || '' , {
116
- truncatedCharLimit : 15 ,
117
- truncatedStartChars : 15 ,
118
- truncatedEndChars : 0 ,
119
- skipCharacterInEnd : true ,
120
- } ) }
99
+ { tokenValue !== null &&
100
+ shortenString ( tokenValue || '' , {
101
+ truncatedCharLimit : 15 ,
102
+ truncatedStartChars : 15 ,
103
+ truncatedEndChars : 0 ,
104
+ skipCharacterInEnd : true ,
105
+ } ) }
121
106
</ Text >
122
107
</ Tooltip >
123
108
</ Box >
0 commit comments