mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import BigNumber from 'bignumber.js';
|
|
import React from 'react';
|
|
|
|
import type { Transaction } from 'types/api/transaction';
|
|
|
|
import { Skeleton } from 'toolkit/chakra/skeleton';
|
|
import * as DetailedInfo from 'ui/shared/DetailedInfo/DetailedInfo';
|
|
import TextSeparator from 'ui/shared/TextSeparator';
|
|
import Utilization from 'ui/shared/Utilization/Utilization';
|
|
|
|
interface Props {
|
|
isLoading?: boolean;
|
|
data: Transaction;
|
|
}
|
|
|
|
const TxDetailsGasUsage = ({ isLoading, data }: Props) => {
|
|
return (
|
|
<>
|
|
<DetailedInfo.ItemLabel
|
|
hint="Actual gas amount used by the transaction"
|
|
isLoading={ isLoading }
|
|
>
|
|
Gas usage & limit by txn
|
|
</DetailedInfo.ItemLabel>
|
|
<DetailedInfo.ItemValue>
|
|
<Skeleton loading={ isLoading }>{ BigNumber(data.gas_used || 0).toFormat() }</Skeleton>
|
|
<TextSeparator/>
|
|
<Skeleton loading={ isLoading }>{ BigNumber(data.gas_limit).toFormat() }</Skeleton>
|
|
<Utilization ml={ 4 } value={ BigNumber(data.gas_used || 0).dividedBy(BigNumber(data.gas_limit)).toNumber() } isLoading={ isLoading }/>
|
|
</DetailedInfo.ItemValue>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default React.memo(TxDetailsGasUsage);
|