From f3f711ef9e558d0f53a3f7204ab8765b8620acaa Mon Sep 17 00:00:00 2001 From: Denis Fadeev Date: Tue, 28 Oct 2025 11:25:48 +0300 Subject: [PATCH] feat(cctx): non-interactive flag --- packages/commands/src/query/cctx.ts | 10 ++++++++-- src/schemas/commands/cctx.ts | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/commands/src/query/cctx.ts b/packages/commands/src/query/cctx.ts index e0129b05..bbb6d71c 100644 --- a/packages/commands/src/query/cctx.ts +++ b/packages/commands/src/query/cctx.ts @@ -64,7 +64,11 @@ const gatherCctxs = async ( while (true) { // Check if we've exceeded the timeout (skip if timeout is 0) if (timeoutMs > 0 && Date.now() - startTime > timeoutMs) { - console.log("\nTimeout reached. Exiting..."); + console.log( + `\n${ + Array.from(results.values()).length + } CCTXs found. Timeout reached. Exiting...` + ); return; } @@ -311,7 +315,8 @@ Revert Gas Limit: ${revert_gas_limit} * CLI entry – clears screen and prints the list of indexes each round. */ const main = async (options: CctxOptions) => { - const { hash, rpc, delay, timeout } = options; + const { hash, rpc, delay, interactive } = options; + const timeout = interactive ? options.timeout : 5000; cctxEmitter.on("cctx", (all) => { console.clear(); all.forEach((cctx) => { @@ -329,6 +334,7 @@ export const cctxCommand = new Command("cctx") ) .requiredOption("--hash ", "Inbound transaction hash") .option("-r, --rpc ", "RPC endpoint", DEFAULT_API_URL) + .option("--non-interactive", "Run in non-interactive mode.") .option( "-d, --delay ", "Delay between polling rounds in milliseconds", diff --git a/src/schemas/commands/cctx.ts b/src/schemas/commands/cctx.ts index da97a5d4..29930ec8 100644 --- a/src/schemas/commands/cctx.ts +++ b/src/schemas/commands/cctx.ts @@ -5,6 +5,7 @@ import { DEFAULT_DELAY, DEFAULT_TIMEOUT } from "../../constants/commands/cctx"; export const cctxOptionsSchema = z.object({ delay: z.coerce.number().int().positive().default(DEFAULT_DELAY), hash: z.string(), + interactive: z.coerce.boolean(), rpc: z.string(), timeout: z.coerce.number().int().min(0).default(DEFAULT_TIMEOUT), });