From c562ee4cc83352bcf3e1d3b7f2e1c97a881e205c Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Fri, 17 Jan 2025 14:51:30 +0100 Subject: [PATCH] fix: types --- .../NewWalletViews/wallets/mipd/FirstClassBody.tsx | 4 +++- .../components/modals/CosmosSignMessageConfirmation.tsx | 5 ++++- .../components/modals/EIP155SignMessageConfirmation.tsx | 5 ++++- .../components/modals/EIP155SignTypedDataConfirmation.tsx | 5 ++++- .../components/modals/EIP155TransactionConfirmation.tsx | 5 ++++- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/context/WalletProvider/NewWalletViews/wallets/mipd/FirstClassBody.tsx b/src/context/WalletProvider/NewWalletViews/wallets/mipd/FirstClassBody.tsx index 4712b3f66a9..ffae7677a71 100644 --- a/src/context/WalletProvider/NewWalletViews/wallets/mipd/FirstClassBody.tsx +++ b/src/context/WalletProvider/NewWalletViews/wallets/mipd/FirstClassBody.tsx @@ -1,4 +1,5 @@ import { Alert, AlertDescription, AlertIcon, Button, Flex, Image, Spinner } from '@chakra-ui/react' +import type { MetaMaskAdapter } from '@shapeshiftoss/hdwallet-metamask-multichain' import { useCallback } from 'react' import { useTranslate } from 'react-polyglot' import { useHistory } from 'react-router-dom' @@ -47,7 +48,8 @@ export const FirstClassBody = ({ setError(null) setIsLoading(true) - const adapter = await getAdapter(keyManager) + // Just to narrow the types so that PairDevice is defined at type-level, this can currently be a Coinbase/Phantom/Keplr adapter + const adapter = (await getAdapter(keyManager)) as MetaMaskAdapter | null if (!adapter) { setIsLoading(false) return diff --git a/src/plugins/walletConnectToDapps/components/modals/CosmosSignMessageConfirmation.tsx b/src/plugins/walletConnectToDapps/components/modals/CosmosSignMessageConfirmation.tsx index 1b5768afb08..02facd33930 100644 --- a/src/plugins/walletConnectToDapps/components/modals/CosmosSignMessageConfirmation.tsx +++ b/src/plugins/walletConnectToDapps/components/modals/CosmosSignMessageConfirmation.tsx @@ -43,7 +43,10 @@ export const CosmosSignMessageConfirmationModal: FC< const translate = useTranslate() const walletInfo = useWallet().state.walletInfo const WalletIcon = walletInfo?.icon ?? FoxIcon - const walletIcon = useMemo(() => , [WalletIcon]) + const walletIcon = useMemo( + () => (typeof WalletIcon === 'string' ? null : ), + [WalletIcon], + ) const cardBg = useColorModeValue('white', 'gray.850') const request = state.modalData.requestEvent?.params.request diff --git a/src/plugins/walletConnectToDapps/components/modals/EIP155SignMessageConfirmation.tsx b/src/plugins/walletConnectToDapps/components/modals/EIP155SignMessageConfirmation.tsx index 7f53ecc3412..00293362d0b 100644 --- a/src/plugins/walletConnectToDapps/components/modals/EIP155SignMessageConfirmation.tsx +++ b/src/plugins/walletConnectToDapps/components/modals/EIP155SignMessageConfirmation.tsx @@ -42,7 +42,10 @@ export const EIP155SignMessageConfirmationModal: FC< const translate = useTranslate() const walletInfo = useWallet().state.walletInfo const WalletIcon = walletInfo?.icon ?? FoxIcon - const walletIcon = useMemo(() => , [WalletIcon]) + const walletIcon = useMemo( + () => (typeof WalletIcon === 'string' ? null : ), + [WalletIcon], + ) const cardBg = useColorModeValue('white', 'gray.850') const handleConfirm = useCallback(async () => { diff --git a/src/plugins/walletConnectToDapps/components/modals/EIP155SignTypedDataConfirmation.tsx b/src/plugins/walletConnectToDapps/components/modals/EIP155SignTypedDataConfirmation.tsx index 587da39b0a9..90631059696 100644 --- a/src/plugins/walletConnectToDapps/components/modals/EIP155SignTypedDataConfirmation.tsx +++ b/src/plugins/walletConnectToDapps/components/modals/EIP155SignTypedDataConfirmation.tsx @@ -31,7 +31,10 @@ export const EIP155SignTypedDataConfirmation: FC< const translate = useTranslate() const walletInfo = useWallet().state.walletInfo const WalletIcon = walletInfo?.icon ?? FoxIcon - const walletIcon = useMemo(() => , [WalletIcon]) + const walletIcon = useMemo( + () => (typeof WalletIcon === 'string' ? null : ), + [WalletIcon], + ) const handleConfirm = useCallback(async () => { setIsLoading(true) diff --git a/src/plugins/walletConnectToDapps/components/modals/EIP155TransactionConfirmation.tsx b/src/plugins/walletConnectToDapps/components/modals/EIP155TransactionConfirmation.tsx index 209e193ecce..479e0b7ceb0 100644 --- a/src/plugins/walletConnectToDapps/components/modals/EIP155TransactionConfirmation.tsx +++ b/src/plugins/walletConnectToDapps/components/modals/EIP155TransactionConfirmation.tsx @@ -65,7 +65,10 @@ export const EIP155TransactionConfirmation: FC< state: { walletInfo }, } = useWallet() const WalletIcon = walletInfo?.icon ?? FoxIcon - const walletIcon = useMemo(() => , [WalletIcon]) + const walletIcon = useMemo( + () => (typeof WalletIcon === 'string' ? null : ), + [WalletIcon], + ) const addressSummaryCardIcon = useMemo( () => , [feeAsset?.icon],