Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
fix: BTC transfer to Legacy address
Browse files Browse the repository at this point in the history
  • Loading branch information
patogallaiovlabs committed May 17, 2021
1 parent e631ff2 commit 9e6136d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/pages/wallet/transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -921,19 +921,23 @@ class Transfer extends Component {
this.setState({ loading: true });
const feeParams = this.getFeeParams();
const extraParams = { data: '', memo, gasFee: feeParams };
let finalToAddress = toAddress;
// In order to send all all balances, we cannot use the amount in the text box to calculate the amount sent, but use the coin balance.
// The amount of the text box is fixed decimal places
let value = new BigNumber(amount);
if (isRequestSendAll) {
if (symbol === 'BTC') {
value = balance.minus(common.convertUnitToCoinAmount(symbol, feeParams.fees, precision));
} else if (symbol === 'RBTC') {
finalToAddress = finalToAddress.toLowercase();
value = balance.minus(common.convertUnitToCoinAmount(symbol, feeParams.gas.times(feeParams.gasPrice), precision));
} else {
finalToAddress = finalToAddress.toLowercase();
value = balance;
}
}
let transaction = new Transaction(coin, toAddress.toLowerCase(), value, extraParams);

let transaction = new Transaction(coin, finalToAddress, value, extraParams);
await transaction.broadcast();
this.setState({ loading: false });
const completedParams = {
Expand Down Expand Up @@ -1217,7 +1221,7 @@ Transfer.propTypes = {
goBack: PropTypes.func.isRequired,
state: PropTypes.shape({
params: PropTypes.shape({
coin: PropTypes.string.isRequired,
coin: PropTypes.shape({}).isRequired,
toAddress: PropTypes.string.isRequired,
}).isRequired,
}).isRequired,
Expand Down

0 comments on commit 9e6136d

Please sign in to comment.