Skip to content

Commit eb7c012

Browse files
authored
Incorrect amount of tx value if decimals for native token is not equal 18 (#3129)
NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS is not respected in transaction amounts Resolves #3128
1 parent d56986f commit eb7c012

17 files changed

+42
-7
lines changed

ui/cluster/ClusterDetails.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22

33
import type { ClusterByNameResponse } from 'types/api/clusters';
44

5+
import config from 'configs/app';
56
import { isEvmAddress } from 'lib/address/isEvmAddress';
67
import { currencyUnits } from 'lib/units';
78
import { Skeleton } from 'toolkit/chakra/skeleton';
@@ -79,6 +80,7 @@ const ClusterDetails = ({ clusterData, clusterName, isLoading }: Props) => {
7980
<CurrencyValue
8081
value={ clusterData?.backingWei || '0' }
8182
currency={ currencyUnits.ether }
83+
decimals={ String(config.chain.currency.decimals) }
8284
isLoading={ isLoading }
8385
/>
8486
</DetailedInfo.ItemValue>

ui/deposits/beaconChain/BeaconChainDepositsListItem.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ const BeaconChainDepositsListItem = ({ item, isLoading, view }: Props) => {
5959

6060
<ListItemMobileGrid.Label isLoading={ isLoading }>Value</ListItemMobileGrid.Label>
6161
<ListItemMobileGrid.Value>
62-
<CurrencyValue value={ item.amount } currency={ currencyUnits.ether } isLoading={ isLoading }/>
62+
<CurrencyValue
63+
value={ item.amount }
64+
currency={ currencyUnits.ether }
65+
decimals={ String(config.chain.currency.decimals) }
66+
isLoading={ isLoading }
67+
/>
6368
</ListItemMobileGrid.Value>
6469

6570
{ view !== 'address' && (

ui/deposits/beaconChain/BeaconChainDepositsTableItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22

33
import type { DepositsItem } from 'types/api/deposits';
44

5+
import config from 'configs/app';
56
import { TableCell, TableRow } from 'toolkit/chakra/table';
67
import BeaconChainDepositSignature from 'ui/shared/beacon/BeaconChainDepositSignature';
78
import BeaconChainDepositStatusTag from 'ui/shared/beacon/BeaconChainDepositStatusTag';
@@ -51,7 +52,7 @@ const BeaconChainDepositsTableItem = ({ item, view, isLoading }: Props) => {
5152
</TableCell>
5253
) }
5354
<TableCell verticalAlign="middle">
54-
<CurrencyValue value={ item.amount } isLoading={ isLoading }/>
55+
<CurrencyValue value={ item.amount } isLoading={ isLoading } decimals={ String(config.chain.currency.decimals) }/>
5556
</TableCell>
5657
{ view !== 'address' && (
5758
<TableCell verticalAlign="middle">

ui/shared/tx/TxFee.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const TxFee = ({ className, tx, accuracy, accuracyUsd, isLoading, withCurrency =
6565
<CurrencyValue
6666
value={ tx.fee.value }
6767
currency={ showCurrency ? currencyUnits.ether : '' }
68+
decimals={ String(config.chain.currency.decimals) }
6869
exchangeRate={ withUsd && 'exchange_rate' in tx ? tx.exchange_rate : null }
6970
accuracy={ accuracy }
7071
accuracyUsd={ accuracyUsd }

ui/tx/TxDetailsWrapped.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import React from 'react';
55
import type { Transaction } from 'types/api/transaction';
66
import type { ExcludeUndefined } from 'types/utils';
77

8+
import config from 'configs/app';
89
import { currencyUnits } from 'lib/units';
910
import { Badge } from 'toolkit/chakra/badge';
1011
import CurrencyValue from 'ui/shared/CurrencyValue';
@@ -72,6 +73,7 @@ const TxDetailsWrapped = ({ data }: Props) => {
7273
<CurrencyValue
7374
value={ data.value }
7475
currency={ currencyUnits.ether }
76+
decimals={ String(config.chain.currency.decimals) }
7577
flexWrap="wrap"
7678
/>
7779
</DetailedInfo.ItemValue>

ui/tx/details/TxDetailsBurntFees.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const TxDetailsBurntFees = ({ data, isLoading }: Props) => {
4545
startElement={ <IconSvg name="flame" boxSize={ 5 } color="icon.primary" isLoading={ isLoading } mr={{ base: 0, lg: 1 }}/> }
4646
value={ value.toString() }
4747
currency={ currencyUnits.ether }
48+
decimals={ String(config.chain.currency.decimals) }
4849
exchangeRate={ data.exchange_rate }
4950
alignItems="center"
5051
flexWrap="wrap"

ui/tx/details/TxDetailsSetMaxGasLimit.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const TxDetailsSetMaxGasLimit = ({ data }: Props) => {
3232
<CurrencyValue
3333
value={ maxGasLimit.toString() }
3434
currency={ currencyUnits.ether }
35+
decimals={ String(config.chain.currency.decimals) }
3536
exchangeRate={ 'exchange_rate' in data ? data.exchange_rate : null }
3637
showGweiTooltip
3738
flexWrap="wrap"

ui/tx/details/TxDetailsTxFee.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ const TxDetailsTxFee = ({ isLoading, data }: Props) => {
4141
<CurrencyValue
4242
value={ data.fee.value }
4343
currency={ currencyUnits.ether }
44+
decimals={ String(config.chain.currency.decimals) }
4445
exchangeRate={ 'exchange_rate' in data ? data.exchange_rate : null }
4546
isLoading={ isLoading }
4647
showGweiTooltip
@@ -56,6 +57,7 @@ const TxDetailsTxFee = ({ isLoading, data }: Props) => {
5657
<CurrencyValue
5758
value={ baseFeeBn.toString() }
5859
currency={ currencyUnits.ether }
60+
decimals={ String(config.chain.currency.decimals) }
5961
exchangeRate={ 'exchange_rate' in data ? data.exchange_rate : null }
6062
isLoading={ isLoading }
6163
showGweiTooltip
@@ -70,6 +72,7 @@ const TxDetailsTxFee = ({ isLoading, data }: Props) => {
7072
<CurrencyValue
7173
value={ priorityFeeBn.toString() }
7274
currency={ currencyUnits.ether }
75+
decimals={ String(config.chain.currency.decimals) }
7376
exchangeRate={ 'exchange_rate' in data ? data.exchange_rate : null }
7477
isLoading={ isLoading }
7578
showGweiTooltip

ui/tx/details/TxInfo.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@ const TxInfo = ({ data, tacOperations, isLoading, socketStatus }: Props) => {
617617
<CurrencyValue
618618
value={ data.value }
619619
currency={ currencyUnits.ether }
620+
decimals={ String(config.chain.currency.decimals) }
620621
exchangeRate={ data.exchange_rate }
621622
isLoading={ isLoading }
622623
flexWrap="wrap"
@@ -638,6 +639,7 @@ const TxInfo = ({ data, tacOperations, isLoading, socketStatus }: Props) => {
638639
<CurrencyValue
639640
value={ data.operator_fee }
640641
currency={ currencyUnits.ether }
642+
decimals={ String(config.chain.currency.decimals) }
641643
exchangeRate={ data.exchange_rate }
642644
flexWrap="wrap"
643645
/>
@@ -657,6 +659,7 @@ const TxInfo = ({ data, tacOperations, isLoading, socketStatus }: Props) => {
657659
<CurrencyValue
658660
value={ data.arbitrum.poster_fee }
659661
currency={ currencyUnits.ether }
662+
decimals={ String(config.chain.currency.decimals) }
660663
exchangeRate={ data.exchange_rate }
661664
flexWrap="wrap"
662665
isLoading={ isLoading }
@@ -673,6 +676,7 @@ const TxInfo = ({ data, tacOperations, isLoading, socketStatus }: Props) => {
673676
<CurrencyValue
674677
value={ data.arbitrum.network_fee }
675678
currency={ currencyUnits.ether }
679+
decimals={ String(config.chain.currency.decimals) }
676680
exchangeRate={ data.exchange_rate }
677681
flexWrap="wrap"
678682
isLoading={ isLoading }

ui/tx/details/TxInfoScrollFees.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import React from 'react';
44

55
import type { Transaction } from 'types/api/transaction';
66

7+
import config from 'configs/app';
78
import { currencyUnits } from 'lib/units';
89
import { Skeleton } from 'toolkit/chakra/skeleton';
910
import { WEI_IN_GWEI } from 'toolkit/utils/consts';
@@ -32,6 +33,7 @@ export const TxInfoScrollFees = ({ data, isLoading }: Props) => {
3233
<CurrencyValue
3334
value={ data.scroll?.l1_fee }
3435
currency={ currencyUnits.ether }
36+
decimals={ String(config.chain.currency.decimals) }
3537
exchangeRate={ data.exchange_rate }
3638
flexWrap="wrap"
3739
/>
@@ -51,6 +53,7 @@ export const TxInfoScrollFees = ({ data, isLoading }: Props) => {
5153
<CurrencyValue
5254
value={ data.scroll?.l2_fee.value }
5355
currency={ currencyUnits.ether }
56+
decimals={ String(config.chain.currency.decimals) }
5457
exchangeRate={ data.exchange_rate }
5558
flexWrap="wrap"
5659
/>
@@ -70,6 +73,7 @@ export const TxInfoScrollFees = ({ data, isLoading }: Props) => {
7073
<CurrencyValue
7174
value={ String(data.scroll?.l1_fee_commit_scalar) }
7275
currency={ currencyUnits.ether }
76+
decimals={ String(config.chain.currency.decimals) }
7377
exchangeRate={ data.exchange_rate }
7478
flexWrap="wrap"
7579
/>
@@ -90,6 +94,7 @@ export const TxInfoScrollFees = ({ data, isLoading }: Props) => {
9094
<CurrencyValue
9195
value={ String(data.scroll?.l1_fee_overhead) }
9296
currency={ currencyUnits.ether }
97+
decimals={ String(config.chain.currency.decimals) }
9398
exchangeRate={ data.exchange_rate }
9499
flexWrap="wrap"
95100
/>

0 commit comments

Comments
 (0)