diff options
author | Frankie <frankie.pangilinan@consensys.net> | 2016-10-07 04:03:01 +0800 |
---|---|---|
committer | Frankie <frankie.pangilinan@consensys.net> | 2016-10-11 09:17:56 +0800 |
commit | e1b78da3e6b45037f8b9dacc4385c02c6c892f7c (patch) | |
tree | 0413e9df33ab994f9c015d6c462febd337081c1c /app/scripts/lib | |
parent | a52c497ad10a980ec9e84e1a9dcc5122c236bcc2 (diff) | |
download | tangerine-wallet-browser-e1b78da3e6b45037f8b9dacc4385c02c6c892f7c.tar tangerine-wallet-browser-e1b78da3e6b45037f8b9dacc4385c02c6c892f7c.tar.gz tangerine-wallet-browser-e1b78da3e6b45037f8b9dacc4385c02c6c892f7c.tar.bz2 tangerine-wallet-browser-e1b78da3e6b45037f8b9dacc4385c02c6c892f7c.tar.lz tangerine-wallet-browser-e1b78da3e6b45037f8b9dacc4385c02c6c892f7c.tar.xz tangerine-wallet-browser-e1b78da3e6b45037f8b9dacc4385c02c6c892f7c.tar.zst tangerine-wallet-browser-e1b78da3e6b45037f8b9dacc4385c02c6c892f7c.zip |
Add custom gas field to send page
Diffstat (limited to 'app/scripts/lib')
-rw-r--r-- | app/scripts/lib/id-management.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/scripts/lib/id-management.js b/app/scripts/lib/id-management.js index e250943a0..299998cee 100644 --- a/app/scripts/lib/id-management.js +++ b/app/scripts/lib/id-management.js @@ -7,6 +7,7 @@ */ const ethUtil = require('ethereumjs-util') +const BN = ethUtil.BN const Transaction = require('ethereumjs-tx') module.exports = IdManagement @@ -24,7 +25,13 @@ function IdManagement (opts) { } this.signTx = function (txParams) { + // calculate gas with custom gas multiplier + var gasMultiplier = txParams.gasMultiplier || 1 + delete txParams.gasMultiplier + var gasPrice = parseFloat(new BN(ethUtil.stripHexPrefix(txParams.gasPrice), 16).toString()) * gasMultiplier + txParams.gasPrice = ethUtil.intToHex(parseInt(gasPrice)) // normalize values + txParams.to = ethUtil.addHexPrefix(txParams.to) txParams.from = ethUtil.addHexPrefix(txParams.from) txParams.value = ethUtil.addHexPrefix(txParams.value) |