aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2018-01-15 06:00:17 +0800
committerfrankiebee <frankie.diamond@gmail.com>2018-01-15 06:00:17 +0800
commitf0dd4f19238d63875fbdfa3a9b31fa7b9d8925ed (patch)
treea5fcb1ebacbd8bbcd70e668a01e991f51ea1bd97
parentd5c311b13e6a9399252c4617b07ad463f6ead9b0 (diff)
downloadtangerine-wallet-browser-f0dd4f19238d63875fbdfa3a9b31fa7b9d8925ed.tar
tangerine-wallet-browser-f0dd4f19238d63875fbdfa3a9b31fa7b9d8925ed.tar.gz
tangerine-wallet-browser-f0dd4f19238d63875fbdfa3a9b31fa7b9d8925ed.tar.bz2
tangerine-wallet-browser-f0dd4f19238d63875fbdfa3a9b31fa7b9d8925ed.tar.lz
tangerine-wallet-browser-f0dd4f19238d63875fbdfa3a9b31fa7b9d8925ed.tar.xz
tangerine-wallet-browser-f0dd4f19238d63875fbdfa3a9b31fa7b9d8925ed.tar.zst
tangerine-wallet-browser-f0dd4f19238d63875fbdfa3a9b31fa7b9d8925ed.zip
transactions - emit 'newUnapprovedTx' before estimateGas finishes
-rw-r--r--app/scripts/controllers/transactions.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js
index ded9739a8..bb9253175 100644
--- a/app/scripts/controllers/transactions.js
+++ b/app/scripts/controllers/transactions.js
@@ -139,7 +139,6 @@ module.exports = class TransactionController extends EventEmitter {
async newUnapprovedTransaction (txParams) {
log.debug(`MetaMaskController newUnapprovedTransaction ${JSON.stringify(txParams)}`)
const initialTxMeta = await this.addUnapprovedTransaction(txParams)
- this.emit('newUnapprovedTx', initialTxMeta)
// listen for tx completion (success, fail)
return new Promise((resolve, reject) => {
this.txStateManager.once(`${initialTxMeta.id}:finished`, (finishedTxMeta) => {
@@ -167,11 +166,16 @@ module.exports = class TransactionController extends EventEmitter {
status: 'unapproved',
metamaskNetworkId: this.getNetwork(),
txParams: txParams,
+ loadingDefaults: true,
}
+ this.addTx(txMeta)
+ this.emit('newUnapprovedTx', txMeta)
// add default tx params
await this.addTxDefaults(txMeta)
+
+ txMeta.loadingDefaults = false
// save txMeta
- this.addTx(txMeta)
+ this.txStateManager.updateTx(txMeta)
return txMeta
}