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

Merge pull request #3774 from danjm/i3686-txparamundefined-sigrequestsintxlist

Fix display of unapprovedMgs in txList; fix txParams undefined errors
This commit is contained in:
kumavis 2018-03-30 18:36:39 -07:00 committed by GitHub
commit ee1acf0a7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 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

@ -68,20 +68,24 @@ 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.context.t('contractDeployment')
let addressText
if (txDataName === 'transfer' || address) {
const addressToRender = txDataName === 'transfer' ? value : address
addressText = `${addressToRender.slice(0, 10)}...${addressToRender.slice(-4)}`
} else if (isMsg) {
addressText = this.context.t('sigRequest')
} else {
addressText = this.context.t('contractDeployment')
}
return addressText
}
TxListItem.prototype.getSendEtherTotal = function () {
@ -191,6 +195,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

@ -77,9 +77,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,
@ -101,6 +101,7 @@ TxList.prototype.renderTransactionListItem = function (transaction, conversionRa
const opts = {
key: transactionId || transactionHash,
txParams: transaction.txParams,
isMsg: Boolean(transaction.msgParams),
transactionStatus,
transactionId,
dateString,