From 1aeac463d5883d0cf0356fc8a5ff7ba3f0114943 Mon Sep 17 00:00:00 2001 From: isstuev Date: Mon, 2 Dec 2024 09:49:58 +0100 Subject: [PATCH] review fix --- ui/tx/details/TxInfo.tsx | 133 +------------------------ ui/tx/details/TxInfoScrollFees.tsx | 151 +++++++++++++++++++++++++++++ 2 files changed, 154 insertions(+), 130 deletions(-) create mode 100644 ui/tx/details/TxInfoScrollFees.tsx 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..72e7c864d6 --- /dev/null +++ b/ui/tx/details/TxInfoScrollFees.tsx @@ -0,0 +1,151 @@ +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() } + + ) } + + + ) } + + ); +};