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

Use new submittedTime field to correctly show retry button in old and new ui.

This commit is contained in:
Dan 2018-03-13 21:09:04 -02:30
parent 9d7640996a
commit d6e4d2e80d
5 changed files with 19 additions and 13 deletions

View File

@ -29,9 +29,15 @@ function TransactionListItem () {
}
TransactionListItem.prototype.showRetryButton = function () {
const { transaction = {} } = this.props
const { status, time } = transaction
return status === 'submitted' && Date.now() - time > 30000
const { transaction = {}, transactions } = this.props
const { status, submittedTime, txParams } = transaction
const currentNonce = txParams.nonce
const currentNonceTxs = transactions.filter(tx => tx.txParams.nonce === currentNonce)
const currentNonceSubmittedTxs = currentNonceTxs.filter(tx => tx.status === 'submitted')
const isLastSubmittedTxWithCurrentNonce =
currentNonceSubmittedTxs[currentNonceSubmittedTxs.length - 1].id === transaction.id
return isLastSubmittedTxWithCurrentNonce && Date.now() - submittedTime > 30000
}
TransactionListItem.prototype.render = function () {

View File

@ -62,7 +62,7 @@ TransactionList.prototype.render = function () {
}
return h(TransactionListItem, {
transaction, i, network, key,
conversionRate,
conversionRate, transactions,
showTx: (txId) => {
this.props.viewPendingTx(txId)
},

View File

@ -11,7 +11,7 @@ const hexToBn = require('../../../../app/scripts/lib/hex-to-bn')
const {
conversionUtil,
addCurrencies,
multiplyCurrencies
multiplyCurrencies,
} = require('../../conversion-util')
const GasFeeDisplay = require('../send/gas-fee-display-v2')

View File

@ -178,18 +178,18 @@ TxListItem.prototype.getSendTokenTotal = async function () {
TxListItem.prototype.showRetryButton = function () {
const {
transactionStatus,
transactionTime,
transactionSubmittedTime,
selectedAddressTxList,
transactionId,
txParams,
} = this.props
const currentNonce = txParams.nonce
const currentNonceTxs = selectedAddressTxList.filter(tx => tx.txParams.nonce === currentNonce)
const currentStatusNonceTx = currentNonceTxs.filter(tx =>
tx.status !== 'rejected' && tx.status !== 'failed')
const isLastPassingWithNonce = currentStatusNonceTx[currentStatusNonceTx.length - 1].id === transactionId
const currentNonceSubmittedTxs = currentNonceTxs.filter(tx => transactionStatus === 'submitted')
const isLastSubmittedTxWithCurrentNonce =
currentNonceSubmittedTxs[currentNonceSubmittedTxs.length - 1].id === transactionId
return transactionStatus === 'submitted' && isLastPassingWithNonce && Date.now() - transactionTime > 30000
return isLastSubmittedTxWithCurrentNonce && Date.now() - transactionSubmittedTime > 30000
}
TxListItem.prototype.resubmit = function () {

View File

@ -77,7 +77,7 @@ TxList.prototype.renderTransactionListItem = function (transaction, conversionRa
transactionId: transaction.id,
transactionHash: transaction.hash,
transactionNetworkId: transaction.metamaskNetworkId,
transactionTime: transaction.time,
transactionSubmittedTime: transaction.transactionSubmittedTime,
}
const {
@ -88,7 +88,7 @@ TxList.prototype.renderTransactionListItem = function (transaction, conversionRa
transactionId,
transactionHash,
transactionNetworkId,
transactionTime,
transactionSubmittedTime,
} = props
const { showConfTxPage } = this.props
@ -103,7 +103,7 @@ TxList.prototype.renderTransactionListItem = function (transaction, conversionRa
transactionHash,
conversionRate,
tokenInfoGetter: this.tokenInfoGetter,
transactionTime,
transactionSubmittedTime,
}
const isUnapproved = transactionStatus === 'unapproved'