Skip to content

Commit

Permalink
Add test chain metadata to infra registry utils
Browse files Browse the repository at this point in the history
  • Loading branch information
jmrossy committed May 1, 2024
1 parent e84e32e commit f51d1cd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
14 changes: 9 additions & 5 deletions typescript/infra/config/environments/test/chains.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { testChains } from '@hyperlane-xyz/sdk';
import {
testChainMetadata as defaultTestChainMetadata,
testChains as defaultTestChains,
} from '@hyperlane-xyz/sdk';

import { AgentChainNames, Role } from '../../../src/roles.js';

export const testChainNames = testChains;
export const testChainNames = defaultTestChains;
export const testChainMetadata = { ...defaultTestChainMetadata };

export const agentChainNames: AgentChainNames = {
[Role.Validator]: testChains,
[Role.Relayer]: testChains,
[Role.Scraper]: testChains,
[Role.Validator]: testChainNames,
[Role.Relayer]: testChainNames,
[Role.Scraper]: testChainNames,
};
8 changes: 7 additions & 1 deletion typescript/infra/config/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ import { objFilter, rootLogger } from '@hyperlane-xyz/utils';
import type { DeployEnvironment } from '../src/config/environment.js';

import { supportedChainNames as mainnet3Chains } from './environments/mainnet3/supportedChainNames.js';
import { testChainNames as testChains } from './environments/test/chains.js';
import {
testChainMetadata,
testChainNames as testChains,
} from './environments/test/chains.js';
import { supportedChainNames as testnet4Chains } from './environments/testnet4/supportedChainNames.js';

const DEFAULT_REGISTRY_URI = join(
Expand Down Expand Up @@ -49,6 +52,9 @@ export function getChains(): ChainName[] {
}

export function getChain(chainName: ChainName): ChainMetadata {
if (testChains.includes(chainName)) {
return testChainMetadata[chainName];
}
return getRegistry().getChainMetadata(chainName);
}

Expand Down

0 comments on commit f51d1cd

Please sign in to comment.