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 ,
@@ -23,24 +24,20 @@ import {
23
24
TextColor ,
24
25
TextVariant ,
25
26
} from '../../../../../../../helpers/constants/design-system' ;
26
- import { MIN_AMOUNT } from '../../../../../../../hooks/useCurrencyDisplay' ;
27
27
import { useFiatFormatter } from '../../../../../../../hooks/useFiatFormatter' ;
28
28
import { getPreferences } from '../../../../../../../selectors' ;
29
29
import { getMultichainNetwork } from '../../../../../../../selectors/multichain' ;
30
30
import { useConfirmContext } from '../../../../../context/confirm' ;
31
- import {
32
- formatAmount ,
33
- formatAmountMaxPrecision ,
34
- } from '../../../../simulation-details/formatAmount' ;
35
- import { toNonScientificString } from '../../hooks/use-token-values' ;
31
+ import { formatAmount } from '../../../../simulation-details/formatAmount' ;
36
32
37
33
const NativeSendHeading = ( ) => {
38
34
const { currentConfirmation : transactionMeta } =
39
35
useConfirmContext < TransactionMeta > ( ) ;
40
36
41
- const nativeAssetTransferValue = new BigNumber (
37
+ const nativeAssetTransferValue = calcTokenAmount (
42
38
transactionMeta . txParams . value as string ,
43
- ) . dividedBy ( new BigNumber ( 10 ) . pow ( 18 ) ) ;
39
+ 18 ,
40
+ ) ;
44
41
45
42
const conversionRate = useSelector ( getConversionRate ) ;
46
43
const fiatValue =
@@ -59,9 +56,7 @@ const NativeSendHeading = () => {
59
56
const locale = useSelector ( getIntlLocale ) ;
60
57
const roundedTransferValue = formatAmount ( locale , nativeAssetTransferValue ) ;
61
58
62
- const transferValue = toNonScientificString (
63
- nativeAssetTransferValue . toNumber ( ) ,
64
- ) ;
59
+ const transferValue = nativeAssetTransferValue . toFixed ( ) ;
65
60
66
61
type TestNetChainId = ( typeof TEST_CHAINS ) [ number ] ;
67
62
const isTestnet = TEST_CHAINS . includes (
@@ -83,8 +78,15 @@ const NativeSendHeading = () => {
83
78
) ;
84
79
85
80
const NativeAssetAmount =
86
- roundedTransferValue ===
87
- `<${ formatAmountMaxPrecision ( locale , MIN_AMOUNT ) } ` ? (
81
+ roundedTransferValue === transferValue ? (
82
+ < Text
83
+ variant = { TextVariant . headingLg }
84
+ color = { TextColor . inherit }
85
+ marginTop = { 3 }
86
+ >
87
+ { `${ roundedTransferValue } ${ ticker } ` }
88
+ </ Text >
89
+ ) : (
88
90
< Tooltip title = { transferValue } position = "right" >
89
91
< Text
90
92
variant = { TextVariant . headingLg }
@@ -94,14 +96,6 @@ const NativeSendHeading = () => {
94
96
{ `${ roundedTransferValue } ${ ticker } ` }
95
97
</ Text >
96
98
</ Tooltip >
97
- ) : (
98
- < Text
99
- variant = { TextVariant . headingLg }
100
- color = { TextColor . inherit }
101
- marginTop = { 3 }
102
- >
103
- { `${ roundedTransferValue } ${ ticker } ` }
104
- </ Text >
105
99
) ;
106
100
107
101
const NativeAssetFiatConversion = Boolean ( fiatDisplayValue ) &&
0 commit comments