diff --git a/.changeset/five-bats-attend.md b/.changeset/five-bats-attend.md new file mode 100644 index 0000000000..02a7c986bb --- /dev/null +++ b/.changeset/five-bats-attend.md @@ -0,0 +1,5 @@ +--- +'@hyperlane-xyz/cli': patch +--- + +fix: balance check skip confirmation diff --git a/typescript/cli/src/deploy/utils.ts b/typescript/cli/src/deploy/utils.ts index f5ac01a175..0378ab7243 100644 --- a/typescript/cli/src/deploy/utils.ts +++ b/typescript/cli/src/deploy/utils.ts @@ -41,7 +41,7 @@ export async function runPreflightChecksForChains({ chainsToGasCheck?: ChainName[]; }) { log('Running pre-flight checks for chains...'); - const { multiProvider } = context; + const { multiProvider, skipConfirmation } = context; if (!chains?.length) throw new Error('Empty chain selection'); for (const chain of chains) { @@ -59,6 +59,7 @@ export async function runPreflightChecksForChains({ multiProvider, chainsToGasCheck ?? chains, minGas, + skipConfirmation, ); } diff --git a/typescript/cli/src/utils/balances.ts b/typescript/cli/src/utils/balances.ts index 2a6e6fcb8a..701acceda6 100644 --- a/typescript/cli/src/utils/balances.ts +++ b/typescript/cli/src/utils/balances.ts @@ -1,15 +1,16 @@ -import { confirm } from '@inquirer/prompts'; import { ethers } from 'ethers'; import { ChainName, MultiProvider } from '@hyperlane-xyz/sdk'; import { ProtocolType } from '@hyperlane-xyz/utils'; -import { logGray, logGreen, logRed } from '../logger.js'; +import { autoConfirm } from '../config/prompts.js'; +import { logBlue, logGray, logGreen, logRed, warnYellow } from '../logger.js'; export async function nativeBalancesAreSufficient( multiProvider: MultiProvider, chains: ChainName[], minGas: string, + skipConfirmation: boolean, ) { const sufficientBalances: boolean[] = []; for (const chain of chains) { @@ -42,9 +43,10 @@ export async function nativeBalancesAreSufficient( if (allSufficient) { logGreen('✅ Balances are sufficient'); } else { - const isResume = await confirm({ - message: 'Deployment may fail due to insufficient balance(s). Continue?', - }); + warnYellow(`Deployment may fail due to insufficient balance(s)`); + const isResume = await autoConfirm('Continue?', skipConfirmation, () => + logBlue('Continuing deployment with insufficient balances'), + ); if (!isResume) throw new Error('Canceled deployment due to low balance'); } }