From 0fae263a9acb1f4023070b37ee1b91815e34de86 Mon Sep 17 00:00:00 2001 From: Frankie Date: Tue, 10 Jan 2017 11:52:25 -0800 Subject: Take some of the tx Logic out of the UI and create a visble state for pending and unaproved transactions --- app/scripts/background.js | 1 - app/scripts/keyring-controller.js | 2 +- app/scripts/metamask-controller.js | 1 + app/scripts/transaction-manager.js | 33 +++++++++++++++++++------ ui/app/account-detail.js | 16 +++--------- ui/app/components/pending-tx-details.js | 12 ++------- ui/app/components/transaction-list-item-icon.js | 18 +++++++++++++- ui/app/components/transaction-list-item.js | 18 ++++++++------ ui/app/components/transaction-list.js | 9 ++++--- ui/app/conf-tx.js | 12 ++------- 10 files changed, 68 insertions(+), 54 deletions(-) diff --git a/app/scripts/background.js b/app/scripts/background.js index 6b7926526..3f15488ee 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -27,7 +27,6 @@ function triggerUi () { if (!popupIsOpen) notification.show() } // On first install, open a window to MetaMask website to how-it-works. - extension.runtime.onInstalled.addListener(function (details) { if ((details.reason === 'install') && (!METAMASK_DEBUG)) { extension.tabs.create({url: 'https://metamask.io/#how-it-works'}) diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js index c58be0aae..a457a2560 100644 --- a/app/scripts/keyring-controller.js +++ b/app/scripts/keyring-controller.js @@ -95,7 +95,6 @@ module.exports = class KeyringController extends EventEmitter { isInitialized: (!!wallet || !!vault), isUnlocked: Boolean(this.password), isDisclaimerConfirmed: this.configManager.getConfirmedDisclaimer(), - transactions: this.configManager.getTxList(), unconfMsgs: messageManager.unconfirmedMsgs(), messages: messageManager.getMsgList(), selectedAccount: address, @@ -273,6 +272,7 @@ module.exports = class KeyringController extends EventEmitter { setSelectedAccount (address) { var addr = normalize(address) this.configManager.setSelectedAccount(addr) + this.emit('update') return Promise.resolve(addr) } diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 555460f3d..ae7aee9e3 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -64,6 +64,7 @@ module.exports = class MetamaskController extends EventEmitter { this.ethStore.on('update', this.sendUpdate.bind(this)) this.keyringController.on('update', this.sendUpdate.bind(this)) + this.txManager.on('update', this.sendUpdate.bind(this)) } getState () { diff --git a/app/scripts/transaction-manager.js b/app/scripts/transaction-manager.js index 6becfa6d1..a279ba23a 100644 --- a/app/scripts/transaction-manager.js +++ b/app/scripts/transaction-manager.js @@ -25,9 +25,8 @@ module.exports = class TransactionManager extends EventEmitter { getState () { var selectedAccount = this.getSelectedAccount() return { - transactions: this.getTxList(), unconfTxs: this.getUnapprovedTxList(), - selectedAccountTxList: this.getFilteredTxList({metamaskNetworkId: this.getNetwork(), from: selectedAccount}), + transactions: this.getFilteredTxList({metamaskNetworkId: this.getNetwork(), from: selectedAccount}), } } @@ -113,10 +112,26 @@ module.exports = class TransactionManager extends EventEmitter { txDidComplete (txMeta, onTxDoneCb, cb, err) { if (err) return cb(err) + var {maxCost, txFee} = this.getMaxTxCostAndFee(txMeta) + txMeta.maxCost = maxCost + txMeta.txFee = txFee this.addTx(txMeta, onTxDoneCb) cb(null, txMeta) } + getMaxTxCostAndFee (txMeta) { + var txParams = txMeta.txParams + + var gasMultiplier = txMeta.gasMultiplier + var gasCost = new BN(ethUtil.stripHexPrefix(txParams.gas || txMeta.estimatedGas), 16) + var gasPrice = new BN(ethUtil.stripHexPrefix(txParams.gasPrice || '0x4a817c800'), 16) + gasPrice = gasPrice.mul(new BN(gasMultiplier * 100), 10).div(new BN(100, 10)) + var txFee = gasCost.mul(gasPrice) + var txValue = new BN(ethUtil.stripHexPrefix(txParams.value || '0x0'), 16) + var maxCost = txValue.add(txFee) + return {maxCost, txFee} + } + getUnapprovedTxList () { var txList = this.getTxList() return txList.filter((txMeta) => txMeta.status === 'unapproved') @@ -227,6 +242,7 @@ module.exports = class TransactionManager extends EventEmitter { setTxStatusConfirmed (txId) { this._setTxStatus(txId, 'confirmed') + this.emit('update') } // merges txParams obj onto txData.txParams @@ -240,17 +256,20 @@ module.exports = class TransactionManager extends EventEmitter { // checks if a signed tx is in a block and // if included sets the tx status as 'confirmed' checkForTxInBlock () { - var signedTxList = this.getFilteredTxList({status: 'signed', err: undefined}) + var signedTxList = this.getFilteredTxList({status: 'signed'}) if (!signedTxList.length) return signedTxList.forEach((tx) => { var txHash = tx.hash var txId = tx.id - if (!txHash) return + if (!txHash) { + tx.err = { errCode: 'No hash was provided', message: 'Tx could possibly have not been submitted or an error accrued during signing'} + return this.updateTx(tx) + } this.txProviderUtils.query.getTransactionByHash(txHash, (err, txMeta) => { - if (err || !txMeta) { - tx.err = err || 'Tx could possibly have not been submitted' + if (err) { + tx.err = {errorCode: err, message: 'Tx could possibly have not been submitted to the block chain',} this.updateTx(tx) - return txMeta ? console.error(err) : console.debug(`txMeta is ${txMeta} for:`, tx) + return console.error(err) } if (txMeta.blockNumber) { this.setTxStatusConfirmed(txId) diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index c41ba61fd..cfc59d99b 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -26,11 +26,10 @@ function mapStateToProps (state) { accounts: state.metamask.accounts, address: state.metamask.selectedAccount, accountDetail: state.appState.accountDetail, - transactions: state.metamask.transactions, network: state.metamask.network, - unconfTxs: valuesFor(state.metamask.unconfTxs), unconfMsgs: valuesFor(state.metamask.unconfMsgs), shapeShiftTxList: state.metamask.shapeShiftTxList, + transactions: state.metamask.transactions, } } @@ -248,20 +247,11 @@ AccountDetailScreen.prototype.subview = function () { } AccountDetailScreen.prototype.transactionList = function () { - const { transactions, unconfTxs, unconfMsgs, address, network, shapeShiftTxList } = this.props - - var txsToRender = transactions.concat(unconfTxs) - // only transactions that are from the current address - .filter(tx => tx.txParams.from === address) - // only transactions that are on the current network - .filter(tx => tx.txParams.metamaskNetworkId === network) + const {transactions, unconfMsgs, address, network, shapeShiftTxList } = this.props // sort by recency - .sort((a, b) => b.time - a.time) - return h(TransactionList, { - txsToRender, + transactions, network, - unconfTxs, unconfMsgs, address, shapeShiftTxList, diff --git a/ui/app/components/pending-tx-details.js b/ui/app/components/pending-tx-details.js index 89472b221..c40cd01b1 100644 --- a/ui/app/components/pending-tx-details.js +++ b/ui/app/components/pending-tx-details.js @@ -7,8 +7,6 @@ const EthBalance = require('./eth-balance') const util = require('../util') const addressSummary = util.addressSummary const nameForAddress = require('../../lib/contract-namer') -const ethUtil = require('ethereumjs-util') -const BN = ethUtil.BN module.exports = PendingTxDetails @@ -29,15 +27,9 @@ PTXP.render = function () { var account = props.accounts[address] var balance = account ? account.balance : '0x0' - var gasMultiplier = txData.gasMultiplier - var gasCost = new BN(ethUtil.stripHexPrefix(txParams.gas || txData.estimatedGas), 16) - var gasPrice = new BN(ethUtil.stripHexPrefix(txParams.gasPrice || '0x4a817c800'), 16) - gasPrice = gasPrice.mul(new BN(gasMultiplier * 100), 10).div(new BN(100, 10)) - var txFee = gasCost.mul(gasPrice) - var txValue = new BN(ethUtil.stripHexPrefix(txParams.value || '0x0'), 16) - var maxCost = txValue.add(txFee) + var txFee = txData.txFee + var maxCost = txData.maxCost var dataLength = txParams.data ? (txParams.data.length - 2) / 2 : 0 - var imageify = props.imageifyIdenticons === undefined ? true : props.imageifyIdenticons return ( diff --git a/ui/app/components/transaction-list-item-icon.js b/ui/app/components/transaction-list-item-icon.js index 8b118b1d4..58aa733f1 100644 --- a/ui/app/components/transaction-list-item-icon.js +++ b/ui/app/components/transaction-list-item-icon.js @@ -13,15 +13,31 @@ function TransactionIcon () { TransactionIcon.prototype.render = function () { const { transaction, txParams, isMsg } = this.props + if (transaction.status === 'unapproved') { + return h('.unapproved-tx', { + style: { + width: '15px', + height: '15px', + background: '#00bfff', + borderRadius: '13px', + }, + }) - if (transaction.status === 'rejected') { + } else if (transaction.status === 'rejected') { return h('i.fa.fa-exclamation-triangle.fa-lg.warning', { style: { width: '24px', }, }) + } else if (transaction.status === 'signed') { + return h('i.fa.fa-ellipsis-h', { + style: { + fontSize: '27px', + }, + }) } + if (isMsg) { return h('i.fa.fa-certificate.fa-lg', { style: { diff --git a/ui/app/components/transaction-list-item.js b/ui/app/components/transaction-list-item.js index bb685abda..bcd50c333 100644 --- a/ui/app/components/transaction-list-item.js +++ b/ui/app/components/transaction-list-item.js @@ -8,6 +8,7 @@ const explorerLink = require('../../lib/explorer-link') const CopyButton = require('./copyButton') const vreme = new (require('vreme')) const extension = require('../../../app/scripts/lib/extension') +const Tooltip = require('./tooltip') const TransactionIcon = require('./transaction-list-item-icon') const ShiftListItem = require('./shift-list-item') @@ -59,11 +60,7 @@ TransactionListItem.prototype.render = function () { }, [ h('.identicon-wrapper.flex-column.flex-center.select-none', [ - transaction.status === 'unapproved' ? h('i.fa.fa-ellipsis-h', { - style: { - fontSize: '27px', - }, - }) : h('.pop-hover', { + h('.pop-hover', { onClick: (event) => { event.stopPropagation() if (!isTx || isPending) return @@ -139,7 +136,14 @@ function failIfFailed (transaction) { if (transaction.status === 'rejected') { return h('span.error', ' (Rejected)') } - if (transaction.status === 'failed') { - return h('span.error', ' (Failed)') + if (transaction.err) { + + return h(Tooltip, { + title: transaction.err.message, + position: 'bottom', + }, [ + h('span.error', ' (Failed)'), + ]) } + } diff --git a/ui/app/components/transaction-list.js b/ui/app/components/transaction-list.js index 7e1bedb05..105b34c90 100644 --- a/ui/app/components/transaction-list.js +++ b/ui/app/components/transaction-list.js @@ -13,12 +13,13 @@ function TransactionList () { } TransactionList.prototype.render = function () { - const { txsToRender, network, unconfMsgs } = this.props + const { transactions = [], network, unconfMsgs } = this.props + var shapeShiftTxList if (network === '1') { shapeShiftTxList = this.props.shapeShiftTxList } - const transactions = !shapeShiftTxList ? txsToRender.concat(unconfMsgs) : txsToRender.concat(unconfMsgs, shapeShiftTxList) + const txsToRender = !shapeShiftTxList ? transactions.concat(unconfMsgs) : txsToRender.concat(unconfMsgs, shapeShiftTxList) .sort((a, b) => b.time - a.time) return ( @@ -55,8 +56,8 @@ TransactionList.prototype.render = function () { }, }, [ - transactions.length - ? transactions.map((transaction, i) => { + txsToRender.length + ? txsToRender.map((transaction, i) => { let key switch (transaction.key) { case 'shapeshift': diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index 5a645022a..79699965b 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -46,7 +46,6 @@ ConfirmTxScreen.prototype.render = function () { var txData = unconfTxList[index] || unconfTxList[0] || {} var txParams = txData.txParams || {} var isNotification = isPopupOrNotification() === 'notification' - return ( h('.flex-column.flex-grow', [ @@ -125,17 +124,10 @@ function currentTxView (opts) { } ConfirmTxScreen.prototype.checkBalanceAgainstTx = function (txData) { var state = this.props - - var txParams = txData.txParams || {} - var address = txParams.from || state.selectedAccount + var address = txData.txParams.from || state.selectedAccount var account = state.accounts[address] var balance = account ? account.balance : '0x0' - - var gasCost = new BN(ethUtil.stripHexPrefix(txParams.gas || txData.estimatedGas), 16) - var gasPrice = new BN(ethUtil.stripHexPrefix(txParams.gasPrice || '0x4a817c800'), 16) - var txFee = gasCost.mul(gasPrice) - var txValue = new BN(ethUtil.stripHexPrefix(txParams.value || '0x0'), 16) - var maxCost = txValue.add(txFee) + var maxCost = new BN(txData.maxCost) var balanceBn = new BN(ethUtil.stripHexPrefix(balance), 16) return maxCost.gt(balanceBn) -- cgit From bbd2f2738b5b260f0e666b9cfb8d0c843342abb2 Mon Sep 17 00:00:00 2001 From: Frankie Date: Wed, 11 Jan 2017 12:23:00 -0800 Subject: Add to CHANGELOG --- CHANGELOG.md | 1 + app/scripts/transaction-manager.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f1ec6823..113d2f7cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Current Master +- Create visible difference in transaction history between a approved but not yet included in a block transaction and a transaction who has been confirmed. - Fix memory leak in RPC Cache - Override RPC commands eth_syncing and web3_clientVersion - Remove certain non-essential permissions from certain builds. diff --git a/app/scripts/transaction-manager.js b/app/scripts/transaction-manager.js index a279ba23a..f83bc41c9 100644 --- a/app/scripts/transaction-manager.js +++ b/app/scripts/transaction-manager.js @@ -262,12 +262,18 @@ module.exports = class TransactionManager extends EventEmitter { var txHash = tx.hash var txId = tx.id if (!txHash) { - tx.err = { errCode: 'No hash was provided', message: 'Tx could possibly have not been submitted or an error accrued during signing'} + tx.err = { + errCode: 'No hash was provided', + message: 'Tx could possibly have not been submitted or an error accrued during signing', + } return this.updateTx(tx) } this.txProviderUtils.query.getTransactionByHash(txHash, (err, txMeta) => { if (err) { - tx.err = {errorCode: err, message: 'Tx could possibly have not been submitted to the block chain',} + tx.err = { + errorCode: err, + message: 'Tx could possibly have not been submitted to the block chain', + } this.updateTx(tx) return console.error(err) } -- cgit From 576e2ad64df293adcc8c2494a3648100ba4b28f5 Mon Sep 17 00:00:00 2001 From: Frankie Date: Wed, 11 Jan 2017 15:44:21 -0800 Subject: Fix wording and icon of failed txs --- app/scripts/keyring-controller.js | 1 - app/scripts/transaction-manager.js | 30 +++++++++++++------------ ui/app/components/transaction-list-item-icon.js | 6 +++++ 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js index a457a2560..81e6a4905 100644 --- a/app/scripts/keyring-controller.js +++ b/app/scripts/keyring-controller.js @@ -272,7 +272,6 @@ module.exports = class KeyringController extends EventEmitter { setSelectedAccount (address) { var addr = normalize(address) this.configManager.setSelectedAccount(addr) - this.emit('update') return Promise.resolve(addr) } diff --git a/app/scripts/transaction-manager.js b/app/scripts/transaction-manager.js index f83bc41c9..527899835 100644 --- a/app/scripts/transaction-manager.js +++ b/app/scripts/transaction-manager.js @@ -82,6 +82,7 @@ module.exports = class TransactionManager extends EventEmitter { var index = txList.findIndex(txData => txData.id === txId) txList[index] = txMeta this._saveTxList(txList) + this.emit('update') } get unapprovedTxCount () { @@ -182,7 +183,6 @@ module.exports = class TransactionManager extends EventEmitter { this.updateTx(metaTx) var rawTx = ethUtil.bufferToHex(tx.serialize()) return Promise.resolve(rawTx) - } /* @@ -242,7 +242,6 @@ module.exports = class TransactionManager extends EventEmitter { setTxStatusConfirmed (txId) { this._setTxStatus(txId, 'confirmed') - this.emit('update') } // merges txParams obj onto txData.txParams @@ -258,26 +257,29 @@ module.exports = class TransactionManager extends EventEmitter { checkForTxInBlock () { var signedTxList = this.getFilteredTxList({status: 'signed'}) if (!signedTxList.length) return - signedTxList.forEach((tx) => { - var txHash = tx.hash - var txId = tx.id + signedTxList.forEach((txMeta) => { + var txHash = txMeta.hash + var txId = txMeta.id if (!txHash) { - tx.err = { + txMeta.err = { 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) => { - if (err) { - tx.err = { + this.txProviderUtils.query.getTransactionByHash(txHash, (err, txParams) => { + if (err || !txParams) { + if (!txParams) return + txMeta.err = { + isWarning: true, 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) } - if (txMeta.blockNumber) { + if (txParams.blockNumber) { this.setTxStatusConfirmed(txId) } }) diff --git a/ui/app/components/transaction-list-item-icon.js b/ui/app/components/transaction-list-item-icon.js index 58aa733f1..356b77c3b 100644 --- a/ui/app/components/transaction-list-item-icon.js +++ b/ui/app/components/transaction-list-item-icon.js @@ -35,6 +35,12 @@ TransactionIcon.prototype.render = function () { fontSize: '27px', }, }) + } else if (transaction.status === 'failed') { + return h('i.fa.fa-exclamation-triangle.fa-lg.warning', { + style: { + fontSize: '24px', + }, + }) } -- cgit From 34081c8cb2635bba0d6dd8a93d381f6554faa861 Mon Sep 17 00:00:00 2001 From: Frankie Date: Wed, 11 Jan 2017 16:27:05 -0800 Subject: Fix sorting and instances where something could be undefined --- ui/app/account-detail.js | 3 ++- ui/app/components/pending-tx-details.js | 4 ++-- ui/app/conf-tx.js | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index cfc59d99b..76554472e 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -249,8 +249,9 @@ AccountDetailScreen.prototype.subview = function () { AccountDetailScreen.prototype.transactionList = function () { const {transactions, unconfMsgs, address, network, shapeShiftTxList } = this.props // sort by recency + var soretedTxs = transactions.sort((a, b) => b.time - a.time) return h(TransactionList, { - transactions, + transactions: soretedTxs, network, unconfMsgs, address, diff --git a/ui/app/components/pending-tx-details.js b/ui/app/components/pending-tx-details.js index c40cd01b1..286931f6f 100644 --- a/ui/app/components/pending-tx-details.js +++ b/ui/app/components/pending-tx-details.js @@ -27,8 +27,8 @@ PTXP.render = function () { var account = props.accounts[address] var balance = account ? account.balance : '0x0' - var txFee = txData.txFee - var maxCost = txData.maxCost + var txFee = txData.txFee || '' + var maxCost = txData.maxCost || '' var dataLength = txParams.data ? (txParams.data.length - 2) / 2 : 0 var imageify = props.imageifyIdenticons === undefined ? true : props.imageifyIdenticons diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index 79699965b..2c5ba5618 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -43,7 +43,7 @@ ConfirmTxScreen.prototype.render = function () { var unconfMsgs = state.unconfMsgs var unconfTxList = txHelper(unconfTxs, unconfMsgs, network) var index = state.index !== undefined ? state.index : 0 - var txData = unconfTxList[index] || unconfTxList[0] || {} + var txData = unconfTxList[index] || unconfTxList[0] || {txParams: {}} var txParams = txData.txParams || {} var isNotification = isPopupOrNotification() === 'notification' return ( -- cgit From 5ed52eed680f503adb0e510320b2610658157d4d Mon Sep 17 00:00:00 2001 From: Frankie Date: Fri, 13 Jan 2017 10:44:22 -0800 Subject: Clean up code --- app/scripts/transaction-manager.js | 3 +- ui/app/account-detail.js | 5 +- ui/app/components/transaction-list-item-icon.js | 61 +++++++++++++------------ ui/app/components/transaction-list.js | 4 +- 4 files changed, 39 insertions(+), 34 deletions(-) diff --git a/app/scripts/transaction-manager.js b/app/scripts/transaction-manager.js index 527899835..f5b57f3c2 100644 --- a/app/scripts/transaction-manager.js +++ b/app/scripts/transaction-manager.js @@ -25,8 +25,9 @@ module.exports = class TransactionManager extends EventEmitter { getState () { var selectedAccount = this.getSelectedAccount() return { + transactions: this.getTxList(), unconfTxs: this.getUnapprovedTxList(), - transactions: this.getFilteredTxList({metamaskNetworkId: this.getNetwork(), from: selectedAccount}), + selectedAccountTxList: this.getFilteredTxList({metamaskNetworkId: this.getNetwork(), from: selectedAccount}), } } diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index 76554472e..d7473aee5 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -29,7 +29,7 @@ function mapStateToProps (state) { network: state.metamask.network, unconfMsgs: valuesFor(state.metamask.unconfMsgs), shapeShiftTxList: state.metamask.shapeShiftTxList, - transactions: state.metamask.transactions, + transactions: state.metamask.selectedAccountTxList || [], } } @@ -249,9 +249,8 @@ AccountDetailScreen.prototype.subview = function () { AccountDetailScreen.prototype.transactionList = function () { const {transactions, unconfMsgs, address, network, shapeShiftTxList } = this.props // sort by recency - var soretedTxs = transactions.sort((a, b) => b.time - a.time) return h(TransactionList, { - transactions: soretedTxs, + transactions: transactions.sort((a, b) => b.time - a.time), network, unconfMsgs, address, diff --git a/ui/app/components/transaction-list-item-icon.js b/ui/app/components/transaction-list-item-icon.js index 356b77c3b..eca0d693a 100644 --- a/ui/app/components/transaction-list-item-icon.js +++ b/ui/app/components/transaction-list-item-icon.js @@ -13,36 +13,41 @@ function TransactionIcon () { TransactionIcon.prototype.render = function () { const { transaction, txParams, isMsg } = this.props - if (transaction.status === 'unapproved') { - return h('.unapproved-tx', { - style: { - width: '15px', - height: '15px', - background: '#00bfff', - borderRadius: '13px', - }, - }) + switch (transaction.status) { + case 'unapproved': + return h('.unapproved-tx', { + style: { + width: '24px', + height: '24px', + background: '#4dffff', + border: 'solid', + borderColor: '#AEAEAE', + borderWidth: '0.5px', + borderRadius: '13px', + }, + }) - } else if (transaction.status === 'rejected') { - return h('i.fa.fa-exclamation-triangle.fa-lg.warning', { - style: { - width: '24px', - }, - }) - } else if (transaction.status === 'signed') { - return h('i.fa.fa-ellipsis-h', { - style: { - fontSize: '27px', - }, - }) - } else if (transaction.status === 'failed') { - return h('i.fa.fa-exclamation-triangle.fa-lg.warning', { - style: { - fontSize: '24px', - }, - }) - } + case 'rejected': + return h('i.fa.fa-exclamation-triangle.fa-lg.warning', { + style: { + width: '24px', + }, + }) + case 'failed': + return h('i.fa.fa-exclamation-triangle.fa-lg.error', { + style: { + width: '24px', + }, + }) + + case 'signed': + return h('i.fa.fa-ellipsis-h', { + style: { + fontSize: '27px', + }, + }) + } if (isMsg) { return h('i.fa.fa-certificate.fa-lg', { diff --git a/ui/app/components/transaction-list.js b/ui/app/components/transaction-list.js index 105b34c90..b055ca9d5 100644 --- a/ui/app/components/transaction-list.js +++ b/ui/app/components/transaction-list.js @@ -13,13 +13,13 @@ function TransactionList () { } TransactionList.prototype.render = function () { - const { transactions = [], network, unconfMsgs } = this.props + const { transactions, network, unconfMsgs } = this.props var shapeShiftTxList if (network === '1') { shapeShiftTxList = this.props.shapeShiftTxList } - const txsToRender = !shapeShiftTxList ? transactions.concat(unconfMsgs) : txsToRender.concat(unconfMsgs, shapeShiftTxList) + const txsToRender = !shapeShiftTxList ? transactions.concat(unconfMsgs) : transactions.concat(unconfMsgs, shapeShiftTxList) .sort((a, b) => b.time - a.time) return ( -- cgit From c1656aff195ad37d8365a0bdc84133eac6fb0263 Mon Sep 17 00:00:00 2001 From: Frankie Date: Fri, 13 Jan 2017 10:53:16 -0800 Subject: lint --- ui/app/conf-tx.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index 2c5ba5618..8d8285f3d 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -43,7 +43,7 @@ ConfirmTxScreen.prototype.render = function () { var unconfMsgs = state.unconfMsgs var unconfTxList = txHelper(unconfTxs, unconfMsgs, network) var index = state.index !== undefined ? state.index : 0 - var txData = unconfTxList[index] || unconfTxList[0] || {txParams: {}} + var txData = unconfTxList[index] || {txParams: {}} var txParams = txData.txParams || {} var isNotification = isPopupOrNotification() === 'notification' return ( -- cgit From b72987405e0ca60db75821ce38f401eb395ae356 Mon Sep 17 00:00:00 2001 From: Frankie Date: Fri, 13 Jan 2017 11:30:58 -0800 Subject: remove orphaned comment --- ui/app/account-detail.js | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index d7473aee5..7a0c599ba 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -248,7 +248,6 @@ AccountDetailScreen.prototype.subview = function () { AccountDetailScreen.prototype.transactionList = function () { const {transactions, unconfMsgs, address, network, shapeShiftTxList } = this.props - // sort by recency return h(TransactionList, { transactions: transactions.sort((a, b) => b.time - a.time), network, -- cgit