Default domainId and protocolType (#3041)

### Description

We only support EVM chains today, so folks pretty much should always use the chainId as the domainId and not choose any other protocol type other than ethereum. So removing the optionality for now until that changes
pull/3028/head
Nam Chu Hoai 11 months ago committed by GitHub
parent 8d8e3b8bc1
commit 9c7dbcb947
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      .changeset/purple-bulldogs-report.md
  2. 23
      typescript/cli/src/config/chain.ts

@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': patch
---
Remove domainId and protocolType setting when creating chain config

@ -1,4 +1,4 @@
import { confirm, input, select } from '@inquirer/prompts';
import { input } from '@inquirer/prompts';
import {
ChainMap,
@ -81,30 +81,13 @@ export async function createChainConfig({
message: 'Enter chain name (one word, lower case)',
});
const chainId = await input({ message: 'Enter chain id (number)' });
const skipDomain = await confirm({
message: 'Will the domainId match the chainId (recommended)?',
});
let domainId: string;
if (skipDomain) {
domainId = chainId;
} else {
domainId = await input({
message: 'Enter domain id (number, often matches chainId)',
});
}
const protocol = await select({
message: 'Select protocol type',
choices: Object.values(ProtocolType).map((protocol) => ({
name: protocol,
value: protocol,
})),
});
const domainId = chainId;
const rpcUrl = await input({ message: 'Enter http or https rpc url' });
const metadata: ChainMetadata = {
name,
chainId: parseInt(chainId, 10),
domainId: parseInt(domainId, 10),
protocol,
protocol: ProtocolType.Ethereum,
rpcUrls: [{ http: rpcUrl }],
};
const parseResult = ChainMetadataSchema.safeParse(metadata);

Loading…
Cancel
Save