-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ccbfdff
commit ca4603f
Showing
18 changed files
with
198 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ | |
| "graphQL" | ||
| "info" | ||
| "key" | ||
| "lightning" | ||
| "link" | ||
| "lock" | ||
| "minus" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import type { TxInterpretationResponse } from 'types/api/txInterpretation'; | ||
|
||
import { TOKEN_INFO_ERC_20 } from './token'; | ||
|
||
export const TX_INTERPRETATION: TxInterpretationResponse = { | ||
data: { | ||
summaries: [ | ||
{ | ||
summary_template: '{action_type} {source_amount} Ether into {destination_amount} {destination_token}', | ||
summary_template_variables: { | ||
action_type: { type: 'string', value: 'Wrap' }, | ||
source_amount: { type: 'currency', value: '0.7' }, | ||
destination_amount: { type: 'currency', value: '0.7' }, | ||
destination_token: { | ||
type: 'token', | ||
value: TOKEN_INFO_ERC_20, | ||
}, | ||
}, | ||
}, | ||
{ | ||
summary_template: '{action_type} {source_amount} Ether into {destination_amount} {destination_token}', | ||
summary_template_variables: { | ||
action_type: { type: 'string', value: 'Wrap' }, | ||
source_amount: { type: 'currency', value: '0.7' }, | ||
destination_amount: { type: 'currency', value: '0.7' }, | ||
destination_token: { | ||
type: 'token', | ||
value: TOKEN_INFO_ERC_20, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Box, Flex, Link } from '@chakra-ui/react'; | ||
import React from 'react'; | ||
|
||
import config from 'configs/app'; | ||
import useApiQuery from 'lib/api/useApiQuery'; | ||
import { TX_INTERPRETATION } from 'stubs/txInterpretation'; | ||
import AccountActionsMenu from 'ui/shared/AccountActionsMenu/AccountActionsMenu'; | ||
import TxEntity from 'ui/shared/entities/tx/TxEntity'; | ||
import NetworkExplorers from 'ui/shared/NetworkExplorers'; | ||
import { TX_ACTIONS_BLOCK_ID } from 'ui/tx/details/txDetailsActions/TxDetailsActionsWrapper'; | ||
import TxInterpretation from 'ui/tx/interpretation/TxInterpretation'; | ||
|
||
type Props = { | ||
hash?: string; | ||
hasTag: boolean; | ||
} | ||
|
||
const TxSubHeading = ({ hash, hasTag }: Props) => { | ||
const hasInterpretationFeature = config.features.txInterpretation.isEnabled; | ||
|
||
const txInterpretationQuery = useApiQuery('tx_interpretation', { | ||
pathParams: { hash }, | ||
queryOptions: { | ||
enabled: Boolean(hash) && hasInterpretationFeature, | ||
placeholderData: TX_INTERPRETATION, | ||
}, | ||
}); | ||
|
||
const hasInterpretation = hasInterpretationFeature && | ||
(txInterpretationQuery.isPlaceholderData || txInterpretationQuery.data?.data.summaries.length); | ||
|
||
return ( | ||
<Box display={{ base: 'block', lg: 'flex' }} alignItems="center" w="100%"> | ||
{ hasInterpretationFeature && ( | ||
<Flex mr={{ base: 0, lg: 6 }} flexWrap="wrap" alignItems="center"> | ||
<TxInterpretation | ||
summary={ txInterpretationQuery.data?.data.summaries[0] } | ||
isLoading={ txInterpretationQuery.isPlaceholderData } | ||
fontSize="lg" | ||
/> | ||
{ !txInterpretationQuery.isPlaceholderData && txInterpretationQuery.data?.data.summaries && txInterpretationQuery.data?.data.summaries.length > 1 && | ||
<Link ml={ 3 } href={ `#${ TX_ACTIONS_BLOCK_ID }` }>all actions</Link> } | ||
</Flex> | ||
) } | ||
{ !hasInterpretation && <TxEntity hash={ hash } noLink noCopy={ false } fontWeight={ 500 } mr={{ base: 0, lg: 2 }} fontFamily="heading"/> } | ||
<Flex alignItems="center" justifyContent={{ base: 'start', lg: 'space-between' }} flexGrow={ 1 }> | ||
{ !hasTag && <AccountActionsMenu mr={ 3 } mt={{ base: 3, lg: 0 }}/> } | ||
<NetworkExplorers type="tx" pathParam={ hash } ml={{ base: 0, lg: 'auto' }} mt={{ base: 3, lg: 0 }}/> | ||
</Flex> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default TxSubHeading; |
Oops, something went wrong.