show status and tx hash in tx description
This commit is contained in:
parent
91e6adbc5b
commit
924f49425e
|
@ -3,11 +3,11 @@ import * as React from 'react'
|
||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
import OpenInNew from '@material-ui/icons/OpenInNew'
|
import OpenInNew from '@material-ui/icons/OpenInNew'
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
|
import Dot from '@material-ui/icons/FiberManualRecord'
|
||||||
import Paragraph from '~/components/layout/Paragraph'
|
import Paragraph from '~/components/layout/Paragraph'
|
||||||
import Link from '~/components/layout/Link'
|
import Link from '~/components/layout/Link'
|
||||||
import Button from '~/components/layout/Button'
|
import Button from '~/components/layout/Button'
|
||||||
import Identicon from '~/components/Identicon'
|
import Identicon from '~/components/Identicon'
|
||||||
import Dot from '@material-ui/icons/FiberManualRecord'
|
|
||||||
import Hairline from '~/components/layout/Hairline'
|
import Hairline from '~/components/layout/Hairline'
|
||||||
import Img from '~/components/layout/Img'
|
import Img from '~/components/layout/Img'
|
||||||
import Row from '~/components/layout/Row'
|
import Row from '~/components/layout/Row'
|
||||||
|
|
|
@ -14,8 +14,7 @@ export const sameAddress = (firstAddress: string, secondAddress: string): boolea
|
||||||
}
|
}
|
||||||
|
|
||||||
export const shortVersionOf = (address: string, cut: number) => {
|
export const shortVersionOf = (address: string, cut: number) => {
|
||||||
const initial = cut
|
|
||||||
const final = 42 - cut
|
const final = 42 - cut
|
||||||
|
|
||||||
return `${address.substring(0, initial)}...${address.substring(final)}`
|
return `${address.substring(0, cut)}...${address.substring(final)}`
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ export const ETHEREUM_NETWORK_IDS = {
|
||||||
42: ETHEREUM_NETWORK.KOVAN,
|
42: ETHEREUM_NETWORK.KOVAN,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const openTxInEtherScan = (tx: string, network: string) => `https://${network}.etherscan.io/tx/${tx}`
|
export const openTxInEtherScan = (txHash: string, network: string) => `https://${network}.etherscan.io/tx/${txHash}`
|
||||||
|
|
||||||
export const getEtherScanLink = (address: string, network: string) => `https://${network}.etherscan.io/address/${address}`
|
export const getEtherScanLink = (address: string, network: string) => `https://${network}.etherscan.io/address/${address}`
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// @flow
|
// @flow
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import Block from '~/components/layout/Block'
|
|
||||||
import OpenInNew from '@material-ui/icons/OpenInNew'
|
import OpenInNew from '@material-ui/icons/OpenInNew'
|
||||||
import Paragraph from '~/components/layout/Paragraph'
|
|
||||||
import LinearProgress from '@material-ui/core/LinearProgress'
|
import LinearProgress from '@material-ui/core/LinearProgress'
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
|
import Block from '~/components/layout/Block'
|
||||||
|
import Paragraph from '~/components/layout/Paragraph'
|
||||||
import Img from '~/components/layout/Img'
|
import Img from '~/components/layout/Img'
|
||||||
import Page from '~/components/layout/Page'
|
import Page from '~/components/layout/Page'
|
||||||
import { openTxInEtherScan } from '~/logic/wallets/getWeb3'
|
import { openTxInEtherScan } from '~/logic/wallets/getWeb3'
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
|
import { List } from 'immutable'
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
import Tabs from '@material-ui/core/Tabs'
|
import Tabs from '@material-ui/core/Tabs'
|
||||||
|
import OpenInNew from '@material-ui/icons/OpenInNew'
|
||||||
import Tab from '@material-ui/core/Tab'
|
import Tab from '@material-ui/core/Tab'
|
||||||
import Row from '~/components/layout/Row'
|
import Row from '~/components/layout/Row'
|
||||||
import Block from '~/components/layout/Block'
|
import Block from '~/components/layout/Block'
|
||||||
|
@ -11,8 +13,11 @@ import Paragraph from '~/components/layout/Paragraph'
|
||||||
import Hairline from '~/components/layout/Hairline'
|
import Hairline from '~/components/layout/Hairline'
|
||||||
import { type Transaction } from '~/routes/safe/store/models/transaction'
|
import { type Transaction } from '~/routes/safe/store/models/transaction'
|
||||||
import { type Owner } from '~/routes/safe/store/models/owner'
|
import { type Owner } from '~/routes/safe/store/models/owner'
|
||||||
|
import { openTxInEtherScan } from '~/logic/wallets/getWeb3'
|
||||||
|
import { shortVersionOf } from '~/logic/wallets/ethAddresses'
|
||||||
import { styles } from './style'
|
import { styles } from './style'
|
||||||
import { formatDate } from '../columns'
|
import { formatDate } from '../columns'
|
||||||
|
import { secondary } from '~/theme/variables'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
classes: Object,
|
classes: Object,
|
||||||
|
@ -21,6 +26,11 @@ type Props = {
|
||||||
owners: List<Owner>,
|
owners: List<Owner>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const openIconStyle = {
|
||||||
|
height: '13px',
|
||||||
|
color: secondary,
|
||||||
|
}
|
||||||
|
|
||||||
const ExpandedTx = ({
|
const ExpandedTx = ({
|
||||||
classes, tx, threshold, owners,
|
classes, tx, threshold, owners,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
|
@ -39,11 +49,18 @@ const ExpandedTx = ({
|
||||||
<Block className={classes.txDataContainer}>
|
<Block className={classes.txDataContainer}>
|
||||||
<Paragraph noMargin>
|
<Paragraph noMargin>
|
||||||
<Bold>TX hash: </Bold>
|
<Bold>TX hash: </Bold>
|
||||||
n/a
|
{tx.executionTxHash ? (
|
||||||
|
<a href={openTxInEtherScan(tx.executionTxHash, 'rinkeby')} target="_blank" rel="noopener noreferrer">
|
||||||
|
{shortVersionOf(tx.executionTxHash, 4)}
|
||||||
|
<OpenInNew style={openIconStyle} />
|
||||||
|
</a>
|
||||||
|
) : (
|
||||||
|
'n/a'
|
||||||
|
)}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
<Paragraph noMargin>
|
<Paragraph noMargin>
|
||||||
<Bold>TX status: </Bold>
|
<Bold>TX status: </Bold>
|
||||||
n/a
|
{tx.executionTxHash ? 'Success' : 'Awaiting confirmations'}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
<Paragraph noMargin>
|
<Paragraph noMargin>
|
||||||
<Bold>TX created: </Bold>
|
<Bold>TX created: </Bold>
|
||||||
|
|
|
@ -13,6 +13,7 @@ import { EMPTY_DATA } from '~/logic/wallets/ethTransactions'
|
||||||
import { addTransactions } from './addTransactions'
|
import { addTransactions } from './addTransactions'
|
||||||
import { getHumanFriendlyToken } from '~/logic/tokens/store/actions/fetchTokens'
|
import { getHumanFriendlyToken } from '~/logic/tokens/store/actions/fetchTokens'
|
||||||
import { isAddressAToken } from '~/logic/tokens/utils/tokenHelpers'
|
import { isAddressAToken } from '~/logic/tokens/utils/tokenHelpers'
|
||||||
|
import { TX_TYPE_EXECUTION } from '~/logic/safe/transactions/send'
|
||||||
|
|
||||||
type ConfirmationServiceModel = {
|
type ConfirmationServiceModel = {
|
||||||
owner: string,
|
owner: string,
|
||||||
|
@ -49,6 +50,13 @@ const buildTransactionFrom = async (safeAddress: string, tx: TxServiceModel, saf
|
||||||
)
|
)
|
||||||
const isToken = await isAddressAToken(tx.to)
|
const isToken = await isAddressAToken(tx.to)
|
||||||
|
|
||||||
|
let executionTxHash
|
||||||
|
const executionTx = confirmations.find(conf => conf.type === TX_TYPE_EXECUTION)
|
||||||
|
|
||||||
|
if (executionTx) {
|
||||||
|
executionTxHash = executionTx.hash
|
||||||
|
}
|
||||||
|
|
||||||
let symbol = 'ETH'
|
let symbol = 'ETH'
|
||||||
if (isToken) {
|
if (isToken) {
|
||||||
const tokenContract = await getHumanFriendlyToken()
|
const tokenContract = await getHumanFriendlyToken()
|
||||||
|
@ -67,6 +75,7 @@ const buildTransactionFrom = async (safeAddress: string, tx: TxServiceModel, saf
|
||||||
isExecuted: tx.isExecuted,
|
isExecuted: tx.isExecuted,
|
||||||
submissionDate: tx.submissionDate,
|
submissionDate: tx.submissionDate,
|
||||||
executionDate: tx.executionDate,
|
executionDate: tx.executionDate,
|
||||||
|
executionTxHash,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ export type TransactionProps = {
|
||||||
submissionDate: Date,
|
submissionDate: Date,
|
||||||
executionDate: Date,
|
executionDate: Date,
|
||||||
symbol: string,
|
symbol: string,
|
||||||
|
executionTxHash?: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const makeTransaction: RecordFactory<TransactionProps> = Record({
|
export const makeTransaction: RecordFactory<TransactionProps> = Record({
|
||||||
|
@ -27,6 +28,7 @@ export const makeTransaction: RecordFactory<TransactionProps> = Record({
|
||||||
submissionDate: '',
|
submissionDate: '',
|
||||||
executionDate: '',
|
executionDate: '',
|
||||||
symbol: '',
|
symbol: '',
|
||||||
|
executionTxHash: undefined,
|
||||||
})
|
})
|
||||||
|
|
||||||
export type Transaction = RecordOf<TransactionProps>
|
export type Transaction = RecordOf<TransactionProps>
|
||||||
|
|
Loading…
Reference in New Issue