From eeac4679e4b58132f16027742c1ed145cf6a9bab Mon Sep 17 00:00:00 2001 From: Nam Chu Hoai Date: Mon, 26 Feb 2024 21:09:27 -0500 Subject: [PATCH] Account for non-evm for domain fetching (#3316) ### Description Copies https://github.com/hyperlane-xyz/hyperlane-monorepo/pull/3275 for the core deployer --- typescript/sdk/src/hook/HyperlaneHookDeployer.ts | 4 +++- typescript/sdk/src/ism/utils.ts | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/typescript/sdk/src/hook/HyperlaneHookDeployer.ts b/typescript/sdk/src/hook/HyperlaneHookDeployer.ts index 30e055c0b..c87d8777b 100644 --- a/typescript/sdk/src/hook/HyperlaneHookDeployer.ts +++ b/typescript/sdk/src/hook/HyperlaneHookDeployer.ts @@ -12,6 +12,7 @@ import { } from '@hyperlane-xyz/core'; import { Address, addressToBytes32 } from '@hyperlane-xyz/utils'; +import { chainMetadata } from '../consts/chainMetadata'; import { HyperlaneContracts } from '../contracts/types'; import { CoreAddresses } from '../core/contracts'; import { HyperlaneDeployer } from '../deploy/HyperlaneDeployer'; @@ -287,7 +288,8 @@ export class HyperlaneHookDeployer extends HyperlaneDeployer< const routingConfigs: DomainRoutingHook.HookConfigStruct[] = []; for (const [dest, hookConfig] of Object.entries(config.domains)) { - const destDomain = this.multiProvider.getDomainId(dest); + const destDomain = + chainMetadata[dest]?.domainId ?? this.multiProvider.getDomainId(dest); if (typeof hookConfig === 'string') { routingConfigs.push({ destination: destDomain, diff --git a/typescript/sdk/src/ism/utils.ts b/typescript/sdk/src/ism/utils.ts index d9c18092b..1a94a08f3 100644 --- a/typescript/sdk/src/ism/utils.ts +++ b/typescript/sdk/src/ism/utils.ts @@ -20,6 +20,7 @@ import { objMap, } from '@hyperlane-xyz/utils'; +import { chainMetadata } from '../consts/chainMetadata'; import { HyperlaneContracts } from '../contracts/types'; import { ProxyFactoryFactories } from '../deploy/contracts'; import { MultiProvider } from '../providers/MultiProvider'; @@ -327,8 +328,11 @@ export async function routingModuleDelta( domain.toNumber(), ); // config.domains is already filtered to only include domains in the multiprovider - const safeConfigDomains = objMap(config.domains, (domain) => - multiProvider.getDomainId(domain), + const safeConfigDomains = objMap( + config.domains, + (chainName) => + chainMetadata[chainName]?.domainId ?? + multiProvider.getDomainId(chainName), ); const delta: RoutingIsmDelta = {