feat(cli): add 'source' to detectAndConfirmOrPrompt (#3906)

### Description

- adds `source` field to detect and confirm prompt so users know where
defaults are coming from

### Drive-by changes

- none

### Related issues

- none

### Backward compatibility

- yes

### Testing

- manual
pull/3908/head
Noah Bayindirli 🥂 5 months ago committed by GitHub
parent c38f799afa
commit 845ed5796e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      typescript/cli/src/commands/core.ts
  2. 3
      typescript/cli/src/config/chain.ts
  3. 1
      typescript/cli/src/config/ism.ts
  4. 2
      typescript/cli/src/config/warp.ts
  5. 5
      typescript/cli/src/utils/chains.ts

@ -60,6 +60,7 @@ export const configure: CommandModuleWithContext<{
async () => context.signer?.getAddress(),
'Enter the desired',
'owner address',
'signer',
);
// Create default Ism config (advanced or trusted)

@ -48,6 +48,7 @@ export async function createChainConfig({
},
'Enter http or https',
'rpc url',
'JSON RPC provider',
);
const provider = new ethers.providers.JsonRpcProvider(rpcUrl);
@ -60,6 +61,7 @@ export async function createChainConfig({
},
'Enter (one word, lower case)',
'chain name',
'JSON RPC provider',
);
const chainId = parseInt(
@ -70,6 +72,7 @@ export async function createChainConfig({
},
'Enter a (number)',
'chain id',
'JSON RPC provider',
),
10,
);

@ -135,6 +135,7 @@ export async function createTrustedRelayerConfig(
async () => context.signer?.getAddress(),
'For trusted relayer ISM, enter',
'relayer address',
'signer',
);
return {
type: IsmType.TRUSTED_RELAYER,

@ -114,6 +114,7 @@ export async function createWarpRouteDeployConfig({
async () => context.signer?.getAddress(),
'Enter the desired',
'owner address',
'signer',
);
const warpChains = await runMultiChainSelectionStep(
@ -140,6 +141,7 @@ export async function createWarpRouteDeployConfig({
},
`For ${chain}, enter the`,
'mailbox address',
'hyperlane-registry',
);
const interchainSecurityModule = shouldUseDefault

@ -78,13 +78,16 @@ export async function detectAndConfirmOrPrompt(
detect: () => Promise<string | undefined>,
prompt: string,
label: string,
source?: string,
): Promise<string> {
let detectedValue: string | undefined;
try {
detectedValue = await detect();
if (detectedValue) {
const confirmed = await confirm({
message: `Detected ${label} as ${detectedValue}, is this correct?`,
message: `Detected ${label} as ${detectedValue}${
source ? ` from ${source}` : ''
}, is this correct?`,
});
if (confirmed) {
return detectedValue;

Loading…
Cancel
Save