returning coin data based on coin symbol

This commit is contained in:
Nouman Tahir 2022-02-15 19:10:07 +05:00
parent f2835ac97a
commit f8b0bb1bfa
3 changed files with 34 additions and 1 deletions

View File

@ -32,5 +32,12 @@ const WALLET_TOKENS = [{
notCryptoToken:false
}] as WalletTokenBase[]
export const COIN_SYMBOLS = {
ECENCY:'Ecency',
HIVE:'HIVE',
HBD:'HBD',
HP:'HP'
}
export default WALLET_TOKENS

View File

@ -20,6 +20,7 @@ import { getEstimatedAmount } from '../utils/vote';
// Constants
import ROUTES from '../constants/routeNames';
import { COIN_SYMBOLS } from '../constants/walletTokens';
const HIVE_DROPDOWN = [
'purchase_estm',
@ -274,6 +275,26 @@ const WalletContainer = ({
}
};
//process symbol based data
let balance = 0;
let estimateValue = 0;
let savings = 0;
switch (coinSymbol) {
case COIN_SYMBOLS.HIVE:
balance = hiveBalance;
estimateValue = estimatedHiveValue;
savings = hiveSavingBalance;
break;
case COIN_SYMBOLS.HBD:
balance = hbdBalance;
estimateValue = estimatedHbdValue;
savings = hbdSavingBalance;
break;
default:
break;
}
return (
children &&
children({
@ -310,6 +331,11 @@ const WalletContainer = ({
hivePowerDropdown: HIVE_POWER_DROPDOWN,
unclaimedBalance: unclaimedBalance && unclaimedBalance.trim(),
estimatedAmount,
//symbol based data
balance,
estimateValue,
savings,
})
);
};

View File

@ -153,7 +153,7 @@ const WalletScreen = ({navigation}) => {
const _onPress = () => {
navigation.navigate(ROUTES.SCREENS.COIN_DETAILS, {
coinSymbol:item.tokenSymbol
coinId:item.id
} as CoinDetailsScreenParams)
}