From 9e6136dabafa64db697da8f60c0cc802f643cd9a Mon Sep 17 00:00:00 2001 From: Patricio Date: Mon, 17 May 2021 12:04:27 -0300 Subject: [PATCH] fix: BTC transfer to Legacy address --- src/pages/wallet/transfer.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pages/wallet/transfer.js b/src/pages/wallet/transfer.js index 20b2b451..8c6b85ed 100644 --- a/src/pages/wallet/transfer.js +++ b/src/pages/wallet/transfer.js @@ -921,6 +921,7 @@ 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); @@ -928,12 +929,15 @@ class Transfer extends Component { 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 = { @@ -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,