From bdcce0532e7cfce9e1a3bba16bc8c62072859e24 Mon Sep 17 00:00:00 2001 From: Harsh Date: Fri, 20 Oct 2023 09:50:27 +0530 Subject: [PATCH 1/3] fix(ui-ux): fixed Send screen displays no assets displayed issue --- mobile-app/app/contexts/EVMProvider.tsx | 2 +- .../screens/Portfolio/hooks/EvmTokenBalances.ts | 2 +- .../screens/Portfolio/screens/SendScreen.tsx | 2 +- .../screens/Portfolio/screens/TokenSelectionScreen.tsx | 9 +++++++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mobile-app/app/contexts/EVMProvider.tsx b/mobile-app/app/contexts/EVMProvider.tsx index 45c838d88d..3b42f1c3fe 100644 --- a/mobile-app/app/contexts/EVMProvider.tsx +++ b/mobile-app/app/contexts/EVMProvider.tsx @@ -44,7 +44,7 @@ export function EVMProvider({ useEffect(() => { getProvider(); - }, [ethRpcUrl]); + }, [network, ethRpcUrl]); const client = useMemo( () => ({ diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/hooks/EvmTokenBalances.ts b/mobile-app/app/screens/AppNavigator/screens/Portfolio/hooks/EvmTokenBalances.ts index 600b7d8133..a69cb8574d 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/hooks/EvmTokenBalances.ts +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/hooks/EvmTokenBalances.ts @@ -112,7 +112,7 @@ export function useEvmTokenBalances(): { evmTokens: WalletToken[] } { ); }); } - }, [network, evmAddress, blockCount, isFocused]); + }, [network, evmAddress, blockCount, isFocused, provider]); useEffect(() => { setAllTokensWithAddress( diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/SendScreen.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/SendScreen.tsx index 181dea740c..9302162ed9 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/SendScreen.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/SendScreen.tsx @@ -234,7 +234,7 @@ export function SendScreen({ route, navigation }: Props): JSX.Element { setToken({ ...t, amount: - t.displaySymbol === "DFI" + t.displaySymbol === "DFI" && t.id !== "0_evm" ? BigNumber.max( new BigNumber(t.amount).minus(reservedDFI), 0, diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/TokenSelectionScreen.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/TokenSelectionScreen.tsx index 65c4ac8720..079a56cb2a 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/TokenSelectionScreen.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/TokenSelectionScreen.tsx @@ -315,11 +315,16 @@ function getTokensWithBalance( tokens.forEach((t) => { const available = new BigNumber( - t.displaySymbol === "DFI" + t.displaySymbol === "DFI" && t.id !== "0_evm" ? new BigNumber(t.amount).minus(reservedFees).toFixed(8) : t.amount, ); - if (available.isLessThan(0) || t.id === "0" || t.id === "0_utxo") { + if ( + available.isLessThan(0) || + t.id === "0" || + t.id === "0_utxo" || + t.id === "0_evm" + ) { return; } From f5a52e910e13cb017b81a153fc8653e85a8dd926 Mon Sep 17 00:00:00 2001 From: Harsh Date: Fri, 20 Oct 2023 10:53:35 +0530 Subject: [PATCH 2/3] updated token listing condition --- .../screens/Portfolio/screens/TokenSelectionScreen.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/TokenSelectionScreen.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/TokenSelectionScreen.tsx index 8906fa9330..2d492a3d0d 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/TokenSelectionScreen.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/TokenSelectionScreen.tsx @@ -324,12 +324,8 @@ function getTokensWithBalance( ? new BigNumber(t.amount).minus(reservedFees).toFixed(8) : t.amount, ); - if ( - available.isLessThan(0) || - t.id === "0" || - t.id === "0_utxo" || - t.id === "0_evm" - ) { + + if (available.isLessThanOrEqualTo(0) || t.id === "0" || t.id === "0_utxo") { return; } From e76986ff83d0e7607a12406dfd09a6412f36b537 Mon Sep 17 00:00:00 2001 From: Harsh Date: Fri, 20 Oct 2023 11:08:53 +0530 Subject: [PATCH 3/3] fixed token detail screen to hide load data in evm domain --- .../Portfolio/screens/TokenDetailScreen.tsx | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/TokenDetailScreen.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/TokenDetailScreen.tsx index 1b25bd3d90..e3ebf76c89 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/TokenDetailScreen.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/TokenDetailScreen.tsx @@ -131,7 +131,7 @@ export function TokenDetailScreen({ route, navigation }: Props): JSX.Element { // usdAmount for crypto tokens, undefined for DFI token const { usdAmount } = route.params.token; - + const isEvmDomain = domain === DomainType.EVM; const onNavigateLiquidity = ({ destination, pair, @@ -186,21 +186,23 @@ export function TokenDetailScreen({ route, navigation }: Props): JSX.Element { token={token} border usdAmount={usdAmount ?? new BigNumber(0)} - isEvmDomain={domain === DomainType.EVM} + isEvmDomain={isEvmDomain} /> - + {!isEvmDomain && ( + + )} {token.symbol === "DFI" && token.id !== "0_evm" && (