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

Fix wording and icon of failed txs

This commit is contained in:
Frankie 2017-01-11 15:44:21 -08:00
parent bbd2f2738b
commit 576e2ad64d
3 changed files with 22 additions and 15 deletions

View File

@ -272,7 +272,6 @@ module.exports = class KeyringController extends EventEmitter {
setSelectedAccount (address) { setSelectedAccount (address) {
var addr = normalize(address) var addr = normalize(address)
this.configManager.setSelectedAccount(addr) this.configManager.setSelectedAccount(addr)
this.emit('update')
return Promise.resolve(addr) return Promise.resolve(addr)
} }

View File

@ -82,6 +82,7 @@ module.exports = class TransactionManager extends EventEmitter {
var index = txList.findIndex(txData => txData.id === txId) var index = txList.findIndex(txData => txData.id === txId)
txList[index] = txMeta txList[index] = txMeta
this._saveTxList(txList) this._saveTxList(txList)
this.emit('update')
} }
get unapprovedTxCount () { get unapprovedTxCount () {
@ -182,7 +183,6 @@ module.exports = class TransactionManager extends EventEmitter {
this.updateTx(metaTx) this.updateTx(metaTx)
var rawTx = ethUtil.bufferToHex(tx.serialize()) var rawTx = ethUtil.bufferToHex(tx.serialize())
return Promise.resolve(rawTx) return Promise.resolve(rawTx)
} }
/* /*
@ -242,7 +242,6 @@ module.exports = class TransactionManager extends EventEmitter {
setTxStatusConfirmed (txId) { setTxStatusConfirmed (txId) {
this._setTxStatus(txId, 'confirmed') this._setTxStatus(txId, 'confirmed')
this.emit('update')
} }
// merges txParams obj onto txData.txParams // merges txParams obj onto txData.txParams
@ -258,26 +257,29 @@ module.exports = class TransactionManager extends EventEmitter {
checkForTxInBlock () { checkForTxInBlock () {
var signedTxList = this.getFilteredTxList({status: 'signed'}) var signedTxList = this.getFilteredTxList({status: 'signed'})
if (!signedTxList.length) return if (!signedTxList.length) return
signedTxList.forEach((tx) => { signedTxList.forEach((txMeta) => {
var txHash = tx.hash var txHash = txMeta.hash
var txId = tx.id var txId = txMeta.id
if (!txHash) { if (!txHash) {
tx.err = { txMeta.err = {
errCode: 'No hash was provided', errCode: 'No hash was provided',
message: 'Tx could possibly have not been submitted or an error accrued during signing', message: 'We had an error while submitting this transaction, please try again.',
} }
return this.updateTx(tx) this.updateTx(txMeta)
return this._setTxStatus(txId, 'failed')
} }
this.txProviderUtils.query.getTransactionByHash(txHash, (err, txMeta) => { this.txProviderUtils.query.getTransactionByHash(txHash, (err, txParams) => {
if (err) { if (err || !txParams) {
tx.err = { if (!txParams) return
txMeta.err = {
isWarning: true,
errorCode: err, errorCode: err,
message: 'Tx could possibly have not been submitted to the block chain', message: 'There was a problem loading this transaction.',
} }
this.updateTx(tx) this.updateTx(txMeta)
return console.error(err) return console.error(err)
} }
if (txMeta.blockNumber) { if (txParams.blockNumber) {
this.setTxStatusConfirmed(txId) this.setTxStatusConfirmed(txId)
} }
}) })

View File

@ -35,6 +35,12 @@ TransactionIcon.prototype.render = function () {
fontSize: '27px', fontSize: '27px',
}, },
}) })
} else if (transaction.status === 'failed') {
return h('i.fa.fa-exclamation-triangle.fa-lg.warning', {
style: {
fontSize: '24px',
},
})
} }