6
6
CHAIN_ID_TO_NETWORK_IMAGE_URL_MAP ,
7
7
TEST_CHAINS ,
8
8
} from '../../../../../../../../shared/constants/network' ;
9
+ import { calcTokenAmount } from '../../../../../../../../shared/lib/transactions-controller-utils' ;
9
10
import {
10
11
AvatarToken ,
11
12
AvatarTokenSize ,
@@ -22,29 +23,25 @@ import {
22
23
TextColor ,
23
24
TextVariant ,
24
25
} from '../../../../../../../helpers/constants/design-system' ;
25
- import { MIN_AMOUNT } from '../../../../../../../hooks/useCurrencyDisplay' ;
26
26
import { useFiatFormatter } from '../../../../../../../hooks/useFiatFormatter' ;
27
27
import {
28
28
getPreferences ,
29
29
selectConversionRateByChainId ,
30
30
} from '../../../../../../../selectors' ;
31
31
import { getMultichainNetwork } from '../../../../../../../selectors/multichain' ;
32
32
import { useConfirmContext } from '../../../../../context/confirm' ;
33
- import {
34
- formatAmount ,
35
- formatAmountMaxPrecision ,
36
- } from '../../../../simulation-details/formatAmount' ;
37
- import { toNonScientificString } from '../../hooks/use-token-values' ;
33
+ import { formatAmount } from '../../../../simulation-details/formatAmount' ;
38
34
39
35
const NativeSendHeading = ( ) => {
40
36
const { currentConfirmation : transactionMeta } =
41
37
useConfirmContext < TransactionMeta > ( ) ;
42
38
43
39
const { chainId } = transactionMeta ;
44
40
45
- const nativeAssetTransferValue = new BigNumber (
41
+ const nativeAssetTransferValue = calcTokenAmount (
46
42
transactionMeta . txParams . value as string ,
47
- ) . dividedBy ( new BigNumber ( 10 ) . pow ( 18 ) ) ;
43
+ 18 ,
44
+ ) ;
48
45
49
46
const conversionRate = useSelector ( ( state ) =>
50
47
selectConversionRateByChainId ( state , chainId ) ,
@@ -66,9 +63,7 @@ const NativeSendHeading = () => {
66
63
const locale = useSelector ( getIntlLocale ) ;
67
64
const roundedTransferValue = formatAmount ( locale , nativeAssetTransferValue ) ;
68
65
69
- const transferValue = toNonScientificString (
70
- nativeAssetTransferValue . toNumber ( ) ,
71
- ) ;
66
+ const transferValue = nativeAssetTransferValue . toFixed ( ) ;
72
67
73
68
type TestNetChainId = ( typeof TEST_CHAINS ) [ number ] ;
74
69
const isTestnet = TEST_CHAINS . includes (
@@ -90,8 +85,15 @@ const NativeSendHeading = () => {
90
85
) ;
91
86
92
87
const NativeAssetAmount =
93
- roundedTransferValue ===
94
- `<${ formatAmountMaxPrecision ( locale , MIN_AMOUNT ) } ` ? (
88
+ roundedTransferValue === transferValue ? (
89
+ < Text
90
+ variant = { TextVariant . headingLg }
91
+ color = { TextColor . inherit }
92
+ marginTop = { 3 }
93
+ >
94
+ { `${ roundedTransferValue } ${ ticker } ` }
95
+ </ Text >
96
+ ) : (
95
97
< Tooltip title = { transferValue } position = "right" >
96
98
< Text
97
99
variant = { TextVariant . headingLg }
@@ -101,14 +103,6 @@ const NativeSendHeading = () => {
101
103
{ `${ roundedTransferValue } ${ ticker } ` }
102
104
</ Text >
103
105
</ Tooltip >
104
- ) : (
105
- < Text
106
- variant = { TextVariant . headingLg }
107
- color = { TextColor . inherit }
108
- marginTop = { 3 }
109
- >
110
- { `${ roundedTransferValue } ${ ticker } ` }
111
- </ Text >
112
106
) ;
113
107
114
108
const NativeAssetFiatConversion = Boolean ( fiatDisplayValue ) &&
0 commit comments