From eebc1034b9cb5e79a56f4e26ed08ee08af50d4a8 Mon Sep 17 00:00:00 2001 From: J M Rossy Date: Tue, 30 Apr 2024 15:38:24 -0400 Subject: [PATCH] Filter agent-utils getAddresses to just env chains --- typescript/infra/scripts/agent-utils.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/typescript/infra/scripts/agent-utils.ts b/typescript/infra/scripts/agent-utils.ts index bc0a78bdb5..7226bdf0b1 100644 --- a/typescript/infra/scripts/agent-utils.ts +++ b/typescript/infra/scripts/agent-utils.ts @@ -1,6 +1,7 @@ import path, { join } from 'path'; import yargs, { Argv } from 'yargs'; +import { ChainAddresses } from '@hyperlane-xyz/registry'; import { ChainMap, ChainMetadata, @@ -13,6 +14,7 @@ import { import { Address, ProtocolType, + objFilter, objMap, promiseObjAll, rootLogger, @@ -26,6 +28,7 @@ import { getChain, getChainAddresses, getChains, + getEnvChains, getRegistry, } from '../config/registry.js'; import { getCurrentKubernetesContext } from '../src/agents/index.js'; @@ -381,7 +384,11 @@ function getInfraLandfillPath(environment: DeployEnvironment, module: Modules) { export function getAddresses(environment: DeployEnvironment, module: Modules) { if (isRegistryModule(environment, module)) { - return getChainAddresses(); + const allAddresses = getChainAddresses(); + const envChains = getEnvChains(environment); + return objFilter(allAddresses, (chain, _): _ is ChainAddresses => { + return envChains.includes(chain); + }); } else { return readJSONAtPath(getInfraLandfillPath(environment, module)); }