diff --git a/packages/canonical-bridge/src/modules/wallet/BridgeWalletProvider.tsx b/packages/canonical-bridge/src/modules/wallet/BridgeWalletProvider.tsx index b2cf75e0d0399..bfa678b3f8d53 100644 --- a/packages/canonical-bridge/src/modules/wallet/BridgeWalletProvider.tsx +++ b/packages/canonical-bridge/src/modules/wallet/BridgeWalletProvider.tsx @@ -5,13 +5,15 @@ import { import { WalletProvider as TronWalletProvider } from '@tronweb3/tronwallet-adapter-react-hooks' import { env } from '../../configs' +const EMPTY_ARRAY: never[] = [] + export function BridgeWalletProvider(props: React.PropsWithChildren) { const { children } = props return ( - - + + {children} diff --git a/packages/canonical-bridge/src/views/index.tsx b/packages/canonical-bridge/src/views/index.tsx index 56756244486c3..f32e5ea8f68fb 100644 --- a/packages/canonical-bridge/src/views/index.tsx +++ b/packages/canonical-bridge/src/views/index.tsx @@ -1,6 +1,6 @@ import { useTranslation } from '@pancakeswap/localization' import { Flex, useToast } from '@pancakeswap/uikit' -import { useMemo } from 'react' +import { useCallback, useMemo } from 'react' import { BridgeRoutes, @@ -67,6 +67,15 @@ export const CanonicalBridge = (props: CanonicalBridgeProps) => { .map((chain) => ({ ...chain, rpcUrl: props.rpcConfig?.[chain.id]?.[0] ?? chain.rpcUrl })) }, [supportedChainIds, connector?.id, props.rpcConfig]) + const handleError = useCallback( + (params: { type: string; message?: string | undefined; error?: Error | undefined }) => { + if (params.message) { + toast.toastError(params.message) + } + }, + [toast], + ) + return ( @@ -76,11 +85,7 @@ export const CanonicalBridge = (props: CanonicalBridgeProps) => { chains={supportedChains} connectWalletButton={connectWalletButton} refreshingIcon={} - onError={(params) => { - if (params.message) { - toast.toastError(params.message) - } - }} + onError={handleError} >