From 7732cd4100f3c40f35eeaec669094f63292cbe3d Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Mon, 25 Jun 2018 21:29:16 -0700 Subject: [PATCH] Display newest transaction --- app/scripts/controllers/transactions/index.js | 2 +- ui/app/components/app-header/app-header.component.js | 3 +-- .../confirm-transaction/confirm-transaction.component.js | 5 +++-- ui/app/ducks/confirm-transaction.duck.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index 8e2288aed..2e5546fee 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -157,7 +157,6 @@ class TransactionController extends EventEmitter { // construct txMeta let txMeta = this.txStateManager.generateTxMeta({ txParams: normalizedTxParams }) this.addTx(txMeta) - this.emit('newUnapprovedTx', txMeta) try { // check whether recipient account is blacklisted @@ -172,6 +171,7 @@ class TransactionController extends EventEmitter { txMeta.loadingDefaults = false // save txMeta this.txStateManager.updateTx(txMeta) + this.emit('newUnapprovedTx', txMeta) return txMeta } diff --git a/ui/app/components/app-header/app-header.component.js b/ui/app/components/app-header/app-header.component.js index 62b04562a..07ca6cf84 100644 --- a/ui/app/components/app-header/app-header.component.js +++ b/ui/app/components/app-header/app-header.component.js @@ -91,7 +91,6 @@ class AppHeader extends Component { network, provider, history, - location, isUnlocked, } = this.props @@ -126,7 +125,7 @@ class AppHeader extends Component { network={network} provider={provider} onClick={event => this.handleNetworkIndicatorClick(event)} - disabled={location.pathname === CONFIRM_TRANSACTION_ROUTE} + disabled={this.isConfirming()} /> { this.renderAccountMenu() } diff --git a/ui/app/components/pages/confirm-transaction/confirm-transaction.component.js b/ui/app/components/pages/confirm-transaction/confirm-transaction.component.js index 29ee5eedc..d4581e8ed 100644 --- a/ui/app/components/pages/confirm-transaction/confirm-transaction.component.js +++ b/ui/app/components/pages/confirm-transaction/confirm-transaction.component.js @@ -61,7 +61,7 @@ export default class ConfirmTransaction extends Component { setTransactionToConfirm(paramsTransactionId) } - if (!paramsTransactionId) { + if (!transactionId) { this.setTransactionToConfirm() } } @@ -84,7 +84,8 @@ export default class ConfirmTransaction extends Component { setTransactionToConfirm(paramsTransactionId) } } else if (unconfirmedTransactions.length) { - const transactionId = unconfirmedTransactions[0].id + const totalUnconfirmed = unconfirmedTransactions.length + const transactionId = unconfirmedTransactions[totalUnconfirmed - 1].id setTransactionToConfirm(transactionId) } } diff --git a/ui/app/ducks/confirm-transaction.duck.js b/ui/app/ducks/confirm-transaction.duck.js index c4557bf2f..cb3582ec3 100644 --- a/ui/app/ducks/confirm-transaction.duck.js +++ b/ui/app/ducks/confirm-transaction.duck.js @@ -236,7 +236,7 @@ export function updateTxDataAndCalculate (txData) { dispatch(updateTxData(txData)) - const { txParams: { value, gas: gasLimit, gasPrice } = {} } = txData + const { txParams: { value, gas: gasLimit = '0x0', gasPrice = '0x0' } = {} } = txData const fiatTransactionAmount = getTransactionAmount({ value, toCurrency: currentCurrency, conversionRate, numberOfDecimals: 2,