mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 12:51:42 +03:00
balances corrected on transfer screens
This commit is contained in:
parent
f462546f07
commit
5afc3cee22
@ -201,21 +201,17 @@ const WalletContainer = ({
|
||||
const _navigate = async (transferType, fundType) => {
|
||||
let balance;
|
||||
|
||||
switch (fundType) {
|
||||
case 'STEEM':
|
||||
balance = Math.round(walletData.balance * 1000) / 1000;
|
||||
break;
|
||||
case 'SBD':
|
||||
balance = Math.round(walletData.sbdBalance * 1000) / 1000;
|
||||
break;
|
||||
case 'SAVING_STEEM':
|
||||
balance = Math.round(walletData.savingBalance * 1000) / 1000;
|
||||
break;
|
||||
case 'SAVING_SBD':
|
||||
balance = Math.round(walletData.savingBalanceSbd * 1000) / 1000;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if (transferType === 'transfer_token' && fundType === 'STEEM') {
|
||||
balance = Math.round(walletData.balance * 1000) / 1000;
|
||||
}
|
||||
if (transferType === 'transfer_token' && fundType === 'SBD') {
|
||||
balance = Math.round(walletData.sbdBalance * 1000) / 1000;
|
||||
}
|
||||
if (transferType === 'withdraw_steem' && fundType === 'STEEM') {
|
||||
balance = Math.round(walletData.savingBalance * 1000) / 1000;
|
||||
}
|
||||
if (transferType === 'withdraw_sbd' && fundType === 'SBD') {
|
||||
balance = Math.round(walletData.savingBalanceSbd * 1000) / 1000;
|
||||
}
|
||||
|
||||
if (isPinCodeOpen) {
|
||||
|
@ -34,6 +34,8 @@ class TransferContainer extends Component {
|
||||
super(props);
|
||||
this.state = {
|
||||
fundType: props.navigation.getParam('fundType', ''),
|
||||
balance: props.navigation.getParam('balance', ''),
|
||||
transferType: props.navigation.getParam('transferType', ''),
|
||||
selectedAccount: props.currentAccount,
|
||||
};
|
||||
}
|
||||
@ -63,33 +65,28 @@ class TransferContainer extends Component {
|
||||
};
|
||||
|
||||
fetchBalance = username => {
|
||||
const { fundType } = this.state;
|
||||
const { fundType, transferType } = this.state;
|
||||
|
||||
getAccount(username).then(async account => {
|
||||
let balance;
|
||||
switch (fundType) {
|
||||
case 'STEEM':
|
||||
balance = account[0].balance.replace(fundType, '');
|
||||
break;
|
||||
case 'SBD':
|
||||
balance = account[0].sbd_balance.replace(fundType, '');
|
||||
break;
|
||||
case 'ESTM':
|
||||
this._getUserPointsBalance(username);
|
||||
break;
|
||||
case 'SAVING_STEEM':
|
||||
this.setState({ fundType: 'STEEM' });
|
||||
balance = account[0].savings_balance.replace(' STEEM', '');
|
||||
break;
|
||||
case 'SAVING_SBD':
|
||||
this.setState({ fundType: 'STEEM DOLLAR' });
|
||||
balance = account[0].savings_sbd_balance.replace(' SBD', '');
|
||||
break;
|
||||
case 'STEEM_POWER':
|
||||
balance = account[0].balance.replace(fundType, '');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
if (transferType === 'transfer_token' && fundType === 'STEEM') {
|
||||
balance = account[0].balance.replace(fundType, '');
|
||||
}
|
||||
if (transferType === 'transfer_token' && fundType === 'SBD') {
|
||||
balance = account[0].sbd_balance.replace(fundType, '');
|
||||
}
|
||||
if (transferType === 'points' && fundType === 'ESTM') {
|
||||
this._getUserPointsBalance(username);
|
||||
}
|
||||
if (transferType === 'transfer_to_saving' && fundType === 'STEEM') {
|
||||
balance = account[0].balance.replace(fundType, '');
|
||||
}
|
||||
if (transferType === 'transfer_to_saving' && fundType === 'SBD') {
|
||||
balance = account[0].sbd_balance.replace(fundType, '');
|
||||
}
|
||||
if (transferType === 'powerUp' && fundType === 'STEEM') {
|
||||
balance = account[0].balance.replace(fundType, '');
|
||||
}
|
||||
|
||||
const local = await getUserDataWithUsername(username);
|
||||
|
@ -31,10 +31,19 @@ class TransferView extends Component {
|
||||
super(props);
|
||||
this.state = {
|
||||
from: props.currentAccountName,
|
||||
destination: props.transferType === 'powerUp' ? props.currentAccountName : '',
|
||||
destination:
|
||||
props.transferType === 'powerUp' ||
|
||||
props.transferType === 'withdraw_steem' ||
|
||||
props.transferType === 'withdraw_steem'
|
||||
? props.currentAccountName
|
||||
: '',
|
||||
amount: '',
|
||||
memo: '',
|
||||
isUsernameValid: !!(props.transferType === 'powerUp' && props.currentAccountName),
|
||||
isUsernameValid: !!(
|
||||
props.transferType === 'powerUp' ||
|
||||
props.transferType === 'withdraw_steem' ||
|
||||
(props.transferType === 'withdraw_steem' && props.currentAccountName)
|
||||
),
|
||||
steemConnectTransfer: false,
|
||||
isTransfering: false,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user