mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add retry background method and action
This commit is contained in:
parent
a78cc013d1
commit
6ff580584a
@ -184,6 +184,10 @@ module.exports = class TransactionController extends EventEmitter {
|
|||||||
return await this.txGasUtil.analyzeGasUsage(txMeta)
|
return await this.txGasUtil.analyzeGasUsage(txMeta)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async retryTransaction (txId) {
|
||||||
|
return this.txStateManager.setTxStatusUnapproved(txId)
|
||||||
|
}
|
||||||
|
|
||||||
async updateAndApproveTransaction (txMeta) {
|
async updateAndApproveTransaction (txMeta) {
|
||||||
this.txStateManager.updateTx(txMeta, 'confTx: user approved transaction')
|
this.txStateManager.updateTx(txMeta, 'confTx: user approved transaction')
|
||||||
await this.approveTransaction(txMeta.id)
|
await this.approveTransaction(txMeta.id)
|
||||||
|
@ -187,6 +187,10 @@ module.exports = class TransactionStateManger extends EventEmitter {
|
|||||||
this._setTxStatus(txId, 'rejected')
|
this._setTxStatus(txId, 'rejected')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// should update the status of the tx to 'unapproved'.
|
||||||
|
setTxStatusUnapproved (txId) {
|
||||||
|
this._setTxStatus(txId, 'unapproved')
|
||||||
|
}
|
||||||
// should update the status of the tx to 'approved'.
|
// should update the status of the tx to 'approved'.
|
||||||
setTxStatusApproved (txId) {
|
setTxStatusApproved (txId) {
|
||||||
this._setTxStatus(txId, 'approved')
|
this._setTxStatus(txId, 'approved')
|
||||||
|
@ -363,6 +363,7 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
// txController
|
// txController
|
||||||
cancelTransaction: nodeify(txController.cancelTransaction, txController),
|
cancelTransaction: nodeify(txController.cancelTransaction, txController),
|
||||||
updateAndApproveTransaction: nodeify(txController.updateAndApproveTransaction, txController),
|
updateAndApproveTransaction: nodeify(txController.updateAndApproveTransaction, txController),
|
||||||
|
retryTransaction: nodeify(txController.retryTransaction, txController),
|
||||||
|
|
||||||
// messageManager
|
// messageManager
|
||||||
signMessage: nodeify(this.signMessage, this),
|
signMessage: nodeify(this.signMessage, this),
|
||||||
|
@ -168,6 +168,7 @@ var actions = {
|
|||||||
|
|
||||||
callBackgroundThenUpdate,
|
callBackgroundThenUpdate,
|
||||||
forceUpdateMetamaskState,
|
forceUpdateMetamaskState,
|
||||||
|
retryTransaction,
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = actions
|
module.exports = actions
|
||||||
@ -759,6 +760,11 @@ function markAccountsFound () {
|
|||||||
return callBackgroundThenUpdate(background.markAccountsFound)
|
return callBackgroundThenUpdate(background.markAccountsFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function retryTransaction () {
|
||||||
|
log.debug(`background.retryTransaction`)
|
||||||
|
return callBackgroundThenUpdate(background.retryTransaction)
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// config
|
// config
|
||||||
//
|
//
|
||||||
|
@ -9,6 +9,7 @@ const CopyButton = require('./copyButton')
|
|||||||
const vreme = new (require('vreme'))()
|
const vreme = new (require('vreme'))()
|
||||||
const Tooltip = require('./tooltip')
|
const Tooltip = require('./tooltip')
|
||||||
const numberToBN = require('number-to-bn')
|
const numberToBN = require('number-to-bn')
|
||||||
|
const actions = require('../actions')
|
||||||
|
|
||||||
const TransactionIcon = require('./transaction-list-item-icon')
|
const TransactionIcon = require('./transaction-list-item-icon')
|
||||||
const ShiftListItem = require('./shift-list-item')
|
const ShiftListItem = require('./shift-list-item')
|
||||||
@ -21,6 +22,7 @@ function TransactionListItem () {
|
|||||||
|
|
||||||
TransactionListItem.prototype.render = function () {
|
TransactionListItem.prototype.render = function () {
|
||||||
const { transaction, network, conversionRate, currentCurrency } = this.props
|
const { transaction, network, conversionRate, currentCurrency } = this.props
|
||||||
|
const { status } = transaction
|
||||||
if (transaction.key === 'shapeshift') {
|
if (transaction.key === 'shapeshift') {
|
||||||
if (network === '1') return h(ShiftListItem, transaction)
|
if (network === '1') return h(ShiftListItem, transaction)
|
||||||
}
|
}
|
||||||
@ -32,7 +34,7 @@ TransactionListItem.prototype.render = function () {
|
|||||||
|
|
||||||
var isMsg = ('msgParams' in transaction)
|
var isMsg = ('msgParams' in transaction)
|
||||||
var isTx = ('txParams' in transaction)
|
var isTx = ('txParams' in transaction)
|
||||||
var isPending = transaction.status === 'unapproved'
|
var isPending = status === 'unapproved'
|
||||||
let txParams
|
let txParams
|
||||||
if (isTx) {
|
if (isTx) {
|
||||||
txParams = transaction.txParams
|
txParams = transaction.txParams
|
||||||
@ -97,10 +99,16 @@ TransactionListItem.prototype.render = function () {
|
|||||||
showFiat: false,
|
showFiat: false,
|
||||||
style: {fontSize: '15px'},
|
style: {fontSize: '15px'},
|
||||||
}) : h('.flex-column'),
|
}) : h('.flex-column'),
|
||||||
|
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TransactionListItem.prototype.resubmit = function () {
|
||||||
|
const { transaction } = this.props
|
||||||
|
this.props.dispatch(actions.resubmitTx(transaction.id))
|
||||||
|
}
|
||||||
|
|
||||||
function domainField (txParams) {
|
function domainField (txParams) {
|
||||||
return h('div', {
|
return h('div', {
|
||||||
style: {
|
style: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user