From 247aaf96f933441ac7c994b41e42247a3cb0fc24 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Mar 2026 07:50:07 +0000 Subject: [PATCH 1/4] Initial plan From bd533cb85e5433ecf789daf6478a753c170e0b12 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Mar 2026 07:52:26 +0000 Subject: [PATCH 2/4] feat: add swap auto-slippage option Co-authored-by: deepfeature <1503768+deepfeature@users.noreply.github.com> Agent-Logs-Url: https://github.com/GMGNAI/gmgn-skills/sessions/b2089672-9ca8-402c-be14-138b55c1bb98 --- Readme.md | 1 + Readme.zh.md | 1 + docs/cli-usage.md | 2 ++ skills/gmgn-swap/SKILL.md | 2 ++ src/commands/swap.ts | 3 ++- 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 2407b60..2838b14 100644 --- a/Readme.md +++ b/Readme.md @@ -295,6 +295,7 @@ npx gmgn-cli swap \ --input-token \ --output-token \ --amount 1000000 \ + --auto-slippage \ --slippage 0.01 # Query order diff --git a/Readme.zh.md b/Readme.zh.md index 0138564..0cf2296 100644 --- a/Readme.zh.md +++ b/Readme.zh.md @@ -295,6 +295,7 @@ npx gmgn-cli swap \ --input-token \ --output-token \ --amount 1000000 \ + --auto-slippage \ --slippage 0.01 # 查询订单 diff --git a/docs/cli-usage.md b/docs/cli-usage.md index 87e8737..8f5f450 100644 --- a/docs/cli-usage.md +++ b/docs/cli-usage.md @@ -388,6 +388,7 @@ npx gmgn-cli swap \ --output-token \ [--amount | --percent ] \ [--slippage ] \ + [--auto-slippage] \ [--min-output ] \ [--anti-mev] \ [--priority-fee ] \ @@ -408,6 +409,7 @@ npx gmgn-cli swap \ | `--amount` | No* | Input raw amount in minimal unit (e.g., lamports for SOL); required unless `--percent` is used | | `--percent` | No* | Input amount as a percentage, e.g. `50` = 50%; required unless `--amount` is used; only valid when input token is not a currency (not SOL/BNB/ETH/USDC) | | `--slippage` | No | Slippage tolerance, e.g. `0.01` = 1% | +| `--auto-slippage` | No | Enable automatic slippage | | `--min-output` | No | Minimum output amount (raw amount) | | `--anti-mev` | No | Enable anti-MEV protection (default true) | | `--priority-fee` | No | Priority fee in SOL (≥ 0.00001 SOL, SOL only) | diff --git a/skills/gmgn-swap/SKILL.md b/skills/gmgn-swap/SKILL.md index 695904b..6766887 100644 --- a/skills/gmgn-swap/SKILL.md +++ b/skills/gmgn-swap/SKILL.md @@ -73,6 +73,7 @@ gmgn-cli swap \ --input-token \ --output-token \ --amount 1000000 \ + --auto-slippage \ --slippage 0.01 # With anti-MEV (SOL) @@ -135,6 +136,7 @@ gmgn-cli order get --chain sol --order-id | `--amount` | No* | Input amount in smallest unit. Required unless `--percent` is used. | | `--percent ` | No* | Sell percentage of `input_token`, e.g. `50` = 50%, `1` = 1%. Sets `input_amount` to `0` automatically. **Only valid when `input_token` is NOT a currency (SOL/BNB/ETH/USDC).** | | `--slippage ` | No | Slippage tolerance, e.g. `0.01` = 1% | +| `--auto-slippage` | No | Enable automatic slippage | | `--min-output ` | No | Minimum output amount | | `--anti-mev` | No | Enable anti-MEV protection (default true) | | `--priority-fee ` | No | Priority fee in SOL (≥ 0.00001, SOL only) | diff --git a/src/commands/swap.ts b/src/commands/swap.ts index 6ad2674..35cabb1 100644 --- a/src/commands/swap.ts +++ b/src/commands/swap.ts @@ -15,6 +15,7 @@ export function registerSwapCommands(program: Command): void { .option("--amount ", "Input raw amount (smallest unit)") .option("--percent ", "Input amount as a percentage, e.g. 50 = 50%, 1 = 1%; only valid when input_token is NOT a currency", parseFloat) .option("--slippage ", "Slippage tolerance (e.g. 0.01 = 1%)", parseFloat) + .option("--auto-slippage", "Enable automatic slippage") .option("--min-output ", "Minimum output amount") .option("--anti-mev", "Enable anti-MEV protection, default true") .option("--priority-fee ", "Priority fee in SOL (≥ 0.00001, SOL only)") @@ -44,6 +45,7 @@ export function registerSwapCommands(program: Command): void { }; if (opts.percent != null) params.input_amount_bps = String(Math.round(opts.percent * 100)); if (opts.slippage != null) params.slippage = opts.slippage; + if (opts.autoSlippage) params.auto_slippage = true; if (opts.minOutput) params.min_output_amount = opts.minOutput; if (opts.antiMev) params.is_anti_mev = true; if (opts.priorityFee) params.priority_fee = opts.priorityFee; @@ -96,4 +98,3 @@ export function registerSwapCommands(program: Command): void { printResult(data, opts.raw); }); } - From 2ca2c24f9ebcc5e02c1099f707f43d44bac9601b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Mar 2026 07:54:11 +0000 Subject: [PATCH 3/4] docs: clarify auto-slippage examples Co-authored-by: deepfeature <1503768+deepfeature@users.noreply.github.com> Agent-Logs-Url: https://github.com/GMGNAI/gmgn-skills/sessions/b2089672-9ca8-402c-be14-138b55c1bb98 --- Readme.md | 3 +-- Readme.zh.md | 3 +-- skills/gmgn-swap/SKILL.md | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Readme.md b/Readme.md index 2838b14..e9cb1f9 100644 --- a/Readme.md +++ b/Readme.md @@ -295,8 +295,7 @@ npx gmgn-cli swap \ --input-token \ --output-token \ --amount 1000000 \ - --auto-slippage \ - --slippage 0.01 + --auto-slippage # Query order npx gmgn-cli order get --chain sol --order-id diff --git a/Readme.zh.md b/Readme.zh.md index 0cf2296..d7b501c 100644 --- a/Readme.zh.md +++ b/Readme.zh.md @@ -295,8 +295,7 @@ npx gmgn-cli swap \ --input-token \ --output-token \ --amount 1000000 \ - --auto-slippage \ - --slippage 0.01 + --auto-slippage # 查询订单 npx gmgn-cli order get --chain sol --order-id diff --git a/skills/gmgn-swap/SKILL.md b/skills/gmgn-swap/SKILL.md index 6766887..b5fe2f1 100644 --- a/skills/gmgn-swap/SKILL.md +++ b/skills/gmgn-swap/SKILL.md @@ -73,8 +73,7 @@ gmgn-cli swap \ --input-token \ --output-token \ --amount 1000000 \ - --auto-slippage \ - --slippage 0.01 + --auto-slippage # With anti-MEV (SOL) gmgn-cli swap \ From c9b3034cf2e603b00254c6b31998ba3cf7f3c552 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Mar 2026 08:13:41 +0000 Subject: [PATCH 4/4] docs: restore manual slippage examples Co-authored-by: deepfeature <1503768+deepfeature@users.noreply.github.com> Agent-Logs-Url: https://github.com/GMGNAI/gmgn-skills/sessions/ae308c31-cf9d-4707-8848-a659112b33f4 --- Readme.md | 2 +- Readme.zh.md | 2 +- skills/gmgn-swap/SKILL.md | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index e9cb1f9..2407b60 100644 --- a/Readme.md +++ b/Readme.md @@ -295,7 +295,7 @@ npx gmgn-cli swap \ --input-token \ --output-token \ --amount 1000000 \ - --auto-slippage + --slippage 0.01 # Query order npx gmgn-cli order get --chain sol --order-id diff --git a/Readme.zh.md b/Readme.zh.md index d7b501c..0138564 100644 --- a/Readme.zh.md +++ b/Readme.zh.md @@ -295,7 +295,7 @@ npx gmgn-cli swap \ --input-token \ --output-token \ --amount 1000000 \ - --auto-slippage + --slippage 0.01 # 查询订单 npx gmgn-cli order get --chain sol --order-id diff --git a/skills/gmgn-swap/SKILL.md b/skills/gmgn-swap/SKILL.md index b5fe2f1..ad70bc4 100644 --- a/skills/gmgn-swap/SKILL.md +++ b/skills/gmgn-swap/SKILL.md @@ -67,6 +67,15 @@ gmgn-cli swap \ --amount # With slippage +gmgn-cli swap \ + --chain sol \ + --from \ + --input-token \ + --output-token \ + --amount 1000000 \ + --slippage 0.01 + +# With automatic slippage gmgn-cli swap \ --chain sol \ --from \