1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

Fix display of unapprovedMessages in txList (old and new ui); includes fix of undefined txParams.

This commit is contained in:
Dan 2018-03-28 10:51:16 -02:30
parent 871edfe12a
commit 21b6a3442d
3 changed files with 21 additions and 9 deletions

View File

@ -31,6 +31,11 @@ function TransactionListItem () {
TransactionListItem.prototype.showRetryButton = function () {
const { transaction = {}, transactions } = this.props
const { status, submittedTime, txParams } = transaction
if (!txParams) {
return false
}
const currentNonce = txParams.nonce
const currentNonceTxs = transactions.filter(tx => tx.txParams.nonce === currentNonce)
const currentNonceSubmittedTxs = currentNonceTxs.filter(tx => tx.status === 'submitted')

View File

@ -62,20 +62,23 @@ TxListItem.prototype.getAddressText = function () {
const {
address,
txParams = {},
isMsg,
} = this.props
const decodedData = txParams.data && abiDecoder.decodeMethod(txParams.data)
const { name: txDataName, params = [] } = decodedData || {}
const { value } = params[0] || {}
switch (txDataName) {
case 'transfer':
return `${value.slice(0, 10)}...${value.slice(-4)}`
default:
return address
? `${address.slice(0, 10)}...${address.slice(-4)}`
: this.props.t('contractDeployment')
let addressText
if (txDataName === 'transfer' || address) {
addressText = `${value.slice(0, 10)}...${value.slice(-4)}`
} else if (isMsg) {
addressText = this.props.t('sigRequest')
} else {
addressText = this.props.t('contractDeployment')
}
return addressText
}
TxListItem.prototype.getSendEtherTotal = function () {
@ -185,6 +188,9 @@ TxListItem.prototype.showRetryButton = function () {
transactionId,
txParams,
} = this.props
if (!txParams) {
return false
}
const currentNonce = txParams.nonce
const currentNonceTxs = selectedAddressTxList.filter(tx => tx.txParams.nonce === currentNonce)
const currentNonceSubmittedTxs = currentNonceTxs.filter(tx => tx.status === 'submitted')

View File

@ -71,9 +71,9 @@ TxList.prototype.renderTransactionListItem = function (transaction, conversionRa
const props = {
dateString: formatDate(transaction.time),
address: transaction.txParams.to,
address: transaction.txParams && transaction.txParams.to,
transactionStatus: transaction.status,
transactionAmount: transaction.txParams.value,
transactionAmount: transaction.txParams && transaction.txParams.value,
transactionId: transaction.id,
transactionHash: transaction.hash,
transactionNetworkId: transaction.metamaskNetworkId,
@ -95,6 +95,7 @@ TxList.prototype.renderTransactionListItem = function (transaction, conversionRa
const opts = {
key: transactionId || transactionHash,
txParams: transaction.txParams,
isMsg: Boolean(transaction.msgParams),
transactionStatus,
transactionId,
dateString,