diff options
author | Frankie <frankie.pangilinan@consensys.net> | 2016-10-13 10:35:09 +0800 |
---|---|---|
committer | Frankie <frankie.pangilinan@consensys.net> | 2016-10-14 06:10:29 +0800 |
commit | c400f7c0f6bff13400eedcd80fdc83e572eb42a8 (patch) | |
tree | 2c7baacd4f7439488e53d412ef2daf8fde520878 /ui | |
parent | 229d95956bc36ec413533df00389f8c5127e050b (diff) | |
download | tangerine-wallet-browser-c400f7c0f6bff13400eedcd80fdc83e572eb42a8.tar tangerine-wallet-browser-c400f7c0f6bff13400eedcd80fdc83e572eb42a8.tar.gz tangerine-wallet-browser-c400f7c0f6bff13400eedcd80fdc83e572eb42a8.tar.bz2 tangerine-wallet-browser-c400f7c0f6bff13400eedcd80fdc83e572eb42a8.tar.lz tangerine-wallet-browser-c400f7c0f6bff13400eedcd80fdc83e572eb42a8.tar.xz tangerine-wallet-browser-c400f7c0f6bff13400eedcd80fdc83e572eb42a8.tar.zst tangerine-wallet-browser-c400f7c0f6bff13400eedcd80fdc83e572eb42a8.zip |
Fix gasPrice range
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/actions.js | 2 | ||||
-rw-r--r-- | ui/app/components/pending-tx-details.js | 4 | ||||
-rw-r--r-- | ui/app/components/range-slider.js | 19 | ||||
-rw-r--r-- | ui/app/send.js | 3 |
4 files changed, 12 insertions, 16 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index 0cce9065e..9cacadc0d 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -277,10 +277,10 @@ function signMsg (msgData) { } function signTx (txData) { + _accountManager.setGasMultiplier(txData.gasMultiplier) return (dispatch) => { web3.eth.sendTransaction(txData, (err, data) => { dispatch(actions.hideLoadingIndication()) - if (err) return dispatch(actions.displayWarning(err.message)) dispatch(actions.hideWarning()) dispatch(actions.goHome()) diff --git a/ui/app/components/pending-tx-details.js b/ui/app/components/pending-tx-details.js index 7fa3d6ddd..0f7e20613 100644 --- a/ui/app/components/pending-tx-details.js +++ b/ui/app/components/pending-tx-details.js @@ -29,10 +29,10 @@ PTXP.render = function () { var account = props.accounts[address] var balance = account ? account.balance : '0x0' - var gasMultiplier = txParams.gasMultiplier + var gasMultiplier = txData.gasMultiplier var gasCost = new BN(ethUtil.stripHexPrefix(txParams.gas || txData.estimatedGas), 16) var gasPrice = new BN(ethUtil.stripHexPrefix(txParams.gasPrice || '0x4a817c800'), 16) - gasPrice = new BN(parseFloat(gasPrice.toString()) * gasMultiplier) + gasPrice = gasPrice.mul(new BN(gasMultiplier * 100)).div(new BN(100, 10)) var txFee = gasCost.mul(gasPrice) var txValue = new BN(ethUtil.stripHexPrefix(txParams.value || '0x0'), 16) var maxCost = txValue.add(txFee) diff --git a/ui/app/components/range-slider.js b/ui/app/components/range-slider.js index 6ca6e434e..cc1de1ce5 100644 --- a/ui/app/components/range-slider.js +++ b/ui/app/components/range-slider.js @@ -10,8 +10,9 @@ function RangeSlider () { } RangeSlider.prototype.render = function () { + const state = this.state || {} const props = this.props - const onChange = props.onChange || function () {} + const onInput = props.onInput || function () {} const name = props.name const { min = 0, @@ -33,8 +34,8 @@ RangeSlider.prototype.render = function () { max: max, step: increment, style: range, - defaultValue: defaultValue, - onChange: mirrorInput ? this.mirrorInputs.bind(this, name) : onChange, + value: state.value || defaultValue, + onChange: mirrorInput ? this.mirrorInputs.bind(this, name) : onInput, }), // Mirrored input for range @@ -43,7 +44,7 @@ RangeSlider.prototype.render = function () { name: `${name}Mirror`, min: min, max: max, - defaultValue: defaultValue, + value: state.value || defaultValue, step: increment, style: input, onChange: this.mirrorInputs.bind(this, `${name}Mirror`), @@ -52,12 +53,6 @@ RangeSlider.prototype.render = function () { ) } -RangeSlider.prototype.mirrorInputs = function (active) { - var range = document.querySelector(`input[name="${this.props.name}"]`) - var inputMirror = document.querySelector(`input[name="${this.props.name}Mirror"]`) - if (active === this.props.name) { - inputMirror.value = range.value - } else { - range.value = inputMirror.value - } +RangeSlider.prototype.mirrorInputs = function (active, event) { + this.setState({value: event.target.value}) } diff --git a/ui/app/send.js b/ui/app/send.js index d10c658e3..01c9314ce 100644 --- a/ui/app/send.js +++ b/ui/app/send.js @@ -319,10 +319,11 @@ SendTransactionScreen.prototype.onSubmit = function (gasPrice) { var txParams = { from: this.props.address, value: '0x' + value.toString(16), + gasMultiplier: gasMultiplier * 0.01, } if (recipient) txParams.to = ethUtil.addHexPrefix(recipient) if (txData) txParams.data = txData - txParams.gasMultiplier = gasMultiplier * 0.01 + this.props.dispatch(actions.signTx(txParams)) } |