From 21b6a3442d8cae8c95a3d7e0b9e216d91bc8bd19 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 28 Mar 2018 10:51:16 -0230 Subject: [PATCH] Fix display of unapprovedMessages in txList (old and new ui); includes fix of undefined txParams. --- .../app/components/transaction-list-item.js | 5 +++++ ui/app/components/tx-list-item.js | 20 ++++++++++++------- ui/app/components/tx-list.js | 5 +++-- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/old-ui/app/components/transaction-list-item.js b/old-ui/app/components/transaction-list-item.js index 7ab3414e5..f7d59005a 100644 --- a/old-ui/app/components/transaction-list-item.js +++ b/old-ui/app/components/transaction-list-item.js @@ -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') diff --git a/ui/app/components/tx-list-item.js b/ui/app/components/tx-list-item.js index 5e88d38d3..a411edd89 100644 --- a/ui/app/components/tx-list-item.js +++ b/ui/app/components/tx-list-item.js @@ -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') diff --git a/ui/app/components/tx-list.js b/ui/app/components/tx-list.js index 5f09d887e..b8619fbf1 100644 --- a/ui/app/components/tx-list.js +++ b/ui/app/components/tx-list.js @@ -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,