add descriptions for eth/erc20 transfers
This commit is contained in:
parent
5a2d6bba91
commit
51048a42a5
|
@ -18,6 +18,20 @@ const openIconStyle = {
|
||||||
color: secondary,
|
color: secondary,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getTxData = (tx: Transaction) => {
|
||||||
|
const txData = {}
|
||||||
|
|
||||||
|
if (tx.isTokenTransfer && tx.decodedParams) {
|
||||||
|
txData.recipient = tx.decodedParams.recipient
|
||||||
|
txData.value = fromWei(toBN(tx.decodedParams.value), 'ether')
|
||||||
|
} else if (Number(tx.value) > 0) {
|
||||||
|
txData.recipient = tx.recipient
|
||||||
|
txData.value = fromWei(toBN(tx.value), 'ether')
|
||||||
|
}
|
||||||
|
|
||||||
|
return txData
|
||||||
|
}
|
||||||
|
|
||||||
export const styles = () => ({
|
export const styles = () => ({
|
||||||
txDataContainer: {
|
txDataContainer: {
|
||||||
padding: `${lg} ${md}`,
|
padding: `${lg} ${md}`,
|
||||||
|
@ -30,7 +44,7 @@ type Props = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const TxDescription = ({ tx, classes }: Props) => {
|
const TxDescription = ({ tx, classes }: Props) => {
|
||||||
const description = ''
|
const { recipient, value } = getTxData(tx)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Block className={classes.txDataContainer}>
|
<Block className={classes.txDataContainer}>
|
||||||
|
@ -38,15 +52,15 @@ const TxDescription = ({ tx, classes }: Props) => {
|
||||||
<Bold>
|
<Bold>
|
||||||
Send
|
Send
|
||||||
{' '}
|
{' '}
|
||||||
{fromWei(toBN(tx.value), 'ether')}
|
{value}
|
||||||
{' '}
|
{' '}
|
||||||
{tx.symbol}
|
{tx.symbol}
|
||||||
{' '}
|
{' '}
|
||||||
to:
|
to:
|
||||||
</Bold>
|
</Bold>
|
||||||
<br />
|
<br />
|
||||||
<a href={getEtherScanLink(tx.recipient, 'rinkeby')} target="_blank" rel="noopener noreferrer">
|
<a href={getEtherScanLink(recipient, 'rinkeby')} target="_blank" rel="noopener noreferrer">
|
||||||
{shortVersionOf(tx.recipient, 4)}
|
{shortVersionOf(recipient, 4)}
|
||||||
<OpenInNew style={openIconStyle} />
|
<OpenInNew style={openIconStyle} />
|
||||||
</a>
|
</a>
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import { md, lg, connected, error } from '~/theme/variables'
|
import {
|
||||||
|
md, lg, connected, error,
|
||||||
|
} from '~/theme/variables'
|
||||||
|
|
||||||
export const styles = () => ({
|
export const styles = () => ({
|
||||||
txDataContainer: {
|
txDataContainer: {
|
||||||
|
|
Loading…
Reference in New Issue