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

chore: instantiate router config in warp generators #4807

Merged
merged 3 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import { WarpRouteDeployConfigSchema } from '@hyperlane-xyz/sdk';

import { getEclipseEthereumUSDTWarpConfig } from '../config/environments/mainnet3/warp/configGetters/getEclipseEthereumUSDTWarpConfig.js';

import { getRouterConfig } from './warp-routes/utils.js';

async function main() {
// remove the argument in the function definition to call
// const tokenConfig = await getEclipseEthereumUSDTWarpConfig();
const parsed = WarpRouteDeployConfigSchema.safeParse('');
const routerConfig = await getRouterConfig();
const tokenConfig = await getEclipseEthereumUSDTWarpConfig(routerConfig);
const parsed = WarpRouteDeployConfigSchema.safeParse(tokenConfig);

if (!parsed.success) {
console.dir(parsed.error.format(), { depth: null });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import { WarpRouteDeployConfigSchema } from '@hyperlane-xyz/sdk';

import { getEclipseEthereumWBTCWarpConfig } from '../config/environments/mainnet3/warp/configGetters/getEclipseEthereumWBTCWarpConfig.js';

import { getRouterConfig } from './warp-routes/utils.js';

async function main() {
// remove the argument in the function definition to call
// const tokenConfig = await getEclipseEthereumWBTCWarpConfig();
const parsed = WarpRouteDeployConfigSchema.safeParse('');
const routerConfig = await getRouterConfig();
const tokenConfig = await getEclipseEthereumWBTCWarpConfig(routerConfig);
const parsed = WarpRouteDeployConfigSchema.safeParse(tokenConfig);

if (!parsed.success) {
console.dir(parsed.error.format(), { depth: null });
Expand Down
30 changes: 30 additions & 0 deletions typescript/infra/scripts/warp-routes/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Contexts } from '../../config/contexts.js';
import { Role } from '../../src/roles.js';
import {
getArgs,
withBuildArtifactPath,
withChains,
withConcurrentDeploy,
withContext,
} from '../agent-utils.js';
import { getEnvironmentConfig, getHyperlaneCore } from '../core-utils.js';

export async function getRouterConfig() {
const {
context = Contexts.Hyperlane,
environment,
chains,
} = await withContext(
withConcurrentDeploy(withChains(withBuildArtifactPath(getArgs()))),
).argv;
const envConfig = getEnvironmentConfig(environment);

let multiProvider = await envConfig.getMultiProvider(
context,
Role.Deployer,
true,
chains,
);
const { core } = await getHyperlaneCore(environment, multiProvider);
return core.getRouterConfig(envConfig.owners);
}