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

Fix transfer token decimal calculation #3445

Merged
merged 2 commits into from
Nov 15, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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