Skip to content

Commit

Permalink
Rename warpDeploys -> warpDeployConfigURIs
Browse files Browse the repository at this point in the history
  • Loading branch information
ltyu committed Jan 24, 2025
1 parent 714cda3 commit 03f1483
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions src/registry/FileSystemRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ export class FileSystemRegistry extends SynchronousRegistry implements IRegistry
warpRoutes[routeId] = filePath;
}

const warpDeploys: RegistryContent['deployments']['warpDeploys'] = {};
const warpDeployConfigURIs: RegistryContent['deployments']['warpDeployConfigURIs'] = {};
const warpDeployFiles = this.listFiles(path.join(this.uri, this.getWarpRoutesPath()));
for (const filePath of warpDeployFiles) {
if (!WARP_ROUTE_DEPLOY_FILE_REGEX.test(filePath)) continue;
const routeId = warpRouteDeployConfigPathToId(filePath);
warpDeploys[routeId] = filePath;
warpDeployConfigURIs[routeId] = filePath;
}

return (this.listContentCache = { chains, deployments: { warpRoutes, warpDeploys } });
return (this.listContentCache = { chains, deployments: { warpRoutes, warpDeployConfigURIs } });
}

getMetadata(): ChainMap<ChainMetadata> {
Expand Down Expand Up @@ -198,19 +198,19 @@ export class FileSystemRegistry extends SynchronousRegistry implements IRegistry
}

protected getWarpDeploysForIds(ids: WarpRouteId[]): WarpRouteDeployConfig[] {
const warpDeploys = this.listRegistryContent().deployments.warpDeploys;
return this.readConfigsForIds(ids, warpDeploys);
const warpDeployConfigURIs = this.listRegistryContent().deployments.warpDeployConfigURIs;
return this.readConfigsForIds(ids, warpDeployConfigURIs);
}

/**
* Reads config files for the given WarpRouteIds.
* @param ids - The WarpRouteIds to read configs for.
* @param registryDeployments - A mapping of WarpRouteIds to file paths where the configs are stored.
* @param configURIs - A mapping of WarpRouteIds to file paths where the configs are stored.
* @returns An array of config objects.
*/
protected readConfigsForIds<Config>(ids: WarpRouteId[], registryDeployments: Record<WarpRouteId, string> ): Config[] {
protected readConfigsForIds<Config>(ids: WarpRouteId[], configURIs: Record<WarpRouteId, string> ): Config[] {
const configs: Config[] = [];
for (const [id, filePath] of Object.entries(registryDeployments)) {
for (const [id, filePath] of Object.entries(configURIs)) {
if (!ids.includes(id)) continue;
const data = fs.readFileSync(filePath, 'utf8');
configs.push(yamlParse(data));
Expand Down
2 changes: 1 addition & 1 deletion src/registry/GithubRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class GithubRegistry extends BaseRegistry implements IRegistry {
}
}

return (this.listContentCache = { chains, deployments: { warpRoutes } });
return (this.listContentCache = { chains, deployments: { warpRoutes, warpDeployConfigURIs: {} } });
}

async getChains(): Promise<Array<ChainName>> {
Expand Down
4 changes: 2 additions & 2 deletions src/registry/IRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export interface RegistryContent {
// Warp route ID to artifact URI
warpRoutes: Record<WarpRouteId, string>;

// Warp route ID to warp config URI
warpDeploys: Record<WarpRouteId, string>;
// Warp route ID to warp deploy config URI
warpDeployConfigURIs: Record<WarpRouteId, string>;
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/registry/MergedRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class MergedRegistry implements IRegistry {
chains: {},
deployments: {
warpRoutes: {},
warpDeploys: {}
warpDeployConfigURIs: {}
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/registry/PartialRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class PartialRegistry extends SynchronousRegistry implements IRegistry {
chains,
deployments: {
warpRoutes,
warpDeploys: warpRoutes
warpDeployConfigURIs: {}
},
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/registry/SynchronousRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export abstract class SynchronousRegistry extends BaseRegistry implements IRegis
}

/**
* Retrieves a filtered map of the warp routes artifacts
* Retrieves a filtered map of the warp routes configs
*/
getWarpRoutes(filter?: WarpRouteFilterParams): WarpRouteConfigMap {
const warpRoutes = this.listRegistryContent().deployments.warpRoutes;
Expand All @@ -79,7 +79,7 @@ export abstract class SynchronousRegistry extends BaseRegistry implements IRegis
* Retrieves a map of all the warp routes deployment configs
*/
getWarpDeploys() {
const warpDeploy = this.listRegistryContent().deployments.warpDeploys;
const warpDeploy = this.listRegistryContent().deployments.warpDeployConfigURIs;
const allRouteIds = Object.keys(warpDeploy);
const configs = this.getWarpDeploysForIds(allRouteIds);
const idsWithConfigs = allRouteIds.map((id, i): [WarpRouteId, WarpRouteDeployConfig] => [id, configs[i]])
Expand Down
2 changes: 1 addition & 1 deletion src/registry/warp-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ChainMap, ChainName, TokenStandard, WarpCoreConfig } from '@hyperlane-xyz/sdk';
import type { ChainMap, ChainName, TokenStandard, WarpCoreConfig, WarpRouteDeployConfig } from '@hyperlane-xyz/sdk';
import { WARP_ROUTE_CONFIG_FILE_REGEX, WARP_ROUTE_DEPLOY_FILE_REGEX } from '../consts.js';
import { ChainAddresses, WarpRouteId } from '../types.js';
import { WarpRouteFilterParams } from './IRegistry.js';
Expand Down

0 comments on commit 03f1483

Please sign in to comment.