|
|
@ -5,7 +5,7 @@ import TransactionStatus from '../transaction-status' |
|
|
|
import TransactionAction from '../transaction-action' |
|
|
|
import TransactionAction from '../transaction-action' |
|
|
|
import CurrencyDisplay from '../currency-display' |
|
|
|
import CurrencyDisplay from '../currency-display' |
|
|
|
import TokenCurrencyDisplay from '../token-currency-display' |
|
|
|
import TokenCurrencyDisplay from '../token-currency-display' |
|
|
|
import prefixForNetwork from '../../../lib/etherscan-prefix-for-network' |
|
|
|
import TransactionListItemDetails from '../transaction-list-item-details' |
|
|
|
import { CONFIRM_TRANSACTION_ROUTE } from '../../routes' |
|
|
|
import { CONFIRM_TRANSACTION_ROUTE } from '../../routes' |
|
|
|
import { UNAPPROVED_STATUS, TOKEN_METHOD_TRANSFER } from '../../constants/transactions' |
|
|
|
import { UNAPPROVED_STATUS, TOKEN_METHOD_TRANSFER } from '../../constants/transactions' |
|
|
|
import { ETH } from '../../constants/common' |
|
|
|
import { ETH } from '../../constants/common' |
|
|
@ -24,17 +24,21 @@ export default class TransactionListItem extends PureComponent { |
|
|
|
assetImages: PropTypes.object, |
|
|
|
assetImages: PropTypes.object, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
state = { |
|
|
|
|
|
|
|
showTransactionDetails: false, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
handleClick = () => { |
|
|
|
handleClick = () => { |
|
|
|
const { transaction, history } = this.props |
|
|
|
const { transaction, history } = this.props |
|
|
|
const { id, status, hash, metamaskNetworkId } = transaction |
|
|
|
const { id, status } = transaction |
|
|
|
|
|
|
|
const { showTransactionDetails } = this.state |
|
|
|
|
|
|
|
|
|
|
|
if (status === UNAPPROVED_STATUS) { |
|
|
|
if (status === UNAPPROVED_STATUS) { |
|
|
|
history.push(`${CONFIRM_TRANSACTION_ROUTE}/${id}`) |
|
|
|
history.push(`${CONFIRM_TRANSACTION_ROUTE}/${id}`) |
|
|
|
} else if (hash) { |
|
|
|
return |
|
|
|
const prefix = prefixForNetwork(metamaskNetworkId) |
|
|
|
|
|
|
|
const etherscanUrl = `https://${prefix}etherscan.io/tx/${hash}` |
|
|
|
|
|
|
|
global.platform.openWindow({ url: etherscanUrl }) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setState({ showTransactionDetails: !showTransactionDetails }) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
handleRetryClick = event => { |
|
|
|
handleRetryClick = event => { |
|
|
@ -75,6 +79,8 @@ export default class TransactionListItem extends PureComponent { |
|
|
|
className="transaction-list-item__amount transaction-list-item__amount--primary" |
|
|
|
className="transaction-list-item__amount transaction-list-item__amount--primary" |
|
|
|
value={value} |
|
|
|
value={value} |
|
|
|
prefix="-" |
|
|
|
prefix="-" |
|
|
|
|
|
|
|
numberOfDecimals={2} |
|
|
|
|
|
|
|
currency={ETH} |
|
|
|
/> |
|
|
|
/> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
@ -89,8 +95,6 @@ export default class TransactionListItem extends PureComponent { |
|
|
|
className="transaction-list-item__amount transaction-list-item__amount--secondary" |
|
|
|
className="transaction-list-item__amount transaction-list-item__amount--secondary" |
|
|
|
prefix="-" |
|
|
|
prefix="-" |
|
|
|
value={value} |
|
|
|
value={value} |
|
|
|
numberOfDecimals={2} |
|
|
|
|
|
|
|
currency={ETH} |
|
|
|
|
|
|
|
/> |
|
|
|
/> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
@ -104,13 +108,14 @@ export default class TransactionListItem extends PureComponent { |
|
|
|
assetImages, |
|
|
|
assetImages, |
|
|
|
} = this.props |
|
|
|
} = this.props |
|
|
|
const { txParams = {} } = transaction |
|
|
|
const { txParams = {} } = transaction |
|
|
|
|
|
|
|
const { showTransactionDetails } = this.state |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div |
|
|
|
<div className="transaction-list-item"> |
|
|
|
className="transaction-list-item" |
|
|
|
<div |
|
|
|
onClick={this.handleClick} |
|
|
|
className="transaction-list-item__grid" |
|
|
|
> |
|
|
|
onClick={this.handleClick} |
|
|
|
<div className="transaction-list-item__grid"> |
|
|
|
> |
|
|
|
<Identicon |
|
|
|
<Identicon |
|
|
|
className="transaction-list-item__identicon" |
|
|
|
className="transaction-list-item__identicon" |
|
|
|
address={txParams.to} |
|
|
|
address={txParams.to} |
|
|
@ -141,12 +146,12 @@ export default class TransactionListItem extends PureComponent { |
|
|
|
{ this.renderSecondaryCurrency() } |
|
|
|
{ this.renderSecondaryCurrency() } |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{ |
|
|
|
{ |
|
|
|
showRetry && methodData.done && ( |
|
|
|
showTransactionDetails && ( |
|
|
|
<div |
|
|
|
<div className="transaction-list-item__details-container"> |
|
|
|
className="transaction-list-item__retry" |
|
|
|
<TransactionListItemDetails |
|
|
|
onClick={this.handleRetryClick} |
|
|
|
transaction={transaction} |
|
|
|
> |
|
|
|
showRetry={showRetry && methodData.done} |
|
|
|
<span>Taking too long? Increase the gas price on your transaction</span> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|