Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Fix transfer token decimal calculation (#3445)
Browse files Browse the repository at this point in the history
* Fix decimal calculation

* Recalc when shorcutting estimate
  • Loading branch information
jacogr authored and arkpar committed Nov 15, 2016
1 parent 3addae9 commit df90137
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion js/src/modals/Transfer/transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit df90137

Please sign in to comment.