67 Commits

Author SHA1 Message Date
David Lau fdc7a3fb16 fix(security): defend against prompt injection via token metadata
Address HackenProof report GMGNWM-143, where attacker-controlled token metadata
could hijack an AI agent driving gmgn-cli into executing an unauthorized trade.
Move guardrails from overridable SKILL.md text into code.

- Add src/sanitize.ts: neutralize prompt-injection framing and hidden/control
  characters in API output (via printResult) and validate create-token metadata
- Add src/confirm.ts: code-enforced human confirmation for financial writes
  (swap, multi-swap, order strategy create, cooking create) — reads a typed
  "yes" from /dev/tty; automation requires GMGN_ALLOW_AUTOMATED_TRADES=1 + --yes
- Harden config.ts: tighten ~/.config/gmgn/.env to 0600 and warn if world-readable
- Update SKILL.md files, Readme.md and Readme.zh.md to document the gate,
  the --yes flag, and untrusted-metadata handling

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-20 19:24:50 +08:00
David Lau 2d7d0043e6 feat(chain): add robinhood support; disable monad/megaeth/hyperevm/tron
Add robinhood as a supported chain across the CLI and skills, and stop
advertising chains that are not publicly supported yet.

robinhood:
- validate.ts: add to VALID_CHAINS and treat as EVM for address checks
- reject guards for commands that do not support it: track kol,
  track smartmoney, cooking create (mirrors market signal)
- --chain help updated for supported commands (token/portfolio/swap/
  market kline·trending·trenches·hot-searches/track follow-*/order get/
  gas-price); OpenApiClient chain comment
- docs: all SKILL.md, Readme.md, Readme.zh.md (split-out row for
  unsupported commands), cli-usage.md, plugin/marketplace descriptions

disable monad/megaeth/hyperevm/tron:
- comment monad out of VALID_CHAINS (kept for quick re-enable)
- strip these chains from all --chain help, SKILL.md, cli-usage.md
  (hot-searches default now 4 chains: sol/bsc/base/eth)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 22:48:54 +08:00
gina888666 d56c904b26 docs(skills): fix Credential Model content in swap to match main verbatim
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-30 17:37:38 +08:00
gina888666 3ecd76c572 docs(skills): restore Credential Model to original position in cooking and swap
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-30 17:30:05 +08:00
gina888666 18a0bf98b1 docs(skills): restore Credential Model section to all 6 SKILL.md files
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-30 17:18:31 +08:00
gina888666 88643ca05c feat(config): add --check flag and improve BEFORE RUNNING ANY COMMAND detection
- Add gmgn-cli config --check: pure local check for GMGN_API_KEY, exit 0 = found, exit 1 = not found
- Update BEFORE RUNNING ANY COMMAND in all 6 SKILL.md files to use --check instead of file path detection
- Add fallback instruction for outdated gmgn-cli versions (unknown option → prompt user to npm install -g gmgn-cli)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 21:39:57 +08:00
gina888666 d701420705 refactor(config): move setup flow into CLI, remove gmgn-config skill
- gmgn-cli config: add multi-language guidance (zh-CN/zh-TW/en) based on system locale
- gmgn-cli config --apply <key>: write GMGN_API_KEY + GMGN_PRIVATE_KEY to ~/.config/gmgn/.env and verify via track follow-wallet
- Delete skills/gmgn-config/SKILL.md — all logic now lives in CLI source
- Simplify BEFORE RUNNING ANY COMMAND in all 6 SKILL.md files to two CLI commands, no duplicated text
- Remove stale First-time setup sections (openssl-based) from all 6 SKILL.md files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 21:39:57 +08:00
gina888666 ec35707d15 feat(config): extract setup flow into gmgn-config skill; simplify CLI output
- Add skills/gmgn-config/SKILL.md with complete setup flow: key pair
  generation, credential writing, and verification via track follow-wallet.
  Verification result is output in the user's conversation language.
- Simplify all 6 SKILL.md BEFORE RUNNING ANY COMMAND to one line that
  delegates to gmgn-config skill, removing duplicate logic.
- Remove locale detection from CLI — output only the link; Agent handles
  all user-facing guidance in the conversation language.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 21:39:57 +08:00
gina888666 cc2fc0ed00 fix(skills): replace python3/awk with node for .env config in all SKILL.md
Use node -e to write GMGN_API_KEY and GMGN_PRIVATE_KEY into .env —
node is guaranteed to be present since gmgn-cli requires Node.js.
Also clarify that the same config step applies when the user explicitly
runs gmgn-cli config and sends back an API Key.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 21:39:57 +08:00
gina888666 5453373ffa fix(skills): fix private key extraction command in BEFORE RUNNING ANY COMMAND
Replace awk+echo with python3+printf to correctly serialize the PEM
private key as a single-line \n-escaped value when writing to .env.
The awk approach produced multi-line output that broke .env parsing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 21:39:57 +08:00
gina888666 e8af4b88b5 feat(config): add gmgn-cli config command for API Key onboarding
Add a new `gmgn-cli config` command that automates Ed25519 key pair
generation for new users. The command reuses an existing keypair.pem if
present, or generates a new one, then outputs a pre-filled API Key
creation link with the public key embedded. Guidance text is output in
the user's system locale (zh-CN, zh-TW, or English).

All 6 SKILL.md files are updated with a BEFORE RUNNING ANY COMMAND
block that detects missing GMGN_API_KEY, triggers gmgn-cli config, and
instructs the Agent to write both GMGN_API_KEY and GMGN_PRIVATE_KEY
into ~/.config/gmgn/.env once the user provides their API Key.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 21:39:57 +08:00
David Lau d0ca1b40ce docs(order-quote): order quote now uses normal auth, no private key needed
quote endpoint downgraded to exist auth (API Key only); from_address
no longer needs to match the key's bound wallet. Update all auth
references in cli-usage.md, SKILL.md, and CLAUDE.md.
2026-06-22 16:55:51 +08:00
David Lau 73d81fa0b2 fix(docs): align slippage to integer 0–100 in all remaining files
Update Readme.md, Readme.zh.md, src/commands/swap.ts and cooking.ts
with integer 0–100 slippage examples (e.g. 30 = 30%) to match the
updated API validation and skill docs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 20:09:27 +08:00
David Lau 4ef54b0bcc fix(docs): update strategy examples slippage to integer and add sell-param
- Change example slippage values from 0.01 to 30 (integer 0-100 scale)
- Add --sell-param option doc (required for smart_trade)
- Add --buy-param option doc
- Clarify --slippage description as integer 0-100

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 19:40:37 +08:00
David Lau 17d7de841e feat(swap): add smart_trade order type to order strategy create
- Add --order-type smart_trade and --sub-order-type mix_trade support
- Make --check-price optional (required for limit_order, omitted for smart_trade)
- Add --open-price, --quote-investment, --condition-orders options
- Update StrategyCreateParams interface: check_price optional, add condition_orders/quote_investment
- Update SKILL.md and cli-usage.md docs with smart_trade examples and parameter table

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 14:27:01 +08:00
David Lau 0a12f0615d docs(swap): add rate limit weights for strategy and multi_swap routes
- order strategy create: POST /v1/trade/strategy/create — weight 1
- order strategy cancel: POST /v1/trade/strategy/cancel — weight 1
- order strategy list:   GET  /v1/trade/strategy/orders — weight 1
- multi-swap already listed; confirms weight 5 (same as swap)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 17:15:25 +08:00
GMGN.AI 0979d14d6a Merge pull request #142 from GMGNAI/docs/strategy-order-list-response-fields
docs(swap): expand order strategy list response fields
2026-05-29 12:05:09 +08:00
David Lau 8729cff4d3 docs(swap): expand order strategy list response fields
Add full sub-tables for list[], condition_orders[], order_statistic,
and sell_param objects in the `order strategy list` response section.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 12:03:35 +08:00
gina888666 8a095a99a8 docs: clarify price/price_usd in portfolio activity and check-price unit in strategy create
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 10:47:39 +08:00
David Lau d51f1c49d3 refactor(auth): rename normalRequest/criticalRequest; align auth terminology
- Rename private methods: normalRequest → authExistRequest,
  criticalRequest → authSignedRequest in OpenApiClient.ts (both gmgn-skills
  and scripts/src)
- Replace all "normal auth" / "critical auth" labels across SKILL.md files,
  cli-usage.md, Readme.md, and CLI command descriptions with:
    exist auth  — API Key only, no private key required
    signed auth — API Key + GMGN_PRIVATE_KEY signature required
- Add explicit "requires GMGN_PRIVATE_KEY" notes to signed-auth commands
  and "API Key only" notes to exist-auth commands throughout docs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 17:45:10 +08:00
David Lau f05e1d5d20 docs: remove "trading bot" references; label condition-orders-only flags
- Replace "trading bot" with user-facing language throughout SKILL.md
  and cli-usage.md
- Mark --auto-fee and --sell-ratio-type as "Only with --condition-orders"
  in swap and multi-swap parameter tables
- TRADING_BOT_UNAVAILABLE error now describes the symptom, not the
  internal service name

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 15:51:11 +08:00
David Lau 317c7d982b docs(swap): expand gas-price response fields to match full upstream schema
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 14:25:48 +08:00
David Lau 15872373cd feat(swap): promote gas-price to top-level command, support all chains
- Move `order gas-price` → `gmgn-cli gas-price` (top-level command)
- Expand chain support to include sol alongside eth / bsc / base
- Reorder commands in swap.ts to match SKILL.md: swap → multi-swap →
  order quote/get → gas-price → order strategy create/list/cancel

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 12:05:39 +08:00
gina888666 4649a7a287 fix(gmgn-swap): note that --anti-mev is not supported on base chain
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 20:41:12 +08:00
GMGN.AI 2b33ee666c Merge pull request #125 from GMGNAI/feat/gas-level-remove-auto-tip-fee
Feat/gas level remove auto tip fee
2026-05-18 19:13:53 +08:00
David Lau b3e99dde94 docs(swap): add Chain column to fee params; reorder SKILL.md by sub-command
- Add Chain column to swap, multi-swap, and strategy-create parameter
  tables in SKILL.md and cli-usage.md, explicitly scoping each fee flag
  to its supported chain(s)
- Reorder SKILL.md sections to follow Sub-commands table order: swap →
  multi-swap → order quote → order get → order gas-price →
  order strategy create/list/cancel
- Group each command's Usage + Parameters + Response Fields together
- Add horizontal dividers between command groups for readability
- Add order get cross-reference to shared swap response fields
- Collapse separate strategy usage examples into their respective command sections

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 19:59:24 +08:00
David Lau 072b180119 feat: add gas-level/auto-fee/gas-price endpoint; remove auto_tip_fee/max_auto_fee
- Add --gas-level (eth only), --auto-fee (eth only) to swap, multi-swap,
  and strategy create commands
- Add order gas-price subcommand (GET /v1/trade/gas_price, normal auth)
- Add --max-fee-per-gas / --max-priority-fee-per-gas to strategy create
- Remove --auto-tip-fee and --max-auto-fee from swap and multi-swap
- Update token SKILL.md: price field is now a nested object (price.price),
  add price window fields and fee_distribution object docs
- Update EIP-1559 chain coverage from Base-only to BSC/BASE/ETH

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 18:55:49 +08:00
deepfeature e181cba142 fix(skills): update rate limit settings for cooking, market, portfolio, swap, token, and track routes 2026-05-13 17:13:26 +08:00
wuyanling 1d433724d3 fix(swap): add critical warning to Chain Currencies table to prevent address guessing
AI models may use incorrect currency addresses from training data (e.g.
So11111111111111111111111111111111111111111 vs the correct ...112), causing
silent failures or misleading "jupiter has no route" errors. Added a warning
above the table and wrapped all addresses in backticks for clarity.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 19:17:53 +08:00
David Lau 56a3a60352 feat(eth): add ETH chain support to multi-swap, strategy, kol, smartmoney, created-tokens
- multi-swap --chain: add eth
- order strategy create/list/cancel --chain: add eth
- track kol/smartmoney --chain: add eth, change to requiredOption
- portfolio created-tokens --chain: add eth
- SKILL.md files updated accordingly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 18:16:58 +08:00
GMGN.AI 211f7d6fd0 docs(swap): remove USDC from ETH chain currencies (ETH-only for now)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 20:41:35 +08:00
David Lau 1012cfffb8 feat(eth): add Ethereum mainnet chain support (P0 commands)
Add ETH chain support to all P0 commands across CLI and SKILL.md docs:

Commands with ETH support added:
- token info/security/pool/holders/traders
- market kline/trending
- portfolio info/holdings/activity/stats/token-balance
- track follow-wallet
- swap, order quote/get

P1/P2 commands remain sol/bsc/base only:
- track kol/smartmoney (P1)
- multi-swap, order strategy create/list/cancel (P1)
- portfolio created-tokens (P2)

Also adds ETH chain currencies, explorer links, and gas price bounds
to gmgn-swap SKILL.md.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 16:08:36 +08:00
GMGN.AI ad4eab3852 docs(skills): front-load key terms and trim descriptions for search optimization
Shorten all 6 descriptions to 60-80 words with high-value terms in the
first 50 words (highest embedding weight). Add "crypto", "meme coin",
"meme token" where missing. Remove redundant chain-name repetition in
"Use when" sections. Keeps discriminating boundary hints (e.g. gmgn-track
→ gmgn-portfolio redirect for single-wallet queries).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 20:58:22 +08:00
GMGN.AI cdcf4e11d3 docs(skills): optimize descriptions for vector search and keyword search
Rewrote all 6 SKILL.md descriptions to improve discoverability on
clawhub.ai via both vector (semantic) and keyword search:
- gmgn-token: add "due diligence", "is it a rug", "dev wallet", "before buying" semantics
- gmgn-market: clarify "without a specific token address" to distinguish from gmgn-token; add "pumping", "fresh listings"
- gmgn-portfolio: add "by address", "decide whether to copy-trade" trigger context
- gmgn-swap: add "single swap" vs multi-wallet distinction; clarify execution verbs
- gmgn-track: add "alpha signals", "on-chain alpha"; explicit boundary note vs gmgn-portfolio
- gmgn-cooking: add "bonding curve fair launch", "cook a token", ETH/TON chain support

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 20:43:44 +08:00
GMGN.AI 932bf8c82c docs(swap): refine description to highlight meme coin trading, multi-wallet, and trailing orders
Surface key features upfront: buying/selling meme coins, multi-wallet
trading, trailing stop loss, and trailing take profit — so clawhub.ai
skill search matches more user intents precisely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 19:38:14 +08:00
GMGN.AI 4f96fedbb1 docs(skills): optimize SKILL.md descriptions for clawhub.ai discoverability
Rewrite description fields across all 6 skills to follow a consistent
"Get [capabilities] via GMGN API. Use when user asks for [intents]."
pattern, aligned with how Openclaw agents search clawhub.ai. Adds
natural-language intent keywords (price, market cap, holder list,
Smart Money, KOL trades, copy-trading, etc.) so skills surface higher
in skill-search results.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 19:32:03 +08:00
David Lau 38bff1aecb feat(swap): add multi-swap command; fix(track): downgrade follow-wallet to normal auth
- Add POST /v1/trade/multi_swap support: new MultiSwapParams interface,
  multiSwap() method, and multi-swap CLI command with full options
  (accounts, input/output amounts, slippage, fees, condition-orders, etc.)
- Fix track follow-wallet: switch from criticalRequest to normalRequest;
  --wallet is now optional (API Key's bound user resolves the follow list)
- Update SKILL.md, cli-usage.md, Readme.md, Readme.zh.md to reflect both changes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 20:43:32 +08:00
gumponchain cd9b285b3f docs(gmgn-swap): add order strategy commands to argument-hint
Add order strategy list (with required --group-tag) and order strategy
create (with required --order-type) to the frontmatter argument-hint,
reflecting newly required parameters added after 2026-04-07.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 20:24:31 +08:00
David Lau 48a06cd9b4 feat(swap): expose execution report fields in order get response
Replace top-level filled_input_amount/filled_output_amount with the
report object returned when state=30 and status=successful. Document
all report fields (amounts, tokens, decimals, price, gas) and update
order polling, post-swap receipt template, and cooking status polling
to reference report.input_amount / report.output_amount.

Closes GMGNAI/gmgn-skills#34

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 20:40:53 +08:00
deepfeature 1ea71149d9 require critical auth for order quote 2026-04-08 17:24:35 +08:00
deepfeature ca3c640afc fix bsc order quote auth 2026-04-08 17:19:16 +08:00
David Lau dbe3eec697 docs(swap): require group_tag in order strategy list; add list examples
- Mark --group-tag as required (LimitOrder or STMix)
- Add usage examples: STMix for condition orders, LimitOrder for limit orders

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 15:05:01 +08:00
gumponchain 567c5f92d1 docs(swap): clarify group-tag and order-type descriptions
- --group-tag: LimitOrder fetches limit orders only; STMix fetches mixed strategy orders (take-profit, stop-loss, trailing variants)
- order cancel --order-type: clarify limit_order vs smart_trade meanings

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 11:47:35 +08:00
David Lau 7445c970bc feat(swap): support profit_stop_trace and loss_stop_trace in condition orders
- Add drawdown_rate optional field to StrategyConditionOrder interface
- Make price_scale optional (required only for fixed-price types)
- Update --condition-orders help text with trace type example
- Document all 4 condition order types in SKILL.md with field requirements,
  drawdown_rate semantics, and usage examples
- Sync order strategy create params: replace --side / auto-inference with
  explicit --order-type and --sub-order-type required options
- Add --group-tag to order strategy list params
- Add --order-type to order strategy cancel params
- Fix --gas-price description: gwei (not wei); CLI converts internally

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 11:02:31 +08:00
gumponchain 8999d36d1d docs(swap): fix price_scale definition and update all skills
- Redefine price_scale: profit_stop uses gain % from entry (e.g. "100" = +100% / 2×), loss_stop uses drop % from entry (e.g. "65" = drops 65%)
- Update all condition-order examples in SKILL.md and both READMEs accordingly
- Add is_anti_mev recommended note and anti-mev flag to swap examples
- Add order strategy create to Financial Risk Notice
- Fix response section heading format (bold → ###) for order strategy create/list
- Add reset_at field extraction guidance to Rate Limit Handling in all 6 skills

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 17:11:16 +08:00
gumponchain 29eeb723e4 docs(swap): add swap with TP/SL examples to readmes and update SKILL.md
- Add "Swap with Take-Profit / Stop-Loss Orders" section to Readme.md and Readme.zh.md
  with hold_amount and buy_amount mode examples (TP at +100%/+300%, SL at -65%)
- Reorder CLI Reference section: basic Swap moved before TP/SL examples
- Update SKILL.md condition-orders examples: add stop-loss at -65%, bump slippage to 0.3,
  add note that hold_amount includes any added positions at trigger time

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 15:52:40 +08:00
gumponchain 60a199cb80 docs(swap): add condition-orders params, ConditionOrder fields, and sell-ratio-type descriptions
- Add --condition-orders parameter with max-10-sub-orders note and best-effort strategy behavior
- Add --sell-ratio-type with detailed explanation of buy_amount vs hold_amount semantics
- Add ConditionOrder sub-table (order_type, side, price_scale, sell_ratio) with supported types
- Add two full CLI examples: hold_amount (sell 50% at 2x, remaining 50% at 4x) and buy_amount (fixed ratio each trigger)
- Add strategy_order_id to swap response fields
- Update --sell-ratio-type description in order strategy create section

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 15:32:50 +08:00
deepfeature ed27705826 fix strategy list signature auth 2026-04-03 14:21:59 +08:00
gumponchain 8c27e42aff fix(swap): remove --open-price parameter and update docs with cooking/limit order examples
- Remove --open-price option from swap order strategy create command
- Remove open_price field from OpenApiClient StrategyCreateParams type
- Update skills/gmgn-swap/SKILL.md: drop open-price row and inference table, simplify examples to use --sub-order-type directly
- Update docs/cli-usage.md: remove --open-price from command signature and parameter table
- Add /gmgn-cooking skill to Skills tables in Readme.md and Readme.zh.md
- Add limit order and cooking CLI examples to section 8 of both readmes
- Update Cline install instructions to include /gmgn-cooking

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 12:14:52 +08:00
deepfeature b12a2294b7 feat: add cooking command and update swap/docs 2026-04-02 21:57:45 +08:00