diff --git a/src/features/chains/MissingChainConfigToast.tsx b/src/features/chains/MissingChainConfigToast.tsx new file mode 100644 index 0000000..67f3c58 --- /dev/null +++ b/src/features/chains/MissingChainConfigToast.tsx @@ -0,0 +1,12 @@ +import Link from 'next/link'; + +export function MissingChainConfigToast({ chainId }: { chainId: number }) { + return ( +
+ No chain config found for chain ID: {chainId}. + + Add a config + +
+ ); +} diff --git a/src/features/deliveryStatus/useMessageDeliveryStatus.ts b/src/features/deliveryStatus/useMessageDeliveryStatus.tsx similarity index 81% rename from src/features/deliveryStatus/useMessageDeliveryStatus.ts rename to src/features/deliveryStatus/useMessageDeliveryStatus.tsx index cab49cd..ce60a9d 100644 --- a/src/features/deliveryStatus/useMessageDeliveryStatus.ts +++ b/src/features/deliveryStatus/useMessageDeliveryStatus.tsx @@ -7,6 +7,7 @@ import { chainIdToMetadata } from '@hyperlane-xyz/sdk'; import { useMultiProvider } from '../../multiProvider'; import { Message, MessageStatus } from '../../types'; import { logger } from '../../utils/logger'; +import { MissingChainConfigToast } from '../chains/MissingChainConfigToast'; import { fetchDeliveryStatus } from './fetchDeliveryStatus'; @@ -16,11 +17,16 @@ export function useMessageDeliveryStatus({ message, pause }: { message: Message; const { data, error } = useQuery( ['messageDeliveryStatus', serializedMessage, pause], async () => { + if (pause || !message || message.status === MessageStatus.Delivered) return null; + + if (!multiProvider.tryGetChainMetadata(message.originChainId)) { + toast.error(); + } else if (!multiProvider.tryGetChainMetadata(message.destinationChainId)) { + toast.error(); + } + // TODO enable PI support here if ( - pause || - !message || - message.status === MessageStatus.Delivered || message.isPiMsg || !chainIdToMetadata[message.originChainId] || !chainIdToMetadata[message.destinationChainId]