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

Fix broken Transfer : total account balance #4127

Merged
merged 1 commit into from
Jan 11, 2017
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
8 changes: 6 additions & 2 deletions js/src/modals/Transfer/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { bytesToHex } from '~/api/util/format';
import Contract from '~/api/contract';
import ERRORS from './errors';
import { ERROR_CODES } from '~/api/transport/error';
import { DEFAULT_GAS, MAX_GAS_ESTIMATION } from '~/util/constants';
import { DEFAULT_GAS, DEFAULT_GASPRICE, MAX_GAS_ESTIMATION } from '~/util/constants';
import GasPriceStore from '~/ui/GasPriceEditor/store';
import { getLogger, LOG_KEYS } from '~/config';

Expand Down Expand Up @@ -441,6 +441,8 @@ export default class TransferStore {
const gasTotal = new BigNumber(_gasTotal || 0);
const { valueAll, isEth, isWallet } = this;

log.debug('@getValues', 'gas', gasTotal.toFormat());

if (!valueAll) {
const value = this.getTokenValue();

Expand Down Expand Up @@ -568,6 +570,7 @@ export default class TransferStore {
send () {
const { options, values } = this._getTransferParams();
options.minBlock = new BigNumber(this.minBlock || 0).gt(0) ? this.minBlock : null;
log.debug('@send', 'transfer value', options.value && options.value.toFormat());

return this._getTransferMethod().postTransaction(options, values);
}
Expand Down Expand Up @@ -626,7 +629,8 @@ export default class TransferStore {
options.gas = MAX_GAS_ESTIMATION;
}

const { token } = this.getValues(options.gas);
const gasTotal = new BigNumber(options.gas || DEFAULT_GAS).mul(options.gasPrice || DEFAULT_GASPRICE);
const { token } = this.getValues(gasTotal);

if (isEth && !isWallet && !forceToken) {
options.value = token;
Expand Down