|
|
@ -2,6 +2,7 @@ const Component = require('react').Component |
|
|
|
const connect = require('react-redux').connect |
|
|
|
const connect = require('react-redux').connect |
|
|
|
const h = require('react-hyperscript') |
|
|
|
const h = require('react-hyperscript') |
|
|
|
const inherits = require('util').inherits |
|
|
|
const inherits = require('util').inherits |
|
|
|
|
|
|
|
const prefixForNetwork = require('../../lib/etherscan-prefix-for-network') |
|
|
|
const selectors = require('../selectors') |
|
|
|
const selectors = require('../selectors') |
|
|
|
const TxListItem = require('./tx-list-item') |
|
|
|
const TxListItem = require('./tx-list-item') |
|
|
|
const { formatBalance, formatDate } = require('../util') |
|
|
|
const { formatBalance, formatDate } = require('../util') |
|
|
@ -71,6 +72,8 @@ TxList.prototype.renderTransactionListItem = function (transaction) { |
|
|
|
transactionStatus: transaction.status, |
|
|
|
transactionStatus: transaction.status, |
|
|
|
transactionAmount: formatBalance(transaction.txParams.value, 6), |
|
|
|
transactionAmount: formatBalance(transaction.txParams.value, 6), |
|
|
|
transActionId: transaction.id, |
|
|
|
transActionId: transaction.id, |
|
|
|
|
|
|
|
transactionHash: transaction.hash, |
|
|
|
|
|
|
|
transactionNetworkId: transaction.metamaskNetworkId, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const { |
|
|
|
const { |
|
|
@ -79,6 +82,8 @@ TxList.prototype.renderTransactionListItem = function (transaction) { |
|
|
|
transactionAmount, |
|
|
|
transactionAmount, |
|
|
|
dateString, |
|
|
|
dateString, |
|
|
|
transActionId, |
|
|
|
transActionId, |
|
|
|
|
|
|
|
transactionHash, |
|
|
|
|
|
|
|
transactionNetworkId, |
|
|
|
} = props |
|
|
|
} = props |
|
|
|
const { showConfTxPage } = this.props |
|
|
|
const { showConfTxPage } = this.props |
|
|
|
|
|
|
|
|
|
|
@ -90,13 +95,33 @@ TxList.prototype.renderTransactionListItem = function (transaction) { |
|
|
|
dateString, |
|
|
|
dateString, |
|
|
|
address, |
|
|
|
address, |
|
|
|
transactionAmount, |
|
|
|
transactionAmount, |
|
|
|
|
|
|
|
transactionHash, |
|
|
|
|
|
|
|
className: '.tx-list-clickable', |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (transactionStatus === 'unapproved') { |
|
|
|
if (transactionStatus === 'unapproved') { |
|
|
|
opts.onClick = () => showConfTxPage({id: transActionId}) |
|
|
|
opts.onClick = () => showConfTxPage({id: transActionId}) |
|
|
|
opts.className = '.tx-list-pending-item-container' |
|
|
|
opts.className += '.tx-list-pending-item-container' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (transactionHash) { |
|
|
|
|
|
|
|
opts.onClick = () => this.view(transactionHash, transactionNetworkId) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return h(TxListItem, opts) |
|
|
|
return h(TxListItem, opts) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TxList.prototype.view = function (txHash, network) { |
|
|
|
|
|
|
|
const url = etherscanLinkFor(txHash, network) |
|
|
|
|
|
|
|
if (url) { |
|
|
|
|
|
|
|
navigateTo(url) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function navigateTo (url) { |
|
|
|
|
|
|
|
global.platform.openWindow({ url }) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function etherscanLinkFor (txHash, network) { |
|
|
|
|
|
|
|
const prefix = prefixForNetwork(network) |
|
|
|
|
|
|
|
return `https://${prefix}etherscan.io/tx/${txHash}` |
|
|
|
|
|
|
|
} |
|
|
|