From ca51ee6a7a608b6966d3b3c9d53cdb32d85f3133 Mon Sep 17 00:00:00 2001 From: David Lau Date: Fri, 5 Jun 2026 12:04:47 +0800 Subject: [PATCH] fix(swap): add --sell-param and --buy-param to order strategy create Add CLI options and StrategyCreateParams fields for sell_param and buy_param, which were documented in SKILL.md but missing from the source. Reuses the existing TradeParam interface. Co-Authored-By: Claude Sonnet 4.6 --- src/client/OpenApiClient.ts | 2 ++ src/commands/swap.ts | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/client/OpenApiClient.ts b/src/client/OpenApiClient.ts index ad56e60..30050b7 100644 --- a/src/client/OpenApiClient.ts +++ b/src/client/OpenApiClient.ts @@ -150,6 +150,8 @@ export interface StrategyCreateParams { custom_rpc?: string; condition_orders?: StrategyConditionOrder[]; quote_investment?: string; + sell_param?: TradeParam; + buy_param?: TradeParam; } export interface StrategyCancelParams { diff --git a/src/commands/swap.ts b/src/commands/swap.ts index b711323..a681a62 100644 --- a/src/commands/swap.ts +++ b/src/commands/swap.ts @@ -224,6 +224,8 @@ export function registerSwapCommands(program: Command): void { .option("--max-priority-fee-per-gas ", "EIP-1559 max priority fee per gas (BSC / BASE / ETH)") .option("--anti-mev", "Enable anti-MEV protection") .option("--condition-orders ", "JSON array of condition sub-orders for smart_trade (must include a buy_low entry + TP/SL entries)") + .option("--sell-param ", "JSON object of sell-side trade params used when a TP/SL condition fires (required for smart_trade)") + .option("--buy-param ", "JSON object of buy-side trade params override for smart_trade") .option("--raw", "Output raw JSON") .action(async (opts) => { if (!opts.amountIn && !opts.amountInPercent) { @@ -265,6 +267,14 @@ export function registerSwapCommands(program: Command): void { try { params.condition_orders = JSON.parse(opts.conditionOrders); } catch { console.error("[gmgn-cli] --condition-orders must be valid JSON"); process.exit(1); } } + if (opts.sellParam) { + try { params.sell_param = JSON.parse(opts.sellParam); } + catch { console.error("[gmgn-cli] --sell-param must be valid JSON"); process.exit(1); } + } + if (opts.buyParam) { + try { params.buy_param = JSON.parse(opts.buyParam); } + catch { console.error("[gmgn-cli] --buy-param must be valid JSON"); process.exit(1); } + } const client = new OpenApiClient(getConfig(true)); const data = await client.createStrategyOrder(params).catch(exitOnError); printResult(data, opts.raw);