aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorFrankie <frankie.diamond@gmail.com>2017-01-05 07:03:45 +0800
committerFrankie <frankie.diamond@gmail.com>2017-01-05 07:03:45 +0800
commitcf6817092b92930ab96e1c9e610669b485b384ff (patch)
treecfa92fa6bbdcd0be1dfbab5d805cf146ac81e416 /app
parent4b17222a5994166e01486698803896fd2d60043c (diff)
downloadtangerine-wallet-browser-cf6817092b92930ab96e1c9e610669b485b384ff.tar
tangerine-wallet-browser-cf6817092b92930ab96e1c9e610669b485b384ff.tar.gz
tangerine-wallet-browser-cf6817092b92930ab96e1c9e610669b485b384ff.tar.bz2
tangerine-wallet-browser-cf6817092b92930ab96e1c9e610669b485b384ff.tar.lz
tangerine-wallet-browser-cf6817092b92930ab96e1c9e610669b485b384ff.tar.xz
tangerine-wallet-browser-cf6817092b92930ab96e1c9e610669b485b384ff.tar.zst
tangerine-wallet-browser-cf6817092b92930ab96e1c9e610669b485b384ff.zip
remove unnecessary try statments
Diffstat (limited to 'app')
-rw-r--r--app/scripts/keyring-controller.js18
-rw-r--r--app/scripts/metamask-controller.js3
-rw-r--r--app/scripts/transaction-manager.js40
3 files changed, 24 insertions, 37 deletions
diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js
index 1a26a887f..c58be0aae 100644
--- a/app/scripts/keyring-controller.js
+++ b/app/scripts/keyring-controller.js
@@ -318,18 +318,12 @@ module.exports = class KeyringController extends EventEmitter {
// TX Manager to update the state after signing
signTransaction (ethTx, selectedAddress, txId) {
- return new Promise((resolve, reject) => {
- try {
- const address = normalize(selectedAddress)
- return this.getKeyringForAccount(address)
- .then((keyring) => {
- return keyring.signTransaction(address, ethTx)
- }).then((tx) => {
- resolve({tx, txId})
- })
- } catch (e) {
- reject(e)
- }
+ const address = normalize(selectedAddress)
+ return this.getKeyringForAccount(address)
+ .then((keyring) => {
+ return keyring.signTransaction(address, ethTx)
+ }).then((tx) => {
+ return {tx, txId}
})
}
// Add Unconfirmed Message
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 4caad46e1..d520a59ad 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -165,7 +165,6 @@ module.exports = class MetamaskController {
sendUpdate () {
this.getState()
.then((state) => {
-
this.listeners.forEach((remote) => {
remote.sendUpdate(state)
})
@@ -461,7 +460,7 @@ module.exports = class MetamaskController {
return this.state.network
}
- markAccountsFound(cb) {
+ markAccountsFound (cb) {
this.configManager.setLostAccounts([])
this.sendUpdate()
cb(null, this.getState())
diff --git a/app/scripts/transaction-manager.js b/app/scripts/transaction-manager.js
index a2dba69b5..6becfa6d1 100644
--- a/app/scripts/transaction-manager.js
+++ b/app/scripts/transaction-manager.js
@@ -138,29 +138,23 @@ module.exports = class TransactionManager extends EventEmitter {
// formats txParams so the keyringController can sign it
formatTxForSigining (txParams) {
- return new Promise((resolve, reject) => {
- try {
- var address = txParams.from
- var metaTx = this.getTx(txParams.metamaskId)
- var gasMultiplier = metaTx.gasMultiplier
- var gasPrice = new BN(ethUtil.stripHexPrefix(txParams.gasPrice), 16)
- gasPrice = gasPrice.mul(new BN(gasMultiplier * 100, 10)).div(new BN(100, 10))
- txParams.gasPrice = ethUtil.intToHex(gasPrice.toNumber())
-
- // normalize values
- txParams.to = normalize(txParams.to)
- txParams.from = normalize(txParams.from)
- txParams.value = normalize(txParams.value)
- txParams.data = normalize(txParams.data)
- txParams.gasLimit = normalize(txParams.gasLimit || txParams.gas)
- txParams.nonce = normalize(txParams.nonce)
- const ethTx = new Transaction(txParams)
- var txId = txParams.metamaskId
- resolve({ethTx, address, txId})
- } catch (err) {
- reject(err)
- }
- })
+ var address = txParams.from
+ var metaTx = this.getTx(txParams.metamaskId)
+ var gasMultiplier = metaTx.gasMultiplier
+ var gasPrice = new BN(ethUtil.stripHexPrefix(txParams.gasPrice), 16)
+ gasPrice = gasPrice.mul(new BN(gasMultiplier * 100, 10)).div(new BN(100, 10))
+ txParams.gasPrice = ethUtil.intToHex(gasPrice.toNumber())
+
+ // normalize values
+ txParams.to = normalize(txParams.to)
+ txParams.from = normalize(txParams.from)
+ txParams.value = normalize(txParams.value)
+ txParams.data = normalize(txParams.data)
+ txParams.gasLimit = normalize(txParams.gasLimit || txParams.gas)
+ txParams.nonce = normalize(txParams.nonce)
+ const ethTx = new Transaction(txParams)
+ var txId = txParams.metamaskId
+ return Promise.resolve({ethTx, address, txId})
}
// receives a signed tx object and updates the tx hash