From f8b0bb1bfa68445360c93f229b69764325025aa8 Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Tue, 15 Feb 2022 19:10:07 +0500 Subject: [PATCH] returning coin data based on coin symbol --- src/constants/walletTokens.ts | 7 ++++++ src/containers/walletContainer.js | 26 ++++++++++++++++++++++ src/screens/wallet/screen/walletScreen.tsx | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/constants/walletTokens.ts b/src/constants/walletTokens.ts index 355da76bf..342b3af92 100644 --- a/src/constants/walletTokens.ts +++ b/src/constants/walletTokens.ts @@ -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 \ No newline at end of file diff --git a/src/containers/walletContainer.js b/src/containers/walletContainer.js index 82c612b6b..f2b7fc7c7 100644 --- a/src/containers/walletContainer.js +++ b/src/containers/walletContainer.js @@ -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, }) ); }; diff --git a/src/screens/wallet/screen/walletScreen.tsx b/src/screens/wallet/screen/walletScreen.tsx index 73be950ec..54e6fae50 100644 --- a/src/screens/wallet/screen/walletScreen.tsx +++ b/src/screens/wallet/screen/walletScreen.tsx @@ -153,7 +153,7 @@ const WalletScreen = ({navigation}) => { const _onPress = () => { navigation.navigate(ROUTES.SCREENS.COIN_DETAILS, { - coinSymbol:item.tokenSymbol + coinId:item.id } as CoinDetailsScreenParams) }