Skip to content

Commit

Permalink
Filter agent-utils getAddresses to just env chains
Browse files Browse the repository at this point in the history
  • Loading branch information
jmrossy committed Apr 30, 2024
1 parent 9e4bde9 commit eebc103
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion typescript/infra/scripts/agent-utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path, { join } from 'path';
import yargs, { Argv } from 'yargs';

import { ChainAddresses } from '@hyperlane-xyz/registry';
import {
ChainMap,
ChainMetadata,
Expand All @@ -13,6 +14,7 @@ import {
import {
Address,
ProtocolType,
objFilter,
objMap,
promiseObjAll,
rootLogger,
Expand All @@ -26,6 +28,7 @@ import {
getChain,
getChainAddresses,
getChains,
getEnvChains,
getRegistry,
} from '../config/registry.js';
import { getCurrentKubernetesContext } from '../src/agents/index.js';
Expand Down Expand Up @@ -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));
}
Expand Down

0 comments on commit eebc103

Please sign in to comment.