Compare commits

...

54 Commits

Author SHA1 Message Date
GMGN.AI b18d7deb32 1.5.2 2026-07-10 10:56:46 +08:00
davidsx ddbfafdac5 Merge pull request #172 from GMGNAI/fix-trenches-robinhood-config
fix(trenches): add robinhood launchpad/quote-address config
2026-07-10 10:36:49 +08:00
David Lau 316840d84d fix(trenches): omit empty launchpad/quote filters as a safety net
Complements the robinhood config: buildTrenchesBody now only sends
launchpad_platform / quote_address_type when non-empty. These fields are
allow-list filters, so an empty array returned an all-empty response. A
future chain missing from the config maps now degrades to API defaults
instead of silently returning nothing (chains should still be added to
both maps).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-09 20:37:35 +08:00
David Lau f6e3bc4ef7 fix(trenches): add robinhood launchpad/quote-address config
market trenches returned all-empty on robinhood because
TRENCHES_PLATFORMS and TRENCHES_QUOTE_ADDRESS_TYPES had no robinhood
entry, so an empty quote_address_type filtered out every result.

Add robinhood config:
- platforms: noxa, virtuals_v2, bankr, dyorswap, pool_uniswap_v2/v3/v4
- quote_address_type: [11, 20, 24, 12, 0]

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-09 17:52:43 +08:00
GMGN.AI 1e45828c8c 1.5.1 2026-07-09 14:41:01 +08:00
davidsx 2c88807988 Merge pull request #171 from GMGNAI/feat-add-robinhood-chain-support
feat(chain): add robinhood support; disable monad/megaeth/hyperevm/tron
2026-07-09 14:04:01 +08:00
David Lau 2670188acb docs(market): hot-searches default set is 5 chains incl. robinhood
Update hot-searches default-set docs from 4 chains to 5
(sol/bsc/base/eth/robinhood) and fix two stale "7-chain" leftovers.

- skills/gmgn-market/SKILL.md, docs/cli-usage.md: 5-chain default
- src/commands/market.ts: update default-config comment

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-09 11:49:43 +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
GMGN.AI 0e1ba6181c 1.5.0 2026-07-01 11:22:11 +08:00
GMGN.AI b7b6250766 Merge pull request #166 from gina888666/feat/auto-config
feat(config): add gmgn-cli config command for API Key onboarding
2026-07-01 11:21:20 +08:00
gina888666 e3b713b150 fix(config): combine stderr+stdout when detecting auth errors in verify
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-30 21:12:27 +08:00
gina888666 ac1ea2e336 fix(config): distinguish auth vs network failures in verify step
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-30 21:08:55 +08:00
gina888666 b782743c8c fix(config): load dotenv before --check so ~/.config/gmgn/.env is read
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-30 20:12:11 +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 d0e9e42f17 docs(skills): remove Credential Model from token/market/portfolio/track (only cooking/swap had it on main)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-30 17:25:48 +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
GMGN.AI 1b27af9bb8 1.4.9 2026-06-29 17:09:58 +08:00
GMGN.AI 1ab38a1685 Merge pull request #169 from GMGNAI/feat/market-hot-searches
feat(market): add hot-searches command for hot-search ranking
2026-06-29 17:08:09 +08:00
David Lau bdf1996e2f feat(market): hot-searches range filters, flattened params, long-form fields
- Add --min-*/--max-* range flags to `market hot-searches` (same metric names as
  market trending); flatten filter fields onto each param (no nested filter object)
- Document response as long-form RankItem fields (server maps shortcodes); drop the
  filter_id field from the documented response shape
- Sync SKILL.md, cli-usage.md, Readme.md, Readme.zh.md, and OpenApiClient types

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 16:02:59 +08:00
David Lau 36771529d7 feat(market): add hot-searches command for hot-search ranking
- Add `market hot-searches` CLI command for POST /v1/market/hot_searches
- Add getHotSearches() + HotSearchesParam/HotSearchesFilter to OpenApiClient
- Support --chain (repeatable), --interval, --limit, --filter, --params override
- Omitting --chain falls back to server default 7-chain config
- Validate --interval against 1m/5m/1h/6h/24h
- Sync SKILL.md, cli-usage.md, Readme.md, Readme.zh.md docs

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 11:22:27 +08:00
GMGN.AI 01a376a951 1.4.8 2026-06-26 22:06:13 +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 48a94a46a5 fix(gmgn-config): fix fixed guidance and verification messages in all languages
Add exact fixed messages for link guidance and verification results in
zh-CN, zh-TW, and English. Instruct Agent to output them verbatim in
the user's conversation language without paraphrasing.

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
davidsx 845a8aaa62 Merge pull request #168 from GMGNAI/feat/openapi-new-feature-sync 2026-06-26 21:34:13 +08:00
David Lau ed58e67180 docs(market): address PR review — ETH trenches docs + created-unit clarity
ETH trenches/trending (SKILL.md, cli-usage.md):
- Add per-chain --launchpad-platform value tables incl. ETH for `market trenches`
- Add ETH trenches usage examples (all / new_creation / completed)
- Rename "Trending — ETH (No Platform Filter)" to "Trending — ETH by Launchpad
  Platform" and add --platform ETH examples (platform list is now supported)

min_created/max_created units (market trending):
- Clarify that the raw upstream rank interface accepts minutes only; the
  openapi-service does NOT forward this field — it evaluates the age window itself
  (cutoff = now - duration, native for m/h/d), so 6h/7d work via this CLI.
- Note a bare number with no unit suffix is rejected. Update --help text and
  code comment accordingly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 21:15:22 +08:00
David Lau ca55a80d12 feat(market): add min/max range filters to trending command
- Register dynamic --min-*/--max-* flags on `market trending`, mirroring the
  trenches pattern; forwarded as min_<metric>/max_<metric> query params to
  /v1/market/rank
- Add RANK_RANGE_FIELDS covering the 18 numeric metrics plus min/max-created
  token-age windows (m/h/d duration strings, passed through as-is)
- Document range filters and web-client filter aliases in SKILL.md, cli-usage.md,
  Readme.md and Readme.zh.md

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 20:30:25 +08:00
David Lau 4205bda0af feat(market): add eth chain support for trenches
- Add eth to TRENCHES_PLATFORMS and TRENCHES_QUOTE_ADDRESS_TYPES
- Allow --chain eth for market trenches
- Document eth platforms in CLI help, SKILL.md, and cli-usage.md

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 16:21:19 +08:00
David Lau 0b140b4a5f feat(market): support 30s kline resolution
- Add 30s to --resolution help text in market kline command
- Sync SKILL.md argument-hint and parameters table
- Sync docs/cli-usage.md resolution values

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 15:00:46 +08:00
GMGN.AI aa74d04839 1.4.7 2026-06-24 16:23:07 +08:00
GMGN.AI 6461d2f8df chore: ignore local Claude Code dev configs 2026-06-24 16:22:55 +08:00
GMGN.AI 22d2ad25d5 Merge pull request #167 from GMGNAI/feat-quote-exist-auth
docs(order-quote): order quote now uses normal auth, no private key needed
2026-06-24 16:21:20 +08:00
David Lau 25f4207351 fix(order-quote): switch quoteOrder to exist auth and update CLI help text
- OpenApiClient.quoteOrder now calls authExistRequest instead of authSignedRequest
- Remove all GMGN_PRIVATE_KEY references from the quote command description and options

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 16:13:37 +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
GMGN.AI 4e54086137 1.4.6 2026-06-18 11:59:38 +08:00
GMGN.AI fcd14effbf Merge pull request #165 from GumpOnchain/feat/add-bsc-launchpad-platforms
feat(bsc): add new BSC launchpad platforms
2026-06-18 11:57:14 +08:00
gumponchain d34315ce98 fix(bsc): update --platform hint text with new BSC launchpad names
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 11:52:04 +08:00
gumponchain b6c4ff50f2 feat(bsc): add new BSC launchpad platforms
Add cubepeg, likwid, goplus_creator, goplus_skills, openfour after
four_xmode_agent; add flap_stocks and flap_aioracle after flap.
Updates both TRENCHES_PLATFORMS defaults and SKILL.md examples.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 11:47:18 +08:00
GMGN.AI e6dfca48d8 1.4.5 2026-06-16 11:19:13 +08:00
deepfeature 362d180910 Merge pull request #161 from GMGNAI/feat/add-user-agent-header
feat(client): send User-Agent header on all API requests
2026-06-16 11:13:35 +08:00
deepfeature d5c43eed51 feat(client): send User-Agent header on all API requests
Add a `User-Agent: gmgn-cli/<version>` header (version read from
package.json) to both authExistRequest and authSignedRequest, so
upstream can identify CLI traffic and gateways that reject empty/default
UAs do not block requests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 11:12:10 +08:00
GMGN.AI 968013ebce Merge pull request #160 from nova-0328/feat/cooking
docs(cooking): clarify Flap fee-share schema and add real-world examples
2026-06-12 15:04:24 +08:00
prodev-nova 3d11f8c6d6 docs(cooking): clarify Flap fee-share schema and add real-world examples
- Correct mkt_bps: it's the tax-recipient share (X handle in gift mode or
  split_conf addresses in split mode), not a generic "marketing" fund
- Make twitter_account / split_conf conditional-required based on recipient_type
  instead of always required
- Add two end-to-end Flap examples (split mode → BSC address, gift mode → X handle)
- Merge "Full worked examples" into the Usage Examples section

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-12 14:54:11 +08:00
GMGN.AI f15e8271f9 1.4.4 2026-06-11 12:07:35 +08:00
GMGN.AI eda0ac9f52 Merge pull request #158 from GMGNAI/feat-add-follow-tokens-command
Feat add follow tokens command
2026-06-11 11:53:40 +08:00
davidsx b940c66c00 Merge pull request #156 from prodev-nova/feat/cooking
fix(cooking): remove deprecated --interval-seconds flag
2026-06-05 21:18:04 +08:00
prodev-nova 1964e927cd fix(cooking): remove deprecated --interval-seconds flag
The interval_seconds param is no longer used. Removed from the CLI
option, params assembly, CreateTokenParams, SKILL.md and cli-usage.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 21:03:23 +08:00
David Lau 0f3d550736 feat(track): add follow-token-groups subcommand
Adds `track follow-token-groups` command that calls
GET /v1/user/follow_token_groups to retrieve a wallet's token follow
group names (id, name, rank) for a given chain.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 17:08:44 +08:00
David Lau dd41e38755 feat(track): add follow-tokens subcommand
Adds gmgn-cli track follow-tokens to query a wallet's followed token
list on a given chain via GET /v1/user/follow_tokens.

- Add getFollowTokens() to OpenApiClient (authExist)
- Add track follow-tokens command with --chain, --wallet (required),
  --group-id, --interval, --order-by, --direction, --limit, --cursor,
  --search optional flags
- Update SKILL.md: sub-commands table, rate limit table (weight 3),
  usage examples, options table, response fields
- Update docs/cli-usage.md and Readme.md / Readme.zh.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 18:37:43 +08:00
25 changed files with 1052 additions and 241 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
"name": "gmgn-cli",
"description": "GMGN OpenAPI skills for AI coding assistants — token info, market data, wallet portfolio, and swap execution across sol / bsc / base / eth / monad",
"description": "GMGN OpenAPI skills for AI coding assistants — token info, market data, wallet portfolio, and swap execution across sol / bsc / base / eth / robinhood",
"owner": {
"name": "GMGN"
},
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "gmgn-cli",
"description": "GMGN OpenAPI skills — token info, market data, wallet portfolio, and swap execution across sol / bsc / base / eth / monad",
"description": "GMGN OpenAPI skills — token info, market data, wallet portfolio, and swap execution across sol / bsc / base / eth / robinhood",
"version": "1.0.0",
"author": {
"name": "GMGN"
+5
View File
@@ -18,3 +18,8 @@ dist
# Internal / testing (not for public release)
testing/
# Local Claude Code configs (dev environment only)
.claude/
.agents/
skills-lock.json
+2 -2
View File
@@ -93,8 +93,8 @@ EOF
| Mode | Commands | Requirements |
|------|----------|--------------|
| Normal | token / market / portfolio (except holdings) / track kol / track smartmoney | `GMGN_API_KEY` only, no signature |
| Critical | swap / order / portfolio holdings / track follow-wallet | `GMGN_API_KEY` + `GMGN_PRIVATE_KEY` — CLI handles signing automatically |
| Normal | token / market / portfolio (except holdings) / track kol / track smartmoney / **order quote** | `GMGN_API_KEY` only, no signature |
| Critical | swap / order (except order quote) / portfolio holdings / track follow-wallet | `GMGN_API_KEY` + `GMGN_PRIVATE_KEY` — CLI handles signing automatically |
## SKILL.md Authoring Rules
+25 -3
View File
@@ -461,6 +461,13 @@ gmgn-cli market trending \
--order-by volume --limit 20 \
--filter not_risk --filter not_honeypot
# Trending with numeric range filters (min_*/max_* are forwarded as query params)
gmgn-cli market trending \
--chain sol --interval 1h \
--min-liquidity 10000 --max-liquidity 1000000 \
--max-created 30m --min-smart-degen-count 1 \
--order-by volume --limit 30
gmgn-cli market trenches \
--chain sol \
--type new_creation --type near_completion --type completed \
@@ -478,6 +485,16 @@ gmgn-cli market signal --chain sol --signal-type 12 --raw
# Token signals — multi-group: smart money OR large buys in parallel
gmgn-cli market signal --chain sol \
--groups '[{"signal_type":[12]},{"signal_type":[14,16]}]' --raw
# Hot searches — most-searched tokens (default 7-chain set, 24h)
gmgn-cli market hot-searches --raw
# Hot searches — SOL only, 1h window, top 50
gmgn-cli market hot-searches --chain sol --interval 1h --limit 50 --raw
# Hot searches — SOL with range filters (same metric names as trending)
gmgn-cli market hot-searches --chain sol --interval 1h \
--min-liquidity 10000 --min-smart-degen-count 1 --raw
```
### Portfolio
@@ -505,6 +522,9 @@ gmgn-cli portfolio created-tokens --chain sol --wallet <addr>
### Track
```bash
# Followed token map for a wallet
gmgn-cli track follow-tokens --chain sol --wallet <wallet_address>
# Follow-wallet trade records
gmgn-cli track follow-wallet --chain sol
gmgn-cli track follow-wallet --chain sol --limit 20 --min-amount-usd 1000
@@ -706,9 +726,11 @@ gmgn-cli cooking \
| Commands | Chains | Chain Currencies |
|----------|--------|-----------------|
| token / market / portfolio / track | `sol` / `bsc` / `base` / `eth` | — |
| swap / order | `sol` / `bsc` / `base` / `eth` | sol: SOL, USDC · bsc: BNB, USDC · base: ETH, USDC · eth: ETH |
| gas-price | `sol` / `bsc` / `base` / `eth` | — |
| token / market / portfolio / track | `sol` / `bsc` / `base` / `eth` / `robinhood` | — |
| swap / order | `sol` / `bsc` / `base` / `eth` / `robinhood` | sol: SOL, USDC · bsc: BNB, USDC · base: ETH, USDC · eth: ETH |
| gas-price | `sol` / `bsc` / `base` / `eth` / `robinhood` | — |
| track kol / track smartmoney · market signal | `sol` / `bsc` / `base` / `eth` (kol/smartmoney) · `sol` / `bsc` (signal) — **no `robinhood`** | — |
| cooking create | `sol` / `bsc` / `base` — **no `robinhood`** | — |
---
+25 -3
View File
@@ -491,6 +491,13 @@ gmgn-cli market trending \
--order-by volume --limit 20 \
--filter not_risk --filter not_honeypot
# 热门榜 + 数值范围过滤(min_*/max_* 以查询参数透传)
gmgn-cli market trending \
--chain sol --interval 1h \
--min-liquidity 10000 --max-liquidity 1000000 \
--max-created 30m --min-smart-degen-count 1 \
--order-by volume --limit 30
# 战壕新币列表
gmgn-cli market trenches \
--chain sol \
@@ -502,6 +509,16 @@ gmgn-cli market trenches \
gmgn-cli market trenches \
--chain sol --type new_creation \
--filter-preset safe --min-smart-degen-count 1 --sort-by smart_degen_count
# 热搜榜——搜索热度最高的代币(默认 7 链,24h)
gmgn-cli market hot-searches --raw
# 热搜榜——仅 SOL,1h 档,前 50
gmgn-cli market hot-searches --chain sol --interval 1h --limit 50 --raw
# 热搜榜——SOL 数值范围过滤(指标名与 trending 一致)
gmgn-cli market hot-searches --chain sol --interval 1h \
--min-liquidity 10000 --min-smart-degen-count 1 --raw
```
### Portfolio
@@ -529,6 +546,9 @@ gmgn-cli portfolio created-tokens --chain sol --wallet <addr>
### Track
```bash
# 查询钱包收藏的代币列表
gmgn-cli track follow-tokens --chain sol --wallet <wallet_address>
# 追踪关注钱包的交易动态
gmgn-cli track follow-wallet --chain sol
gmgn-cli track follow-wallet --chain sol --limit 20 --min-amount-usd 1000
@@ -730,9 +750,11 @@ gmgn-cli cooking \
| 接口类型 | 支持的链 | 链原生货币 |
|----------|----------|-----------|
| token / market / portfolio / track | `sol` / `bsc` / `base` / `eth` | — |
| swap / order | `sol` / `bsc` / `base` / `eth` | sol: SOL、USDC · bsc: BNB、USDC · base: ETH、USDC · eth: ETH |
| gas-price | `sol` / `bsc` / `base` / `eth` | — |
| token / market / portfolio / track | `sol` / `bsc` / `base` / `eth` / `robinhood` | — |
| swap / order | `sol` / `bsc` / `base` / `eth` / `robinhood` | sol: SOL、USDC · bsc: BNB、USDC · base: ETH、USDC · eth: ETH |
| gas-price | `sol` / `bsc` / `base` / `eth` / `robinhood` | — |
| track kol / track smartmoney · market signal | `sol` / `bsc` / `base` / `eth`kol/smartmoney)· `sol` / `bsc`signal)— **不支持 `robinhood`** | — |
| cooking create | `sol` / `bsc` / `base` — **不支持 `robinhood`** | — |
---
+103 -15
View File
@@ -101,7 +101,7 @@ npx gmgn-cli market kline \
|--------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` |
| `--address` | Yes | Token contract address |
| `--resolution` | Yes | Candlestick resolution: `1m` / `5m` / `15m` / `1h` / `4h` / `1d` |
| `--resolution` | Yes | Candlestick resolution: `30s` / `1m` / `5m` / `15m` / `1h` / `4h` / `1d` |
| `--from` | No | Start time (Unix seconds) |
| `--to` | No | End time (Unix seconds) |
@@ -120,18 +120,21 @@ npx gmgn-cli market trending \
[--direction asc|desc] \
[--filter <tag>] \
[--platform <name>] \
[--min-<metric> <n>] [--max-<metric> <n>] \
[--raw]
```
| Option | Required | Description |
|--------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` |
| `--interval` | Yes | `1h` / `3h` / `6h` / `24h` |
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--interval` | Yes | `1m` / `5m` / `1h` / `6h` / `24h` |
| `--limit` | No | Number of results (default 100, max 100) |
| `--order-by` | No | Sort field: `volume` / `swaps` / `liquidity` / `marketcap` / `holders` / `price` / `change` / `change1m` / `change5m` / `change1h` / `renowned_count` / `smart_degen_count` / `bluechip_owner_percentage` / `rank` / `creation_timestamp` / `square_mentions` / `history_highest_market_cap` / `gas_fee` |
| `--direction` | No | Sort direction: `asc` / `desc` (default `desc`) |
| `--filter` | No | Filter tag (repeatable): `has_social` / `not_risk` / `not_honeypot` / `verified` / `locked` / `renounced` / `distributed` / `frozen` / `burn` / `token_burnt` / `creator_hold` / `creator_close` / `creator_add_liquidity` / `creator_remove_liquidity` / `creator_sell` / `creator_buy` / `not_wash_trading` / `not_social_dup` / `not_image_dup` / `is_internal_market` / `is_out_market` |
| `--filter` | No | Filter tag (repeatable): `has_social` / `not_risk` / `not_honeypot` / `verified` / `locked` / `renounced` / `distributed` / `frozen` / `burn` / `token_burnt` / `creator_hold` / `creator_close` / `creator_add_liquidity` / `creator_remove_liquidity` / `creator_sell` / `creator_buy` / `not_wash_trading` / `not_social_dup` / `not_image_dup` / `is_internal_market` / `is_out_market`. The gmgn web client also sends aliases `social_not_duplicate` / `img_not_duplicate` / `is_burnt` / `launching` / `migrated`, which are accepted but only the canonical tags change behavior. |
| `--platform` | No | Platform filter (repeatable). Omit (or pass an empty list) to include **all** platforms. Available values depend on chain — see below. |
| `--min-<metric>` / `--max-<metric>` | No | Numeric range filters (inclusive). Supported metrics: `volume` / `liquidity` / `marketcap` / `history-highest-marketcap` / `swaps` / `holder-count` / `gas-fee` / `renowned-count` / `smart-degen-count` / `bot-degen-count` / `visiting-count` / `price-change-percent` / `insider-rate` / `bundler-rate` / `entrapment-ratio` / `top10-holder-rate` / `top70-sniper-hold-rate` / `dev-team-hold-rate`. Unknown metrics are ignored by the service. |
| `--min-created` / `--max-created` | No | Token-age window, duration string with a `m` (minutes) / `h` (hours) / `d` (days) suffix, e.g. `30m` / `6h` / `7d`. `--min-created` is a minimum age (excludes younger tokens); `--max-created` a maximum age (excludes older tokens). The raw upstream rank interface accepts minutes only; the openapi-service does not forward this field — it evaluates the age window itself (cutoff = now duration, native for `m`/`h`/`d`), so `6h`/`7d` work here. A bare number with no unit suffix is not accepted. |
**`sol` platforms:** `Pump.fun` / `pump_mayhem` / `pump_mayhem_agent` / `pump_agent` / `letsbonk` / `bonkers` / `bags` / `memoo` / `liquid` / `bankr` / `zora` / `surge` / `anoncoin` / `moonshot_app` / `wendotdev` / `heaven` / `sugar` / `token_mill` / `believe` / `trendsfun` / `trends_fun` / `jup_studio` / `Moonshot` / `boop` / `xstocks` / `ray_launchpad` / `meteora_virtual_curve` / `pool_ray` / `pool_meteora` / `pool_pump_amm` / `pool_orca`
@@ -139,6 +142,8 @@ npx gmgn-cli market trending \
**`base` platforms:** `clanker` / `bankr` / `flaunch` / `zora` / `zora_creator` / `baseapp` / `basememe` / `virtuals_v2` / `klik`
**`eth` platforms:** `trench` / `clanker` / `klik` / `livo` / `stroid` / `pool_uniswap_v2` / `pool_uniswap_v3` / `printr`
---
## portfolio holdings
@@ -289,11 +294,19 @@ npx gmgn-cli market trenches --chain <chain> [--type <type...>] [--launchpad-pla
| Option | Required | Description |
|--------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` |
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--type` | No | Categories to query, repeatable: `new_creation` / `near_completion` / `completed` (default: all three) |
| `--launchpad-platform` | No | Launchpad platform filter, repeatable (default: all platforms for the chain) |
| `--launchpad-platform` | No | Launchpad platform filter, repeatable (default: all platforms for the chain). Values depend on chain — see below. |
| `--limit` | No | Max results per category, max 80 (default: 80) |
**`sol` platforms:** `Pump.fun` / `pump_mayhem` / `pump_mayhem_agent` / `pump_agent` / `letsbonk` / `bonkers` / `bags` / `memoo` / `liquid` / `bankr` / `zora` / `surge` / `anoncoin` / `moonshot_app` / `wendotdev` / `heaven` / `sugar` / `token_mill` / `believe` / `trendsfun` / `trends_fun` / `jup_studio` / `Moonshot` / `boop` / `ray_launchpad` / `meteora_virtual_curve` / `xstocks`
**`bsc` platforms:** `fourmeme` / `fourmeme_agent` / `bn_fourmeme` / `four_xmode_agent` / `cubepeg` / `likwid` / `goplus_creator` / `goplus_skills` / `openfour` / `flap` / `flap_stocks` / `flap_aioracle` / `clanker` / `lunafun`
**`base` platforms:** `clanker` / `bankr` / `flaunch` / `zora` / `zora_creator` / `baseapp` / `basememe` / `virtuals_v2` / `klik`
**`eth` platforms:** `trench` / `clanker` / `klik` / `livo` / `stroid` / `pool_uniswap_v2` / `pool_uniswap_v3` / `printr`
**Response:** `data.new_creation`, `data.pump`, `data.completed` — each is an array of `RankItem` (same structure as `market trending` rank items). **Note: `data.pump` in the response corresponds to `--type near_completion` in the request. The API always returns this category under the key `pump`, not `near_completion`.**
---
@@ -349,6 +362,82 @@ gmgn-cli market signal --chain sol --groups '<json_array>' [--raw]
---
## market hot-searches
Query the hot-search ranking — the most-searched tokens, ranked by `visiting_count` (search heat). Cross-chain top-500; one request can cover several chains at once. API Key auth only.
```bash
# Default 5-chain set (sol/bsc/base/eth/robinhood, each 24h):
gmgn-cli market hot-searches [--raw]
# Specific chain(s) and interval:
gmgn-cli market hot-searches --chain <chain...> [--interval <1m|5m|1h|6h|24h>] [--limit <n>] [--filter <tag...>] [--min-* <n>] [--max-* <n>] [--raw]
# Full per-param override (JSON array):
gmgn-cli market hot-searches --params '<json_array>' [--raw]
```
| Option | Required | Description |
|--------|----------|-------------|
| `--chain` | No | Repeatable: `sol` / `bsc` / `base` / `eth` / `robinhood`. Omit for the default 5-chain set. |
| `--interval` | No | `1m` / `5m` / `1h` / `6h` / `24h` (default `24h`). Applies to every `--chain`. |
| `--limit` | No | Max results per chain (default `500`). |
| `--filter` | No | Repeatable **boolean** filter tags (downstream `filter.filters`). sol defaults: `renounced` / `frozen`; EVM defaults: `not_honeypot` / `verified` / `renounced`. Recognised tags: `renounced` / `frozen` (sol) / `is_burnt` / `token_burnt` / `not_wash_trading` / `not_honeypot` (EVM) / `verified` (EVM) / `locked` (EVM) / `has_social` / `distribed` / `not_risk` / `img_not_duplicate` / `social_not_duplicate` / `creator_hold` / `creator_close` / `dexscr_update_link` / `launching` / `migrated` / `hide_b20` (base) / `hide_non_b20` (base). Unknown tags are silent no-ops. |
| `--min-*` / `--max-*` | No | Numeric range bounds, **same metric names as `market trending`** (`--min-liquidity`, `--max-marketcap`, `--min-volume`, `--min-swaps`, `--min-smart-degen-count`, …, plus `--min-created`/`--max-created` durations). Translated server-side per `--interval`. `price_change_percent` only applies to `1m`/`5m`/`1h`. |
| `--params` | No | Full JSON array override — overrides `--chain` / `--interval` / `--limit` / `--filter` and range flags when provided. Filter fields are flattened onto each param (no nested `filter` object): a param accepts `filters`, `limit`, `min_created`/`max_created`, and rank-style `min_<metric>`/`max_<metric>` keys. |
**Response:** `data` is an array of `(interval, chain)` blocks; each block has `interval`, `chain`, `version`, and `tokens`. `tokens` uses the **same long-form fields as `market trending`** (`address`, `symbol`, `visiting_count`, `market_cap`, …) — the server maps the upstream shortcodes for you — and each token carries a 1-based `rank`. Ranked by search heat (`visiting_count`), max 500 per chain. **Note:** `--chain all` is not valid — pass `--chain` multiple times to aggregate across chains. Boolean tag names differ from `market trending`: this path uses `launching`/`migrated` and `img_not_duplicate`/`social_not_duplicate`.
---
## track follow-tokens
Query the followed token list for a wallet. Returns a paginated list of tokens the wallet has bookmarked on GMGN, with full market data. API Key auth only.
```bash
gmgn-cli track follow-tokens \
--chain <chain> \
--wallet <wallet_address> \
[--group-id <id>] \
[--order-by <field>] \
[--direction <asc|desc>] \
[--limit <n>] \
[--cursor <cursor>] \
[--raw]
```
| Option | Required | Description |
|--------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--wallet` | Yes | Wallet address |
| `--group-id` | No | `all_group` (all tokens), `default`, or a user-defined group ID |
| `--interval` | No | Time interval for price change stats: `1m` / `5m` / `1h` / `6h` / `24h` |
| `--order-by` | No | `created_at` / `swaps` / `volume` / `market_cap` / `liquidity` / `price` / `open_timestamp` |
| `--direction` | No | Sort direction: `asc` / `desc` |
| `--limit` | No | Page size |
| `--cursor` | No | Pagination cursor from previous response |
| `--search` | No | Search by token name or address |
---
## track follow-token-groups
Query the follow token group names for a wallet. Returns the groups a wallet uses to organise its followed tokens on GMGN. API Key auth only.
```bash
gmgn-cli track follow-token-groups \
--chain <chain> \
--wallet <wallet_address> \
[--raw]
```
| Option | Required | Description |
|--------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--wallet` | Yes | Wallet address |
---
## portfolio follow-wallet
Query follow-wallet trade records. Returns trades from wallets you personally follow on the GMGN platform. The follow list is resolved automatically from the GMGN user account bound to the API Key — `--wallet` is optional. Signed auth (API Key + private key signature).
@@ -411,7 +500,7 @@ gmgn-cli track smartmoney [--chain <chain>] [--limit <n>] [--side <side>] [--raw
## order quote
Get a swap quote without submitting a transaction. All supported quote chains use signed auth and require `GMGN_PRIVATE_KEY`.
Get a swap quote without submitting a transaction. Uses normal auth — only `GMGN_API_KEY` is required, no `GMGN_PRIVATE_KEY` needed.
```bash
npx gmgn-cli order quote \
@@ -426,8 +515,8 @@ npx gmgn-cli order quote \
| Option | Required | Description |
|--------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` (all require `GMGN_PRIVATE_KEY` for quote) |
| `--from` | Yes | Wallet address (must match API Key binding) |
| `--chain` | Yes | `sol` / `bsc` / `base` |
| `--from` | Yes | Wallet address |
| `--input-token` | Yes | Input token contract address |
| `--output-token` | Yes | Output token contract address |
| `--amount` | Yes | Input amount (smallest unit) |
@@ -473,7 +562,7 @@ npx gmgn-cli swap \
| Option | Required | Chain | Description |
|--------|----------|-------|-------------|
| `--chain` | Yes | all | `sol` / `bsc` / `base` / `eth` |
| `--chain` | Yes | all | `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--from` | Yes | all | Wallet address (must match the wallet bound to the API Key) |
| `--input-token` | Yes | all | Input token contract address |
| `--output-token` | Yes | all | Output token contract address |
@@ -550,7 +639,7 @@ gmgn-cli multi-swap \
| Option | Required | Chain | Description |
|--------|----------|-------|-------------|
| `--chain` | Yes | all | `sol` / `bsc` / `base` / `eth` |
| `--chain` | Yes | all | `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--accounts` | Yes | all | Comma-separated wallet addresses (1100, all bound to API Key) |
| `--input-token` | Yes | all | Input token contract address |
| `--output-token` | Yes | all | Output token contract address |
@@ -593,7 +682,7 @@ npx gmgn-cli order get --chain <chain> --order-id <order_id> [--raw]
| Option | Required | Description |
|--------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` / `monad` |
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--order-id` | Yes | Order ID (returned by the `swap` command) |
**Response fields (data):** Same structure as the `swap` response above.
@@ -628,7 +717,7 @@ gmgn-cli order strategy create \
| Option | Required | Description |
|--------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--from` | Yes | Wallet address (must match API Key binding) |
| `--base-token` | Yes | Base token contract address |
| `--quote-token` | Yes | Quote token contract address |
@@ -749,7 +838,7 @@ gmgn-cli cooking create \
[--fourmeme-rate-conf <json>] \
[--bags-fee-share-list <json>] \
[--bonk-model <model>] \
[--buy-wallets <json>] [--snip-buy-wallets <json>] [--interval-seconds <n>] \
[--buy-wallets <json>] [--snip-buy-wallets <json>] \
[--buy-trade-config <json>] [--sell-trade-config <json>] [--sell-configs <json>] \
[--raw]
```
@@ -795,7 +884,6 @@ gmgn-cli cooking create \
| `--bonk-model` | No | Bonk model identifier (**bonk DEX only**) |
| `--buy-wallets` | No | Multi-wallet buy config as JSON array: `[{"from_address":"<addr>","buy_amt":"<n>"}]` |
| `--snip-buy-wallets` | No | Snipe-buy wallet config as JSON array: `[{"from_address":"<addr>","buy_amt":"<n>"}]` |
| `--interval-seconds` | No | Interval between multi-wallet buys in seconds |
| `--buy-trade-config` | No | Buy-side trade config for CondMarket orders as JSON (TradeParam) |
| `--sell-trade-config` | No | Sell-side trade config for auto-sell / pending_sell as JSON (TradeParam) |
| `--sell-configs` | No | Auto-sell strategy list as JSON array (CookingSellConfig[]): `[{"sell_type":"delay_sell","delay_sec":<n>,"sell_ratio":"0.5","wallet_addresses":["<addr>"]}]` |
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "gmgn-cli",
"version": "1.4.3",
"version": "1.5.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "gmgn-cli",
"version": "1.4.3",
"version": "1.5.2",
"license": "MIT",
"dependencies": {
"commander": "^12.1.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "gmgn-cli",
"version": "1.4.3",
"version": "1.5.2",
"description": "GMGN OpenAPI CLI — call GMGN market, token, portfolio and swap APIs from the command line",
"type": "module",
"bin": {
+59 -29
View File
@@ -6,6 +6,8 @@ metadata:
cliHelp: "gmgn-cli cooking --help"
---
**BEFORE RUNNING ANY COMMAND: Run `gmgn-cli config --check`. If exit code is 0, proceed normally. If exit code is 1, (1) run `gmgn-cli config` and show the output to the user; (2) once the user sends the API Key, run `gmgn-cli config --apply <KEY>` to complete configuration and verification, then show the output to the user. If `--check` returns an error (unknown option or command not found), tell the user to run `npm install -g gmgn-cli` to update, then retry.**
**IMPORTANT: Always use `gmgn-cli` commands below. Do NOT use web search, WebFetch, curl, or visit gmgn.ai — all token creation operations must go through the CLI. The CLI handles signing and submission automatically.**
**IMPORTANT: Do NOT guess field names or values. When a field's meaning is unclear, look it up in the Response Fields sections below before using it.**
@@ -100,23 +102,6 @@ When a request returns `429`:
- `cooking create` is a real transaction: **never loop or auto-resubmit** after a `429`. Wait until the reset time, then ask for confirmation again before retrying.
- For `RATE_LIMIT_EXCEEDED` or `RATE_LIMIT_BANNED`, repeated requests during cooldown extend the ban by 5 seconds each time, up to 5 minutes.
**First-time setup** (if credentials are not configured):
1. Generate key pair and show the public key to the user:
```bash
openssl genpkey -algorithm ed25519 -out /tmp/gmgn_private.pem 2>/dev/null && \
openssl pkey -in /tmp/gmgn_private.pem -pubout 2>/dev/null
```
Tell the user: *"This is your Ed25519 public key. Go to **https://gmgn.ai/ai**, paste it into the API key creation form (enable swap/cooking capability), then send me the API Key value shown on the page."*
2. Wait for the user's API key, then configure both credentials:
```bash
mkdir -p ~/.config/gmgn
echo 'GMGN_API_KEY=<key_from_user>' > ~/.config/gmgn/.env
echo 'GMGN_PRIVATE_KEY="<pem_content_from_step_1>"' >> ~/.config/gmgn/.env
chmod 600 ~/.config/gmgn/.env
```
### Credential Model
- `GMGN_PRIVATE_KEY` is used exclusively for **local message signing** — the private key never leaves the machine. The CLI computes an Ed25519 signature in-process and transmits only the base64-encoded result in the `X-Signature` request header.
@@ -180,7 +165,6 @@ gmgn-cli cooking stats [--raw]
| `--bonk-model` | No | Bonk model identifier (**bonk DEX only**) |
| `--buy-wallets` | No | Multi-wallet buy config as JSON array: `[{"from_address":"<addr>","buy_amt":"<n>"}]` |
| `--snip-buy-wallets` | No | Snipe-buy wallet config as JSON array: `[{"from_address":"<addr>","buy_amt":"<n>"}]` |
| `--interval-seconds` | No | Interval between multi-wallet buys in seconds |
| `--buy-trade-config` | No | Buy-side trade config for CondMarket orders as JSON (TradeParam) — see Advanced API Fields |
| `--sell-trade-config` | No | Sell-side trade config for auto-sell / pending_sell as JSON (TradeParam) — see Advanced API Fields |
| `--sell-configs` | No | Auto-sell strategy list as JSON array (CookingSellConfig[]) — see Auto-Sell Configuration |
@@ -263,23 +247,25 @@ Example: `--pump-fee-share-list '[{"provider":"twitter","username":"handle","bas
| Field | Type | Required | Description |
|---|---|---|---|
| `beneficiary` | string | Yes | Fee recipient address |
| `tax_rate` | int | Conditional | V5 unified tax rate in bps, e.g. 5% → `500` |
| `buy_tax_rate` | int | Conditional | V6 separate buy tax rate in bps |
| `buy_tax_rate` | int | Conditional | V6 separate buy tax rate in bps, e.g. 1% → `100`. Use together with `sell_tax_rate`. |
| `sell_tax_rate` | int | Conditional | V6 separate sell tax rate in bps |
| `mkt_bps` | int | Yes | Marketing / donation fund share |
| `tax_rate` | int | Conditional | V5 unified tax rate in bps, e.g. 5% → `500`. Use instead of `buy_tax_rate` + `sell_tax_rate`. |
| `mkt_bps` | int | Yes | **Tax recipient share** — the slice of the collected tax routed to the recipient(s): the X handle when `recipient_type = gift`, or the `split_conf` addresses when `recipient_type = split`. This is NOT a generic "marketing" fund. |
| `deflation_bps` | int | Yes | Burn (supply-reduction) share |
| `dividend_bps` | int | Yes | Dividend (holder-reward) share |
| `lp_bps` | int | Yes | Liquidity share |
| `recipient_type` | string | Yes | `gift` (route the recipient share to an X handle) / `split` (route it to specific addresses) |
| `twitter_account` | string | Conditional | X / Twitter handle that receives the recipient share — **required when `recipient_type = gift`**; leave `""` when `split`. |
| `split_conf` | array | Conditional | Recipient address split list — **required when `recipient_type = split`**; leave `[]` when `gift`. |
| `minimum_share_balance` | int | Yes | Min holding to qualify for dividends — minimum **10000** tokens |
| `recipient_type` | string | Yes | `split` (proportional) / `gift` |
| `twitter_account` | string | Yes | Twitter username |
| `split_conf` | array | Yes | Split list — see below |
| `beneficiary` | string | No | Legacy single fee-recipient address. Omit when using `recipient_type` + `twitter_account` / `split_conf`. |
`split_conf` entries: `{ "recipient": "<address>", "bps": <n> }` — all `bps` must sum to **10000**.
> - **Tax distribution:** whenever the tax rate > 0, `mkt_bps + deflation_bps + dividend_bps + lp_bps` must sum to **10000**. `mkt_bps` is the recipient's cut; the other three are burn / dividend / liquidity.
> - **Recipient routing:** set `recipient_type = gift` + `twitter_account` to send the recipient cut to an X handle, OR `recipient_type = split` + `split_conf` to send it to one or more addresses. Fill only the field that matches the chosen mode; leave the other empty (`""` / `[]`).
> - Use `tax_rate` for V5 (unified rate); use `buy_tax_rate` + `sell_tax_rate` for V6 (separate rates).
> - When the tax rate > 0: `mkt_bps + deflation_bps + dividend_bps + lp_bps` must sum to **10000**. When `lp_bps > 0`: `minimum_share_balance` must be > 0.
> - When `lp_bps > 0`: `minimum_share_balance` must be > 0.
### FourMeme (`--dex fourmeme`)
@@ -373,6 +359,8 @@ Token creation is **asynchronous**. If the initial `cooking create` response sho
## Usage Examples
Examples run shortest-first: basic single-launch commands, then full end-to-end configurations. Every JSON flag below is a valid payload shape — copy and adapt.
```bash
# Get token creation statistics per launchpad
gmgn-cli cooking stats
@@ -426,9 +414,7 @@ gmgn-cli cooking create \
--sell-configs '[{"sell_type":"delay_sell","delay_sec":60,"sell_ratio":"0.5","wallet_addresses":["<wallet_address>"]}]'
```
### Full worked examples
These mirror real launch configurations end-to-end. Copy and adapt — every JSON flag below is a valid payload shape.
These mirror real launch configurations end-to-end.
**Pump.fun (SOL) — Bundle + Sniper + Auto-Sell + Agent Auto Buyback**
@@ -477,6 +463,50 @@ gmgn-cli cooking create \
- `--gas-price 1000000000` is wei (1 Gwei).
- In `--fourmeme-rate-conf`, `recipient_rate + burn_rate + divide_rate + liquidity_rate` must sum to **100**.
**Flap (BSC) — `split` mode: route the recipient cut to a BSC address**
```bash
gmgn-cli cooking create \
--chain bsc \
--dex flap \
--from 0x1f8d977b6843e1bbcb306c4a3664c9fb0277979d \
--name "refer" \
--symbol refer \
--buy-amt 2 \
--image-url https://gmgn.ai/external-res-va/11ad7747dcefcfaae87d3f53a4d7330d_v2l.webp \
--website https://www.refercoins.bond/ \
--twitter https://x.com/referdotfun \
--dev-gas 50000000 \
--auto-slippage \
--flap-rate-conf '{"buy_tax_rate":100,"sell_tax_rate":100,"mkt_bps":10000,"deflation_bps":0,"dividend_bps":0,"lp_bps":0,"minimum_share_balance":10000,"recipient_type":"split","twitter_account":"","split_conf":[{"recipient":"0x1f8d977b6843e1bbcb306c4a3664c9fb0277979d","bps":10000}]}'
```
- `recipient_type: split` → the recipient cut goes to `split_conf` addresses; `twitter_account` is left `""`.
- `mkt_bps:10000` means the **entire** tax (1% buy / 1% sell) goes to the recipient — `deflation_bps + dividend_bps + lp_bps` are all `0`, and the four still sum to **10000**.
- `split_conf` has one address taking all `10000` bps (100%). Multiple addresses are allowed as long as their `bps` sum to `10000`.
**Flap (BSC) — `gift` mode: route the recipient cut to an X handle, split the rest across burn / dividend / LP**
```bash
gmgn-cli cooking create \
--chain bsc \
--dex flap \
--from 0x1f8d977b6843e1bbcb306c4a3664c9fb0277979d \
--name "refer" \
--symbol refer \
--buy-amt 2 \
--image-url https://gmgn.ai/external-res-va/11ad7747dcefcfaae87d3f53a4d7330d_v2l.webp \
--website https://www.refercoins.bond/ \
--twitter https://x.com/referdotfun \
--dev-gas 50000000 \
--auto-slippage \
--flap-rate-conf '{"buy_tax_rate":100,"sell_tax_rate":100,"mkt_bps":5000,"deflation_bps":2700,"dividend_bps":1800,"lp_bps":500,"minimum_share_balance":10000,"recipient_type":"gift","twitter_account":"handleName","split_conf":[]}'
```
- `recipient_type: gift` → the recipient cut goes to the `twitter_account` X handle; `split_conf` is left `[]`.
- Tax distribution: `mkt_bps:5000` (50% to the handle) + `deflation_bps:2700` (27% burn) + `dividend_bps:1800` (18% dividend) + `lp_bps:500` (5% LP) = **10000**.
- `lp_bps > 0`, so `minimum_share_balance` must be > 0 (`10000` here).
## Output Format
### Pre-create Confirmation
+266 -33
View File
@@ -1,11 +1,13 @@
---
name: gmgn-market
description: Get crypto and meme token price charts (K-line, candlestick, OHLCV), trending meme coin rankings by volume, and newly launched tokens on launchpads (pump.fun, fourmeme, letsbonk, Raydium, etc.) via GMGN API on Solana, BSC, Base, or Ethereum. Use when user asks for price chart, trending tokens, what's pumping, hot coins, new launches, token signals, or wants to discover early-stage opportunities.
argument-hint: "kline --chain <sol|bsc|base|eth> --address <token_address> --resolution <1m|5m|15m|1h|4h|1d> [--from <unix_ts>] [--to <unix_ts>] | trending --chain <sol|bsc|base|eth> --interval <1m|5m|1h|6h|24h> | trenches --chain <sol|bsc|base> | signal --chain <sol|bsc>"
description: Get crypto and meme token price charts (K-line, candlestick, OHLCV), trending meme coin rankings by volume, newly launched tokens on launchpads (pump.fun, fourmeme, letsbonk, Raydium, etc.), and the hot-search ranking (most-searched tokens) via GMGN API on Solana, BSC, Base, or Ethereum. Use when user asks for price chart, trending tokens, what's pumping, hot coins, most searched tokens, new launches, token signals, or wants to discover early-stage opportunities.
argument-hint: "kline --chain <sol|bsc|base|eth|robinhood> --address <token_address> --resolution <30s|1m|5m|15m|1h|4h|1d> [--from <unix_ts>] [--to <unix_ts>] | trending --chain <sol|bsc|base|eth|robinhood> --interval <1m|5m|1h|6h|24h> | trenches --chain <sol|bsc|base|eth|robinhood> | signal --chain <sol|bsc> | hot-searches [--chain <sol|bsc|base|eth|robinhood...>] [--interval <1m|5m|1h|6h|24h>]"
metadata:
cliHelp: "gmgn-cli market --help"
---
**BEFORE RUNNING ANY COMMAND: Run `gmgn-cli config --check`. If exit code is 0, proceed normally. If exit code is 1, (1) run `gmgn-cli config` and show the output to the user; (2) once the user sends the API Key, run `gmgn-cli config --apply <KEY>` to complete configuration and verification, then show the output to the user. If `--check` returns an error (unknown option or command not found), tell the user to run `npm install -g gmgn-cli` to update, then retry.**
**IMPORTANT: Always use `gmgn-cli` commands below. Do NOT use web search, WebFetch, curl, or visit gmgn.ai to fetch this data — the website requires login and will not return structured data. The CLI is the only correct method.**
**IMPORTANT: Do NOT guess field names or values. When a field's meaning is unclear, look it up in the Response Fields sections below before using it.**
@@ -49,10 +51,11 @@ Use the `gmgn-cli` tool to query K-line data for a token, browse trending tokens
| `market trending` | Trending tokens ranked by swap activity — use `--interval` to specify the time window (e.g. `1m` for 1-minute hottest, `1h` for 1-hour trending) |
| `market trenches` | Newly launched launchpad platform tokens — **use this when the user asks for "new tokens", "just launched tokens", "latest tokens on pump.fun/letsbonk"**. Three categories: `new_creation` (just created), `near_completion` (bonding curve almost full), `completed` (graduated to open market / DEX) |
| `market signal` | Real-time token signal feed — price spikes, smart money buys, large buys, Dex ads, CTO events, and more. Results sorted by `trigger_at` descending. **sol / bsc only. Max 50 results per group.** |
| `market hot-searches` | Hot-search ranking — the most-searched tokens, ranked by `visiting_count` (search heat). **Use this when the user asks "what tokens are people searching for", "most searched tokens", "hot search list", "热搜榜".** Supports multiple chains in a single request. |
## Supported Chains
`sol` / `bsc` / `base` / `eth` (kline / trending only; trenches: `sol` / `bsc` / `base`; signal: `sol` / `bsc` only)
`sol` / `bsc` / `base` / `eth` / `robinhood` (kline / trending / trenches; signal: `sol` / `bsc` only; hot-searches: `sol` / `bsc` / `base` / `eth` / `robinhood`)
## Prerequisites
@@ -69,6 +72,7 @@ All market routes used by this skill go through GMGN's leaky-bucket limiter with
| `market trending` | `GET /v1/market/rank` | 1 |
| `market trenches` | `POST /v1/trenches` | 3 |
| `market signal` | `POST /v1/market/token_signal` | 3 |
| `market hot-searches` | `POST /v1/market/hot_searches` | 3 |
When a request returns `429`:
@@ -77,29 +81,13 @@ When a request returns `429`:
- The CLI may wait and retry once automatically when the remaining cooldown is short. If it still fails, stop and tell the user the exact retry time instead of sending more requests.
- For `RATE_LIMIT_EXCEEDED` or `RATE_LIMIT_BANNED`, repeated requests during the cooldown can extend the ban by 5 seconds each time, up to 5 minutes. Do not spam retries.
**First-time setup** (if `GMGN_API_KEY` is not configured):
1. Generate key pair and show the public key to the user:
```bash
openssl genpkey -algorithm ed25519 -out /tmp/gmgn_private.pem 2>/dev/null && \
openssl pkey -in /tmp/gmgn_private.pem -pubout 2>/dev/null
```
Tell the user: *"This is your Ed25519 public key. Go to **https://gmgn.ai/ai**, paste it into the API key creation form, then send me the API Key value shown on the page."*
2. Wait for the user's API key, then configure:
```bash
mkdir -p ~/.config/gmgn
echo 'GMGN_API_KEY=<key_from_user>' > ~/.config/gmgn/.env
chmod 600 ~/.config/gmgn/.env
```
## `market kline` Parameters
| Parameter | Required | Description |
|-----------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--address` | Yes | Token contract address |
| `--resolution` | Yes | Candlestick resolution: `1m` / `5m` / `15m` / `1h` / `4h` / `1d` |
| `--resolution` | Yes | Candlestick resolution: `30s` / `1m` / `5m` / `15m` / `1h` / `4h` / `1d` |
| `--from` | No | Start time (Unix seconds) |
| `--to` | No | End time (Unix seconds) |
@@ -140,13 +128,39 @@ The response is an object with a `list` array. Each element in `list` is one can
| Option | Description |
|--------|-------------|
| `--chain` | Required. `sol` / `bsc` / `base` / `eth` |
| `--chain` | Required. `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--interval` | Required. `1m` / `5m` / `1h` / `6h` / `24h` (default `1h`) |
| `--limit <n>` | Number of results (default 100, max 100) |
| `--order-by <field>` | Sort field: `default` / `swaps` / `marketcap` / `history_highest_market_cap` / `liquidity` / `volume` / `holder_count` / `smart_degen_count` / `renowned_count` / `gas_fee` / `price` / `change1m` / `change5m` / `change1h` / `creation_timestamp` |
| `--direction <asc\|desc>` | Sort direction (default `desc`) |
| `--filter <tag...>` | Repeatable filter tags (chain-specific). **⚠️ SOL defaults: `renounced frozen`; BSC/Base/ETH defaults: `not_honeypot verified renounced`.** Omitting `--filter` is NOT "no filter" — chain defaults always apply. **sol** tags: `renounced` / `frozen` / `burn` / `token_burnt` / `has_social` / `not_social_dup` / `not_image_dup` / `dexscr_update_link` / `not_wash_trading` / `is_internal_market` / `is_out_market`. **evm** tags: `not_honeypot` / `verified` / `renounced` / `locked` / `token_burnt` / `has_social` / `not_social_dup` / `not_image_dup` / `dexscr_update_link` / `is_internal_market` / `is_out_market` |
| `--platform <name...>` | Repeatable platform filter (chain-specific). **sol**: `Pump.fun` / `pump_mayhem` / `pump_mayhem_agent` / `pump_agent` / `letsbonk` / `bonkers` / `bags` / `memoo` / `liquid` / `bankr` / `zora` / `surge` / `anoncoin` / `moonshot_app` / `wendotdev` / `heaven` / `sugar` / `token_mill` / `believe` / `trendsfun` / `trends_fun` / `jup_studio` / `Moonshot` / `boop` / `xstocks` / `ray_launchpad` / `meteora_virtual_curve` / `pool_ray` / `pool_meteora` / `pool_pump_amm` / `pool_orca`. **bsc**: `fourmeme` / `fourmeme_agent` / `bn_fourmeme` / `flap` / `clanker` / `lunafun` / `pool_uniswap` / `pool_pancake`. **base**: `clanker` / `bankr` / `flaunch` / `zora` / `zora_creator` / `baseapp` / `basememe` / `virtuals_v2` / `klik`. **eth**: no platform filter (omit `--platform` for ETH) |
| `--platform <name...>` | Repeatable platform filter (chain-specific). **sol**: `Pump.fun` / `pump_mayhem` / `pump_mayhem_agent` / `pump_agent` / `letsbonk` / `bonkers` / `bags` / `memoo` / `liquid` / `bankr` / `zora` / `surge` / `anoncoin` / `moonshot_app` / `wendotdev` / `heaven` / `sugar` / `token_mill` / `believe` / `trendsfun` / `trends_fun` / `jup_studio` / `Moonshot` / `boop` / `xstocks` / `ray_launchpad` / `meteora_virtual_curve` / `pool_ray` / `pool_meteora` / `pool_pump_amm` / `pool_orca`. **bsc**: `fourmeme` / `fourmeme_agent` / `bn_fourmeme` / `four_xmode_agent` / `cubepeg` / `likwid` / `goplus_creator` / `goplus_skills` / `openfour` / `flap` / `flap_stocks` / `flap_aioracle` / `clanker` / `lunafun` / `pool_uniswap` / `pool_pancake`. **base**: `clanker` / `bankr` / `flaunch` / `zora` / `zora_creator` / `baseapp` / `basememe` / `virtuals_v2` / `klik`. **eth**: `trench` / `clanker` / `klik` / `livo` / `stroid` / `pool_uniswap_v2` / `pool_uniswap_v3` / `printr` |
### `market trending` Range Filters
Optional `--min-*` / `--max-*` flags apply server-side numeric range filtering (inclusive). Unknown metrics are ignored by the service.
| Option | Description |
|--------|-------------|
| `--min-volume` / `--max-volume` | Trading volume (USD) |
| `--min-liquidity` / `--max-liquidity` | Liquidity (USD) |
| `--min-marketcap` / `--max-marketcap` | Market cap (USD) |
| `--min-history-highest-marketcap` / `--max-history-highest-marketcap` | Historical highest market cap (USD) |
| `--min-swaps` / `--max-swaps` | Swap count |
| `--min-holder-count` / `--max-holder-count` | Holder count |
| `--min-gas-fee` / `--max-gas-fee` | Gas fee |
| `--min-renowned-count` / `--max-renowned-count` | KOL / renowned wallet count |
| `--min-smart-degen-count` / `--max-smart-degen-count` | Smart-money holder count |
| `--min-bot-degen-count` / `--max-bot-degen-count` | Bot-degen wallet count |
| `--min-visiting-count` / `--max-visiting-count` | Visitor count |
| `--min-price-change-percent` / `--max-price-change-percent` | Price change ratio over the interval |
| `--min-insider-rate` / `--max-insider-rate` | Insider trading ratio (01); tokens lacking this field are excluded |
| `--min-bundler-rate` / `--max-bundler-rate` | Bundle-bot trading ratio (01); tokens lacking this field are excluded |
| `--min-entrapment-ratio` / `--max-entrapment-ratio` | Entrapment trading ratio (01); tokens lacking this field are excluded |
| `--min-top10-holder-rate` / `--max-top10-holder-rate` | Top-10 holder concentration (01) |
| `--min-top70-sniper-hold-rate` / `--max-top70-sniper-hold-rate` | Top-70 sniper holding ratio (01) |
| `--min-dev-team-hold-rate` / `--max-dev-team-hold-rate` | Dev-team holding ratio (01); `--min-dev-team-hold-rate` also excludes creator-close tokens |
| `--min-created` / `--max-created` | Token age window, duration string with a `m` (minutes) / `h` (hours) / `d` (days) suffix, e.g. `30m` / `6h` / `7d`. `--min-created` is a minimum age (excludes younger tokens); `--max-created` a maximum age (excludes older tokens). **Note:** the raw upstream rank interface accepts minutes only; the openapi-service does not forward this field — it evaluates the age window itself (cutoff = now duration, computed natively for `m`/`h`/`d`), so `6h` / `7d` work here. Always include a unit suffix — a bare number is **not** accepted. |
## Usage Examples
@@ -242,29 +256,41 @@ gmgn-cli market trending \
--platform fourmeme --platform four_xmode_agent \
--order-by volume --limit 50 --raw
# BSC 5m hottest — fourmeme family, sorted by volume
# BSC 5m hottest — all BSC launchpads, sorted by volume
gmgn-cli market trending \
--chain bsc --interval 5m \
--platform fourmeme --platform fourmeme_agent --platform bn_fourmeme --platform four_xmode_agent \
--platform cubepeg --platform likwid --platform goplus_creator --platform goplus_skills --platform openfour \
--platform flap --platform flap_stocks --platform flap_aioracle --platform clanker --platform lunafun \
--order-by volume --limit 50 --raw
# BSC 1h trending — fourmeme with safety filters
# BSC 1h trending — all BSC launchpads with safety filters
gmgn-cli market trending \
--chain bsc --interval 1h \
--platform fourmeme --platform fourmeme_agent --platform bn_fourmeme --platform four_xmode_agent \
--platform cubepeg --platform likwid --platform goplus_creator --platform goplus_skills --platform openfour \
--platform flap --platform flap_stocks --platform flap_aioracle --platform clanker --platform lunafun \
--filter not_honeypot --filter verified \
--order-by volume --limit 20 --raw
```
### Trending — ETH (No Platform Filter)
### Trending — ETH by Launchpad Platform
```bash
# ETH 1h trending — all tokens, sorted by volume
# ETH 1h trending — all platforms, sorted by volume
gmgn-cli market trending --chain eth --interval 1h --order-by volume --limit 20
# ETH 1h trending — with safety filters
# ETH 1h trending — specific platforms only
gmgn-cli market trending \
--chain eth --interval 1h \
--platform trench --platform clanker --platform klik \
--order-by volume --limit 50 --raw
# ETH 1h trending — all ETH platforms with safety filters
gmgn-cli market trending \
--chain eth --interval 1h \
--platform trench --platform clanker --platform klik --platform livo --platform stroid \
--platform pool_uniswap_v2 --platform pool_uniswap_v3 --platform printr \
--filter not_honeypot --filter verified \
--order-by volume --limit 20 --raw
@@ -275,6 +301,28 @@ gmgn-cli market trending \
--order-by smart_degen_count --limit 20 --raw
```
### Trending — Numeric Range Filters
```bash
# SOL 1h trending — liquidity 10k1M, market cap above 50k, sorted by volume
gmgn-cli market trending \
--chain sol --interval 1h \
--min-liquidity 10000 --max-liquidity 1000000 --min-marketcap 50000 \
--order-by volume --limit 30 --raw
# SOL 5m hottest — fresh tokens (under 30 min old) with smart money interest
gmgn-cli market trending \
--chain sol --interval 5m \
--max-created 30m --min-smart-degen-count 1 \
--order-by volume --limit 50 --raw
# SOL 1h trending — exclude high-insider / high-bundler tokens
gmgn-cli market trending \
--chain sol --interval 1h \
--max-insider-rate 0.3 --max-bundler-rate 0.3 \
--order-by volume --limit 20 --raw
```
### Trending — Base by Launchpad Platform
```bash
@@ -494,7 +542,7 @@ Use field combinations to determine what stage a token is in. This affects how s
| Parameter | Required | Description |
|-----------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` |
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--type` | No | Categories to query, repeatable: `new_creation` / `near_completion` / `completed` (default: all three) |
| `--launchpad-platform` | No | Launchpad platform filter, repeatable (default: all platforms for the chain) |
| `--limit` | No | Max results per category, max 80 (default: 80) |
@@ -503,6 +551,15 @@ Use field combinations to determine what stage a token is in. This affects how s
| `--direction` | No | Sort direction: `asc` / `desc` (default: `desc`; `asc` for `rug_ratio`) |
| `--min-*` / `--max-*` | No | Server-side filter range flags — see Filter Fields Reference below |
**`--launchpad-platform` values by chain** (omit `--launchpad-platform` to use all of the chain's platforms):
| Chain | Platforms |
|-------|-----------|
| `sol` | `Pump.fun` / `pump_mayhem` / `pump_mayhem_agent` / `pump_agent` / `letsbonk` / `bonkers` / `bags` / `memoo` / `liquid` / `bankr` / `zora` / `surge` / `anoncoin` / `moonshot_app` / `wendotdev` / `heaven` / `sugar` / `token_mill` / `believe` / `trendsfun` / `trends_fun` / `jup_studio` / `Moonshot` / `boop` / `ray_launchpad` / `meteora_virtual_curve` / `xstocks` |
| `bsc` | `fourmeme` / `fourmeme_agent` / `bn_fourmeme` / `four_xmode_agent` / `cubepeg` / `likwid` / `goplus_creator` / `goplus_skills` / `openfour` / `flap` / `flap_stocks` / `flap_aioracle` / `clanker` / `lunafun` |
| `base` | `clanker` / `bankr` / `flaunch` / `zora` / `zora_creator` / `baseapp` / `basememe` / `virtuals_v2` / `klik` |
| `eth` | `trench` / `clanker` / `klik` / `livo` / `stroid` / `pool_uniswap_v2` / `pool_uniswap_v3` / `printr` |
### Filter Presets
Presets are applied server-side: the API filters tokens before returning results.
@@ -745,25 +802,33 @@ gmgn-cli market trenches --chain sol --raw \
# All three categories at once
gmgn-cli market trenches --chain bsc --raw \
--type new_creation --type near_completion --type completed \
--launchpad-platform fourmeme --launchpad-platform fourmeme_agent --launchpad-platform bn_fourmeme --launchpad-platform four_xmode_agent --launchpad-platform flap --launchpad-platform clanker --launchpad-platform lunafun \
--launchpad-platform fourmeme --launchpad-platform fourmeme_agent --launchpad-platform bn_fourmeme --launchpad-platform four_xmode_agent \
--launchpad-platform cubepeg --launchpad-platform likwid --launchpad-platform goplus_creator --launchpad-platform goplus_skills --launchpad-platform openfour \
--launchpad-platform flap --launchpad-platform flap_stocks --launchpad-platform flap_aioracle --launchpad-platform clanker --launchpad-platform lunafun \
--limit 80
# New creation only
gmgn-cli market trenches --chain bsc --raw \
--type new_creation \
--launchpad-platform fourmeme --launchpad-platform fourmeme_agent --launchpad-platform bn_fourmeme --launchpad-platform four_xmode_agent --launchpad-platform flap --launchpad-platform clanker --launchpad-platform lunafun \
--launchpad-platform fourmeme --launchpad-platform fourmeme_agent --launchpad-platform bn_fourmeme --launchpad-platform four_xmode_agent \
--launchpad-platform cubepeg --launchpad-platform likwid --launchpad-platform goplus_creator --launchpad-platform goplus_skills --launchpad-platform openfour \
--launchpad-platform flap --launchpad-platform flap_stocks --launchpad-platform flap_aioracle --launchpad-platform clanker --launchpad-platform lunafun \
--limit 80
# Near completion only
gmgn-cli market trenches --chain bsc --raw \
--type near_completion \
--launchpad-platform fourmeme --launchpad-platform fourmeme_agent --launchpad-platform bn_fourmeme --launchpad-platform four_xmode_agent --launchpad-platform flap --launchpad-platform clanker --launchpad-platform lunafun \
--launchpad-platform fourmeme --launchpad-platform fourmeme_agent --launchpad-platform bn_fourmeme --launchpad-platform four_xmode_agent \
--launchpad-platform cubepeg --launchpad-platform likwid --launchpad-platform goplus_creator --launchpad-platform goplus_skills --launchpad-platform openfour \
--launchpad-platform flap --launchpad-platform flap_stocks --launchpad-platform flap_aioracle --launchpad-platform clanker --launchpad-platform lunafun \
--limit 80
# Completed (open market) only
gmgn-cli market trenches --chain bsc --raw \
--type completed \
--launchpad-platform fourmeme --launchpad-platform fourmeme_agent --launchpad-platform bn_fourmeme --launchpad-platform four_xmode_agent --launchpad-platform flap --launchpad-platform clanker --launchpad-platform lunafun \
--launchpad-platform fourmeme --launchpad-platform fourmeme_agent --launchpad-platform bn_fourmeme --launchpad-platform four_xmode_agent \
--launchpad-platform cubepeg --launchpad-platform likwid --launchpad-platform goplus_creator --launchpad-platform goplus_skills --launchpad-platform openfour \
--launchpad-platform flap --launchpad-platform flap_stocks --launchpad-platform flap_aioracle --launchpad-platform clanker --launchpad-platform lunafun \
--limit 80
```
@@ -795,6 +860,28 @@ gmgn-cli market trenches --chain base --raw \
--limit 80
```
### ETH Trenches Examples
```bash
# All three categories at once
gmgn-cli market trenches --chain eth --raw \
--type new_creation --type near_completion --type completed \
--launchpad-platform trench --launchpad-platform clanker --launchpad-platform klik --launchpad-platform livo --launchpad-platform stroid --launchpad-platform pool_uniswap_v2 --launchpad-platform pool_uniswap_v3 --launchpad-platform printr \
--limit 80
# New creation only
gmgn-cli market trenches --chain eth --raw \
--type new_creation \
--launchpad-platform trench --launchpad-platform clanker --launchpad-platform klik --launchpad-platform livo --launchpad-platform stroid --launchpad-platform pool_uniswap_v2 --launchpad-platform pool_uniswap_v3 --launchpad-platform printr \
--limit 80
# Completed (open market) only
gmgn-cli market trenches --chain eth --raw \
--type completed \
--launchpad-platform trench --launchpad-platform clanker --launchpad-platform klik --launchpad-platform livo --launchpad-platform stroid --launchpad-platform pool_uniswap_v2 --launchpad-platform pool_uniswap_v3 --launchpad-platform printr \
--limit 80
```
## Output Format
### `market kline` — Price Summary
@@ -944,12 +1031,158 @@ gmgn-cli market signal --chain sol \
--groups '[{"signal_type":[12,13],"mc_min":100000},{"signal_type":[6,7],"mc_min":50000,"mc_max":1000000}]' --raw
```
## `market hot-searches` Parameters
Returns the hot-search ranking — the tokens people are searching for most right now, ranked by `visiting_count` (search heat). Cross-chain top-500 ranking; one request can cover several chains at once. **Use this for "most searched tokens", "hot search list", "热搜榜", "what is everyone looking at"** — this is distinct from `market trending` (ranked by swap activity), which answers "what is being traded most."
| Option | Description |
|--------|-------------|
| `--chain <chain...>` | Repeatable. `sol` / `bsc` / `base` / `eth` / `robinhood`. **Omit to query the default 5-chain set** (sol / bsc / base / eth / robinhood, each at `24h` with chain-appropriate safety filters). |
| `--interval <interval>` | `1m` / `5m` / `1h` / `6h` / `24h` (default `24h`). Applies to every `--chain` provided. |
| `--limit <n>` | Max results per chain (default `500`). |
| `--filter <tag...>` | Repeatable **boolean** filter tags (the downstream `filter.filters` array). **⚠️ SOL defaults: `renounced frozen`; EVM defaults: `not_honeypot verified renounced`.** Omitting `--filter` is NOT "no filter" — the server applies chain defaults. See the Filter Tags table below for the exact vocabulary. |
| `--min-* / --max-* <n>` | Numeric range bounds, **same metric names as `market trending`** (e.g. `--min-liquidity`, `--max-marketcap`, `--min-smart-degen-count`). Translated server-side per `--interval`. `--min-created` / `--max-created` are token-age durations. See the Range Filters table below. |
| `--params <json>` | Full override: a JSON array of param objects. When provided, `--chain` / `--interval` / `--limit` / `--filter` and all range flags are ignored. Filter fields are **flattened onto each param** (no nested `filter` object): `{ "label": "...", "chain": "...", "interval": "...", "filters": [...], "limit": 500, "min_liquidity": 1000 }` — a param accepts `filters`, `limit`, `min_created`/`max_created`, and rank-style `min_<metric>`/`max_<metric>` keys. |
### `market hot-searches` Filter Tags (`--filter` / `filter.filters`)
The downstream (gmgn rank filter-service) evaluates each tag as an AND condition — a token must pass **every** tag to stay in the list. **Unknown tags are silently accepted but do nothing** (pass-through), so an unrecognised tag will NOT filter anything — spelling matters. This tag set is the filter-service vocabulary and differs slightly from `market trending`'s tag names (see the alias note below).
**These are the only recognised tags** (anything else is a no-op):
| Tag | Chains | Passes when |
|----------------------|-------------|-------------|
| `renounced` | sol / EVM | sol: mint authority renounced (`renounced_mint == 1`); EVM: owner renounced (`is_renounced == 1`; lenient — nil passes) |
| `frozen` | sol only | freeze authority renounced (`renounced_freeze_account == 1`); non-sol always fails |
| `is_burnt` | all | LP pool burned (`burn_status == "burn"`) |
| `token_burnt` | all | creator burned tokens (`dev_token_burn_ratio > 0`) |
| `not_wash_trading` | all | not flagged as wash trading |
| `not_honeypot` | EVM | not a honeypot (`is_honeypot == 0`; lenient — nil passes) |
| `verified` | EVM | contract open-source (`is_open_source == 1`; lenient — nil passes) |
| `locked` | EVM | liquidity locked ≥ 50% (`lock_percent >= 0.5`) |
| `has_social` | all | has Twitter, Telegram, or Website |
| `distribed` | all | top-10 holder rate in (0, 0.3] (well distributed) |
| `not_risk` | all | composite low-risk filter (sol: liquidity≥4000 + mint renounced + top10<0.3 + freeze renounced + LP burned; EVM: not honeypot + liquidity≥4000 + open-source + renounced + lock≥0.5) |
| `img_not_duplicate` | all | avatar image not duplicated (`image_dup == "0"`) |
| `social_not_duplicate` | all | social links not shared (`twitter_dup == 0 && telegram_dup == 0 && website_dup == 0`) |
| `creator_hold` | all | dev still holding (not `creator_close`) |
| `creator_close` | all | dev sold/closed (`creator_token_status == "creator_close"`) |
| `dexscr_update_link` | all | social links updated on DexScreener (`> 0`) |
| `launching` | all | still on the launchpad bonding curve (`launchpad_status == "0"`); pair with `migrated` to allow both |
| `migrated` | all | graduated / migrated to DEX (`launchpad_status == "1"`); pair with `launching` to allow both |
| `hide_b20` | base only | token standard is not `b20` (no-op on non-base) |
| `hide_non_b20` | base only | token standard is `b20` (no-op on non-base) |
> **⚠️ Different names than `market trending`.** This path uses `launching` / `migrated` (NOT `is_internal_market` / `is_out_market`) and `img_not_duplicate` / `social_not_duplicate` (NOT `not_image_dup` / `not_social_dup`). Tags that `market trending` supports but this endpoint does **not** recognise (they become silent no-ops here): `dexscr_ad`, `dexscr_trending_bar`, `dexscr_boost`, `cto_flag`, `is_internal_market`, `is_out_market`, `not_image_dup`, `not_social_dup`.
### `market hot-searches` Range Filters (`--min-*` / `--max-*`)
Numeric bounds use the **same rank-style metric names as `market trending`**. They are sent flattened on each param and translated server-side to the downstream field for the param's `--interval`. Closed intervals; metrics the downstream cannot read are dropped (not silent no-ops on the wire — they are removed before the request).
| Flag pair | Type | Metric |
|------------------------------------------------------------|----------|--------|
| `--min-volume` / `--max-volume` | float | Trading volume (USD) — bound to the `--interval` window |
| `--min-swaps` / `--max-swaps` | int | Swap count — bound to the `--interval` window |
| `--min-price-change-percent` / `--max-price-change-percent` | float | Price change ratio — **only `1m` / `5m` / `1h`; dropped for `6h` / `24h`** |
| `--min-liquidity` / `--max-liquidity` | float | Liquidity (USD) |
| `--min-marketcap` / `--max-marketcap` | float | Market cap (USD) |
| `--min-history-highest-marketcap` / `--max-history-highest-marketcap` | float | All-time-high market cap (USD) |
| `--min-holder-count` / `--max-holder-count` | int | Holder count |
| `--min-gas-fee` / `--max-gas-fee` | float | Gas fee |
| `--min-renowned-count` / `--max-renowned-count` | int | KOL / renowned holder count |
| `--min-smart-degen-count` / `--max-smart-degen-count` | int | Smart-money holder count |
| `--min-bot-degen-count` / `--max-bot-degen-count` | int | Bot-degen wallet count |
| `--min-visiting-count` / `--max-visiting-count` | int | Visitor count |
| `--min-insider-rate` / `--max-insider-rate` | float | Insider trading ratio (01); tokens lacking this field are excluded |
| `--min-bundler-rate` / `--max-bundler-rate` | float | Bundle-bot trading ratio (01); tokens lacking this field are excluded |
| `--min-entrapment-ratio` / `--max-entrapment-ratio` | float | Entrapment trading ratio (01); tokens lacking this field are excluded |
| `--min-top10-holder-rate` / `--max-top10-holder-rate` | float | Top-10 holder concentration (01) |
| `--min-top70-sniper-hold-rate` / `--max-top70-sniper-hold-rate` | float | Top-70 sniper holding ratio (01) |
| `--min-dev-team-hold-rate` / `--max-dev-team-hold-rate` | float | Dev-team holding ratio (01) |
| `--min-created` / `--max-created` | duration | Token age window (`30m` / `6h` / `7d`). `min_created` = minimum age; `max_created` = maximum age |
**Notes on behaviour:**
- `--chain all` is **not** valid. To aggregate across chains, pass `--chain` multiple times (or omit `--chain` for the default 5-chain set).
- When you pass `--chain` but omit `--filter`, the **server** applies the chain-appropriate default filters — so each chain is filtered even without an explicit `--filter`.
- Different chains return different counts: a chain's token count depends on how many of its tokens made the global top-500 (sol is usually the largest).
## `market hot-searches` Response Fields
The response `data` is an array. Each element is one `(interval, chain)` result block:
| Field | Type | Description |
|-------|------|-------------|
| `interval` | string | The interval for this block |
| `chain` | string | The chain for this block |
| `version` | string | Subscription version — persist it for WebSocket reconnect |
| `tokens` | array | Ranked tokens (search heat desc), max 500. Each token carries a 1-based `rank` |
**Token fields are the same long-form fields as `market trending`** — the server maps the upstream shortcodes for you, so you read `visiting_count` / `market_cap` / `symbol` directly (NOT `v_c` / `mc` / `s`). Key fields:
| Field | Description |
|-------|-------------|
| `address` | Token contract address |
| `chain` | Chain |
| `name` / `symbol` | Token name / ticker |
| `price` | Current price (USD) |
| `visiting_count` | **Primary ranking key — search / visit heat** |
| `market_cap` | Market cap (USD) |
| `volume` | Volume in this interval (USD) |
| `liquidity` | Liquidity (USD) |
| `swaps` / `buys` / `sells` | Swap / buy / sell counts |
| `holder_count` | Holder count |
| `rank` | 1-based position within the block |
See the [`market trending` Response Fields](#market-trending-response-fields) section above for the full field set — hot-searches tokens use the identical `RankItem` shape.
### `market hot-searches` Usage Examples
```bash
# Default 5-chain hot-search ranking (sol/bsc/base/eth/robinhood, each 24h)
gmgn-cli market hot-searches --raw
# SOL only, 24h hot-search list
gmgn-cli market hot-searches --chain sol --interval 24h --raw
# SOL + BSC + Base, 1h window, top 50 per chain
gmgn-cli market hot-searches --chain sol --chain bsc --chain base --interval 1h --limit 50 --raw
# SOL with custom boolean filters
gmgn-cli market hot-searches --chain sol --interval 24h \
--filter renounced --filter frozen --raw
# SOL 1h hot-searches with numeric range filters (same metric names as `market trending`)
gmgn-cli market hot-searches --chain sol --interval 1h \
--min-liquidity 10000 --min-volume 5000 --min-smart-degen-count 1 --raw
# Range filter by token age + market cap
gmgn-cli market hot-searches --chain sol --interval 24h \
--max-created 7d --min-marketcap 50000 --raw
# Full per-param override via JSON (different filters per chain, incl. ranges)
gmgn-cli market hot-searches --raw --params '[
{"label":"hot-search","chain":"sol","interval":"24h","filters":["renounced","frozen"],"limit":500,"min_liquidity":10000},
{"label":"hot-search","chain":"bsc","interval":"24h","filters":["not_honeypot","verified","renounced"],"limit":500}
]'
```
### `market hot-searches` — Output Format
Present per chain, ranked by `visiting_count` (search heat):
```
🔥 Hot Searches — {chain} ({interval})
# | Symbol | Price | MCap | Volume | Search Heat (visiting_count) | Liq
```
---
## Notes
- `market kline`: `--from` and `--to` are Unix timestamps in **seconds** — CLI converts to milliseconds automatically
- `market trending`: `--filter` and `--platform` are repeatable flags
- `market hot-searches`: `--chain` and `--filter` are repeatable flags; omit `--chain` to query the default 5-chain set. `--min-*`/`--max-*` range flags reuse the same metric names as `market trending` and are translated server-side per `--interval`
- All commands use exist auth (API Key only, no signature)
- If the user doesn't provide kline timestamps, calculate them from the current time based on their desired time range
- Use `--raw` to get single-line JSON for further processing
+4 -18
View File
@@ -1,11 +1,13 @@
---
name: gmgn-portfolio
description: Analyze any crypto wallet by address — holdings, realized/unrealized P&L, win rate, trading history, performance stats, specific token balance, and tokens created by a developer wallet (with ATH market cap and DEX graduation status) via GMGN API on Solana, BSC, Base, or Ethereum. Use when user asks about a wallet's holdings, P&L, win rate, what tokens a dev has launched, the highest ATH token a dev ever created, or wants a wallet report to decide whether to copy-trade or follow.
argument-hint: "<info|holdings|activity|stats|token-balance|created-tokens> [--chain <sol|bsc|base|eth>] [--wallet <wallet_address>]"
argument-hint: "<info|holdings|activity|stats|token-balance|created-tokens> [--chain <sol|bsc|base|eth|robinhood>] [--wallet <wallet_address>]"
metadata:
cliHelp: "gmgn-cli portfolio --help"
---
**BEFORE RUNNING ANY COMMAND: Run `gmgn-cli config --check`. If exit code is 0, proceed normally. If exit code is 1, (1) run `gmgn-cli config` and show the output to the user; (2) once the user sends the API Key, run `gmgn-cli config --apply <KEY>` to complete configuration and verification, then show the output to the user. If `--check` returns an error (unknown option or command not found), tell the user to run `npm install -g gmgn-cli` to update, then retry.**
**IMPORTANT: Always use `gmgn-cli` commands below. Do NOT use web search, WebFetch, curl, or visit gmgn.ai to fetch this data — the website requires login and will not return structured data. The CLI is the only correct method.**
**⚠️ IPv6 NOT SUPPORTED: If you get a `401` or `403` error and credentials look correct, check for IPv6 immediately: (1) list all network interfaces and their IPv6 addresses — run `ifconfig | grep inet6` (macOS) or `ip addr show | grep inet6` (Linux); (2) send a test request to `https://ipv6.icanhazip.com` — if the response is an IPv6 address, outbound traffic is going via IPv6. Tell the user immediately: "Please disable IPv6 on your network interface — gmgn-cli commands only work over IPv4."**
@@ -43,7 +45,7 @@ Use the `gmgn-cli` tool to query wallet portfolio data based on the user's reque
## Supported Chains
`sol` / `bsc` / `base` / `eth`
`sol` / `bsc` / `base` / `eth` / `robinhood`
## Prerequisites
@@ -77,22 +79,6 @@ When a request returns `429`:
- The CLI may wait and retry once automatically when the remaining cooldown is short. If it still fails, stop and tell the user the exact retry time instead of sending more requests.
- For `RATE_LIMIT_EXCEEDED` or `RATE_LIMIT_BANNED`, repeated requests during the cooldown can extend the ban by 5 seconds each time, up to 5 minutes. Do not spam retries.
**First-time setup** (if `GMGN_API_KEY` is not configured):
1. Generate key pair and show the public key to the user:
```bash
openssl genpkey -algorithm ed25519 -out /tmp/gmgn_private.pem 2>/dev/null && \
openssl pkey -in /tmp/gmgn_private.pem -pubout 2>/dev/null
```
Tell the user: *"This is your Ed25519 public key. Go to **https://gmgn.ai/ai**, paste it into the API key creation form, then send me the API Key value shown on the page."*
2. Wait for the user's API key, then configure:
```bash
mkdir -p ~/.config/gmgn
echo 'GMGN_API_KEY=<key_from_user>' > ~/.config/gmgn/.env
chmod 600 ~/.config/gmgn/.env
```
## Usage Examples
```bash
+22 -38
View File
@@ -6,13 +6,15 @@ metadata:
cliHelp: "gmgn-cli swap --help"
---
**BEFORE RUNNING ANY COMMAND: Run `gmgn-cli config --check`. If exit code is 0, proceed normally. If exit code is 1, (1) run `gmgn-cli config` and show the output to the user; (2) once the user sends the API Key, run `gmgn-cli config --apply <KEY>` to complete configuration and verification, then show the output to the user. If `--check` returns an error (unknown option or command not found), tell the user to run `npm install -g gmgn-cli` to update, then retry.**
**IMPORTANT: Always use `gmgn-cli` commands below. Do NOT use web search, WebFetch, curl, or visit gmgn.ai — all swap operations must go through the CLI. The CLI handles signing and submission automatically.**
**IMPORTANT: Do NOT guess field names or values. When a field's meaning is unclear, look it up in the Response Fields sections below before using it.**
**⚠️ IPv6 NOT SUPPORTED: If you get a `401` or `403` error and credentials look correct, check for IPv6 immediately: (1) list all network interfaces and their IPv6 addresses — run `ifconfig | grep inet6` (macOS) or `ip addr show | grep inet6` (Linux); (2) send a test request to `https://ipv6.icanhazip.com` — if the response is an IPv6 address, outbound traffic is going via IPv6. Tell the user immediately: "Please disable IPv6 on your network interface — gmgn-cli commands only work over IPv4."**
Use the `gmgn-cli` tool to submit a token swap or query an existing order. `GMGN_API_KEY` is always required. `GMGN_PRIVATE_KEY` is required for critical-auth commands such as `swap` and all `order` subcommands, including `order quote`.
Use the `gmgn-cli` tool to submit a token swap or query an existing order. `GMGN_API_KEY` is always required. `GMGN_PRIVATE_KEY` is required for critical-auth commands such as `swap` and `order` subcommands — except `order quote`, which only requires `GMGN_API_KEY`.
## Core Concepts
@@ -26,7 +28,7 @@ Use the `gmgn-cli` tool to submit a token swap or query an existing order. `GMGN
- **Anti-MEV** — MEV (Miner/Maximal Extractable Value) refers to frontrunning and sandwich attacks where bots exploit pending transactions. `--anti-mev` routes the transaction through protected channels to reduce this risk. **Recommended: always enable.** Default: on. **Not supported on `base` chain.**
- **Signed auth**`swap` and all `order` subcommands require both `GMGN_API_KEY` and `GMGN_PRIVATE_KEY`. The private key never leaves the machine — the CLI uses it only for local signing and sends only the resulting signature.
- **Signed auth**`swap` and most `order` subcommands require both `GMGN_API_KEY` and `GMGN_PRIVATE_KEY`. The private key never leaves the machine — the CLI uses it only for local signing and sends only the resulting signature. Exception: `order quote` only requires `GMGN_API_KEY`.
- **`order_id` / `status`** — After submitting a swap, the response includes an `order_id`. Use `order get --order-id` to poll for final status. Possible values: `pending``processed``confirmed` (success) or `failed` / `expired`. Do not report success until status is `confirmed`.
@@ -47,7 +49,7 @@ Use the `gmgn-cli` tool to submit a token swap or query an existing order. `GMGN
|-------------|-------------|
| `swap` | Submit a token swap |
| `multi-swap` | Submit token swaps across multiple wallets concurrently (up to 100) |
| `order quote` | Get a swap quote (no transaction submitted; requires signed auth) |
| `order quote` | Get a swap quote (no transaction submitted; exist auth — API Key only, no private key needed) |
| `order get` | Query order status |
| `gas-price` | Query recommended gas price (low / average / high tiers) for any chain; exist auth (API Key only) |
| `order strategy create` | Create a limit/strategy order (requires private key) |
@@ -56,7 +58,7 @@ Use the `gmgn-cli` tool to submit a token swap or query an existing order. `GMGN
## Supported Chains
`sol` / `bsc` / `base` / `eth`
`sol` / `bsc` / `base` / `eth` / `robinhood`
## Chain Currencies
@@ -71,10 +73,9 @@ Currency tokens are the base/native assets of each chain. They are used to buy o
| `base` | ETH (native, `0x0000000000000000000000000000000000000000`), USDC (`0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`) |
| `eth` | ETH (native, `0x0000000000000000000000000000000000000000`) |
## Prerequisites
`GMGN_API_KEY` must be configured in `~/.config/gmgn/.env`. `GMGN_PRIVATE_KEY` is additionally required for `swap` and all `order` subcommands. The private key must correspond to the wallet bound to the API Key.
`GMGN_API_KEY` must be configured in `~/.config/gmgn/.env`. `GMGN_PRIVATE_KEY` is additionally required for `swap` and `order` subcommands other than `order quote`. The private key must correspond to the wallet bound to the API Key.
- `gmgn-cli` installed globally — if missing, run: `npm install -g gmgn-cli`
@@ -102,31 +103,6 @@ When a request returns `429`:
- For `RATE_LIMIT_EXCEEDED` or `RATE_LIMIT_BANNED`, repeated requests during the cooldown can extend the ban by 5 seconds each time, up to 5 minutes.
- `POST /v1/trade/swap` also has an error-count limiter. Repeatedly triggering the same business error, especially `40003701` (insufficient token balance), can return `ERROR_RATE_LIMIT_BLOCKED`. When this happens, do not retry until the reset time and fix the underlying request first.
**First-time setup** (if credentials are not configured):
1. Generate key pair and show the public key to the user:
```bash
openssl genpkey -algorithm ed25519 -out /tmp/gmgn_private.pem 2>/dev/null && \
openssl pkey -in /tmp/gmgn_private.pem -pubout 2>/dev/null
```
Tell the user: *"This is your Ed25519 public key. Go to **https://gmgn.ai/ai**, paste it into the API key creation form (enable swap capability), then send me the API Key value shown on the page."*
2. Wait for the user's API key, then configure both credentials:
```bash
mkdir -p ~/.config/gmgn
echo 'GMGN_API_KEY=<key_from_user>' > ~/.config/gmgn/.env
echo 'GMGN_PRIVATE_KEY="<pem_content_from_step_1>"' >> ~/.config/gmgn/.env
chmod 600 ~/.config/gmgn/.env
```
### Credential Model
- Both `GMGN_API_KEY` and `GMGN_PRIVATE_KEY` are read from the `.env` file by the CLI at startup. They are **never passed as command-line arguments** and never appear in shell command strings.
- `GMGN_PRIVATE_KEY` is used exclusively for **local message signing** — the private key never leaves the machine. The CLI computes an Ed25519 or RSA-SHA256 signature in-process and transmits only the base64-encoded result in the `X-Signature` request header.
- `GMGN_API_KEY` is transmitted in the `X-APIKEY` request header to GMGN's servers over HTTPS.
---
## `swap` Usage
```bash
@@ -178,7 +154,7 @@ gmgn-cli swap \
| Parameter | Required | Chain | Description |
|-----------|----------|-------|-------------|
| `--chain` | Yes | all | `sol` / `bsc` / `base` / `eth` |
| `--chain` | Yes | all | `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--from` | Yes | all | Wallet address (must match API Key binding) |
| `--input-token` | Yes | all | Input token contract address |
| `--output-token` | Yes | all | Output token contract address |
@@ -396,7 +372,7 @@ gmgn-cli multi-swap \
| Parameter | Required | Chain | Description |
|-----------|----------|-------|-------------|
| `--chain` | Yes | all | `sol` / `bsc` / `base` / `eth` |
| `--chain` | Yes | all | `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--accounts` | Yes | all | Comma-separated wallet addresses (1100, all must be bound to the API Key) |
| `--input-token` | Yes | all | Input token contract address |
| `--output-token` | Yes | all | Output token contract address |
@@ -431,9 +407,17 @@ The response `data` is an array — one element per wallet:
---
### Credential Model
- Both `GMGN_API_KEY` and `GMGN_PRIVATE_KEY` are read from the `.env` file by the CLI at startup. They are **never passed as command-line arguments** and never appear in shell command strings.
- `GMGN_PRIVATE_KEY` is used exclusively for **local message signing** — the private key never leaves the machine. The CLI computes an Ed25519 or RSA-SHA256 signature in-process and transmits only the base64-encoded result in the `X-Signature` request header.
- `GMGN_API_KEY` is transmitted in the `X-APIKEY` request header to GMGN's servers over HTTPS.
---
## `order quote` Usage
Get an estimated output amount before submitting a swap. All supported quote chains use signed auth and require `GMGN_PRIVATE_KEY`.
Get an estimated output amount before submitting a swap. Uses normal auth — only `GMGN_API_KEY` required, no `GMGN_PRIVATE_KEY` needed.
```bash
gmgn-cli order quote \
@@ -555,7 +539,7 @@ gmgn-cli order strategy create \
| Parameter | Required | Chain | Description |
|-----------|----------|-------|-------------|
| `--chain` | Yes | all | `sol` / `bsc` / `base` / `eth` |
| `--chain` | Yes | all | `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--from` | Yes | all | Wallet address (must match API Key binding) |
| `--base-token` | Yes | all | Base token contract address |
| `--quote-token` | Yes | all | Quote token contract address |
@@ -612,7 +596,7 @@ gmgn-cli order strategy list --chain sol --group-tag STMix --base-token <token_a
| Parameter | Required | Description |
|-----------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--type` | No | `open` (default) / `history` |
| `--from` | No | Filter by wallet address |
| `--group-tag` | Yes | Filter by order group: `LimitOrder` (limit orders only) / `STMix` (mixed strategy orders: take-profit, stop-loss, trailing take-profit, trailing stop-loss) |
@@ -636,7 +620,7 @@ gmgn-cli order strategy list --chain sol --group-tag STMix --base-token <token_a
| `auto_slippage` | bool | Whether auto slippage is enabled |
| `base_decimal` | int | Base token decimal places |
| `base_token` | string | Base token contract address |
| `chain` | string | Chain: `sol` / `bsc` / `base` / `eth` |
| `chain` | string | Chain: `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `close_amount` | string | Token amount sold on close; empty when order is open |
| `close_price` | string | Token price at close; empty when order is open |
| `close_sell_model` | string | Sell model used on close; empty when order is open |
@@ -750,7 +734,7 @@ gmgn-cli order strategy cancel \
| Parameter | Required | Description |
|-----------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--from` | Yes | Wallet address (must match API Key binding) |
| `--order-id` | Yes | Order ID to cancel |
| `--order-type` | No | Order type: `limit_order` (limit order) / `smart_trade` (mixed strategy order: take-profit, stop-loss, trailing take-profit, trailing stop-loss) |
+7 -21
View File
@@ -1,11 +1,13 @@
---
name: gmgn-token
description: Research any crypto or meme token by address — real-time price, market cap, liquidity, holder list, trader list, top Smart Money and KOL positions, security audit (honeypot, rug pull risk, dev wallet, renounced status), social links (Twitter/X, website) via GMGN API on Solana, BSC, Base, or Ethereum. Use when user asks about a token's price, safety, holders, traders, smart money exposure, or wants due diligence before buying.
argument-hint: "<sub-command> --chain <sol|bsc|base|eth> --address <token_address>"
argument-hint: "<sub-command> --chain <sol|bsc|base|eth|robinhood> --address <token_address>"
metadata:
cliHelp: "gmgn-cli token --help"
---
**BEFORE RUNNING ANY COMMAND: Run `gmgn-cli config --check`. If exit code is 0, proceed normally. If exit code is 1, (1) run `gmgn-cli config` and show the output to the user; (2) once the user sends the API Key, run `gmgn-cli config --apply <KEY>` to complete configuration and verification, then show the output to the user. If `--check` returns an error (unknown option or command not found), tell the user to run `npm install -g gmgn-cli` to update, then retry.**
**IMPORTANT: Always use `gmgn-cli` commands below. Do NOT use web search, WebFetch, curl, or visit gmgn.ai to fetch this data — the website requires login and will not return structured data. The CLI is the only correct method.**
**⚠️ IPv6 NOT SUPPORTED: If you get a `401` or `403` error and credentials look correct, check for IPv6 immediately: (1) list all network interfaces and their IPv6 addresses — run `ifconfig | grep inet6` (macOS) or `ip addr show | grep inet6` (Linux); (2) send a test request to `https://ipv6.icanhazip.com` — if the response is an IPv6 address, outbound traffic is going via IPv6. Tell the user immediately: "Please disable IPv6 on your network interface — gmgn-cli commands only work over IPv4."**
@@ -17,7 +19,7 @@ Use the `gmgn-cli` tool to query token information based on the user's request.
## Core Concepts
- **Token address** — The on-chain contract address that uniquely identifies a token on its chain. Required for all token sub-commands. Format: base58 (SOL) or `0x...` hex (BSC/Base).
- **Chain** — The blockchain network: `sol` = Solana, `bsc` = BNB Smart Chain, `base` = Base (Coinbase L2), `eth` = Ethereum mainnet.
- **Chain** — The blockchain network: `sol` = Solana, `bsc` = BNB Smart Chain, `base` = Base (Coinbase L2), `eth` = Ethereum mainnet, `robinhood` = Robinhood chain.
- **Market cap** — Not returned directly by `token info`. Calculate as `price.price × circulating_supply` (`price` is a nested object; use `price.price` for the current USD price string).
- **Liquidity** — USD value of token reserves in the main trading pool. Low liquidity (< $10k) means high price impact / slippage when buying or selling.
- **Holder** — A wallet that currently holds the token. `token holders` returns wallets ranked by current balance.
@@ -42,7 +44,7 @@ Use the `gmgn-cli` tool to query token information based on the user's request.
## Supported Chains
`sol` / `bsc` / `base` / `eth`
`sol` / `bsc` / `base` / `eth` / `robinhood`
## Prerequisites
@@ -68,27 +70,11 @@ When a request returns `429`:
- The CLI may wait and retry once automatically when the remaining cooldown is short. If it still fails, stop and tell the user the exact retry time instead of sending more requests.
- For `RATE_LIMIT_EXCEEDED` or `RATE_LIMIT_BANNED`, repeated requests during the cooldown can extend the ban by 5 seconds each time, up to 5 minutes. Do not spam retries.
**First-time setup** (if `GMGN_API_KEY` is not configured):
1. Generate key pair and show the public key to the user:
```bash
openssl genpkey -algorithm ed25519 -out /tmp/gmgn_private.pem 2>/dev/null && \
openssl pkey -in /tmp/gmgn_private.pem -pubout 2>/dev/null
```
Tell the user: *"This is your Ed25519 public key. Go to **https://gmgn.ai/ai**, paste it into the API key creation form, then send me the API Key value shown on the page."*
2. Wait for the user's API key, then configure:
```bash
mkdir -p ~/.config/gmgn
echo 'GMGN_API_KEY=<key_from_user>' > ~/.config/gmgn/.env
chmod 600 ~/.config/gmgn/.env
```
## Parameters — `token info` / `token security` / `token pool`
| Parameter | Required | Description |
|-----------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--address` | Yes | Token contract address |
| `--raw` | No | Output raw single-line JSON (for piping or further processing) |
@@ -96,7 +82,7 @@ When a request returns `429`:
| Parameter | Required | Default | Description |
|-----------|----------|---------|-------------|
| `--chain` | Yes | — | `sol` / `bsc` / `base` / `eth` |
| `--chain` | Yes | — | `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--address` | Yes | — | Token contract address |
| `--limit` | No | `20` | Number of results, max `100` |
| `--order-by` | No | `amount_percentage` | Sort field — see table below |
+86 -23
View File
@@ -1,11 +1,13 @@
---
name: gmgn-track
description: Get real-time crypto buy/sell activity from Smart Money wallets, KOL influencer wallets, and personally followed wallets via GMGN API — alpha signals, whale tracking, meme token copy-trading ideas on Solana, BSC, Base, or Ethereum. Use when user asks what smart money or KOLs are buying, wants whale alerts, on-chain alpha, or copy-trade signals. (For a specific wallet address, use gmgn-portfolio.)
argument-hint: "<follow-wallet|kol|smartmoney> --chain <sol|bsc|base|eth> [--wallet <wallet_address>]"
description: Get real-time crypto buy/sell activity from Smart Money wallets, KOL influencer wallets, and personally followed wallets via GMGN API — alpha signals, whale tracking, meme token copy-trading ideas on Solana, BSC, Base, or Ethereum. Also query which tokens a wallet has followed (bookmarked) on GMGN. Use when user asks what smart money or KOLs are buying, wants whale alerts, on-chain alpha, copy-trade signals, or wants to check a wallet's followed tokens. (For a specific wallet address's portfolio, use gmgn-portfolio.)
argument-hint: "<follow-tokens|follow-wallet|kol|smartmoney> --chain <sol|bsc|base|eth> [--wallet <wallet_address>]"
metadata:
cliHelp: "gmgn-cli track --help"
---
**BEFORE RUNNING ANY COMMAND: Run `gmgn-cli config --check`. If exit code is 0, proceed normally. If exit code is 1, (1) run `gmgn-cli config` and show the output to the user; (2) once the user sends the API Key, run `gmgn-cli config --apply <KEY>` to complete configuration and verification, then show the output to the user. If `--check` returns an error (unknown option or command not found), tell the user to run `npm install -g gmgn-cli` to update, then retry.**
**IMPORTANT: Always use `gmgn-cli` commands below. Do NOT use web search, WebFetch, curl, or visit gmgn.ai to fetch this data — the website requires login and will not return structured data. The CLI is the only correct method.**
**IMPORTANT: Do NOT guess field names or values. When a field's meaning is unclear, look it up in the Response Fields sections below before using it.**
@@ -49,19 +51,23 @@ Use the `gmgn-cli` tool to query on-chain tracking data based on the user's requ
| Sub-command | Description |
|-------------|-------------|
| `track follow-tokens` | Followed token list for a wallet — which tokens a wallet has bookmarked on GMGN, with full market data |
| `track follow-token-groups` | Follow token group names for a wallet — the group names and IDs the wallet uses to organise followed tokens |
| `track follow-wallet` | Trade records from wallets the user personally follows on GMGN |
| `track kol` | Real-time trades from KOL / influencer wallets tagged by GMGN |
| `track smartmoney` | Real-time trades from smart money / whale wallets tagged by GMGN |
## Supported Chains
`sol` / `bsc` / `base` / `eth`
`sol` / `bsc` / `base` / `eth` / `robinhood`
Note: `track kol` and `track smartmoney` do **not** support `robinhood` — they accept `sol` / `bsc` / `base` / `eth` only.
## Prerequisites
- `gmgn-cli` installed globally — if missing, run: `npm install -g gmgn-cli`
- `GMGN_API_KEY` configured in `~/.config/gmgn/.env` — required for all sub-commands
- `GMGN_PRIVATE_KEY` — required for `track follow-wallet` only (signed auth); not needed for `kol` or `smartmoney`
- `GMGN_PRIVATE_KEY` — required for `track follow-wallet` only (signed auth); not needed for `follow-tokens`, `kol`, or `smartmoney`
## Rate Limit Handling
@@ -69,6 +75,8 @@ All tracking routes used by this skill go through GMGN's leaky-bucket limiter wi
| Command | Route | Weight |
|---------|-------|--------|
| `track follow-tokens` | `GET /v1/user/follow_tokens` | 3 |
| `track follow-token-groups` | `GET /v1/user/follow_token_groups` | 1 |
| `track follow-wallet` | `GET /v1/trade/follow_wallet` | 3 |
| `track kol` | `GET /v1/user/kol` | 1 |
| `track smartmoney` | `GET /v1/user/smartmoney` | 1 |
@@ -80,27 +88,21 @@ When a request returns `429`:
- The CLI may wait and retry once automatically when the remaining cooldown is short. If it still fails, stop and tell the user the exact retry time instead of sending more requests.
- For `RATE_LIMIT_EXCEEDED` or `RATE_LIMIT_BANNED`, repeated requests during the cooldown can extend the ban by 5 seconds each time, up to 5 minutes. Do not spam retries.
**First-time setup** (if `GMGN_API_KEY` is not configured):
1. Generate key pair and show the public key to the user:
```bash
openssl genpkey -algorithm ed25519 -out /tmp/gmgn_private.pem 2>/dev/null && \
openssl pkey -in /tmp/gmgn_private.pem -pubout 2>/dev/null
```
Tell the user: *"This is your Ed25519 public key. Go to **https://gmgn.ai/ai**, paste it into the API key creation form, then send me the API Key value shown on the page."*
2. Wait for the user's API key, then configure (saves both API key and private key — private key is required for `track follow-wallet`):
```bash
mkdir -p ~/.config/gmgn
echo "GMGN_API_KEY=<key_from_user>" > ~/.config/gmgn/.env
echo "GMGN_PRIVATE_KEY=$(awk '{printf "%s\\n", $0}' /tmp/gmgn_private.pem)" >> ~/.config/gmgn/.env
chmod 600 ~/.config/gmgn/.env
rm /tmp/gmgn_private.pem
```
## Usage Examples
```bash
# Followed token list for a wallet on SOL
gmgn-cli track follow-tokens --chain sol --wallet <wallet_address>
# Followed token list on BSC, raw JSON output
gmgn-cli track follow-tokens --chain bsc --wallet <wallet_address> --raw
# Follow token group names for a wallet on SOL
gmgn-cli track follow-token-groups --chain sol --wallet <wallet_address>
# Follow token group names, raw JSON output
gmgn-cli track follow-token-groups --chain sol --wallet <wallet_address> --raw
# Follow-wallet trades (all wallets you follow)
gmgn-cli track follow-wallet --chain sol
@@ -126,11 +128,71 @@ gmgn-cli track smartmoney --limit 10 --raw
gmgn-cli track smartmoney --chain sol --side sell --limit 10 --raw
```
## `track follow-tokens` Options
| Option | Description |
|--------|-------------|
| `--chain` | Required. `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--wallet <address>` | Required. Wallet address to query |
| `--group-id <id>` | Filter by group: `all_group` (all tokens across groups), `default` (default group), or a user-defined group ID |
| `--interval <interval>` | Time interval for price change stats (e.g. `1m`, `5m`, `1h`, `6h`, `24h`) |
| `--order-by <field>` | Sort field: `created_at` / `swaps` / `volume` / `market_cap` / `liquidity` / `price` / `open_timestamp` |
| `--direction <dir>` | Required when `--order-by` is set. `asc` / `desc` |
| `--limit <n>` | Page size |
| `--cursor <cursor>` | Pagination cursor from previous response |
| `--search <text>` | Search by token name or address |
## `track follow-tokens` Response Fields
Top-level fields:
| Field | Description |
|-------|-------------|
| `cursor` | Opaque cursor for fetching the next page |
| `all_following` | Total number of followed tokens |
| `is_recommend` | Whether results include recommended tokens |
| `followings` | Array of followed token objects |
Each item in `followings` contains:
| Field | Description |
|-------|-------------|
| `address` | Token contract address |
| `symbol` | Token ticker symbol |
| `name` | Token name |
| `chain` | Chain the token is on |
| `price` | Current token price |
| `price_change_percent` | Price change percentage |
| `volume` | Trading volume |
| `liquidity` | Pool liquidity |
| `market_cap` | Market cap |
| `swaps` | Total swaps |
| `group_ids` | Follow groups this token belongs to |
| `open_timestamp` | Unix timestamp when trading opened |
## `track follow-token-groups` Options
| Option | Description |
|--------|-------------|
| `--chain` | Required. `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--wallet <address>` | Required. Wallet address to query |
## `track follow-token-groups` Response Fields
`data` is an array. Each item contains:
| Field | Description |
|-------|-------------|
| `chain` | Chain the group is on |
| `group_id` | Group identifier (e.g. `default`, or a user-defined ID) |
| `group_name` | Human-readable group name |
| `rank` | Display order / sort rank |
## `track follow-wallet` Options
| Option | Description |
|--------|-------------|
| `--chain` | Required. `sol` / `bsc` / `base` / `eth` |
| `--chain` | Required. `sol` / `bsc` / `base` / `eth` / `robinhood` |
| `--wallet <address>` | Filter by wallet address |
| `--limit <n>` | Page size (1100, default 10) |
| `--side <side>` | Trade direction: `buy` / `sell` |
@@ -311,6 +373,7 @@ To research any token surfaced by smart money activity, follow [`docs/workflow-t
## Notes
- `track follow-tokens` uses exist auth (API Key only); `--wallet` is required
- `track follow-wallet` uses signed auth (API Key + private key signature); `track kol` and `track smartmoney` use exist auth (API Key only)
- `track follow-wallet` returns trades from wallets followed on the GMGN platform; the follow list is resolved automatically from the GMGN user account bound to the API Key — `--wallet` is optional
- Use `--raw` to get single-line JSON for further processing
+53 -5
View File
@@ -6,11 +6,16 @@
* Signed (swap and order routes): X-APIKEY + timestamp + client_id + X-Signature (private key signature)
*/
import { createRequire } from "node:module";
import { buildAuthQuery, buildMessage, detectAlgorithm, sign } from "./signer.js";
const RATE_LIMIT_RETRY_BUFFER_MS = 1000;
const DEFAULT_RATE_LIMIT_AUTO_RETRY_MAX_WAIT_MS = 5000;
const { version: CLI_VERSION } = createRequire(import.meta.url)("../../package.json") as { version: string };
const USER_AGENT = `gmgn-cli/${CLI_VERSION}`;
interface PreparedRequest {
method: string;
subPath: string;
@@ -174,6 +179,20 @@ export interface TokenSignalGroup {
max_create_or_open_ts?: string;
}
// HotSearchesParam carries its filter fields flattened (no nested `filter` object):
// label/interval/chain plus optional `filters` boolean tags, `limit`, and rank-style
// numeric range bounds (min_<metric>/max_<metric>) incl. min_created/max_created.
// Extra range keys are forwarded verbatim; the service translates metric names per
// interval. See `market hot-searches` docs for the supported metric list.
export interface HotSearchesParam {
label?: string;
interval: string; // "1m" | "5m" | "1h" | "6h" | "24h"
chain: string; // "sol" | "bsc" | "base" | "eth" | "robinhood"
filters?: string[];
limit?: number;
[key: string]: string[] | number | string | undefined;
}
export interface PumpFeeShareInfo {
provider: string; // "solana" | "twitter" | "github"
username: string; // platform username; a SOL address when provider = "solana"
@@ -314,7 +333,6 @@ export interface CreateTokenParams {
// Multi-wallet buy
buy_wallets?: BuyWalletInfo[];
snip_buy_wallets?: BuyWalletInfo[];
interval_seconds?: number;
}
export class OpenApiClient {
@@ -426,6 +444,10 @@ export class OpenApiClient {
return this.authExistRequest("POST", "/v1/market/token_signal", {}, { chain, groups });
}
async getHotSearches(params: HotSearchesParam[]): Promise<unknown> {
return this.authExistRequest("POST", "/v1/market/hot_searches", {}, { params });
}
// ---- User endpoints (exist auth) ----
async getUserInfo(): Promise<unknown> {
@@ -436,6 +458,14 @@ export class OpenApiClient {
return this.authSignedRequest("GET", "/v1/trade/follow_wallet", { chain, ...extra }, null);
}
async getFollowTokens(chain: string, walletAddress: string, extra: Record<string, string | number> = {}): Promise<unknown> {
return this.authExistRequest("GET", "/v1/user/follow_tokens", { chain, wallet_address: walletAddress, ...extra });
}
async getFollowGroupNames(chain: string, walletAddress: string): Promise<unknown> {
return this.authExistRequest("GET", "/v1/user/follow_token_groups", { chain, wallet_address: walletAddress });
}
async getKol(chain?: string, limit?: number): Promise<unknown> {
const query: Record<string, string | number> = {};
if (chain) query["chain"] = chain;
@@ -463,7 +493,7 @@ export class OpenApiClient {
slippage: number
): Promise<unknown> {
const query = { chain, from_address, input_token, output_token, input_amount, slippage };
return this.authSignedRequest("GET", "/v1/trade/quote", query, null);
return this.authExistRequest("GET", "/v1/trade/quote", query);
}
// ---- Swap endpoints (signed auth) ----
@@ -523,6 +553,7 @@ export class OpenApiClient {
const headers: Record<string, string> = {
"X-APIKEY": this.apiKey,
"Content-Type": "application/json",
"User-Agent": USER_AGENT,
};
const bodyStr = body !== null ? JSON.stringify(body) : null;
return {
@@ -558,6 +589,7 @@ export class OpenApiClient {
"X-APIKEY": this.apiKey,
"X-Signature": signature,
"Content-Type": "application/json",
"User-Agent": USER_AGENT,
};
return {
method,
@@ -799,18 +831,29 @@ const TRENCHES_PLATFORMS: Record<string, string[]> = {
],
bsc: [
"fourmeme", "fourmeme_agent", "bn_fourmeme", "four_xmode_agent",
"flap", "clanker", "lunafun",
"cubepeg", "likwid", "goplus_creator", "goplus_skills", "openfour",
"flap", "flap_stocks", "flap_aioracle", "clanker", "lunafun",
],
base: [
"clanker", "bankr", "flaunch", "zora", "zora_creator",
"baseapp", "basememe", "virtuals_v2", "klik",
],
eth: [
"trench", "clanker", "klik", "livo", "stroid",
"pool_uniswap_v2", "pool_uniswap_v3", "printr",
],
robinhood: [
"noxa", "virtuals_v2", "bankr", "dyorswap",
"pool_uniswap_v2", "pool_uniswap_v3", "pool_uniswap_v4",
],
};
const TRENCHES_QUOTE_ADDRESS_TYPES: Record<string, number[]> = {
sol: [4, 5, 3, 1, 13, 0],
bsc: [6, 7, 1, 16, 8, 3, 9, 10, 2, 17, 18, 0],
base: [11, 3, 12, 13, 0],
eth: [20, 11, 8, 3, 12, 1, 0],
robinhood: [11, 20, 24, 12, 0],
};
function buildTrenchesBody(chain: string, types?: string[], platforms?: string[], limit?: number, filters?: Record<string, number | string>): Record<string, unknown> {
@@ -820,12 +863,17 @@ function buildTrenchesBody(chain: string, types?: string[], platforms?: string[]
const actualLimit = limit ?? 80;
const section: Record<string, unknown> = {
filters: ["offchain", "onchain"],
launchpad_platform,
quote_address_type,
launchpad_platform_v2: true,
limit: actualLimit,
...filters,
};
// launchpad_platform / quote_address_type act as allow-list filters: sending an
// empty array filters out every result. Configured chains (see the maps above)
// supply real values; for any chain missing config we omit the field so the API
// applies its own defaults rather than returning an all-empty response. This is a
// safety net — new chains should still be added to both maps above.
if (launchpad_platform.length) section.launchpad_platform = launchpad_platform;
if (quote_address_type.length) section.quote_address_type = quote_address_type;
const body: Record<string, unknown> = { version: "v2" };
for (const type of selectedTypes) {
body[type] = { ...section };
+155
View File
@@ -0,0 +1,155 @@
import { config as loadDotenv } from "dotenv";
import { Command } from "commander";
import * as crypto from "crypto";
import * as fs from "fs";
import * as path from "path";
import * as os from "os";
import { execSync } from "child_process";
const GMGN_CONFIG_DIR = path.join(os.homedir(), ".config", "gmgn");
const KEYPAIR_FILE = path.join(GMGN_CONFIG_DIR, "keypair.pem");
const ENV_FILE = path.join(GMGN_CONFIG_DIR, ".env");
const GMGN_API_URL = "https://gmgn.ai/ai/generateapi";
type Lang = "zh-CN" | "zh-TW" | "en";
function detectLang(): Lang {
const locale =
process.env.LANG ||
process.env.LC_ALL ||
process.env.LC_MESSAGES ||
Intl.DateTimeFormat().resolvedOptions().locale ||
"en";
const l = locale.toLowerCase();
if (l.startsWith("zh_tw") || l.startsWith("zh-tw") || l.startsWith("zh_hk") || l.startsWith("zh-hk")) return "zh-TW";
if (l.startsWith("zh")) return "zh-CN";
return "en";
}
const MESSAGES = {
linkGuide: {
"zh-CN": (link: string) =>
`请点击下方链接创建你的 GMGN API Key,完成后将 Key 发给我,我来帮你完成配置:\n${link}`,
"zh-TW": (link: string) =>
`請點擊下方連結建立你的 GMGN API Key,完成後將 Key 發給我,我來幫你完成配置:\n${link}`,
en: (link: string) =>
`Please click the link below to create your GMGN API Key. Once created, send me the API Key and I will finish the configuration:\n${link}`,
},
verifySuccess: {
"zh-CN": "配置验证成功,可以开始使用了。",
"zh-TW": "配置驗證成功,可以開始使用了。",
en: "Configuration verified successfully. You are ready to use GMGN.",
},
verifyFail: {
"zh-CN":
"配置验证失败:API Key 与本地密钥不匹配。\n请确认:\n1. API Key 是否填写正确;\n2. 创建 API Key 时,是否使用的是页面自动填入的公钥。",
"zh-TW":
"配置驗證失敗:API Key 與本地密鑰不匹配。\n請確認:\n1. API Key 是否填寫正確;\n2. 創建 API Key 時,是否使用的是頁面自動填入的公鑰。",
en: "Configuration verification failed: API Key does not match your local key pair.\nPlease confirm:\n1. Whether the API Key was entered correctly.\n2. Whether you used the public key that was pre-filled on the page when creating the API Key.",
},
verifyNetworkFail: {
"zh-CN": "配置已写入,但验证请求失败(可能是网络问题)。你可以先尝试使用,如遇接口报错再重新配置。",
"zh-TW": "配置已寫入,但驗證請求失敗(可能是網路問題)。你可以先嘗試使用,如遇介面報錯再重新配置。",
en: "Configuration saved, but the verification request failed (possibly a network issue). You can try using it now and reconfigure if you encounter API errors.",
},
};
function getOrCreateKeypair(): string {
fs.mkdirSync(GMGN_CONFIG_DIR, { recursive: true });
if (fs.existsSync(KEYPAIR_FILE)) {
const content = fs.readFileSync(KEYPAIR_FILE, "utf-8");
const match = content.match(/(-----BEGIN PUBLIC KEY-----[\s\S]+?-----END PUBLIC KEY-----)/);
if (!match) {
console.error("Error: keypair.pem exists but public key could not be parsed. Delete ~/.config/gmgn/keypair.pem and try again.");
process.exit(1);
}
return match[1] + "\n";
}
const { privateKey, publicKey } = crypto.generateKeyPairSync("ed25519");
const privatePem = privateKey.export({ type: "pkcs8", format: "pem" }) as string;
const publicPem = publicKey.export({ type: "spki", format: "pem" }) as string;
const entry = `# Private Key\n${privatePem}\n# Public Key\n${publicPem}\n`;
fs.writeFileSync(KEYPAIR_FILE, entry, { mode: 0o600 });
return publicPem;
}
function writeEnv(apiKey: string, privatePem: string): void {
const pkOneLine = privatePem.replace(/\r?\n/g, "\\n");
let existing = fs.existsSync(ENV_FILE) ? fs.readFileSync(ENV_FILE, "utf-8") : "";
existing = existing
.split("\n")
.filter((l) => !/^GMGN_API_KEY=|^GMGN_PRIVATE_KEY=/.test(l))
.join("\n")
.trim();
const content = (existing ? existing + "\n" : "") + `GMGN_API_KEY=${apiKey}\nGMGN_PRIVATE_KEY=${pkOneLine}\n`;
fs.mkdirSync(GMGN_CONFIG_DIR, { recursive: true });
fs.writeFileSync(ENV_FILE, content, { mode: 0o600 });
}
function verify(): "ok" | "auth_fail" | "network_fail" {
try {
execSync("gmgn-cli track follow-wallet --chain sol --limit 1", { stdio: "pipe" });
return "ok";
} catch (e: unknown) {
const output = [
(e as any).stderr?.toString() ?? "",
(e as any).stdout?.toString() ?? "",
].join(" ");
if (/401|403|unauthorized|forbidden|invalid.*key|key.*invalid|signature/i.test(output)) {
return "auth_fail";
}
return "network_fail";
}
}
export function registerConfigCommands(program: Command): void {
const cmd = program
.command("config")
.description("Generate an Ed25519 key pair and output a pre-filled GMGN API Key creation link, or apply an API Key");
cmd
.option("--check", "Check if GMGN_API_KEY is configured (exit 0 = found, exit 1 = not found)")
.option("--apply <api_key>", "Write API Key + private key to ~/.config/gmgn/.env and verify")
.action(async (opts) => {
const lang = detectLang();
if (opts.check) {
loadDotenv({ path: ENV_FILE, override: true });
loadDotenv();
process.exit(process.env.GMGN_API_KEY ? 0 : 1);
}
if (opts.apply) {
// --apply: read private key from keypair.pem, write .env, verify
if (!fs.existsSync(KEYPAIR_FILE)) {
console.error("Error: ~/.config/gmgn/keypair.pem not found. Run `gmgn-cli config` first to generate a key pair.");
process.exit(1);
}
const content = fs.readFileSync(KEYPAIR_FILE, "utf-8");
const match = content.match(/(-----BEGIN PRIVATE KEY-----[\s\S]+?-----END PRIVATE KEY-----)/);
if (!match) {
console.error("Error: keypair.pem exists but private key could not be parsed. Delete ~/.config/gmgn/keypair.pem and run `gmgn-cli config` again.");
process.exit(1);
}
writeEnv(opts.apply, match[1]);
const result = verify();
if (result === "ok") {
console.log(MESSAGES.verifySuccess[lang]);
} else if (result === "auth_fail") {
console.error(MESSAGES.verifyFail[lang]);
process.exit(1);
} else {
console.log(MESSAGES.verifyNetworkFail[lang]);
}
return;
}
// Default: generate/reuse keypair, output link with guidance
const publicPem = getOrCreateKeypair();
const link = `${GMGN_API_URL}?pbk=${encodeURIComponent(publicPem)}`;
console.log(MESSAGES.linkGuide[lang](link));
});
}
+4 -2
View File
@@ -66,7 +66,6 @@ export function registerCookingCommands(program: Command): void {
// Multi-wallet buy
.option("--buy-wallets <json>", "Multi-wallet buy config as JSON array [{from_address, buy_amt}]")
.option("--snip-buy-wallets <json>", "Snipe-buy wallet config as JSON array [{from_address, buy_amt}]")
.option("--interval-seconds <n>", "Interval between multi-wallet buys in seconds", parseInt)
// CondMarket execution config + auto-sell (JSON)
.option("--buy-trade-config <json>", "Buy-side trade config for CondMarket orders as JSON (TradeParam)")
.option("--sell-trade-config <json>", "Sell-side trade config for auto-sell / pending_sell as JSON (TradeParam)")
@@ -82,6 +81,10 @@ export function registerCookingCommands(program: Command): void {
process.exit(1);
}
validateChain(opts.chain);
if (opts.chain === "robinhood") {
console.error(`[gmgn-cli] cooking create does not support robinhood, got "${opts.chain}"`);
process.exit(1);
}
const params: CreateTokenParams = {
chain: opts.chain,
dex: opts.dex,
@@ -124,7 +127,6 @@ export function registerCookingCommands(program: Command): void {
if (opts.bonkModel) params.bonk_model = opts.bonkModel;
if (opts.buyWallets) params.buy_wallets = JSON.parse(opts.buyWallets);
if (opts.snipBuyWallets) params.snip_buy_wallets = JSON.parse(opts.snipBuyWallets);
if (opts.intervalSeconds != null) params.interval_seconds = opts.intervalSeconds;
if (opts.buyTradeConfig) params.buy_trade_config = JSON.parse(opts.buyTradeConfig);
if (opts.sellTradeConfig) params.sell_trade_config = JSON.parse(opts.sellTradeConfig);
if (opts.sellConfigs) params.sell_configs = JSON.parse(opts.sellConfigs);
+156 -20
View File
@@ -1,5 +1,5 @@
import { Command } from "commander";
import { OpenApiClient, TokenSignalGroup } from "../client/OpenApiClient.js";
import { OpenApiClient, TokenSignalGroup, HotSearchesParam } from "../client/OpenApiClient.js";
import { getConfig } from "../config.js";
import { exitOnError, printResult } from "../output.js";
import { validateAddress, validateChain } from "../validate.js";
@@ -26,9 +26,9 @@ export function registerMarketCommands(program: Command): void {
market
.command("kline")
.description("Get token K-line (candlestick) data")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--address <address>", "Token contract address")
.requiredOption("--resolution <resolution>", "Candlestick resolution: 1m / 5m / 15m / 1h / 4h / 1d")
.requiredOption("--resolution <resolution>", "Candlestick resolution: 30s / 1m / 5m / 15m / 1h / 4h / 1d")
.option("--from <timestamp>", "Start time (Unix seconds)", parseInt)
.option("--to <timestamp>", "End time (Unix seconds)", parseInt)
.option("--raw", "Output raw JSON")
@@ -48,35 +48,55 @@ export function registerMarketCommands(program: Command): void {
printResult(data, opts.raw);
});
market
const trendingCmd = market
.command("trending")
.description("Get trending token swap data")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--interval <interval>", "Time interval: 1m / 5m / 1h / 6h / 24h")
.option("--limit <n>", "Number of results (default 100, max 100)", parseInt)
.option("--order-by <field>", "Sort field: default / volume / swaps / marketcap / holder_count / price / change1h / ... (see docs for full list)")
.option("--direction <dir>", "Sort direction: asc / desc")
.option("--filter <tag...>", "Filter tags, repeatable. sol: renounced / frozen / has_social / not_wash_trading / ... evm: not_honeypot / verified / renounced / locked / ... (see docs for full list)")
.option("--platform <name...>", "Platform filter, repeatable. sol: Pump.fun / letsbonk / moonshot_app / ... bsc: fourmeme / flap / clanker / ... base: clanker / flaunch / zora / ... (see docs for full list)")
.option("--raw", "Output raw JSON")
.action(async (opts) => {
validateChain(opts.chain);
const extra: Record<string, string | number | string[]> = {};
if (opts.limit != null) extra["limit"] = opts.limit;
if (opts.orderBy) extra["order_by"] = opts.orderBy;
if (opts.direction) extra["direction"] = opts.direction;
if (opts.filter?.length) extra["filters"] = opts.filter;
if (opts.platform?.length) extra["platforms"] = opts.platform;
.option("--platform <name...>", "Platform filter, repeatable. sol: Pump.fun / letsbonk / moonshot_app / ... bsc: fourmeme / four_xmode_agent / cubepeg / likwid / goplus_creator / goplus_skills / openfour / flap / flap_stocks / flap_aioracle / clanker / ... base: clanker / flaunch / zora / ... eth: trench / clanker / klik / livo / stroid / pool_uniswap_v2 / pool_uniswap_v3 / printr (see docs for full list)")
.option("--raw", "Output raw JSON");
const client = new OpenApiClient(getConfig());
const data = await client.getTrendingSwaps(opts.chain, opts.interval, extra).catch(exitOnError);
printResult(data, opts.raw);
});
// Dynamically register all server-side min_*/max_* range filter flags
for (const def of RANK_RANGE_FIELDS) {
const flag = def.api.replace(/_/g, "-");
if (def.type === "int") {
trendingCmd.option(`--${flag} <${def.type}>`, def.desc, parseInt);
} else if (def.type === "float") {
trendingCmd.option(`--${flag} <${def.type}>`, def.desc, parseFloat);
} else {
trendingCmd.option(`--${flag} <value>`, def.desc);
}
}
trendingCmd.action(async (opts) => {
validateChain(opts.chain);
const extra: Record<string, string | number | string[]> = {};
if (opts.limit != null) extra["limit"] = opts.limit;
if (opts.orderBy) extra["order_by"] = opts.orderBy;
if (opts.direction) extra["direction"] = opts.direction;
if (opts.filter?.length) extra["filters"] = opts.filter;
if (opts.platform?.length) extra["platforms"] = opts.platform;
// Apply server-side min_*/max_* range filters
const optsMap = opts as Record<string, unknown>;
for (const def of RANK_RANGE_FIELDS) {
const val = optsMap[apiFieldToCliKey(def.api)];
if (val != null) extra[def.api] = val as string | number;
}
const client = new OpenApiClient(getConfig());
const data = await client.getTrendingSwaps(opts.chain, opts.interval, extra).catch(exitOnError);
printResult(data, opts.raw);
});
const trenchesCmd = market
.command("trenches")
.description("Get Trenches token data (new creation, near completion, completed)")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.option("--type <type...>", "Categories to query, repeatable: new_creation / near_completion / completed (default: all three)")
.option("--launchpad-platform <platform...>", "Launchpad platform filter, repeatable (default: all platforms for the chain)")
.option("--limit <n>", "Max results per category, max 80 (default: 80)", parseInt)
@@ -183,8 +203,74 @@ export function registerMarketCommands(program: Command): void {
const data = await client.getTokenSignalV2(opts["chain"] as string, groups).catch(exitOnError);
printResult(data, opts["raw"] as boolean | undefined);
});
const hotSearchesCmd = market
.command("hot-searches")
.description("Get the hot-search ranking (most-searched tokens) for one or more chains")
.option("--chain <chain...>", "Chain(s), repeatable: sol / bsc / base / eth / robinhood (default: all default chains)")
.option("--interval <interval>", "Time window: 1m / 5m / 1h / 6h / 24h (default 24h)", "24h")
.option("--limit <n>", "Max results per chain (default 500)", parseInt)
.option("--filter <tag...>", "Boolean filter tags, repeatable. sol defaults: renounced / frozen; EVM defaults: not_honeypot / verified / renounced")
.option("--params <json>", "Full params override: JSON array of param objects — overrides --chain/--interval/--limit/--filter and all range flags when provided")
.option("--raw", "Output raw JSON");
// Reuse the same min_*/max_* range flags as `market trending` — the hot_searches
// endpoint accepts the identical rank-style metric names inside `filter` and
// translates them server-side per interval (min_created/max_created are durations).
for (const def of RANK_RANGE_FIELDS) {
const flag = def.api.replace(/_/g, "-");
if (def.type === "int") {
hotSearchesCmd.option(`--${flag} <${def.type}>`, def.desc, parseInt);
} else if (def.type === "float") {
hotSearchesCmd.option(`--${flag} <${def.type}>`, def.desc, parseFloat);
} else if (def.type === "duration") {
hotSearchesCmd.option(`--${flag} <duration>`, def.desc, parseDuration);
} else {
hotSearchesCmd.option(`--${flag} <value>`, def.desc);
}
}
hotSearchesCmd.action(async (opts) => {
const interval = String(opts.interval);
if (!HOT_SEARCHES_INTERVALS.has(interval)) {
console.error(`[gmgn-cli] Invalid --interval "${interval}". Must be one of: ${[...HOT_SEARCHES_INTERVALS].join(", ")}`);
process.exit(1);
}
let params: HotSearchesParam[];
if (opts.params != null) {
try {
params = JSON.parse(opts.params as string) as HotSearchesParam[];
} catch {
console.error(`[gmgn-cli] --params must be a valid JSON array, e.g. '[{"chain":"sol","interval":"24h","filters":["renounced","frozen"],"limit":500,"min_liquidity":1000}]'`);
process.exit(1);
}
} else {
// Empty params lets the server apply its default 5-chain config. Filter fields
// are flattened directly onto each param (no nested `filter` object).
const optsMap = opts as Record<string, unknown>;
const chains: string[] = opts.chain?.length ? (opts.chain as string[]) : [];
params = chains.map((chain) => {
const param: HotSearchesParam = { label: "hot-search", chain, interval };
if (opts.filter?.length) param.filters = opts.filter as string[];
if (opts.limit != null) param.limit = opts.limit as number;
// Fold in any rank-style min_*/max_* range flags (incl. min_created/max_created).
for (const def of RANK_RANGE_FIELDS) {
const val = optsMap[apiFieldToCliKey(def.api)];
if (val != null) param[def.api] = val as number | string;
}
return param;
});
}
const client = new OpenApiClient(getConfig());
const data = await client.getHotSearches(params).catch(exitOnError);
printResult(data, opts.raw);
});
}
const HOT_SEARCHES_INTERVALS = new Set(["1m", "5m", "1h", "6h", "24h"]);
// ---- Trenches filter field definitions ----
type TrenchesFieldType = "int" | "float" | "string" | "duration";
@@ -270,6 +356,56 @@ const TRENCHES_FILTER_FIELDS: TrenchesFilterField[] = [
{ api: "max_tg_call_count", type: "int", desc: "Max Telegram call count" },
];
// Server-side numeric range filters for `market trending` (/v1/market/rank).
// Passed through as min_<metric>/max_<metric> query params; the service applies the
// metrics it understands and ignores the rest. min_created/max_created are token-age
// windows expressed as duration strings (e.g. 30m / 6h / 7d) — note these use m/h/d,
// NOT the s/m form used by trenches; min_created is a minimum age, max_created a maximum.
// The raw upstream rank interface accepts minutes only; the openapi-service does not
// forward this field — it evaluates the age window itself (cutoff = now - duration,
// native for m/h/d), so h/d are valid through this CLI. Passed through verbatim
// (string); a bare number with no unit suffix is rejected.
const RANK_RANGE_FIELDS: TrenchesFilterField[] = [
{ api: "min_volume", type: "float", desc: "Min trading volume (USD)" },
{ api: "max_volume", type: "float", desc: "Max trading volume (USD)" },
{ api: "min_liquidity", type: "float", desc: "Min liquidity (USD)" },
{ api: "max_liquidity", type: "float", desc: "Max liquidity (USD)" },
{ api: "min_marketcap", type: "float", desc: "Min market cap (USD)" },
{ api: "max_marketcap", type: "float", desc: "Max market cap (USD)" },
{ api: "min_history_highest_marketcap", type: "float", desc: "Min historical highest market cap (USD)" },
{ api: "max_history_highest_marketcap", type: "float", desc: "Max historical highest market cap (USD)" },
{ api: "min_swaps", type: "int", desc: "Min swap count" },
{ api: "max_swaps", type: "int", desc: "Max swap count" },
{ api: "min_holder_count", type: "int", desc: "Min holder count" },
{ api: "max_holder_count", type: "int", desc: "Max holder count" },
{ api: "min_gas_fee", type: "float", desc: "Min gas fee" },
{ api: "max_gas_fee", type: "float", desc: "Max gas fee" },
{ api: "min_renowned_count", type: "int", desc: "Min KOL / renowned wallet count" },
{ api: "max_renowned_count", type: "int", desc: "Max KOL / renowned wallet count" },
{ api: "min_smart_degen_count", type: "int", desc: "Min smart-money holder count" },
{ api: "max_smart_degen_count", type: "int", desc: "Max smart-money holder count" },
{ api: "min_bot_degen_count", type: "int", desc: "Min bot-degen wallet count" },
{ api: "max_bot_degen_count", type: "int", desc: "Max bot-degen wallet count" },
{ api: "min_visiting_count", type: "int", desc: "Min visitor count" },
{ api: "max_visiting_count", type: "int", desc: "Max visitor count" },
{ api: "min_price_change_percent", type: "float", desc: "Min price change ratio over the interval" },
{ api: "max_price_change_percent", type: "float", desc: "Max price change ratio over the interval" },
{ api: "min_insider_rate", type: "float", desc: "Min insider trading ratio (01); tokens lacking this field are excluded" },
{ api: "max_insider_rate", type: "float", desc: "Max insider trading ratio (01); tokens lacking this field are excluded" },
{ api: "min_bundler_rate", type: "float", desc: "Min bundle-bot trading ratio (01); tokens lacking this field are excluded" },
{ api: "max_bundler_rate", type: "float", desc: "Max bundle-bot trading ratio (01); tokens lacking this field are excluded" },
{ api: "min_entrapment_ratio", type: "float", desc: "Min entrapment trading ratio (01); tokens lacking this field are excluded" },
{ api: "max_entrapment_ratio", type: "float", desc: "Max entrapment trading ratio (01); tokens lacking this field are excluded" },
{ api: "min_top10_holder_rate", type: "float", desc: "Min top-10 holder concentration (01)" },
{ api: "max_top10_holder_rate", type: "float", desc: "Max top-10 holder concentration (01)" },
{ api: "min_top70_sniper_hold_rate", type: "float", desc: "Min top-70 sniper holding ratio (01)" },
{ api: "max_top70_sniper_hold_rate", type: "float", desc: "Max top-70 sniper holding ratio (01)" },
{ api: "min_dev_team_hold_rate", type: "float", desc: "Min dev-team holding ratio (01); also excludes creator-close tokens" },
{ api: "max_dev_team_hold_rate", type: "float", desc: "Max dev-team holding ratio (01)" },
{ api: "min_created", type: "string", desc: "Min token age (minimum age). Duration with unit suffix m/h/d, e.g. 30m / 6h / 7d (h/d evaluated server-side; raw upstream takes minutes only). A bare number with no unit is rejected." },
{ api: "max_created", type: "string", desc: "Max token age (maximum age). Duration with unit suffix m/h/d, e.g. 600m / 24h (h/d evaluated server-side; raw upstream takes minutes only). A bare number with no unit is rejected." },
];
// Named filter presets using actual server-side API field names
const TRENCHES_FILTER_PRESETS: Record<string, Record<string, number | string>> = {
safe: {
+5 -5
View File
@@ -10,7 +10,7 @@ export function registerPortfolioCommands(program: Command): void {
portfolio
.command("holdings")
.description("Get wallet token holdings")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--wallet <address>", "Wallet address")
.option("--limit <n>", "Page size (default 20, max 50)", parseInt, 20)
.option("--cursor <cursor>", "Pagination cursor")
@@ -46,7 +46,7 @@ export function registerPortfolioCommands(program: Command): void {
portfolio
.command("activity")
.description("Get wallet transaction activity")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--wallet <address>", "Wallet address")
.option("--token <address>", "Filter by token contract address")
.option("--limit <n>", "Page size", parseInt)
@@ -71,7 +71,7 @@ export function registerPortfolioCommands(program: Command): void {
portfolio
.command("stats")
.description("Get wallet trading statistics (supports multiple wallets)")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--wallet <address...>", "Wallet address(es), repeatable")
.option("--period <period>", "Stats period: 7d / 30d", "7d")
.option("--raw", "Output raw JSON")
@@ -96,7 +96,7 @@ export function registerPortfolioCommands(program: Command): void {
portfolio
.command("token-balance")
.description("Get wallet token balance for a single token")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--wallet <address>", "Wallet address")
.requiredOption("--token <address>", "Token contract address")
.option("--raw", "Output raw JSON")
@@ -112,7 +112,7 @@ export function registerPortfolioCommands(program: Command): void {
portfolio
.command("created-tokens")
.description("Get tokens created by a developer wallet")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--wallet <address>", "Developer wallet address")
.option("--order-by <field>", "Sort field: market_cap / token_ath_mc")
.option("--direction <dir>", "Sort direction: asc / desc")
+11 -11
View File
@@ -8,7 +8,7 @@ export function registerSwapCommands(program: Command): void {
program
.command("swap")
.description("Submit a token swap")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--from <address>", "Wallet address (must match API Key binding)")
.requiredOption("--input-token <address>", "Input token contract address")
.requiredOption("--output-token <address>", "Output token contract address")
@@ -76,7 +76,7 @@ export function registerSwapCommands(program: Command): void {
program
.command("multi-swap")
.description("Submit token swaps across multiple wallets concurrently (up to 100 wallets)")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--accounts <addresses>", "Comma-separated wallet addresses (all must be bound to the API Key)")
.requiredOption("--input-token <address>", "Input token contract address")
.requiredOption("--output-token <address>", "Output token contract address")
@@ -149,9 +149,9 @@ export function registerSwapCommands(program: Command): void {
order
.command("quote")
.description("Get a swap quote without submitting a transaction (signed auth — requires GMGN_PRIVATE_KEY)")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth (requires GMGN_PRIVATE_KEY)")
.requiredOption("--from <address>", "Wallet address (must match API Key binding)")
.description("Get a swap quote without submitting a transaction (exist auth — GMGN_API_KEY only, no private key needed)")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--from <address>", "Wallet address")
.requiredOption("--input-token <address>", "Input token contract address")
.requiredOption("--output-token <address>", "Output token contract address")
.requiredOption("--amount <amount>", "Input amount (smallest unit)")
@@ -173,7 +173,7 @@ export function registerSwapCommands(program: Command): void {
order
.command("get")
.description("Query order status (requires private key)")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / monad")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--order-id <id>", "Order ID")
.option("--raw", "Output raw JSON")
.action(async (opts) => {
@@ -185,8 +185,8 @@ export function registerSwapCommands(program: Command): void {
program
.command("gas-price")
.description("Query recommended gas price tiers for any chain (exist auth — API Key only; eth / bsc / base / sol)")
.requiredOption("--chain <chain>", "Chain: eth / bsc / base / sol")
.description("Query recommended gas price tiers for any chain (exist auth — API Key only; eth / bsc / base / sol / robinhood)")
.requiredOption("--chain <chain>", "Chain: eth / bsc / base / sol / robinhood")
.option("--raw", "Output raw JSON")
.action(async (opts) => {
const client = new OpenApiClient(getConfig(false));
@@ -199,7 +199,7 @@ export function registerSwapCommands(program: Command): void {
strategy
.command("create")
.description("Create a limit/strategy order (requires private key)")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--from <address>", "Wallet address (must match API Key binding)")
.requiredOption("--base-token <address>", "Base token contract address")
.requiredOption("--quote-token <address>", "Quote token contract address")
@@ -283,7 +283,7 @@ export function registerSwapCommands(program: Command): void {
strategy
.command("list")
.description("List strategy orders (requires private key)")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.option("--type <type>", "open (default) / history")
.option("--from <address>", "Filter by wallet address")
.option("--group-tag <tag>", "Filter by group: LimitOrder / STMix")
@@ -308,7 +308,7 @@ export function registerSwapCommands(program: Command): void {
strategy
.command("cancel")
.description("Cancel a strategy order (requires private key)")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--from <address>", "Wallet address (must match API Key binding)")
.requiredOption("--order-id <id>", "Order ID to cancel")
.option("--order-type <type>", "Order type: limit_order / smart_trade")
+5 -5
View File
@@ -10,7 +10,7 @@ export function registerTokenCommands(program: Command): void {
token
.command("info")
.description("Get token basic information and realtime price")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--address <address>", "Token contract address")
.option("--raw", "Output raw JSON")
.action(async (opts) => {
@@ -24,7 +24,7 @@ export function registerTokenCommands(program: Command): void {
token
.command("security")
.description("Get token security metrics")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--address <address>", "Token contract address")
.option("--raw", "Output raw JSON")
.action(async (opts) => {
@@ -38,7 +38,7 @@ export function registerTokenCommands(program: Command): void {
token
.command("pool")
.description("Get token liquidity pool information")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--address <address>", "Token contract address")
.option("--raw", "Output raw JSON")
.action(async (opts) => {
@@ -52,7 +52,7 @@ export function registerTokenCommands(program: Command): void {
token
.command("holders")
.description("Get top token holders")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--address <address>", "Token contract address")
.option("--limit <n>", "Number of results (default 20, max 100)", parseInt)
.option("--order-by <field>", "Sort field: amount_percentage / profit / unrealized_profit / buy_volume_cur / sell_volume_cur", "amount_percentage")
@@ -75,7 +75,7 @@ export function registerTokenCommands(program: Command): void {
token
.command("traders")
.description("Get top token traders")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--address <address>", "Token contract address")
.option("--limit <n>", "Number of results (default 20, max 100)", parseInt)
.option("--order-by <field>", "Sort field: amount_percentage / profit / unrealized_profit / buy_volume_cur / sell_volume_cur", "amount_percentage")
+50 -1
View File
@@ -7,10 +7,51 @@ import { validateChain } from "../validate.js";
export function registerTrackCommands(program: Command): void {
const track = program.command("track").description("On-chain tracking commands: follow-wallet trades, KOL trades, Smart Money trades");
track
.command("follow-tokens")
.description("Get the followed token list for a wallet on a given chain")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--wallet <address>", "Wallet address")
.option("--group-id <id>", "Filter by group: all_group (all), default, or a user-defined group ID")
.option("--interval <interval>", "Time interval for price change stats (e.g. 1m, 5m, 1h, 6h, 24h)")
.option("--order-by <field>", "Sort field: created_at / swaps / volume / market_cap / liquidity / price / open_timestamp")
.option("--direction <dir>", "Sort direction: asc / desc")
.option("--limit <n>", "Page size", parseInt)
.option("--cursor <cursor>", "Pagination cursor")
.option("--search <text>", "Search by token name or address")
.option("--raw", "Output raw JSON")
.action(async (opts) => {
validateChain(opts.chain);
const extra: Record<string, string | number> = {};
if (opts.groupId) extra["group_id"] = opts.groupId;
if (opts.interval) extra["interval"] = opts.interval;
if (opts.orderBy) extra["order_by"] = opts.orderBy;
if (opts.direction) extra["direction"] = opts.direction;
if (opts.limit != null) extra["limit"] = opts.limit;
if (opts.cursor) extra["cursor"] = opts.cursor;
if (opts.search) extra["search_text"] = opts.search;
const client = new OpenApiClient(getConfig());
const data = await client.getFollowTokens(opts.chain, opts.wallet, extra).catch(exitOnError);
printResult(data, opts.raw);
});
track
.command("follow-token-groups")
.description("Get the follow token group names for a wallet on a given chain")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.requiredOption("--wallet <address>", "Wallet address")
.option("--raw", "Output raw JSON")
.action(async (opts) => {
validateChain(opts.chain);
const client = new OpenApiClient(getConfig());
const data = await client.getFollowGroupNames(opts.chain, opts.wallet).catch(exitOnError);
printResult(data, opts.raw);
});
track
.command("follow-wallet")
.description("Get follow-wallet trade records")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / robinhood")
.option("--wallet <address>", "Filter by wallet address")
.option("--limit <n>", "Page size (1100, default 10)", parseInt)
.option("--side <side>", "Trade direction filter: buy / sell")
@@ -41,6 +82,10 @@ export function registerTrackCommands(program: Command): void {
.option("--raw", "Output raw JSON")
.action(async (opts) => {
if (opts.chain) validateChain(opts.chain);
if (opts.chain === "robinhood") {
console.error(`[gmgn-cli] track kol does not support robinhood, got "${opts.chain}"`);
process.exit(1);
}
const client = new OpenApiClient(getConfig());
const data = await client.getKol(opts.chain, opts.limit).catch(exitOnError) as { list?: { side: string }[] };
if (opts.side && data?.list) {
@@ -58,6 +103,10 @@ export function registerTrackCommands(program: Command): void {
.option("--raw", "Output raw JSON")
.action(async (opts) => {
if (opts.chain) validateChain(opts.chain);
if (opts.chain === "robinhood") {
console.error(`[gmgn-cli] track smartmoney does not support robinhood, got "${opts.chain}"`);
process.exit(1);
}
const client = new OpenApiClient(getConfig());
const data = await client.getSmartMoney(opts.chain, opts.limit).catch(exitOnError) as { list?: { side: string }[] };
if (opts.side && data?.list) {
+2
View File
@@ -11,6 +11,7 @@ import { registerPortfolioCommands } from "./commands/portfolio.js";
import { registerTrackCommands } from "./commands/track.js";
import { registerSwapCommands } from "./commands/swap.js";
import { registerCookingCommands } from "./commands/cooking.js";
import { registerConfigCommands } from "./commands/config.js";
const proxy = process.env.HTTPS_PROXY ?? process.env.https_proxy
?? process.env.HTTP_PROXY ?? process.env.http_proxy;
@@ -60,6 +61,7 @@ registerPortfolioCommands(program);
registerTrackCommands(program);
registerSwapCommands(program);
registerCookingCommands(program);
registerConfigCommands(program);
program.parseAsync().catch((err) => {
console.error(`[gmgn-cli] ${err.message}`);
+2 -2
View File
@@ -1,4 +1,4 @@
const VALID_CHAINS = new Set(["sol", "bsc", "base", "eth", "monad"]);
const VALID_CHAINS = new Set(["sol", "bsc", "base", "eth", "robinhood" /*, "monad" */]);
const SOL_ADDRESS_RE = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
const EVM_ADDRESS_RE = /^0x[0-9a-fA-F]{40}$/;
const POSITIVE_INT_RE = /^\d+$/;
@@ -13,7 +13,7 @@ export function validateChain(chain: string): void {
}
export function validateAddress(address: string, chain: string, label: string): void {
const isEvm = chain === "bsc" || chain === "base" || chain === "eth" || chain === "monad";
const isEvm = chain === "bsc" || chain === "base" || chain === "eth" || chain === "robinhood" /* || chain === "monad" */;
const valid = isEvm ? EVM_ADDRESS_RE.test(address) : SOL_ADDRESS_RE.test(address);
if (!valid) {
console.error(