diff --git a/ui/tx/details/TxInfo.tsx b/ui/tx/details/TxInfo.tsx index b207d7121a..af430c281e 100644 --- a/ui/tx/details/TxInfo.tsx +++ b/ui/tx/details/TxInfo.tsx @@ -64,6 +64,8 @@ import TxAllowedPeekers from 'ui/tx/TxAllowedPeekers'; import TxSocketAlert from 'ui/tx/TxSocketAlert'; import ZkSyncL2TxnBatchHashesInfo from 'ui/txnBatches/zkSyncL2/ZkSyncL2TxnBatchHashesInfo'; +import TxInfoScrollFees from './TxInfoScrollFees'; + const rollupFeature = config.features.rollup; interface Props { @@ -789,136 +791,7 @@ const TxInfo = ({ data, isLoading, socketStatus }: Props) => { ) } ) } - - { data.scroll?.l1_fee !== undefined && ( - <> - - L1 data fee - - - - - - ) } - - { data.scroll?.l2_fee !== undefined && ( - <> - - Execution fee - - - - - - ) } - - { data.scroll?.l1_fee_commit_scalar !== undefined && ( - <> - - L1 commit scalar - - - - - - ) } - - { data.scroll?.l1_fee_overhead !== undefined && ( - <> - - L1 Fee Overhead - - - - - - - - ) } - { (data.scroll?.l1_base_fee !== undefined || data.scroll?.l1_fee_scalar !== undefined) && ( - <> - - L1 gas fees - - - { data.scroll?.l1_base_fee !== undefined && ( - - Base: - { BigNumber(data.scroll?.l1_base_fee || 0).dividedBy(WEI_IN_GWEI).toFixed() } - - ) } - { data.scroll?.l1_fee_scalar !== undefined && ( - - - Scalar: - { BigNumber(data.scroll?.l1_fee_scalar || 0).dividedBy(WEI_IN_GWEI).toFixed() } - - ) } - - - ) } - - { (data.scroll?.l1_blob_base_fee !== undefined || data.scroll?.l1_fee_blob_scalar !== undefined) && ( - <> - - L1 blob fees - - - { data.scroll?.l1_blob_base_fee !== undefined && ( - - Base: - { BigNumber(data.scroll?.l1_blob_base_fee || 0).dividedBy(WEI_IN_GWEI).toFixed() } - - ) } - { data.scroll?.l1_fee_blob_scalar !== undefined && ( - - - Scalar: - { BigNumber(data.scroll?.l1_fee_blob_scalar || 0).dividedBy(WEI_IN_GWEI).toFixed() } - - ) } - - - ) } + diff --git a/ui/tx/details/TxInfoScrollFees.tsx b/ui/tx/details/TxInfoScrollFees.tsx new file mode 100644 index 0000000000..95c792a504 --- /dev/null +++ b/ui/tx/details/TxInfoScrollFees.tsx @@ -0,0 +1,153 @@ +import { Skeleton, Text } from '@chakra-ui/react'; +import BigNumber from 'bignumber.js'; +import React from 'react'; + +import type { Transaction } from 'types/api/transaction'; + +import { WEI_IN_GWEI } from 'lib/consts'; +import { currencyUnits } from 'lib/units'; +import CurrencyValue from 'ui/shared/CurrencyValue'; +import * as DetailsInfoItem from 'ui/shared/DetailsInfoItem'; +import TextSeparator from 'ui/shared/TextSeparator'; + +type Props = { + data: Transaction; + isLoading: boolean; +}; + +export const TxInfoScrollFees = ({ data, isLoading }: Props) => { + return ( + <> + { data.scroll?.l1_fee !== undefined && ( + <> + + L1 data fee + + + + + + ) } + + { data.scroll?.l2_fee !== undefined && ( + <> + + Execution fee + + + + + + ) } + + { data.scroll?.l1_fee_commit_scalar !== undefined && ( + <> + + L1 commit scalar + + + + + + ) } + + { data.scroll?.l1_fee_overhead !== undefined && ( + <> + + L1 Fee Overhead + + + + + + + + ) } + { (data.scroll?.l1_base_fee !== undefined || data.scroll?.l1_fee_scalar !== undefined) && ( + <> + + L1 gas fees + + + { data.scroll?.l1_base_fee !== undefined && ( + + Base: + { BigNumber(data.scroll?.l1_base_fee || 0).dividedBy(WEI_IN_GWEI).toFixed() } + + ) } + { data.scroll?.l1_fee_scalar !== undefined && ( + + + Scalar: + { BigNumber(data.scroll?.l1_fee_scalar || 0).dividedBy(WEI_IN_GWEI).toFixed() } + + ) } + + + ) } + { (data.scroll?.l1_blob_base_fee !== undefined || data.scroll?.l1_fee_blob_scalar !== undefined) && ( + <> + + L1 blob fees + + + { data.scroll?.l1_blob_base_fee !== undefined && ( + + Base: + { BigNumber(data.scroll?.l1_blob_base_fee || 0).dividedBy(WEI_IN_GWEI).toFixed() } + + ) } + { data.scroll?.l1_fee_blob_scalar !== undefined && ( + + + Scalar: + { BigNumber(data.scroll?.l1_fee_blob_scalar || 0).dividedBy(WEI_IN_GWEI).toFixed() } + + ) } + + + ) } + + ); +}; + +export default TxInfoScrollFees;