From f23eaa97f479cd64707bf831304f60f2d9750306 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Tue, 15 Nov 2016 11:25:37 +0100 Subject: [PATCH 1/2] Fix decimal calculation --- js/src/modals/Transfer/transfer.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/src/modals/Transfer/transfer.js b/js/src/modals/Transfer/transfer.js index 506e91930b9..413d242589d 100644 --- a/js/src/modals/Transfer/transfer.js +++ b/js/src/modals/Transfer/transfer.js @@ -314,7 +314,7 @@ export default class Transfer extends Component { } const token = balance.tokens.find((balance) => balance.token.tag === tag).token; - const s = new BigNumber(num).mul(token.format || 1).toString(); + const s = new BigNumber(num).mul(token.format || 1).toFixed(); if (s.indexOf('.') !== -1) { return ERRORS.invalidDecimals; @@ -516,6 +516,10 @@ export default class Transfer extends Component { } recalculateGas = () => { + if (!this.isValid()) { + return; + } + (this.state.isEth ? this._estimateGasEth() : this._estimateGasToken() From 687094b34c041e046c70bbd5440e41bb57a24296 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Tue, 15 Nov 2016 11:39:56 +0100 Subject: [PATCH 2/2] Recalc when shorcutting estimate --- js/src/modals/Transfer/transfer.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/src/modals/Transfer/transfer.js b/js/src/modals/Transfer/transfer.js index 413d242589d..d27fdd2b4c1 100644 --- a/js/src/modals/Transfer/transfer.js +++ b/js/src/modals/Transfer/transfer.js @@ -517,6 +517,9 @@ export default class Transfer extends Component { recalculateGas = () => { if (!this.isValid()) { + this.setState({ + gas: '0' + }, this.recalculate); return; }