Fix transfer token decimal calculation (#3445)

* Fix decimal calculation

* Recalc when shorcutting estimate


Former-commit-id: e7f457cf1b0fa66964320b259a70ae196fff50a7
This commit is contained in:
Jaco Greeff 2016-11-15 22:00:14 +01:00 committed by arkpar
parent a80e19e51e
commit 5a40dba9ab
1 changed files with 8 additions and 1 deletions

View File

@ -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,13 @@ export default class Transfer extends Component {
}
recalculateGas = () => {
if (!this.isValid()) {
this.setState({
gas: '0'
}, this.recalculate);
return;
}
(this.state.isEth
? this._estimateGasEth()
: this._estimateGasToken()