mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 09:23:21 +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:
commit
ee1acf0a7e
@ -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')
|
||||
|
@ -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')
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user