mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +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 () {
|
TransactionListItem.prototype.showRetryButton = function () {
|
||||||
const { transaction = {} } = this.props
|
const { transaction = {}, transactions } = this.props
|
||||||
const { status, time } = transaction
|
const { status, submittedTime, txParams } = transaction
|
||||||
return status === 'submitted' && Date.now() - time > 30000
|
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 () {
|
TransactionListItem.prototype.render = function () {
|
||||||
|
@ -62,7 +62,7 @@ TransactionList.prototype.render = function () {
|
|||||||
}
|
}
|
||||||
return h(TransactionListItem, {
|
return h(TransactionListItem, {
|
||||||
transaction, i, network, key,
|
transaction, i, network, key,
|
||||||
conversionRate,
|
conversionRate, transactions,
|
||||||
showTx: (txId) => {
|
showTx: (txId) => {
|
||||||
this.props.viewPendingTx(txId)
|
this.props.viewPendingTx(txId)
|
||||||
},
|
},
|
||||||
|
@ -11,7 +11,7 @@ const hexToBn = require('../../../../app/scripts/lib/hex-to-bn')
|
|||||||
const {
|
const {
|
||||||
conversionUtil,
|
conversionUtil,
|
||||||
addCurrencies,
|
addCurrencies,
|
||||||
multiplyCurrencies
|
multiplyCurrencies,
|
||||||
} = require('../../conversion-util')
|
} = require('../../conversion-util')
|
||||||
const GasFeeDisplay = require('../send/gas-fee-display-v2')
|
const GasFeeDisplay = require('../send/gas-fee-display-v2')
|
||||||
|
|
||||||
|
@ -178,18 +178,18 @@ TxListItem.prototype.getSendTokenTotal = async function () {
|
|||||||
TxListItem.prototype.showRetryButton = function () {
|
TxListItem.prototype.showRetryButton = function () {
|
||||||
const {
|
const {
|
||||||
transactionStatus,
|
transactionStatus,
|
||||||
transactionTime,
|
transactionSubmittedTime,
|
||||||
selectedAddressTxList,
|
selectedAddressTxList,
|
||||||
transactionId,
|
transactionId,
|
||||||
txParams,
|
txParams,
|
||||||
} = this.props
|
} = this.props
|
||||||
const currentNonce = txParams.nonce
|
const currentNonce = txParams.nonce
|
||||||
const currentNonceTxs = selectedAddressTxList.filter(tx => tx.txParams.nonce === currentNonce)
|
const currentNonceTxs = selectedAddressTxList.filter(tx => tx.txParams.nonce === currentNonce)
|
||||||
const currentStatusNonceTx = currentNonceTxs.filter(tx =>
|
const currentNonceSubmittedTxs = currentNonceTxs.filter(tx => transactionStatus === 'submitted')
|
||||||
tx.status !== 'rejected' && tx.status !== 'failed')
|
const isLastSubmittedTxWithCurrentNonce =
|
||||||
const isLastPassingWithNonce = currentStatusNonceTx[currentStatusNonceTx.length - 1].id === transactionId
|
currentNonceSubmittedTxs[currentNonceSubmittedTxs.length - 1].id === transactionId
|
||||||
|
|
||||||
return transactionStatus === 'submitted' && isLastPassingWithNonce && Date.now() - transactionTime > 30000
|
return isLastSubmittedTxWithCurrentNonce && Date.now() - transactionSubmittedTime > 30000
|
||||||
}
|
}
|
||||||
|
|
||||||
TxListItem.prototype.resubmit = function () {
|
TxListItem.prototype.resubmit = function () {
|
||||||
|
@ -77,7 +77,7 @@ TxList.prototype.renderTransactionListItem = function (transaction, conversionRa
|
|||||||
transactionId: transaction.id,
|
transactionId: transaction.id,
|
||||||
transactionHash: transaction.hash,
|
transactionHash: transaction.hash,
|
||||||
transactionNetworkId: transaction.metamaskNetworkId,
|
transactionNetworkId: transaction.metamaskNetworkId,
|
||||||
transactionTime: transaction.time,
|
transactionSubmittedTime: transaction.transactionSubmittedTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@ -88,7 +88,7 @@ TxList.prototype.renderTransactionListItem = function (transaction, conversionRa
|
|||||||
transactionId,
|
transactionId,
|
||||||
transactionHash,
|
transactionHash,
|
||||||
transactionNetworkId,
|
transactionNetworkId,
|
||||||
transactionTime,
|
transactionSubmittedTime,
|
||||||
} = props
|
} = props
|
||||||
const { showConfTxPage } = this.props
|
const { showConfTxPage } = this.props
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ TxList.prototype.renderTransactionListItem = function (transaction, conversionRa
|
|||||||
transactionHash,
|
transactionHash,
|
||||||
conversionRate,
|
conversionRate,
|
||||||
tokenInfoGetter: this.tokenInfoGetter,
|
tokenInfoGetter: this.tokenInfoGetter,
|
||||||
transactionTime,
|
transactionSubmittedTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
const isUnapproved = transactionStatus === 'unapproved'
|
const isUnapproved = transactionStatus === 'unapproved'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user