Skip to content

Commit

Permalink
fix: types
Browse files Browse the repository at this point in the history
  • Loading branch information
gomesalexandre committed Jan 17, 2025
1 parent 77d0cd5 commit c562ee4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 w='full' h='full' />, [WalletIcon])
const walletIcon = useMemo(
() => (typeof WalletIcon === 'string' ? null : <WalletIcon w='full' h='full' />),
[WalletIcon],
)
const cardBg = useColorModeValue('white', 'gray.850')
const request = state.modalData.requestEvent?.params.request

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 w='full' h='full' />, [WalletIcon])
const walletIcon = useMemo(
() => (typeof WalletIcon === 'string' ? null : <WalletIcon w='full' h='full' />),
[WalletIcon],
)
const cardBg = useColorModeValue('white', 'gray.850')

const handleConfirm = useCallback(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 w='full' h='full' />, [WalletIcon])
const walletIcon = useMemo(
() => (typeof WalletIcon === 'string' ? null : <WalletIcon w='full' h='full' />),
[WalletIcon],
)

const handleConfirm = useCallback(async () => {
setIsLoading(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ export const EIP155TransactionConfirmation: FC<
state: { walletInfo },
} = useWallet()
const WalletIcon = walletInfo?.icon ?? FoxIcon
const walletIcon = useMemo(() => <WalletIcon w='full' h='full' />, [WalletIcon])
const walletIcon = useMemo(
() => (typeof WalletIcon === 'string' ? null : <WalletIcon w='full' h='full' />),
[WalletIcon],
)
const addressSummaryCardIcon = useMemo(
() => <Image borderRadius='full' w='full' h='full' src={feeAsset?.icon} />,
[feeAsset?.icon],
Expand Down

0 comments on commit c562ee4

Please sign in to comment.