From e9dae2a75bc99b53bc0b7bfc12fd14dec324b7e7 Mon Sep 17 00:00:00 2001 From: Harsh Date: Thu, 3 Aug 2023 12:16:07 +0530 Subject: [PATCH 1/7] fix(ui-ux): fixed domain switch toggle --- mobile-app/app/components/DomainSwitch.tsx | 30 ++++++++++------------ 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/mobile-app/app/components/DomainSwitch.tsx b/mobile-app/app/components/DomainSwitch.tsx index ed01cae9ca..d78623ca06 100644 --- a/mobile-app/app/components/DomainSwitch.tsx +++ b/mobile-app/app/components/DomainSwitch.tsx @@ -4,7 +4,6 @@ import { getNativeIcon } from "@components/icons/assets"; import { useThemeContext } from "@waveshq/walletkit-ui"; import React from "react"; import { useDomainContext, DomainType } from "@contexts/DomainContext"; -import { DomainPersistence } from "@api"; import { tailwind } from "@tailwind"; import { LinearGradient } from "expo-linear-gradient"; @@ -14,21 +13,23 @@ export function DomainSwitch({ testID }: { testID: string }): JSX.Element { const DFIIcon = getNativeIcon("DFIlogo"); const EvmDFIIcon = getNativeIcon("EvmDFI"); + const toggleDomain = async () => { + await setDomain( + domain === DomainType.DFI ? DomainType.EVM : DomainType.DFI + ); + }; return ( - {domain === DomainType.DFI && ( - { - setDomain(DomainType.EVM); - await DomainPersistence.set(domain); - }} + - + )} {domain === DomainType.EVM && ( - { - setDomain(DomainType.DFI); - await DomainPersistence.set(domain); - }} + - + )} - + ); } From 34005db304a5454bc1cc952ef4d477101add5ef6 Mon Sep 17 00:00:00 2001 From: Harsh Date: Thu, 3 Aug 2023 12:59:17 +0530 Subject: [PATCH 2/7] added testcse --- mobile-app/app/components/DomainSwitch.tsx | 2 ++ .../screens/Portfolio/PortfolioScreen.tsx | 1 + .../wallet/portfolio/addresses.spec.ts | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/mobile-app/app/components/DomainSwitch.tsx b/mobile-app/app/components/DomainSwitch.tsx index d78623ca06..d025155c1f 100644 --- a/mobile-app/app/components/DomainSwitch.tsx +++ b/mobile-app/app/components/DomainSwitch.tsx @@ -49,6 +49,7 @@ export function DomainSwitch({ testID }: { testID: string }): JSX.Element { "text-white": isLight, "text-black": !isLight, })} + testID={`${testID}_DFI`} > DFI @@ -80,6 +81,7 @@ export function DomainSwitch({ testID }: { testID: string }): JSX.Element { style={tailwind( "text-mono-light-v2-00 text-xs ml-1 font-normal-v2" )} + testID={`${testID}_EVM`} > EVM diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/PortfolioScreen.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/PortfolioScreen.tsx index 36f45ed0f5..dcaa2d9a97 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/PortfolioScreen.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/PortfolioScreen.tsx @@ -537,6 +537,7 @@ export function PortfolioScreen({ navigation }: Props): JSX.Element { style={tailwind("text-xs font-normal-v2 pr-1")} dark={tailwind("text-mono-dark-v2-700")} light={tailwind("text-mono-light-v2-700")} + testID="bottomsheet-address-header" > {domain} diff --git a/mobile-app/cypress/e2e/functional/wallet/portfolio/addresses.spec.ts b/mobile-app/cypress/e2e/functional/wallet/portfolio/addresses.spec.ts index 7d08d3e21c..96d184d840 100644 --- a/mobile-app/cypress/e2e/functional/wallet/portfolio/addresses.spec.ts +++ b/mobile-app/cypress/e2e/functional/wallet/portfolio/addresses.spec.ts @@ -48,6 +48,7 @@ context("Wallet - Addresses", () => { cy.getByTestID("active_address") .invoke("css", "text-overflow") .should("eq", "ellipsis"); + cy.getByTestID("bottomsheet-address-header").contains("DFI"); cy.getByTestID("active_address").click(); cy.getByTestID("wallet_toast").should("exist"); }); @@ -71,6 +72,24 @@ context("Wallet - Addresses", () => { }); }); + it("should show EVM address when toggle set to EVM", () => { + cy.getByTestID("header_settings").click(); + cy.getByTestID("address_book_title").click(); + cy.getByTestID("address_button_group_YOUR_ADDRESS").click(); + cy.getByTestID("address_row_text_0_YOUR_ADDRESS_EVM") + .invoke("text") + .then((evmAddress: string) => { + cy.getByTestID("bottom_tab_portfolio").click(); + cy.getByTestID("domain_switch_DFI").should("exist"); + cy.getByTestID("domain_switch").click(); + cy.getByTestID("domain_switch_EVM").should("exist"); + cy.getByTestID("switch_account_button").click(); + cy.getByTestID("address_row_text_0").contains(evmAddress); + cy.getByTestID("bottomsheet-address-header").contains("EVM"); + cy.getByTestID("close_bottom_sheet_button").click(); + }); + }); + it("should be able to create new address when all available address are active", () => { cy.sendDFItoWallet().wait(4000); cy.getByTestID("dfi_total_balance_amount") From ca69d1aa1170d20d059702e62f0d7efec76f9e63 Mon Sep 17 00:00:00 2001 From: Harsh Date: Thu, 3 Aug 2023 13:46:49 +0530 Subject: [PATCH 3/7] updated DFI to DVM --- mobile-app/app/components/DomainSwitch.tsx | 6 +++--- .../AppNavigator/screens/Portfolio/PortfolioScreen.tsx | 2 +- .../e2e/functional/wallet/portfolio/addresses.spec.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mobile-app/app/components/DomainSwitch.tsx b/mobile-app/app/components/DomainSwitch.tsx index d025155c1f..f0577b1504 100644 --- a/mobile-app/app/components/DomainSwitch.tsx +++ b/mobile-app/app/components/DomainSwitch.tsx @@ -45,13 +45,13 @@ export function DomainSwitch({ testID }: { testID: string }): JSX.Element { - DFI + DVM diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/PortfolioScreen.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/PortfolioScreen.tsx index dcaa2d9a97..122657eae1 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/PortfolioScreen.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/PortfolioScreen.tsx @@ -539,7 +539,7 @@ export function PortfolioScreen({ navigation }: Props): JSX.Element { light={tailwind("text-mono-light-v2-700")} testID="bottomsheet-address-header" > - {domain} + {domain === DomainType.EVM ? "EVM" : "DVM"} { cy.getByTestID("active_address") .invoke("css", "text-overflow") .should("eq", "ellipsis"); - cy.getByTestID("bottomsheet-address-header").contains("DFI"); + cy.getByTestID("bottomsheet-address-header").contains("DVM"); cy.getByTestID("active_address").click(); cy.getByTestID("wallet_toast").should("exist"); }); @@ -80,7 +80,7 @@ context("Wallet - Addresses", () => { .invoke("text") .then((evmAddress: string) => { cy.getByTestID("bottom_tab_portfolio").click(); - cy.getByTestID("domain_switch_DFI").should("exist"); + cy.getByTestID("domain_switch_DVM").should("exist"); cy.getByTestID("domain_switch").click(); cy.getByTestID("domain_switch_EVM").should("exist"); cy.getByTestID("switch_account_button").click(); From 991667ecb85ef937c9be02b465f11a9404332876 Mon Sep 17 00:00:00 2001 From: Harsh Date: Thu, 3 Aug 2023 14:35:06 +0530 Subject: [PATCH 4/7] updated DFI to DVM in enum --- mobile-app/app/components/DomainSwitch.tsx | 4 ++-- .../app/components/WalletAddressRow.test.tsx | 2 +- mobile-app/app/contexts/DomainContext.tsx | 6 +++--- .../app/contexts/__mocks__/DomainContext.tsx | 7 +------ .../screens/Portfolio/PortfolioScreen.tsx | 6 +++--- .../components/AddressListEditButton.test.tsx | 2 +- .../components/AddressSelectionButton.test.tsx | 2 +- .../components/BottomSheetAddressDetailV2.tsx | 4 ++-- .../components/CreateOrEditAddressLabelForm.tsx | 2 +- .../Portfolio/components/PortfolioCard.tsx | 4 ++-- .../Portfolio/components/TotalPortfolio.tsx | 3 +-- .../screens/AddOrEditAddressBookScreen.tsx | 6 +++--- .../Portfolio/screens/AddressBookScreen.tsx | 2 +- .../screens/ConvertConfirmationScreen.tsx | 8 ++++---- .../screens/Portfolio/screens/ConvertScreen.tsx | 16 ++++++++-------- .../Portfolio/screens/OCG/CFPDetailScreen.tsx | 2 +- .../screens/Portfolio/screens/SendScreen.tsx | 2 +- shared/store/userPreferences.ts | 2 +- 18 files changed, 37 insertions(+), 43 deletions(-) diff --git a/mobile-app/app/components/DomainSwitch.tsx b/mobile-app/app/components/DomainSwitch.tsx index f0577b1504..056db1ab50 100644 --- a/mobile-app/app/components/DomainSwitch.tsx +++ b/mobile-app/app/components/DomainSwitch.tsx @@ -15,7 +15,7 @@ export function DomainSwitch({ testID }: { testID: string }): JSX.Element { const toggleDomain = async () => { await setDomain( - domain === DomainType.DFI ? DomainType.EVM : DomainType.DFI + domain === DomainType.DVM ? DomainType.EVM : DomainType.DVM ); }; return ( @@ -28,7 +28,7 @@ export function DomainSwitch({ testID }: { testID: string }): JSX.Element { onPress={toggleDomain} testID={testID} > - {domain === DomainType.DFI && ( + {domain === DomainType.DVM && ( { bar: { address: "bar", label: "bar", - addressDomainType: DomainType.DFI, + addressDomainType: DomainType.DVM, }, }, }, diff --git a/mobile-app/app/contexts/DomainContext.tsx b/mobile-app/app/contexts/DomainContext.tsx index 74069de291..b715fc0cfe 100644 --- a/mobile-app/app/contexts/DomainContext.tsx +++ b/mobile-app/app/contexts/DomainContext.tsx @@ -20,12 +20,12 @@ interface DomainContextI { } export enum DomainType { - DFI = "DFI", + DVM = "DVM", EVM = "EVM", } export function useDomain({ api }: DomainContextI): DomainLoader { - const defaultDomain = DomainType.DFI; + const defaultDomain = DomainType.DVM; const logger = useLogger(); const [isDomainLoaded, setIsDomainLoaded] = useState(false); const [domain, setDomain] = useState>(defaultDomain); @@ -79,7 +79,7 @@ export function DomainProvider( setDomain(DomainType.EVM); break; default: - setDomain(DomainType.DFI); + setDomain(DomainType.DVM); } }, [currentDomain]); diff --git a/mobile-app/app/contexts/__mocks__/DomainContext.tsx b/mobile-app/app/contexts/__mocks__/DomainContext.tsx index dbf9684ecd..3581a72376 100644 --- a/mobile-app/app/contexts/__mocks__/DomainContext.tsx +++ b/mobile-app/app/contexts/__mocks__/DomainContext.tsx @@ -1,10 +1,5 @@ -export enum DomainType { - DFI = "DFI", - EVM = "EVM", -} - export const useDomainContext = () => { return { - domain: "DFI", + domain: "DVM", }; }; diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/PortfolioScreen.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/PortfolioScreen.tsx index 122657eae1..720858f4d7 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/PortfolioScreen.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/PortfolioScreen.tsx @@ -539,7 +539,7 @@ export function PortfolioScreen({ navigation }: Props): JSX.Element { light={tailwind("text-mono-light-v2-700")} testID="bottomsheet-address-header" > - {domain === DomainType.EVM ? "EVM" : "DVM"} + {domain} - {domain === DomainType.DFI && } + {domain === DomainType.DVM && } - {domain === DomainType.DFI && ( + {domain === DomainType.DVM && ( { bar: { address: "bar", label: "bar", - addressDomainType: DomainType.DFI, + addressDomainType: DomainType.DVM, }, }, }, diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/AddressSelectionButton.test.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/AddressSelectionButton.test.tsx index 2fb7488133..5800479cef 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/AddressSelectionButton.test.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/AddressSelectionButton.test.tsx @@ -22,7 +22,7 @@ describe("Address Selection Button", () => { bar: { address: "bar", label: "bar", - addressDomainType: DomainType.DFI, + addressDomainType: DomainType.DVM, }, }, }, diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/BottomSheetAddressDetailV2.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/BottomSheetAddressDetailV2.tsx index 8b811e0a57..cfebc2d662 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/BottomSheetAddressDetailV2.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/BottomSheetAddressDetailV2.tsx @@ -204,7 +204,7 @@ export const BottomSheetAddressDetailV2 = ( const hasLabel = labeledAddresses?.[item.dfi]?.label != null && labeledAddresses?.[item.dfi]?.label !== ""; - const displayAddress = domain === DomainType.DFI ? item.dfi : item.evm; + const displayAddress = domain === DomainType.EVM ? item.evm : item.dfi; return ( )} state.wallet); const { domain } = useDomainContext(); - const isEvmDomain = domain !== DomainType.DFI; const { hasFetchedVaultsData } = useSelector( (state: RootState) => state.loans ); @@ -124,7 +123,7 @@ export function TotalPortfolio(props: TotalPortfolioProps): JSX.Element { } /> - {domain === DomainType.DFI && ( + {domain === DomainType.DVM && ( setIsExpanded(!isExpanded)} diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/AddOrEditAddressBookScreen.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/AddOrEditAddressBookScreen.tsx index 4dd86d06bd..0dd3a95ddf 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/AddOrEditAddressBookScreen.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/AddOrEditAddressBookScreen.tsx @@ -61,7 +61,7 @@ export function AddOrEditAddressBookScreen({ const AddressDomains = [ { label: "DeFiChain (DVM)", - value: DomainType.DFI, + value: DomainType.DVM, }, { label: "MetaChain (EVM)", @@ -70,7 +70,7 @@ export function AddOrEditAddressBookScreen({ ]; const [selectedAddressDomainType, setSelectedAddressDomainType] = useState( - addressDomainType ?? DomainType.DFI + addressDomainType ?? DomainType.DVM ); const validateLabelInput = (input: string): boolean => { @@ -103,7 +103,7 @@ export function AddOrEditAddressBookScreen({ const addressType = getAddressType(input, networkName); if ( addressType === undefined || - (selectedAddressDomainType === DomainType.DFI && + (selectedAddressDomainType === DomainType.DVM && addressType === AddressType.ETH) || (selectedAddressDomainType === DomainType.EVM && addressType !== AddressType.ETH) diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/AddressBookScreen.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/AddressBookScreen.tsx index 33d2c2b9f2..aef8d7cf34 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/AddressBookScreen.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/AddressBookScreen.tsx @@ -68,7 +68,7 @@ export function AddressBookScreen({ route, navigation }: Props): JSX.Element { selectedAddress, onAddressSelect, disabledTab, - addressDomainType = DomainType.DFI, + addressDomainType = DomainType.DVM, } = route.params; const { isLight } = useThemeContext(); const { network } = useNetworkContext(); diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/ConvertConfirmationScreen.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/ConvertConfirmationScreen.tsx index 653d3ea0dc..aeaef72f91 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/ConvertConfirmationScreen.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/ConvertConfirmationScreen.tsx @@ -215,7 +215,7 @@ export function ConvertConfirmationScreen({ route }: Props): JSX.Element { lhs={{ value: translate( "screens/ConvertConfirmScreen", - domain === DomainType.DFI + domain === DomainType.DVM ? "Resulting UTXO" : "Resulting Tokens (EVM)" ), @@ -227,7 +227,7 @@ export function ConvertConfirmationScreen({ route }: Props): JSX.Element { }} rhs={{ value: getResultingValue( - domain === DomainType.DFI + domain === DomainType.DVM ? ConvertTokenUnit.UTXO : ConvertTokenUnit.EVMDFI, fee, @@ -236,7 +236,7 @@ export function ConvertConfirmationScreen({ route }: Props): JSX.Element { targetBalance, targetUnit ), - suffix: domain === DomainType.DFI ? " DFI" : "", + suffix: domain === DomainType.DVM ? " DFI" : "", testID: "resulting_utxo_value", themedProps: { light: tailwind("text-mono-light-v2-900 font-semibold-v2"), @@ -244,7 +244,7 @@ export function ConvertConfirmationScreen({ route }: Props): JSX.Element { }, subValue: { value: getResultingPercentage( - domain === DomainType.DFI + domain === DomainType.DVM ? ConvertTokenUnit.UTXO : ConvertTokenUnit.EVMDFI, sourceBalance, diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/ConvertScreen.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/ConvertScreen.tsx index 4fac4da047..3c34d8aba3 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/ConvertScreen.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/ConvertScreen.tsx @@ -292,7 +292,7 @@ export function ConvertScreen(props: Props): JSX.Element { /> - {domain === DomainType.DFI && ( + {domain === DomainType.DVM && ( - {domain === DomainType.DFI && ( + {domain === DomainType.DVM && ( - {`${translate( + {translate( "screens/ConvertScreen", "Review full details in the next screen" - )}`} + )} )} @@ -616,9 +616,9 @@ function ConversionResultCard(props: { light={tailwind("text-mono-light-v2-500")} dark={tailwind("text-mono-dark-v2-500")} > - {`${translate("screens/ConvertScreen", "Available {{unit}}", { + {translate("screens/ConvertScreen", "Available {{unit}}", { unit: translate("screens/ConvertScreen", props.unit), - })}`} + })} - {`${translate("screens/ConvertScreen", "Resulting {{unit}}", { + {translate("screens/ConvertScreen", "Resulting {{unit}}", { unit: translate("screens/ConvertScreen", props.unit), - })}`} + })} Date: Thu, 3 Aug 2023 14:48:10 +0530 Subject: [PATCH 5/7] updated dfi to dvm in useWalletAddress --- mobile-app/app/components/InputHelperText.tsx | 4 ++-- mobile-app/app/hooks/useWalletAddress.ts | 6 ++--- .../PoolPairCards/PoolPairCards.tsx | 4 ++-- .../Portfolio/components/AddressRow.tsx | 4 ++-- .../components/BottomSheetAddressDetailV2.tsx | 24 +++++++++---------- .../CreateOrEditAddressLabelForm.tsx | 2 +- .../screens/AddOrEditAddressBookScreen.tsx | 2 +- .../Portfolio/screens/AddressBookScreen.tsx | 10 ++++---- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/mobile-app/app/components/InputHelperText.tsx b/mobile-app/app/components/InputHelperText.tsx index 01b3af005a..f1ae18a447 100644 --- a/mobile-app/app/components/InputHelperText.tsx +++ b/mobile-app/app/components/InputHelperText.tsx @@ -31,7 +31,7 @@ export function InputHelperText(props: InputHelperTextProps): JSX.Element { dark={tailwind("text-gray-500")} style={[tailwind("text-sm"), props.labelStyleProps]} > - {`${props.label}`} + {props.label} - {`${props.label}`} + {props.label} e.dfi === address || e.evm === address + (e: WalletAddressI) => e.dvm === address || e.evm === address ); if (address !== undefined && addressObj) { // wallet address that does not have a label setMatchedAddress({ - address: addressObj.dfi, + address: addressObj.dvm, evmAddress: addressObj.evm, label: "", }); diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/BottomSheetAddressDetailV2.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/BottomSheetAddressDetailV2.tsx index cfebc2d662..506bc6d0ec 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/BottomSheetAddressDetailV2.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/BottomSheetAddressDetailV2.tsx @@ -200,14 +200,14 @@ export const BottomSheetAddressDetailV2 = ( item: WalletAddressI; index: number; }): JSX.Element => { - const isSelected = item.dfi === props.address; + const isSelected = item.dvm === props.address; const hasLabel = - labeledAddresses?.[item.dfi]?.label != null && - labeledAddresses?.[item.dfi]?.label !== ""; - const displayAddress = domain === DomainType.EVM ? item.evm : item.dfi; + labeledAddresses?.[item.dvm]?.label != null && + labeledAddresses?.[item.dvm]?.label !== ""; + const displayAddress = domain === DomainType.EVM ? item.evm : item.dvm; return ( - + {hasLabel && ( @@ -233,7 +233,7 @@ export const BottomSheetAddressDetailV2 = ( testID={`list_address_label_${item}`} numberOfLines={1} > - {labeledAddresses[item.dfi]?.label} + {labeledAddresses[item.dvm]?.label} {isSelected && ( { const activeAddress = availableAddresses.find( - ({ dfi }) => dfi === props.address + ({ dvm }) => dvm === props.address ); return ( item.dfi} + keyExtractor={(item) => item.dvm} stickyHeaderIndices={[0]} style={tailwind({ "bg-mono-dark-v2-100": !isLight, diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/CreateOrEditAddressLabelForm.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/CreateOrEditAddressLabelForm.tsx index 1dd3354deb..41868c177a 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/CreateOrEditAddressLabelForm.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/CreateOrEditAddressLabelForm.tsx @@ -99,7 +99,7 @@ export const CreateOrEditAddressLabelForm = memo( return storedWalletAddress.evmAddress; } // to support backward compatibility for already saved address - const addressObj = walletAddress.find((a) => a.dfi === address); + const addressObj = walletAddress.find((a) => a.dvm === address); return addressObj?.evm ?? ""; }; diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/AddOrEditAddressBookScreen.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/AddOrEditAddressBookScreen.tsx index 0dd3a95ddf..ed0f9e43e9 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/AddOrEditAddressBookScreen.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/AddOrEditAddressBookScreen.tsx @@ -260,7 +260,7 @@ export function AddOrEditAddressBookScreen({ useEffect(() => { let isSubscribed = true; - void fetchWalletAddresses().then((walletAddress) => { + fetchWalletAddresses().then((walletAddress: WalletAddressI[]) => { if (isSubscribed) { const allWalletAddresses = walletAddress.reduce( (allAddress: string[], each: WalletAddressI) => { diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/AddressBookScreen.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/AddressBookScreen.tsx index aef8d7cf34..f88cd7dfa2 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/AddressBookScreen.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/AddressBookScreen.tsx @@ -38,7 +38,7 @@ import { debounce } from "lodash"; import { openURL } from "@api/linking"; import { Logging } from "@api"; import { useWalletContext } from "@shared-contexts/WalletContext"; -import { useWalletAddress } from "@hooks/useWalletAddress"; +import { WalletAddressI, useWalletAddress } from "@hooks/useWalletAddress"; import { useAppDispatch } from "@hooks/useAppDispatch"; import LightEmptyAddress from "@assets/images/empty-address-light.png"; import DarkEmptyAddress from "@assets/images/empty-address-dark.png"; @@ -125,18 +125,18 @@ export function AddressBookScreen({ route, navigation }: Props): JSX.Element { fetchWalletAddresses().then((walletAddresses) => { if (isSubscribed) { const addresses: LocalAddress[] = []; - walletAddresses.forEach((address) => { + walletAddresses.forEach((address: WalletAddressI) => { const storedWalletAddress = walletAddressFromStore.find( - (a) => a.address === address.dfi + (a) => a.address === address.dvm ); - if (selectedAddress === address.dfi) { + if (selectedAddress === address.dvm) { // change tab if selected address is from your addresses setActiveButtonGroup(ButtonGroupTabKey.YourAddress); } if (storedWalletAddress === undefined) { addresses.push({ - address: address.dfi, + address: address.dvm, evmAddress: address.evm, label: "", }); From a400fbef5df4391f3037f3061dc0cf75c1e80fb0 Mon Sep 17 00:00:00 2001 From: Harsh Date: Thu, 3 Aug 2023 15:41:29 +0530 Subject: [PATCH 6/7] toggle btn style fix --- mobile-app/app/components/DomainSwitch.tsx | 13 ++++++------- mobile-app/app/styles.json | 3 +++ mobile-app/app/tailwind.config.js | 3 ++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/mobile-app/app/components/DomainSwitch.tsx b/mobile-app/app/components/DomainSwitch.tsx index 056db1ab50..a202df9675 100644 --- a/mobile-app/app/components/DomainSwitch.tsx +++ b/mobile-app/app/components/DomainSwitch.tsx @@ -21,10 +21,9 @@ export function DomainSwitch({ testID }: { testID: string }): JSX.Element { return ( @@ -41,11 +40,11 @@ export function DomainSwitch({ testID }: { testID: string }): JSX.Element { })} > - + diff --git a/mobile-app/app/styles.json b/mobile-app/app/styles.json index ae7230b8d5..9613b28352 100644 --- a/mobile-app/app/styles.json +++ b/mobile-app/app/styles.json @@ -4395,6 +4395,9 @@ "w-20": { "width": 80 }, + "w-21": { + "width": 84 + }, "w-24": { "width": 96 }, diff --git a/mobile-app/app/tailwind.config.js b/mobile-app/app/tailwind.config.js index 20cfc5f059..69f91855da 100644 --- a/mobile-app/app/tailwind.config.js +++ b/mobile-app/app/tailwind.config.js @@ -196,7 +196,8 @@ module.exports = { }, width: { 15: 60, - 18: 76 + 18: 76, + 21: 84 }, height: { 15: 60, From 5648ec69fe7ef976cf9de75b9d2ddf794e5f9eb5 Mon Sep 17 00:00:00 2001 From: Harsh Date: Thu, 3 Aug 2023 15:57:25 +0530 Subject: [PATCH 7/7] test case fix --- mobile-app/app/contexts/__mocks__/DomainContext.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mobile-app/app/contexts/__mocks__/DomainContext.tsx b/mobile-app/app/contexts/__mocks__/DomainContext.tsx index 3581a72376..0a95faf8dd 100644 --- a/mobile-app/app/contexts/__mocks__/DomainContext.tsx +++ b/mobile-app/app/contexts/__mocks__/DomainContext.tsx @@ -1,3 +1,8 @@ +export enum DomainType { + DVM = "DVM", + EVM = "EVM", +} + export const useDomainContext = () => { return { domain: "DVM",