Commit 04fd0313 authored by tom's avatar tom

gas limit for internal transactions

parent 4ba45ecf
...@@ -10,10 +10,11 @@ export interface InternalTransaction { ...@@ -10,10 +10,11 @@ export interface InternalTransaction {
from: AddressParam; from: AddressParam;
to: AddressParam; to: AddressParam;
created_contract: AddressParam; created_contract: AddressParam;
value: number; value: string;
index: number; index: number;
block: number; block: number;
timestamp: string; timestamp: string;
gas_limit: string;
} }
export interface InternalTransactionsResponse { export interface InternalTransactionsResponse {
......
...@@ -42,16 +42,15 @@ const sortFn = (sort: Sort | undefined) => (a: InternalTransaction, b: InternalT ...@@ -42,16 +42,15 @@ const sortFn = (sort: Sort | undefined) => (a: InternalTransaction, b: InternalT
return a.value === b.value ? 0 : result; return a.value === b.value ? 0 : result;
} }
// no gas limit in api yet case 'gas-limit-desc': {
// case 'gas-limit-desc': { const result = a.gas_limit > b.gas_limit ? -1 : 1;
// const result = a.gasLimit > b.gasLimit ? -1 : 1; return a.gas_limit === b.gas_limit ? 0 : result;
// return a.gasLimit === b.gasLimit ? 0 : result; }
// }
case 'gas-limit-asc': {
// case 'gas-limit-asc': { const result = a.gas_limit > b.gas_limit ? 1 : -1;
// const result = a.gasLimit > b.gasLimit ? 1 : -1; return a.gas_limit === b.gas_limit ? 0 : result;
// return a.gasLimit === b.gasLimit ? 0 : result; }
// }
default: default:
return 0; return 0;
......
import { Flex, Tag, Icon, Box, HStack, Text } from '@chakra-ui/react'; import { Flex, Tag, Icon, Box, HStack, Text } from '@chakra-ui/react';
import BigNumber from 'bignumber.js';
import React from 'react'; import React from 'react';
import type { InternalTransaction } from 'types/api/internalTransaction'; import type { InternalTransaction } from 'types/api/internalTransaction';
...@@ -14,7 +15,7 @@ import { TX_INTERNALS_ITEMS } from 'ui/tx/internals/utils'; ...@@ -14,7 +15,7 @@ import { TX_INTERNALS_ITEMS } from 'ui/tx/internals/utils';
type Props = InternalTransaction; type Props = InternalTransaction;
const TxInternalsListItem = ({ type, from, to, value, success, error }: Props) => { const TxInternalsListItem = ({ type, from, to, value, success, error, gas_limit: gasLimit }: Props) => {
const typeTitle = TX_INTERNALS_ITEMS.find(({ id }) => id === type)?.title; const typeTitle = TX_INTERNALS_ITEMS.find(({ id }) => id === type)?.title;
return ( return (
...@@ -38,11 +39,10 @@ const TxInternalsListItem = ({ type, from, to, value, success, error }: Props) = ...@@ -38,11 +39,10 @@ const TxInternalsListItem = ({ type, from, to, value, success, error }: Props) =
<Text fontSize="sm" fontWeight={ 500 }>Value { appConfig.network.currency }</Text> <Text fontSize="sm" fontWeight={ 500 }>Value { appConfig.network.currency }</Text>
<Text fontSize="sm" variant="secondary">{ value }</Text> <Text fontSize="sm" variant="secondary">{ value }</Text>
</HStack> </HStack>
{ /* no gas limit in api yet */ } <HStack spacing={ 3 }>
{ /* <HStack spacing={ 3 }>
<Text fontSize="sm" fontWeight={ 500 }>Gas limit</Text> <Text fontSize="sm" fontWeight={ 500 }>Gas limit</Text>
<Text fontSize="sm" variant="secondary">{ gasLimit.toLocaleString('en') }</Text> <Text fontSize="sm" variant="secondary">{ BigNumber(gasLimit).toFormat() }</Text>
</HStack> */ } </HStack>
</AccountListItemMobile> </AccountListItemMobile>
); );
}; };
......
...@@ -10,7 +10,7 @@ const TxInternalsSkeletonDesktop = () => { ...@@ -10,7 +10,7 @@ const TxInternalsSkeletonDesktop = () => {
<Skeleton w="78px"/> <Skeleton w="78px"/>
<Skeleton w="360px"/> <Skeleton w="360px"/>
</Flex> </Flex>
<SkeletonTable columns={ [ '28%', '28%', '24px', '28%', '16%' ] }/> <SkeletonTable columns={ [ '28%', '20%', '24px', '20%', '16%', '16%' ] }/>
</> </>
); );
}; };
......
...@@ -38,6 +38,10 @@ const TxInternalsSkeletonMobile = () => { ...@@ -38,6 +38,10 @@ const TxInternalsSkeletonMobile = () => {
<Skeleton w="70px" mr={ 2 }/> <Skeleton w="70px" mr={ 2 }/>
<Skeleton w="30px"/> <Skeleton w="30px"/>
</Flex> </Flex>
<Flex h={ 6 }>
<Skeleton w="70px" mr={ 2 }/>
<Skeleton w="60px"/>
</Flex>
</Flex> </Flex>
)) } )) }
</Box> </Box>
......
...@@ -23,22 +23,21 @@ const TxInternalsTable = ({ data, sort, onSortToggle }: Props) => { ...@@ -23,22 +23,21 @@ const TxInternalsTable = ({ data, sort, onSortToggle }: Props) => {
<Thead> <Thead>
<Tr> <Tr>
<Th width="28%">Type</Th> <Th width="28%">Type</Th>
<Th width="28%">From</Th> <Th width="20%">From</Th>
<Th width="24px" px={ 0 }/> <Th width="24px" px={ 0 }/>
<Th width="28%">To</Th> <Th width="20%">To</Th>
<Th width="16%" isNumeric> <Th width="16%" isNumeric>
<Link display="flex" alignItems="center" justifyContent="flex-end" onClick={ onSortToggle('value') } columnGap={ 1 }> <Link display="flex" alignItems="center" justifyContent="flex-end" onClick={ onSortToggle('value') } columnGap={ 1 }>
{ sort?.includes('value') && <Icon as={ arrowIcon } boxSize={ 4 } transform={ sortIconTransform }/> } { sort?.includes('value') && <Icon as={ arrowIcon } boxSize={ 4 } transform={ sortIconTransform }/> }
Value { appConfig.network.currency } Value { appConfig.network.currency }
</Link> </Link>
</Th> </Th>
{ /* no gas limit in api yet */ } <Th width="16%" isNumeric>
{ /* <Th width="16%" isNumeric>
<Link display="flex" alignItems="center" justifyContent="flex-end" onClick={ onSortToggle('gas-limit') } columnGap={ 1 }> <Link display="flex" alignItems="center" justifyContent="flex-end" onClick={ onSortToggle('gas-limit') } columnGap={ 1 }>
{ sort?.includes('gas-limit') && <Icon as={ arrowIcon } boxSize={ 4 } transform={ sortIconTransform }/> } { sort?.includes('gas-limit') && <Icon as={ arrowIcon } boxSize={ 4 } transform={ sortIconTransform }/> }
Gas limit Gas limit { appConfig.network.currency }
</Link> </Link>
</Th> */ } </Th>
</Tr> </Tr>
</Thead> </Thead>
<Tbody> <Tbody>
......
import { Tr, Td, Tag, Icon, Box } from '@chakra-ui/react'; import { Tr, Td, Tag, Icon, Box } from '@chakra-ui/react';
import BigNumber from 'bignumber.js';
import React from 'react'; import React from 'react';
import type { InternalTransaction } from 'types/api/internalTransaction'; import type { InternalTransaction } from 'types/api/internalTransaction';
...@@ -12,7 +13,7 @@ import { TX_INTERNALS_ITEMS } from 'ui/tx/internals/utils'; ...@@ -12,7 +13,7 @@ import { TX_INTERNALS_ITEMS } from 'ui/tx/internals/utils';
type Props = InternalTransaction type Props = InternalTransaction
const TxInternalTableItem = ({ type, from, to, value, success, error }: Props) => { const TxInternalTableItem = ({ type, from, to, value, success, error, gas_limit: gasLimit }: Props) => {
const typeTitle = TX_INTERNALS_ITEMS.find(({ id }) => id === type)?.title; const typeTitle = TX_INTERNALS_ITEMS.find(({ id }) => id === type)?.title;
return ( return (
...@@ -43,10 +44,9 @@ const TxInternalTableItem = ({ type, from, to, value, success, error }: Props) = ...@@ -43,10 +44,9 @@ const TxInternalTableItem = ({ type, from, to, value, success, error }: Props) =
<Td isNumeric verticalAlign="middle"> <Td isNumeric verticalAlign="middle">
{ value } { value }
</Td> </Td>
{ /* no gas limit in api yet */ } <Td isNumeric verticalAlign="middle">
{ /* <Td isNumeric verticalAlign='middle'> { BigNumber(gasLimit).toFormat() }
{ gasLimit.toLocaleString('en') } </Td>
</Td> */ }
</Tr> </Tr>
); );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment