From ed277058264a5551f939189fb7890680e5cf4067 Mon Sep 17 00:00:00 2001 From: deepfeature Date: Fri, 3 Apr 2026 14:21:59 +0800 Subject: [PATCH] fix strategy list signature auth --- Readme.md | 2 +- Readme.zh.md | 2 +- docs/cli-usage.md | 2 +- skills/gmgn-swap/SKILL.md | 4 ++-- src/client/OpenApiClient.ts | 4 ++-- src/commands/swap.ts | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Readme.md b/Readme.md index 881f8a1..bc73079 100644 --- a/Readme.md +++ b/Readme.md @@ -525,7 +525,7 @@ gmgn-cli order strategy create \ --amount-in-percent 100 \ --slippage 0.01 -# List open strategy orders +# List open strategy orders (requires private key) gmgn-cli order strategy list --chain sol # Cancel a strategy order diff --git a/Readme.zh.md b/Readme.zh.md index f238a80..d427178 100644 --- a/Readme.zh.md +++ b/Readme.zh.md @@ -557,7 +557,7 @@ gmgn-cli order strategy create \ --amount-in-percent 100 \ --slippage 0.01 -# 查看当前挂单 +# 查看当前挂单(需要私钥) gmgn-cli order strategy list --chain sol # 撤销策略单 diff --git a/docs/cli-usage.md b/docs/cli-usage.md index 5a135cc..9797a49 100644 --- a/docs/cli-usage.md +++ b/docs/cli-usage.md @@ -532,7 +532,7 @@ gmgn-cli order strategy create \ ## order strategy list -List strategy orders. Uses normal auth. +List strategy orders. **Requires `GMGN_PRIVATE_KEY` configured in `.env`.** ```bash gmgn-cli order strategy list --chain [--type ] [--from
] [--group-tag ] [--base-token
] [--page-token ] [--limit ] [--raw] diff --git a/skills/gmgn-swap/SKILL.md b/skills/gmgn-swap/SKILL.md index 32572a1..45b0829 100644 --- a/skills/gmgn-swap/SKILL.md +++ b/skills/gmgn-swap/SKILL.md @@ -49,7 +49,7 @@ Use the `gmgn-cli` tool to submit a token swap or query an existing order. **Req | `order quote` | Get a swap quote (no transaction submitted) | | `order get` | Query order status | | `order strategy create` | Create a limit/strategy order (requires private key) | -| `order strategy list` | List strategy orders (normal auth) | +| `order strategy list` | List strategy orders (requires private key) | | `order strategy cancel` | Cancel a strategy order (requires private key) | ## Supported Chains @@ -383,7 +383,7 @@ gmgn-cli order strategy cancel \ - Swap uses **critical auth** (API Key + signature) — CLI handles signing automatically, no manual processing needed - After submitting a swap, use `order get` to poll for confirmation - `--amount` is in the **smallest unit** (e.g., lamports for SOL) -- `order strategy create` and `order strategy cancel` use critical auth (require `GMGN_PRIVATE_KEY`); `order strategy list` uses normal auth +- `order strategy create`, `order strategy list`, and `order strategy cancel` use critical auth (require `GMGN_PRIVATE_KEY`) - Use `--raw` to get single-line JSON for further processing ## Input Validation diff --git a/src/client/OpenApiClient.ts b/src/client/OpenApiClient.ts index ffac497..fd43e11 100644 --- a/src/client/OpenApiClient.ts +++ b/src/client/OpenApiClient.ts @@ -306,14 +306,14 @@ export class OpenApiClient { return this.criticalRequest("GET", "/v1/trade/query_order", { order_id: orderId, chain }, null); } - // ---- Strategy order endpoints ---- + // ---- Strategy order endpoints (critical auth) ---- async createStrategyOrder(params: StrategyCreateParams): Promise { return this.criticalRequest("POST", "/v1/trade/strategy/create", {}, params); } async getStrategyOrders(chain: string, extra: Record = {}): Promise { - return this.normalRequest("GET", "/v1/trade/strategy/orders", { chain, ...extra }); + return this.criticalRequest("GET", "/v1/trade/strategy/orders", { chain, ...extra }, null); } async cancelStrategyOrder(params: StrategyCancelParams): Promise { diff --git a/src/commands/swap.ts b/src/commands/swap.ts index ad35409..cc6dd2f 100644 --- a/src/commands/swap.ts +++ b/src/commands/swap.ts @@ -170,7 +170,7 @@ export function registerSwapCommands(program: Command): void { strategy .command("list") - .description("List strategy orders (normal auth)") + .description("List strategy orders (requires private key)") .requiredOption("--chain ", "Chain: sol / bsc / base") .option("--type ", "open (default) / history") .option("--from
", "Filter by wallet address") @@ -188,7 +188,7 @@ export function registerSwapCommands(program: Command): void { if (opts.baseToken) extra["base_token"] = opts.baseToken; if (opts.pageToken) extra["page_token"] = opts.pageToken; if (opts.limit != null) extra["limit"] = opts.limit; - const client = new OpenApiClient(getConfig()); + const client = new OpenApiClient(getConfig(true)); const data = await client.getStrategyOrders(opts.chain, extra).catch(exitOnError); printResult(data, opts.raw); });