Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add exportConfigs Infra script #5235

Merged
merged 12 commits into from
Jan 24, 2025
2 changes: 1 addition & 1 deletion typescript/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dependencies": {
"@aws-sdk/client-kms": "^3.577.0",
"@aws-sdk/client-s3": "^3.577.0",
"@hyperlane-xyz/registry": "6.18.0",
"@hyperlane-xyz/registry": "7.1.0",
"@hyperlane-xyz/sdk": "8.3.0",
"@hyperlane-xyz/utils": "8.3.0",
"@inquirer/core": "9.0.10",
Expand Down
2 changes: 1 addition & 1 deletion typescript/helloworld/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "8.3.0",
"dependencies": {
"@hyperlane-xyz/core": "5.10.0",
"@hyperlane-xyz/registry": "6.18.0",
"@hyperlane-xyz/registry": "7.1.0",
"@hyperlane-xyz/sdk": "8.3.0",
"@openzeppelin/contracts-upgradeable": "^4.9.3",
"ethers": "^5.7.2"
Expand Down
2 changes: 1 addition & 1 deletion typescript/infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@ethersproject/providers": "*",
"@google-cloud/secret-manager": "^5.5.0",
"@hyperlane-xyz/helloworld": "8.3.0",
"@hyperlane-xyz/registry": "6.18.0",
"@hyperlane-xyz/registry": "7.1.0",
"@hyperlane-xyz/sdk": "8.3.0",
"@hyperlane-xyz/utils": "8.3.0",
"@inquirer/prompts": "3.3.2",
Expand Down
33 changes: 33 additions & 0 deletions typescript/infra/scripts/warp-routes/export-warp-configs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { getRegistry } from '../../config/registry.js';
import { getWarpConfig, warpConfigGetterMap } from '../../config/warp.js';
import { getArgs, withOutputFile } from '../agent-utils.js';
import { getEnvironmentConfig, getHyperlaneCore } from '../core-utils.js';

// Writes the warp configs into the Registry
async function main() {
const { environment } = await withOutputFile(getArgs()).argv;
const { multiProvider } = await getHyperlaneCore(environment);
const envConfig = getEnvironmentConfig(environment);
const registry = getRegistry();

const warpIdsToCheck = Object.keys(warpConfigGetterMap);
for (const warpRouteId of warpIdsToCheck) {
console.log(`Generating Warp config for ${warpRouteId}`);

const warpConfig = await getWarpConfig(
multiProvider,
envConfig,
warpRouteId,
);

const configFileName = `${warpRouteId}-deploy.yaml`;
registry.addWarpRouteConfig(warpConfig, configFileName);

// TODO: Use registry.getWarpRoutesPath() to dynamically generate path by removing "protected"
ltyu marked this conversation as resolved.
Show resolved Hide resolved
console.log(
`Warp config successfully created at ${registry.getUri()}/deployments/warp_routes/${configFileName}`,
);
}
}

main().catch((err) => console.error('Error:', err));
2 changes: 1 addition & 1 deletion typescript/infra/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export function writeJsonAtPath(filepath: string, obj: any) {
}

export function writeYamlAtPath(filepath: string, obj: any) {
const content = stringifyObject(obj, 'yaml');
const content = stringifyObject(obj, 'yaml', 2);
writeToFile(filepath, content);
}

Expand Down
5 changes: 4 additions & 1 deletion typescript/utils/src/objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,10 @@ export function stringifyObject(
if (format === 'json') {
return json;
}
return yamlStringify(JSON.parse(json), null, space);
return yamlStringify(JSON.parse(json), null, {
indent: space ?? 2,
sortMapEntries: true,
ltyu marked this conversation as resolved.
Show resolved Hide resolved
});
}

interface ObjectDiffOutput {
Expand Down
2 changes: 1 addition & 1 deletion typescript/widgets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@eslint/js": "^9.15.0",
"@hyperlane-xyz/registry": "6.18.0",
"@hyperlane-xyz/registry": "7.1.0",
"@storybook/addon-essentials": "^7.6.14",
"@storybook/addon-interactions": "^7.6.14",
"@storybook/addon-links": "^7.6.14",
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7337,7 +7337,7 @@ __metadata:
"@eslint/js": "npm:^9.15.0"
"@ethersproject/abi": "npm:*"
"@ethersproject/providers": "npm:*"
"@hyperlane-xyz/registry": "npm:6.18.0"
"@hyperlane-xyz/registry": "npm:7.1.0"
"@hyperlane-xyz/sdk": "npm:8.3.0"
"@hyperlane-xyz/utils": "npm:8.3.0"
"@inquirer/core": "npm:9.0.10"
Expand Down Expand Up @@ -7443,7 +7443,7 @@ __metadata:
dependencies:
"@eslint/js": "npm:^9.15.0"
"@hyperlane-xyz/core": "npm:5.10.0"
"@hyperlane-xyz/registry": "npm:6.18.0"
"@hyperlane-xyz/registry": "npm:7.1.0"
"@hyperlane-xyz/sdk": "npm:8.3.0"
"@nomiclabs/hardhat-ethers": "npm:^2.2.3"
"@nomiclabs/hardhat-waffle": "npm:^2.0.6"
Expand Down Expand Up @@ -7494,7 +7494,7 @@ __metadata:
"@ethersproject/providers": "npm:*"
"@google-cloud/secret-manager": "npm:^5.5.0"
"@hyperlane-xyz/helloworld": "npm:8.3.0"
"@hyperlane-xyz/registry": "npm:6.18.0"
"@hyperlane-xyz/registry": "npm:7.1.0"
"@hyperlane-xyz/sdk": "npm:8.3.0"
"@hyperlane-xyz/utils": "npm:8.3.0"
"@inquirer/prompts": "npm:3.3.2"
Expand Down Expand Up @@ -7556,13 +7556,13 @@ __metadata:
languageName: unknown
linkType: soft

"@hyperlane-xyz/registry@npm:6.18.0":
version: 6.18.0
resolution: "@hyperlane-xyz/registry@npm:6.18.0"
"@hyperlane-xyz/registry@npm:7.1.0":
version: 7.1.0
resolution: "@hyperlane-xyz/registry@npm:7.1.0"
dependencies:
yaml: "npm:2.4.5"
zod: "npm:^3.21.2"
checksum: 10/0090afeffa60cf1891b1c7178d5f91d80db96a85595ba9a4ad7160cdc830737efc54022e11d416da4f4d9f7c032fde6f7aef678ae99e4a1f6142cdc06c50ccbc
checksum: 10/94b594ecd5734bc564e1a9ad220f4e5c9f04a98cd768cd4472afbaffe91009ae0680b8c4ffb01c13dbe913030dd730b22d5a73d7bfc88d6405df1e9f842ef939
languageName: node
linkType: hard

Expand Down Expand Up @@ -7661,7 +7661,7 @@ __metadata:
"@emotion/styled": "npm:^11.13.0"
"@eslint/js": "npm:^9.15.0"
"@headlessui/react": "npm:^2.1.8"
"@hyperlane-xyz/registry": "npm:6.18.0"
"@hyperlane-xyz/registry": "npm:7.1.0"
"@hyperlane-xyz/sdk": "npm:8.3.0"
"@hyperlane-xyz/utils": "npm:8.3.0"
"@interchain-ui/react": "npm:^1.23.28"
Expand Down
Loading