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:
parent
9d7640996a
commit
d6e4d2e80d
@ -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 () {
|
||||
|
@ -62,7 +62,7 @@ TransactionList.prototype.render = function () {
|
||||
}
|
||||
return h(TransactionListItem, {
|
||||
transaction, i, network, key,
|
||||
conversionRate,
|
||||
conversionRate, transactions,
|
||||
showTx: (txId) => {
|
||||
this.props.viewPendingTx(txId)
|
||||
},
|
||||
|
@ -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')
|
||||
|
||||
|
@ -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 () {
|
||||
|
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user