aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-04-03 13:26:25 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-04-03 13:26:25 +0800
commit89c924101e3ff52849c5a82ced7e058e1fa39dfd (patch)
treeebc5e65345362b9912d893ee70f3d27a4cf4fd3c /app
parent8d49d519c090d287484008346aba1df6d7ad77e7 (diff)
parent0a5c634081656c9450d4341b96bab6b4134a0b7a (diff)
downloadtangerine-wallet-browser-89c924101e3ff52849c5a82ced7e058e1fa39dfd.tar
tangerine-wallet-browser-89c924101e3ff52849c5a82ced7e058e1fa39dfd.tar.gz
tangerine-wallet-browser-89c924101e3ff52849c5a82ced7e058e1fa39dfd.tar.bz2
tangerine-wallet-browser-89c924101e3ff52849c5a82ced7e058e1fa39dfd.tar.lz
tangerine-wallet-browser-89c924101e3ff52849c5a82ced7e058e1fa39dfd.tar.xz
tangerine-wallet-browser-89c924101e3ff52849c5a82ced7e058e1fa39dfd.tar.zst
tangerine-wallet-browser-89c924101e3ff52849c5a82ced7e058e1fa39dfd.zip
Merge branch 'master' into mascara
Diffstat (limited to 'app')
-rw-r--r--app/manifest.json3
-rw-r--r--app/scripts/lib/extension.js5
-rw-r--r--app/scripts/lib/notifications.js4
-rw-r--r--app/scripts/lib/tx-utils.js7
-rw-r--r--app/scripts/migrations/index.js1
-rw-r--r--app/scripts/transaction-manager.js20
6 files changed, 30 insertions, 10 deletions
diff --git a/app/manifest.json b/app/manifest.json
index 75e72c295..a3242149b 100644
--- a/app/manifest.json
+++ b/app/manifest.json
@@ -57,7 +57,8 @@
"permissions": [
"storage",
"clipboardWrite",
- "http://localhost:8545/"
+ "http://localhost:8545/",
+ "https://www.cryptonator.com/"
],
"web_accessible_resources": [
"scripts/inpage.js"
diff --git a/app/scripts/lib/extension.js b/app/scripts/lib/extension.js
index 4b670490f..6f8b5d800 100644
--- a/app/scripts/lib/extension.js
+++ b/app/scripts/lib/extension.js
@@ -11,4 +11,7 @@
*/
const Extension = require('./extension-instance')
-module.exports = new Extension()
+const instance = new Extension()
+window.METAMASK_EXTENSION = instance
+module.exports = instance
+
diff --git a/app/scripts/lib/notifications.js b/app/scripts/lib/notifications.js
index 3db1ac6b5..0ec01f3a7 100644
--- a/app/scripts/lib/notifications.js
+++ b/app/scripts/lib/notifications.js
@@ -22,10 +22,12 @@ function show () {
extension.windows.create({
url: 'notification.html',
type: 'popup',
- focused: true,
width,
height,
})
+ .catch((reason) => {
+ log.error('failed to create poupup', reason)
+ })
}
})
}
diff --git a/app/scripts/lib/tx-utils.js b/app/scripts/lib/tx-utils.js
index 72df53631..e8e23f8b5 100644
--- a/app/scripts/lib/tx-utils.js
+++ b/app/scripts/lib/tx-utils.js
@@ -63,14 +63,15 @@ module.exports = class txProviderUtils {
addGasBuffer (initialGasLimitHex, blockGasLimitHex) {
const initialGasLimitBn = hexToBn(initialGasLimitHex)
const blockGasLimitBn = hexToBn(blockGasLimitHex)
+ const upperGasLimitBn = blockGasLimitBn.muln(0.9)
const bufferedGasLimitBn = initialGasLimitBn.muln(1.5)
// if initialGasLimit is above blockGasLimit, dont modify it
- if (initialGasLimitBn.gt(blockGasLimitBn)) return bnToHex(initialGasLimitBn)
+ if (initialGasLimitBn.gt(upperGasLimitBn)) return bnToHex(initialGasLimitBn)
// if bufferedGasLimit is below blockGasLimit, use bufferedGasLimit
- if (bufferedGasLimitBn.lt(blockGasLimitBn)) return bnToHex(bufferedGasLimitBn)
+ if (bufferedGasLimitBn.lt(upperGasLimitBn)) return bnToHex(bufferedGasLimitBn)
// otherwise use blockGasLimit
- return bnToHex(blockGasLimitBn)
+ return bnToHex(upperGasLimitBn)
}
fillInTxParams (txParams, cb) {
diff --git a/app/scripts/migrations/index.js b/app/scripts/migrations/index.js
index a3dd48c17..019b4d13d 100644
--- a/app/scripts/migrations/index.js
+++ b/app/scripts/migrations/index.js
@@ -22,4 +22,5 @@ module.exports = [
require('./009'),
require('./010'),
require('./011'),
+ require('./012'),
]
diff --git a/app/scripts/transaction-manager.js b/app/scripts/transaction-manager.js
index a70159680..d7051b2cb 100644
--- a/app/scripts/transaction-manager.js
+++ b/app/scripts/transaction-manager.js
@@ -205,11 +205,23 @@ module.exports = class TransactionManager extends EventEmitter {
})
}
+ getChainId() {
+ const networkState = this.networkStore.getState()
+ const getChainId = parseInt(networkState.network)
+ if (Number.isNaN(getChainId)) {
+ return 0
+ } else {
+ return getChainId
+ }
+ }
+
signTransaction (txId, cb) {
- let txMeta = this.getTx(txId)
- let txParams = txMeta.txParams
- let fromAddress = txParams.from
- let ethTx = this.txProviderUtils.buildEthTxFromParams(txParams)
+ const txMeta = this.getTx(txId)
+ const txParams = txMeta.txParams
+ const fromAddress = txParams.from
+ // add network/chain id
+ txParams.chainId = this.getChainId()
+ const ethTx = this.txProviderUtils.buildEthTxFromParams(txParams)
this.signEthTx(ethTx, fromAddress).then(() => {
this.setTxStatusSigned(txMeta.id)
cb(null, ethUtil.bufferToHex(ethTx.serialize()))