Skip to content

Commit

Permalink
chore: instantiate router config in warp generators (#4807)
Browse files Browse the repository at this point in the history
### Description

Uncomments generator code to actually instantiate a `routerConfig`, as
recommended in
#4799 (comment)

### Drive-by changes

<!--
Are there any minor or drive-by changes also included?
-->

### Related issues

<!--
- Fixes #[issue number here]
-->

### Backward compatibility

<!--
Are these changes backward compatible? Are there any infrastructure
implications, e.g. changes that would prohibit deploying older commits
using this infra tooling?

Yes/No
-->

### Testing

<!--
What kind of testing have these changes undergone?

None/Manual/Unit Tests
-->

---------

Co-authored-by: Trevor Porter <tkporter4@gmail.com>
  • Loading branch information
daniel-savu and tkporter authored Nov 4, 2024
1 parent 3660ebe commit ffbc13c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
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);
}

0 comments on commit ffbc13c

Please sign in to comment.