Commit 57c317b5 authored by isstuev's avatar isstuev

add new fields

parent 3955f6db
...@@ -38,6 +38,8 @@ export interface Transaction { ...@@ -38,6 +38,8 @@ export interface Transaction {
token_transfers: Array<TokenTransfer> | null; token_transfers: Array<TokenTransfer> | null;
token_transfers_overflow: boolean; token_transfers_overflow: boolean;
exchange_rate: string; exchange_rate: string;
method: string;
tx_types: Array<TransactionType>;
tx_tag: string | null; tx_tag: string | null;
} }
...@@ -49,3 +51,5 @@ export interface TransactionsResponse { ...@@ -49,3 +51,5 @@ export interface TransactionsResponse {
items_count: number; items_count: number;
} | null; } | null;
} }
export type TransactionType = 'token_transfer' | 'contract_creation' | 'contract_call' | 'token_creation' | 'coin_transfer'
import { Tag } from '@chakra-ui/react'; import { Tag } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import type { TransactionType } from 'types/api/transaction';
export interface Props { export interface Props {
type: 'contract-call' | 'transaction' | 'token-transfer' | 'internal-tx' | 'multicall'; type: TransactionType;
} }
const TxStatus = ({ type }: Props) => { const TxStatus = ({ type }: Props) => {
...@@ -10,24 +12,24 @@ const TxStatus = ({ type }: Props) => { ...@@ -10,24 +12,24 @@ const TxStatus = ({ type }: Props) => {
let colorScheme; let colorScheme;
switch (type) { switch (type) {
case 'contract-call': case 'contract_call':
label = 'Contract call'; label = 'Contract call';
colorScheme = 'blue'; colorScheme = 'blue';
break; break;
case 'transaction': case 'contract_creation':
label = 'Transaction'; label = 'Contract creation';
colorScheme = 'purple'; colorScheme = 'purple';
break; break;
case 'token-transfer': case 'token_transfer':
label = 'Token transfer'; label = 'Token transfer';
colorScheme = 'orange'; colorScheme = 'orange';
break; break;
case 'internal-tx': case 'token_creation':
label = 'Internal txn'; label = 'Token creation';
colorScheme = 'cyan'; colorScheme = 'cyan';
break; break;
case 'multicall': case 'coin_transfer':
label = 'Multicall'; label = 'Coin transfer';
colorScheme = 'teal'; colorScheme = 'teal';
break; break;
} }
......
...@@ -39,9 +39,7 @@ const TxsListItem = ({ tx }: {tx: Transaction}) => { ...@@ -39,9 +39,7 @@ const TxsListItem = ({ tx }: {tx: Transaction}) => {
<Box width="100%" borderBottom="1px solid" borderColor={ borderColor } _first={{ borderTop: '1px solid', borderColor }}> <Box width="100%" borderBottom="1px solid" borderColor={ borderColor } _first={{ borderTop: '1px solid', borderColor }}>
<Flex justifyContent="space-between" mt={ 4 }> <Flex justifyContent="space-between" mt={ 4 }>
<HStack> <HStack>
{ /* TODO: we don't recieve type from api */ } { tx.tx_types.map(item => <TxType key={ item } type={ item }/>) }
{ /* <TxType type={ tx.type }/> */ }
<TxType type="transaction"/>
<TxStatus status={ tx.status } errorText={ tx.status === 'error' ? tx.result : undefined }/> <TxStatus status={ tx.status } errorText={ tx.status === 'error' ? tx.result : undefined }/>
</HStack> </HStack>
<TxAdditionalInfoButton onClick={ onOpen }/> <TxAdditionalInfoButton onClick={ onOpen }/>
...@@ -68,7 +66,6 @@ const TxsListItem = ({ tx }: {tx: Transaction}) => { ...@@ -68,7 +66,6 @@ const TxsListItem = ({ tx }: {tx: Transaction}) => {
</Flex> </Flex>
<Flex mt={ 3 }> <Flex mt={ 3 }>
<Text as="span" whiteSpace="pre">Method </Text> <Text as="span" whiteSpace="pre">Method </Text>
{ /* TODO: we don't recieve method from api */ }
<Text <Text
as="span" as="span"
variant="secondary" variant="secondary"
...@@ -76,8 +73,7 @@ const TxsListItem = ({ tx }: {tx: Transaction}) => { ...@@ -76,8 +73,7 @@ const TxsListItem = ({ tx }: {tx: Transaction}) => {
whiteSpace="nowrap" whiteSpace="nowrap"
textOverflow="ellipsis" textOverflow="ellipsis"
> >
{ /* { tx.method } */ } { tx.method }
CommitHash
</Text> </Text>
</Flex> </Flex>
{ tx.block !== null && ( { tx.block !== null && (
......
...@@ -73,9 +73,7 @@ const TxsTableItem = ({ tx }: {tx: Transaction}) => { ...@@ -73,9 +73,7 @@ const TxsTableItem = ({ tx }: {tx: Transaction}) => {
</Td> </Td>
<Td> <Td>
<VStack alignItems="start"> <VStack alignItems="start">
{ /* TODO: we don't recieve type from api */ } { tx.tx_types.map(item => <TxType key={ item } type={ item }/>) }
{ /* <TxType type={ tx.type }/> */ }
<TxType type="transaction"/>
<TxStatus status={ tx.status } errorText={ tx.status === 'error' ? tx.result : undefined }/> <TxStatus status={ tx.status } errorText={ tx.status === 'error' ? tx.result : undefined }/>
</VStack> </VStack>
</Td> </Td>
...@@ -93,20 +91,12 @@ const TxsTableItem = ({ tx }: {tx: Transaction}) => { ...@@ -93,20 +91,12 @@ const TxsTableItem = ({ tx }: {tx: Transaction}) => {
</VStack> </VStack>
</Td> </Td>
<Td> <Td>
{ /* TODO: we don't recieve method from api */ } <TruncatedTextTooltip label={ tx.method }>
{ /* <TruncatedTextTooltip label={ tx.method }>
<Tag <Tag
colorScheme={ tx.method === 'Multicall' ? 'teal' : 'gray' } colorScheme={ tx.method === 'Multicall' ? 'teal' : 'gray' }
> >
{ tx.method } { tx.method }
</Tag> </Tag>
</TruncatedTextTooltip> */ }
<TruncatedTextTooltip label="CommitHash">
<Tag
colorScheme="gray"
>
CommitHash
</Tag>
</TruncatedTextTooltip> </TruncatedTextTooltip>
</Td> </Td>
<Td> <Td>
......
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