fix: tryGetChainName instead of hard crashing (#137)

use tryGetChainName instead of hard crashing for unknown domains

tested locally


![image](https://github.com/user-attachments/assets/7b6e6de5-c023-4644-af02-e8ccb5a00e0e)
pull/139/head
Paul Balaji 2 weeks ago committed by GitHub
parent b8e0d310e3
commit b7e8e1dcd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      src/features/deliveryStatus/fetchDeliveryStatus.ts
  2. 4
      src/features/messages/MessageDetails.tsx
  3. 4
      src/features/messages/MessageTable.tsx

@ -25,7 +25,11 @@ export async function fetchDeliveryStatus(
overrideChainMetadata: ChainMap<Partial<ChainMetadata>>,
message: Message,
): Promise<MessageDeliveryStatusResponse> {
const destName = multiProvider.getChainName(message.destinationDomainId);
const destName = multiProvider.tryGetChainName(message.destinationDomainId);
if (!destName)
throw new Error(
`Cannot check delivery status, no chain name provided for domain ${message.destinationDomainId}`,
);
const destMailboxAddr = await getMailboxAddress(destName, overrideChainMetadata, registry);
if (!destMailboxAddr)
throw new Error(

@ -88,8 +88,8 @@ export function MessageDetails({ messageId, message: messageFromUrlParams }: Pro
// Banner color setter
useDynamicBannerColor(isFetching, status, isMessageFound, isError || isPiError);
const originChainName = multiProvider.getChainName(originDomainId);
const destinationChainName = multiProvider.getChainName(destinationDomainId);
const originChainName = multiProvider.tryGetChainName(originDomainId) || 'Unknown';
const destinationChainName = multiProvider.tryGetChainName(destinationDomainId) || 'Unknown';
return (
<>

@ -67,8 +67,8 @@ export function MessageSummaryRow({ message, mp }: { message: MessageStub; mp: M
const base64 = message.isPiMsg ? serializeMessage(message) : undefined;
const originChainName = mp.getChainName(originDomainId);
const destinationChainName = mp.getChainName(destinationDomainId);
const originChainName = mp.tryGetChainName(originDomainId) || 'Unknown';
const destinationChainName = mp.tryGetChainName(destinationDomainId) || 'Unknown';
return (
<>

Loading…
Cancel
Save