Compare commits

...

101 Commits

Author SHA1 Message Date
GMGN.AI aebe509f29 1.3.7 2026-05-29 19:37:00 +08:00
GMGN.AI 26ebfe6843 Merge pull request #146 from GMGNAI/fix/signer-encode-query-params
fix(signer): percent-encode query params in buildMessage to match server
2026-05-29 19:34:22 +08:00
David Lau 412531f04e fix(signer): percent-encode query params in buildMessage to match server
Server's CanonicalQueryString uses url.QueryEscape on all keys and values,
but buildMessage was using raw string interpolation. Cursor values (base64)
contain +, =, / which diverge under encoding — causing 401 on all paginated
signed requests (e.g. portfolio holdings page 2+).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 19:32:54 +08:00
GMGN.AI b0b25118aa Merge pull request #143 from GMGNAI/docs/swap-ratelimit-weights
docs(swap): add rate limit weights for strategy and multi_swap routes
2026-05-29 17:25:39 +08:00
David Lau 0a12f0615d docs(swap): add rate limit weights for strategy and multi_swap routes
- order strategy create: POST /v1/trade/strategy/create — weight 1
- order strategy cancel: POST /v1/trade/strategy/cancel — weight 1
- order strategy list:   GET  /v1/trade/strategy/orders — weight 1
- multi-swap already listed; confirms weight 5 (same as swap)

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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 12:03:35 +08:00
GMGN.AI 0cf2e514e6 Merge pull request #141 from gina888666/fix/portfolio-activity-price-fields-and-strategy-check-price
docs: clarify price/price_usd in portfolio activity and check-price unit in strategy create
2026-05-29 12:03:13 +08:00
gina888666 693a63c723 docs(gmgn-portfolio): remove example from price field description
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 10:53:20 +08:00
gina888666 81d67808fa docs(gmgn-portfolio): fix price field description to mention quote token may vary (SOL or USDC)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 10:51:34 +08:00
gina888666 8a095a99a8 docs: clarify price/price_usd in portfolio activity and check-price unit in strategy create
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-29 10:47:39 +08:00
GMGN.AI 0bc73a6430 1.3.6 2026-05-27 12:08:27 +08:00
gumponchain d00a1d3ce3 fix(swap): preserve Solana address case when normalizing wallet addresses
toLowerCase() breaks base58 Solana addresses which are case-sensitive.
Only apply lowercase normalization on EVM chains (bsc/base/eth).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 12:06:22 +08:00
GMGN.AI 30e535617f 1.3.5 2026-05-26 20:03:37 +08:00
GMGN.AI f64a3e086b ci: add workflow_dispatch to Release workflow 2026-05-26 20:01:04 +08:00
GMGN.AI 60438dff5c 1.3.4 2026-05-26 19:55:08 +08:00
deepfeature 6f0d4464e2 Merge pull request #138 from GMGNAI/feat/wallet-holdings-critical-auth
breaking(portfolio): upgrade wallet_holdings to critical auth
2026-05-26 19:48:09 +08:00
David Lau 48e7346d8e fix(swap): normalize wallet addresses to lowercase before API call
Ensures from_address and multi-swap accounts are lowercased at the CLI
boundary to prevent case-sensitivity issues on the API side.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 13:55:25 +08:00
deepfeature 2f76b375c5 breaking(portfolio): upgrade wallet_holdings to critical auth
Align CLI with server-side breaking change: GET /v1/user/wallet_holdings
was upgraded from authExistMW to authCriticalMW on the openapi-service.

- OpenApiClient: switch getWalletHoldings to authSignedRequest
- SKILL.md: split rate-limit table by auth level; update Notes section
- CLAUDE.md: move portfolio holdings from Normal to Critical auth row

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 11:19:30 +08:00
GMGN.AI a65d5fd1cb Merge pull request #136 from gina888666/fix/token-info-skill-doc-corrections-v2
fix(gmgn-token): correct fee_distribution usage hint and volume fields note
2026-05-25 17:34:10 +08:00
gina888666 7d16bd80e8 fix(gmgn-token): correct fee_distribution usage hint and volume fields note
- Add usage context to fee_distribution section so agents know to use
  token info when querying claim status and royalty allocation
- Fix incorrect Note that said trading volume is not in token info;
  price.volume_{window}, buys_{window}, sells_{window}, swaps_{window}
  are all available in the token info price object

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 16:02:17 +08:00
GMGN.AI 9dfccd129d 1.3.3 2026-05-19 21:03:49 +08:00
GMGN.AI ce7f762e5b Merge pull request #132 from GMGNAI/feat/gas-price-all-chains
refactor(auth): rename normalRequest/criticalRequest; align auth terminology
2026-05-19 20:35:11 +08:00
David Lau d51f1c49d3 refactor(auth): rename normalRequest/criticalRequest; align auth terminology
- Rename private methods: normalRequest → authExistRequest,
  criticalRequest → authSignedRequest in OpenApiClient.ts (both gmgn-skills
  and scripts/src)
- Replace all "normal auth" / "critical auth" labels across SKILL.md files,
  cli-usage.md, Readme.md, and CLI command descriptions with:
    exist auth  — API Key only, no private key required
    signed auth — API Key + GMGN_PRIVATE_KEY signature required
- Add explicit "requires GMGN_PRIVATE_KEY" notes to signed-auth commands
  and "API Key only" notes to exist-auth commands throughout docs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 17:45:10 +08:00
gumponchain 17b901c29f docs: add gas-price command and ETH gas control examples to README
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 16:19:22 +08:00
GMGN.AI f3738e0bd4 Merge pull request #130 from GMGNAI/feat/gas-price-all-chains
docs: remove "trading bot" references; label condition-orders-only flags
2026-05-19 15:55:37 +08:00
David Lau f05e1d5d20 docs: remove "trading bot" references; label condition-orders-only flags
- Replace "trading bot" with user-facing language throughout SKILL.md
  and cli-usage.md
- Mark --auto-fee and --sell-ratio-type as "Only with --condition-orders"
  in swap and multi-swap parameter tables
- TRADING_BOT_UNAVAILABLE error now describes the symptom, not the
  internal service name

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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 12:05:39 +08:00
GMGN.AI 674c7032a8 Merge pull request #126 from gina888666/fix/base-chain-no-anti-mev
fix(gmgn-swap): note that --anti-mev is not supported on base chain
2026-05-18 20:49:05 +08:00
gina888666 4649a7a287 fix(gmgn-swap): note that --anti-mev is not supported on base chain
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 20:41:12 +08:00
GMGN.AI 2b33ee666c Merge pull request #125 from GMGNAI/feat/gas-level-remove-auto-tip-fee
Feat/gas level remove auto tip fee
2026-05-18 19:13:53 +08:00
GMGN.AI 123bdba738 1.3.0 2026-05-14 20:47:03 +08:00
GMGN.AI 1d03fb1672 1.2.10 2026-05-14 20:46:10 +08:00
GMGN.AI 6f79600869 Merge pull request #122 from GumpOnchain/docs/token-native-transfer-shared-funding
docs(token): move native_transfer to Shared Funding section with updated description
2026-05-14 20:44:38 +08:00
GMGN.AI 12ab55bb63 docs(token): move native_transfer to Shared Funding section with updated description
native_transfer records the first native token (SOL/BNB/ETH) transfer into a
wallet, not the most recent — it indicates the original funding source. Wallets
sharing the same native_transfer.address are likely funded from a common origin
(coordinated wallets / same operator).

Move it out of Last Transaction Records into its own Shared Funding section to
reflect its distinct purpose.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 20:43:36 +08:00
GMGN.AI aa09490a9b Merge pull request #121 from GumpOnchain/fix/trenches-volume-filter
fix(trenches): fix apiFieldToCliKey for numeric suffix flags (--min/max-volume-24h etc.)
2026-05-14 20:08:22 +08:00
David Lau b3e99dde94 docs(swap): add Chain column to fee params; reorder SKILL.md by sub-command
- Add Chain column to swap, multi-swap, and strategy-create parameter
  tables in SKILL.md and cli-usage.md, explicitly scoping each fee flag
  to its supported chain(s)
- Reorder SKILL.md sections to follow Sub-commands table order: swap →
  multi-swap → order quote → order get → order gas-price →
  order strategy create/list/cancel
- Group each command's Usage + Parameters + Response Fields together
- Add horizontal dividers between command groups for readability
- Add order get cross-reference to shared swap response fields
- Collapse separate strategy usage examples into their respective command sections

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 19:59:24 +08:00
GMGN.AI 2b6c220581 fix(trenches): fix apiFieldToCliKey to match Commander.js camelCase for numeric suffixes
Commander.js removes hyphens before digits (e.g. -24h → 24h) but does not
uppercase them. The previous regex only handled -[a-z] patterns, leaving
a residual hyphen: minVolume-24h instead of minVolume24h.

This caused all 24h-suffixed filter flags to be silently ignored:
--min-volume-24h, --max-volume-24h, --min-net-buy-24h, --min-swaps-24h,
--min-buys-24h, --min-sells-24h.

Fix: add .replace(/-(\d)/g, '$1') to strip hyphens before digit sequences.

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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 18:55:49 +08:00
deepfeature e181cba142 fix(skills): update rate limit settings for cooking, market, portfolio, swap, token, and track routes 2026-05-13 17:13:26 +08:00
deepfeature ee04212098 1.2.9 2026-05-04 09:41:21 +08:00
deepfeature e4496eafeb fix(config): update dotenv loading order and simplify host assignment 2026-05-04 09:35:54 +08:00
GMGN.AI f56cf1f966 Merge pull request #117 from GMGNAI/fix/remove-bluechip-owner-stat-fields
fix(token): remove bluechip_owner_count and bluechip_owner_percentage from stat fields
2026-04-24 15:23:21 +08:00
David Lau 698ae707e8 fix(token): remove bluechip_owner_count and bluechip_owner_percentage from stat fields
These fields were removed from the TokenStatData struct in the openapi-service
and are no longer returned in the token info response.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 15:01:47 +08:00
GMGN.AI 34fc2f9e2a 1.2.8 2026-04-23 19:37:48 +08:00
GMGN.AI 5ef03579cf Merge pull request #114 from gina888666/fix/swap-currency-address-warning
fix(swap): add critical warning to Chain Currencies table to prevent address guessing
2026-04-23 19:30:20 +08:00
wuyanling 1d433724d3 fix(swap): add critical warning to Chain Currencies table to prevent address guessing
AI models may use incorrect currency addresses from training data (e.g.
So11111111111111111111111111111111111111111 vs the correct ...112), causing
silent failures or misleading "jupiter has no route" errors. Added a warning
above the table and wrapped all addresses in backticks for clarity.

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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 18:16:58 +08:00
GMGN.AI 211f7d6fd0 docs(swap): remove USDC from ETH chain currencies (ETH-only for now)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 20:41:35 +08:00
GMGN.AI 5e1560188e docs: remove USDC from ETH chain currencies (ETH-only for now)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 20:39:31 +08:00
GMGN.AI 08f7b66251 docs: add ETH chain to multi-chain descriptions in README
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 20:31:56 +08:00
GMGN.AI 48c596ab10 1.2.7 2026-04-22 19:31:47 +08:00
GMGN.AI ec099ea399 Merge pull request #112 from GMGNAI/feat-add-eth-chain-support
feat(eth): add Ethereum mainnet chain support (P0 commands)
2026-04-22 17:40:24 +08:00
David Lau 1012cfffb8 feat(eth): add Ethereum mainnet chain support (P0 commands)
Add ETH chain support to all P0 commands across CLI and SKILL.md docs:

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

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

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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 16:08:36 +08:00
GMGN.AI f6f1d56b82 Merge pull request #111 from gina888666/fix/trenches-created-duration-unit
fix(trenches): require unit suffix for --min-created / --max-created
2026-04-22 15:26:48 +08:00
wuyanling b83422769f fix(trenches): remove 1h example from min/max-created desc, align with s/m only
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 15:22:44 +08:00
GMGN.AI 8922811e04 Merge pull request #110 from GMGNAI/expand-trader-holder-tag-filter
feat(token): expand --tag filter for holders and traders to all 10 values
2026-04-22 15:14:20 +08:00
wuyanling cc1cb48db9 fix(trenches): treat bare duration numbers as minutes with warning, update skill docs
- parseDuration: bare numbers now default to minutes (e.g. "5" → "5m") instead of hard error
- Print a warning to stderr so users know the implicit conversion is happening
- Update SKILL.md: document unit suffix recommendation and bare-number fallback behavior

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 11:52:01 +08:00
wuyanling 981600f170 fix(trenches): require unit suffix for --min-created / --max-created
Bare numbers like 0.5 were silently accepted but caused inconsistent
server-side filtering. This change:

- Adds a parseDuration() validator that rejects values without a unit
- Accepts seconds (e.g. 30s) and minutes (e.g. 0.5m / 1m / 5m)
- Prints a clear error message when a bare number is passed
- Updates desc strings to document the required unit format
- Adds a new TrenchesFieldType 'duration' to distinguish these fields
2026-04-22 11:37:44 +08:00
David Lau 1f49d61363 feat(token): expand --tag filter for holders and traders to all 10 values
Update --tag option description and SKILL.md docs to reflect the full
backend allowlist: smart_degen, renowned, fresh_wallet, dev, sniper,
rat_trader, bundler, transfer_in, dex_bot, bluechip_owner.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 16:42:06 +08:00
GMGN.AI 3046c6d6cd 1.2.6 2026-04-20 11:46:18 +08:00
GMGN.AI ee4838d565 Merge pull request #108 from GumpOnchain/fix/follow-wallet-critical-auth
fix(track): switch follow-wallet to critical auth (fix HTTP 401 AUTH_INVALID)
2026-04-20 11:44:20 +08:00
GMGN.AI f19a1919da fix(track): switch follow-wallet to critical auth and fix signer array support
GET /v1/trade/follow_wallet requires X-Signature (critical auth) but was
called via normalRequest (API Key only), causing HTTP 401 AUTH_INVALID
with "missing signature".

- OpenApiClient: getFollowWallet now calls criticalRequest; criticalRequest
  queryExtra type widened to accept string[] to support the --filter option
- signer: buildMessage handles string[] values as sorted repeated k=v pairs,
  consistent with buildUrl / URLSearchParams serialization
- config: update PRIVATE_KEY_REQUIRED_MSG to include follow-wallet
- SKILL.md: prerequisites note GMGN_PRIVATE_KEY for follow-wallet; first-time
  setup now saves private key to ~/.config/gmgn/.env and removes /tmp copy;
  Notes section corrected to reflect split auth modes
- CLAUDE.md: Auth Modes table updated — follow-wallet moved to Critical row

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-20 11:42:56 +08:00
davidsx 4cfe0e0fb5 Merge pull request #107 from GMGNAI/docs/market-signal-disallow-types-14-16
docs(gmgn-market): document token_signal types 14–16 rejected by API
2026-04-20 11:42:04 +08:00
David Lau 5755206b58 docs(gmgn-market): document token_signal types 14–16 rejected by API
Align SKILL with OpenAPI validation: signal_type must not include 14, 15,
or 16 (400 BAD_REQUEST). Update examples and clarify behavior when
--signal-type is omitted.

Made-with: Cursor
2026-04-20 11:41:40 +08:00
davidsx 6ab9cb108b Update SKILL.md 2026-04-17 14:37:42 +08:00
GMGN.AI 51d2214253 1.2.5 2026-04-17 14:34:03 +08:00
GMGN.AI 8d3541c2a3 Merge pull request #104 from GMGNAI/feat-market-signal
feat(market): add market signal command for token signal feed
2026-04-17 14:29:25 +08:00
David Lau 39d80429f6 feat(market): add market signal command for token signal feed
- Add POST /v1/market/token_signal client method and TokenSignalGroup interface
- Add market signal sub-command with individual flags for single-group queries
- Support --groups <json> override for multi-group parallel queries
- Document max 50 results per group limit
- Update SKILL.md, cli-usage.md, and README with signal types, response fields, and examples

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 14:00:52 +08:00
GMGN.AI fd226c654b Merge pull request #103 from GumpOnchain/feat/description-frontload
docs(portfolio): add created-tokens and dev wallet capabilities to description
2026-04-15 21:05:41 +08:00
GMGN.AI a08fc7b580 docs(portfolio): add created-tokens and dev wallet capabilities to description
Previous description omitted portfolio created-tokens (dev wallet token
history, ATH market cap, graduation status) and token-balance sub-commands.
Added "tokens created by a developer wallet (with ATH market cap and DEX
graduation status)" and corresponding trigger phrases so agents match
queries like "what tokens has this dev launched" or "highest ATH token
this dev ever created".

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

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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 20:43:44 +08:00
GMGN.AI 319c4bbf33 Merge pull request #100 from GumpOnchain/feat/track-description-refine
docs(track): clarify description with "crypto token trading activity"
2026-04-15 19:54:27 +08:00
GMGN.AI 2b61eb807a docs(track): clarify description with "crypto token trading activity"
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 19:52:58 +08:00
GMGN.AI 46c56b7e5d Merge pull request #99 from GumpOnchain/feat/market-description-fourmeme
docs(market): add fourmeme to launchpad list in description
2026-04-15 19:46:55 +08:00
GMGN.AI b18738177c docs(market): add fourmeme to launchpad list in description
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 19:45:53 +08:00
GMGN.AI cfb4270816 Merge pull request #98 from GumpOnchain/feat/swap-description-refine
docs(swap): refine description to highlight meme coin trading, multi-wallet, and trailing orders
2026-04-15 19:40:01 +08:00
GMGN.AI 932bf8c82c docs(swap): refine description to highlight meme coin trading, multi-wallet, and trailing orders
Surface key features upfront: buying/selling meme coins, multi-wallet
trading, trailing stop loss, and trailing take profit — so clawhub.ai
skill search matches more user intents precisely.

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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 19:32:03 +08:00
GMGN.AI eeb4a77cf7 Merge pull request #96 from gina888666/fix/portfolio-created-tokens-docs
docs(portfolio): clarify created-tokens total count and add routing guidance
2026-04-15 17:47:19 +08:00
gina888666 f7c051e2d1 docs(portfolio): clarify created-tokens total count and add routing guidance
- Clarify `inner_count` description: add "(NOT graduated)" to distinguish from `open_count`
- Add explicit note that total created = `inner_count + open_count` (tokens array is capped at 100 and may be truncated)
- Add routing guidance for dev token queries: direct AI to use `portfolio created-tokens` when user asks about tokens a dev created

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 17:35:28 +08:00
GMGN.AI 8bc1b2be6b 1.2.4 2026-04-14 16:48:22 +08:00
GMGN.AI 990601d031 Merge pull request #94 from GMGNAI/feat/portfolio-created-tokens
feat(portfolio): add created-tokens command for developer wallet token history
2026-04-14 16:46:09 +08:00
David Lau db55c77a26 feat(portfolio): add created-tokens command for developer wallet token history
Add GET /v1/user/created_tokens support: portfolio created-tokens CLI command,
OpenApiClient method, SKILL.md docs, cli-usage.md, and Readme examples.

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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 20:43:32 +08:00
GMGN.AI 6d09536349 Merge pull request #92 from GumpOnchain/docs/swap-skill-argument-hint
docs(gmgn-swap): add order strategy commands to argument-hint
2026-04-10 20:26:17 +08:00
gumponchain cd9b285b3f docs(gmgn-swap): add order strategy commands to argument-hint
Add order strategy list (with required --group-tag) and order strategy
create (with required --order-type) to the frontmatter argument-hint,
reflecting newly required parameters added after 2026-04-07.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 20:24:31 +08:00
GMGN.AI c6141c880f Merge pull request #91 from GMGNAI/feat/token-info-extra-fields
docs(gmgn-token): add launchpad, migration, ath_price, locked_ratio a…
2026-04-10 16:04:47 +08:00
David Lau 3551bc3a25 docs(gmgn-token): add launchpad, migration, ath_price, locked_ratio and dev.ath_token_info fields
- Document 9 new top-level fields in token info response:
  launchpad, launchpad_status, launchpad_progress, launchpad_platform,
  migrated_pool, migration_market_cap, migration_market_cap_quote,
  ath_price, locked_ratio
- Document dev.ath_token_info sub-fields (creator all-time-high token)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 17:47:20 +08:00
GMGN.AI 8448787176 Merge pull request #90 from gina888666/fix/portfolio-stats-created-at-doc
docs(gmgn-portfolio): add created_at field to portfolio stats common object
2026-04-09 15:35:18 +08:00
gina888666 04389b98f0 docs(gmgn-portfolio): add created_at field to portfolio stats common object 2026-04-09 14:50:29 +08:00
22 changed files with 1402 additions and 336 deletions
+1
View File
@@ -4,6 +4,7 @@ on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: read
+3 -3
View File
@@ -20,7 +20,7 @@ This includes: trending tokens, token info, security checks, K-line / price hist
## Project Overview
This is a **Claude Code plugin** — a collection of GMGN OpenAPI skills for on-chain operations. It provides CLI tools and skills for token queries, market data, wallet portfolio analysis, and swap execution across sol / bsc / base.
This is a **Claude Code plugin** — a collection of GMGN OpenAPI skills for on-chain operations. It provides CLI tools and skills for token queries, market data, wallet portfolio analysis, and swap execution across sol / bsc / base / eth.
## Available Skills
@@ -93,8 +93,8 @@ EOF
| Mode | Commands | Requirements |
|------|----------|--------------|
| Normal | token / market / portfolio | `GMGN_API_KEY` only, no signature |
| Critical | swap / order | `GMGN_API_KEY` + `GMGN_PRIVATE_KEY` — CLI handles signing automatically |
| 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 |
## SKILL.md Authoring Rules
+61 -7
View File
@@ -22,7 +22,7 @@ With GMGN Agent Skills, you can use AI agents to query real-time trending token
### 1. Real-time on-chain data — faster
Data across SOL / BSC / Base is live on every query. Supports multi-parameter customization, no snapshot cache — built for AI agent real-time decision-making (including but not limited to):
Data across SOL / BSC / Base / ETH is live on every query. Supports multi-parameter customization, no snapshot cache — built for AI agent real-time decision-making (including but not limited to):
| Data | Granularity |
|------|-------------|
@@ -471,6 +471,13 @@ 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
# Token signals — smart money buys on SOL (single group)
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
```
### Portfolio
@@ -490,14 +497,17 @@ gmgn-cli portfolio info
# Single token balance
gmgn-cli portfolio token-balance --chain sol --wallet <addr> --token <token_addr>
# Tokens created by a developer wallet
gmgn-cli portfolio created-tokens --chain sol --wallet <addr>
```
### Track
```bash
# Follow-wallet trade records (requires GMGN_PRIVATE_KEY)
# Follow-wallet trade records
gmgn-cli track follow-wallet --chain sol
gmgn-cli track follow-wallet --chain sol --wallet <wallet_address> --side buy
gmgn-cli track follow-wallet --chain sol --limit 20 --min-amount-usd 1000
# KOL trade records
gmgn-cli track kol --limit 100 --raw
@@ -547,7 +557,7 @@ gmgn-cli order quote \
--amount 1000000 \
--slippage 0.01
# Quotes use critical auth and require GMGN_PRIVATE_KEY on every chain
# Quotes use signed auth and require GMGN_PRIVATE_KEY on every chain
gmgn-cli order quote \
--chain bsc \
--from <wallet-address> \
@@ -558,9 +568,52 @@ gmgn-cli order quote \
# Query order
gmgn-cli order get --chain sol --order-id <order-id>
# Query real-time gas price (all chains)
gmgn-cli gas-price --chain sol
gmgn-cli gas-price --chain eth
gmgn-cli gas-price --chain bsc
gmgn-cli gas-price --chain base
# Multi-wallet concurrent swap
gmgn-cli multi-swap \
--chain sol \
--accounts <addr1>,<addr2> \
--input-token <input-token-addr> \
--output-token <output-token-addr> \
--input-amount '{"<addr1>":"1000000","<addr2>":"2000000"}' \
--slippage 0.01
```
> `order quote` uses critical auth on `sol` / `bsc` / `base` and requires `GMGN_PRIVATE_KEY`.
> `order quote` uses signed auth on `sol` / `bsc` / `base` / `eth` and requires `GMGN_PRIVATE_KEY`.
### ETH Gas Control (ETH only)
```bash
# Pick a gas tier instead of entering gwei manually (low / average / high)
gmgn-cli swap \
--chain eth \
--from <wallet-address> \
--input-token <input-token-addr> \
--output-token <output-token-addr> \
--amount <amount> \
--slippage 0.01 \
--gas-level high
# Let GMGN auto-select the optimal gas fee for condition orders
gmgn-cli swap \
--chain eth \
--from <wallet-address> \
--input-token <input-token-addr> \
--output-token <output-token-addr> \
--amount <amount> \
--slippage 0.01 \
--condition-orders '[...]' \
--auto-fee
```
> `--gas-level` and `--auto-fee` are ETH only. `--auto-fee` only takes effect when used with `--condition-orders`.
> For other chains (SOL / BSC / BASE), use `gas-price` to query the current gas, then pass the result via `--gas-price`.
### Swap with Take-Profit / Stop-Loss Orders (requires private key)
@@ -653,8 +706,9 @@ gmgn-cli cooking \
| Commands | Chains | Chain Currencies |
|----------|--------|-----------------|
| token / market / portfolio / track | `sol` / `bsc` / `base` | — |
| swap / order | `sol` / `bsc` / `base` | sol: SOL, USDC · bsc: BNB, USDC · base: ETH, USDC |
| 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` | — |
---
+53 -6
View File
@@ -22,7 +22,7 @@
### 1. 链上实时数据查询快
SOL / BSC / Base 多链数据每次查询均为实时,支持多参数个性化调用,无快照缓存,方便AI Agent实时决策(包括不限于下表)。
SOL / BSC / Base / ETH 多链数据每次查询均为实时,支持多参数个性化调用,无快照缓存,方便AI Agent实时决策(包括不限于下表)。
| 数据类型 | 粒度 |
|---------|------|
@@ -521,14 +521,17 @@ gmgn-cli portfolio info
# 单个 token 余额
gmgn-cli portfolio token-balance --chain sol --wallet <addr> --token <token_addr>
# 查询开发者钱包创建的代币列表
gmgn-cli portfolio created-tokens --chain sol --wallet <addr>
```
### Track
```bash
# 追踪关注钱包的交易动态(需要 GMGN_PRIVATE_KEY
# 追踪关注钱包的交易动态
gmgn-cli track follow-wallet --chain sol
gmgn-cli track follow-wallet --chain sol --wallet <wallet_address> --side buy
gmgn-cli track follow-wallet --chain sol --limit 20 --min-amount-usd 1000
# KOL 交易动态
gmgn-cli track kol --limit 100 --raw
@@ -589,9 +592,52 @@ gmgn-cli order quote \
# 查询订单状态
gmgn-cli order get --chain sol --order-id <order-id>
# 查询实时 Gas 价格(支持全链)
gmgn-cli gas-price --chain sol
gmgn-cli gas-price --chain eth
gmgn-cli gas-price --chain bsc
gmgn-cli gas-price --chain base
# 多钱包并发 Swap
gmgn-cli multi-swap \
--chain sol \
--accounts <addr1>,<addr2> \
--input-token <input-token-addr> \
--output-token <output-token-addr> \
--input-amount '{"<addr1>":"1000000","<addr2>":"2000000"}' \
--slippage 0.01
```
> `order quote` 在 `sol` / `bsc` / `base` 上都走关键鉴权,必须配置 `GMGN_PRIVATE_KEY`。
> `order quote` 在 `sol` / `bsc` / `base` / `eth` 上都走关键鉴权,必须配置 `GMGN_PRIVATE_KEY`。
### ETH Gas 档位控制(仅限 ETH
```bash
# 按档位设置 Gaslow / average / high),替代手动填写 gwei
gmgn-cli swap \
--chain eth \
--from <wallet-address> \
--input-token <input-token-addr> \
--output-token <output-token-addr> \
--amount <amount> \
--slippage 0.01 \
--gas-level high
# 策略单(condition-orders)由 GMGN 自动选择最优 Gas Fee
gmgn-cli swap \
--chain eth \
--from <wallet-address> \
--input-token <input-token-addr> \
--output-token <output-token-addr> \
--amount <amount> \
--slippage 0.01 \
--condition-orders '[...]' \
--auto-fee
```
> `--gas-level` 和 `--auto-fee` 仅支持 ETH 链。`--auto-fee` 仅在携带 `--condition-orders` 时生效。
> 其他链(SOL / BSC / BASE)请先用 `gas-price` 查询当前 Gas,再通过 `--gas-price` 手动传入。
### 带止盈止损的 Swap(需要私钥)
@@ -684,8 +730,9 @@ gmgn-cli cooking \
| 接口类型 | 支持的链 | 链原生货币 |
|----------|----------|-----------|
| token / market / portfolio / track | `sol` / `bsc` / `base` | — |
| swap / order | `sol` / `bsc` / `base` | sol: SOL、USDC · bsc: BNB、USDC · base: ETH、USDC |
| 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` | — |
---
+175 -47
View File
@@ -255,6 +255,30 @@ npx gmgn-cli portfolio token-balance \
---
## portfolio created-tokens
Query tokens created by a developer wallet.
```bash
npx gmgn-cli portfolio created-tokens \
--chain <chain> \
--wallet <wallet_address> \
[--order-by <field>] \
[--direction asc|desc] \
[--migrate-state <state>] \
[--raw]
```
| Option | Required | Description |
|--------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` |
| `--wallet` | Yes | Developer wallet address |
| `--order-by` | No | Sort field: `market_cap` / `token_ath_mc` |
| `--direction` | No | Sort direction: `asc` / `desc` |
| `--migrate-state` | No | Filter: `migrated` / `non_migrated` |
---
## market trenches
Query Trenches token lists (new creation, near completion, completed).
@@ -274,77 +298,120 @@ npx gmgn-cli market trenches --chain <chain> [--type <type...>] [--launchpad-pla
---
## portfolio follow-wallet
## market signal
Query follow-wallet trade records.
Query token signals — price spikes, smart money buys, large buys, Dex ads, CTO events, and more. Returns a list of `TokenSignalItem` sorted by `trigger_at` descending (most recent first). **Maximum 50 results per group.**
```bash
npx gmgn-cli portfolio follow-wallet \
# Single group (individual flags):
gmgn-cli market signal --chain sol [--signal-type <n>...] [--mc-min <usd>] [--mc-max <usd>] [--raw]
# Multi-group override (JSON array):
gmgn-cli market signal --chain sol --groups '<json_array>' [--raw]
```
| Option | Required | Description |
|--------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` |
| `--signal-type` | No | Signal type(s), repeatable (118, default: all). See Signal Types below. |
| `--mc-min` | No | Min market cap at trigger time (USD) |
| `--mc-max` | No | Max market cap at trigger time (USD) |
| `--trigger-mc-min` | No | Min market cap at signal trigger moment (USD) |
| `--trigger-mc-max` | No | Max market cap at signal trigger moment (USD) |
| `--total-fee-min` | No | Min total fees paid (USD) |
| `--total-fee-max` | No | Max total fees paid (USD) |
| `--min-create-or-open-ts` | No | Min token creation or open timestamp (Unix seconds string) |
| `--max-create-or-open-ts` | No | Max token creation or open timestamp (Unix seconds string) |
| `--groups` | No | Multi-group JSON array — overrides all individual flags when provided |
**Signal Types:**
| Value | Name | Description |
|-------|------|-------------|
| 1 | SignalType1 | General signal (K-line price spike) |
| 2 | SignalTypeDexAd | Dex ad placement |
| 3 | SignalTypeDexUpdateLink | Dex social link updated |
| 4 | SignalTypeDexTrendingBar | Dex trending bar |
| 5 | SignalTypeDexBoost | Dex Boost |
| 6 | SignalTypePriceUp | Price spike |
| 7 | SignalTypePriceATH | All-time high price |
| 8 | SignalTypeMcpKeyLevel | Market cap key level |
| 9 | SignalTypeLive | Live stream |
| 10 | SignalTypeBundlerSell | Bundler sell |
| 11 | SignalTypeCto | Community takeover (CTO) |
| 12 | SignalTypeSmartDegenBuy | Smart money buy |
| 13 | SignalTypePlatformCall | Platform call |
| 14 | SignalTypeLargeAmountBuy | Large amount buy |
| 15 | SignalTypeMultiBuy | Multiple buys |
| 16 | SignalTypeMultiLargeBuy | Multiple large buys |
| 17 | SignalTypeBagsClaims | Bags Claim |
| 18 | SignalTypePumpClaims | Pump Claim |
---
## 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).
```bash
gmgn-cli track follow-wallet \
--chain <chain> \
[--wallet <wallet_address>] \
[--base-token <token_address>] \
[--page-token <cursor>] \
[--limit <n>] \
[--side <side>] \
[--cost <cost>] \
[--filter <tag>] \
[--with-balance] \
[--with-security] \
[--min-amount-usd <n>] \
[--max-amount-usd <n>] \
[--is-gray] \
[--raw]
```
| Option | Required | Description |
|--------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
| `--wallet` | No | Filter by wallet address |
| `--base-token` | No | Filter by base token address |
| `--page-token` | No | Pagination cursor |
| `--limit` | No | Page size (1200, default 100) |
| `--side` | No | Trade direction filter |
| `--cost` | No | Cost filter |
| `--chain` | Yes | `sol` / `bsc` / `base` |
| `--wallet` | No | Wallet address (optional; follow list resolved from API Key's bound user account) |
| `--limit` | No | Page size (1100, default 10) |
| `--side` | No | Trade direction: `buy` / `sell` |
| `--filter` | No | Filter conditions (repeatable) |
| `--with-balance` | No | Include balance in response |
| `--with-security` | No | Include security info in response |
| `--min-amount-usd` | No | Minimum trade amount (USD) |
| `--max-amount-usd` | No | Maximum trade amount (USD) |
| `--is-gray` | No | Gray mode filter |
---
## portfolio kol
Query KOL trade records (SOL chain).
Query KOL trade records.
```bash
npx gmgn-cli portfolio kol [--limit <n>] [--raw]
gmgn-cli track kol [--chain <chain>] [--limit <n>] [--side <side>] [--raw]
```
| Option | Required | Description |
|--------|----------|-------------|
| `--chain` | No | `sol` / `bsc` / `base` (default `sol`) |
| `--limit` | No | Page size (1200, default 100) |
| `--side` | No | Filter by trade direction: `buy` / `sell` (client-side filter) |
---
## portfolio smartmoney
Query Smart Money trade records (SOL chain).
Query Smart Money trade records.
```bash
npx gmgn-cli portfolio smartmoney [--limit <n>] [--raw]
gmgn-cli track smartmoney [--chain <chain>] [--limit <n>] [--side <side>] [--raw]
```
| Option | Required | Description |
|--------|----------|-------------|
| `--chain` | No | `sol` / `bsc` / `base` (default `sol`) |
| `--limit` | No | Page size (1200, default 100) |
| `--side` | No | Filter by trade direction: `buy` / `sell` (client-side filter) |
---
## order quote
Get a swap quote without submitting a transaction. All supported quote chains use critical auth and require `GMGN_PRIVATE_KEY`.
Get a swap quote without submitting a transaction. All supported quote chains use signed auth and require `GMGN_PRIVATE_KEY`.
```bash
npx gmgn-cli order quote \
@@ -396,7 +463,6 @@ npx gmgn-cli swap \
[--anti-mev] \
[--priority-fee <sol>] \
[--tip-fee <amount>] \
[--max-auto-fee <amount>] \
[--gas-price <gwei>] \
[--max-fee-per-gas <amount>] \
[--max-priority-fee-per-gas <amount>] \
@@ -405,26 +471,27 @@ npx gmgn-cli swap \
[--raw]
```
| Option | Required | Description |
|--------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
| `--from` | Yes | Wallet address (must match the wallet bound to the API Key) |
| `--input-token` | Yes | Input token contract address |
| `--output-token` | Yes | Output token contract address |
| `--amount` | No* | Input raw amount in minimal unit (e.g., lamports for SOL); required unless `--percent` is used |
| `--percent` | No* | Input amount as a percentage, e.g. `50` = 50%; required unless `--amount` is used; only valid when input token is not a currency (not SOL/BNB/ETH/USDC) |
| `--slippage` | No | Slippage tolerance, e.g. `0.01` = 1% |
| `--auto-slippage` | No | Enable automatic slippage |
| `--min-output` | No | Minimum output amount (raw amount) |
| `--anti-mev` | No | Enable anti-MEV protection (default true) |
| `--priority-fee` | No | Priority fee in SOL (≥ 0.00001 SOL, SOL only) |
| `--tip-fee` | No | Tip fee (SOL ≥ 0.00001 SOL / BSC ≥ 0.000001 BNB) |
| `--max-auto-fee` | No | Max automatic fee cap |
| `--gas-price` | No | Gas price in gwei (BSC ≥ 0.05 gwei / BASE/ETH ≥ 0.01 gwei) |
| `--max-fee-per-gas` | No | EIP-1559 max fee per gas (Base/ETH only) |
| `--max-priority-fee-per-gas` | No | EIP-1559 max priority fee per gas (Base/ETH only) |
| `--condition-orders` | No | JSON array of take-profit/stop-loss conditions attached after a successful swap (see example below); only `profit_stop` and `loss_stop` are supported |
| `--sell-ratio-type` | No | Sell ratio base for `--condition-orders`: `buy_amount` (default) / `hold_amount` |
| Option | Required | Chain | Description |
|--------|----------|-------|-------------|
| `--chain` | Yes | all | `sol` / `bsc` / `base` / `eth` |
| `--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 |
| `--amount` | No* | all | Input raw amount in minimal unit (e.g., lamports for SOL); required unless `--percent` is used |
| `--percent` | No* | all | Input amount as a percentage, e.g. `50` = 50%; required unless `--amount` is used; only valid when input token is not a currency (not SOL/BNB/ETH/USDC) |
| `--slippage` | No | all | Slippage tolerance, e.g. `0.01` = 1% |
| `--auto-slippage` | No | all | Enable automatic slippage |
| `--min-output` | No | all | Minimum output amount (raw amount) |
| `--anti-mev` | No | all | Enable anti-MEV protection (default true) |
| `--priority-fee` | No | `sol` | Priority fee in SOL (≥ 0.00001) |
| `--tip-fee` | No | `sol` / `bsc` | Tip fee (SOL ≥ 0.00001 / BSC ≥ 0.000001 BNB) |
| `--gas-price` | No | `bsc` / `base` / `eth` | Gas price in gwei (BSC ≥ 0.05 / BASE/ETH ≥ 0.01) |
| `--gas-level` | No | `eth` | Gas price tier: `low` / `average` / `high`. Mutually exclusive with `--gas-price`. |
| `--auto-fee` | No | `eth` | **Only with `--condition-orders`.** GMGN automatically selects the optimal fee. |
| `--max-fee-per-gas` | No | `bsc` / `base` / `eth` | EIP-1559 max fee per gas |
| `--max-priority-fee-per-gas` | No | `bsc` / `base` / `eth` | EIP-1559 max priority fee per gas |
| `--condition-orders` | No | all | JSON array of take-profit/stop-loss conditions attached after a successful swap (see example below) |
| `--sell-ratio-type` | No | all | **Only with `--condition-orders`.** Sell ratio base: `buy_amount` (default) / `hold_amount` |
**`--condition-orders` example** (100% sell at 2× price, 100% sell at 50% price):
@@ -455,6 +522,67 @@ npx gmgn-cli swap \
---
## multi-swap
Submit token swaps across multiple wallets concurrently. Each wallet executes independently. Up to 100 wallets per request, all must be bound to the API Key. **Requires `GMGN_PRIVATE_KEY` configured in `.env`.**
```bash
gmgn-cli multi-swap \
--chain <chain> \
--accounts <addr1>,<addr2> \
--input-token <input_token_address> \
--output-token <output_token_address> \
[--input-amount <json>] \
[--input-amount-bps <json>] \
[--output-amount <json>] \
[--slippage <n>] \
[--auto-slippage] \
[--anti-mev] \
[--priority-fee <sol>] \
[--tip-fee <amount>] \
[--gas-price <gwei>] \
[--max-fee-per-gas <amount>] \
[--max-priority-fee-per-gas <amount>] \
[--condition-orders <json>] \
[--sell-ratio-type <buy_amount|hold_amount>] \
[--raw]
```
| Option | Required | Chain | Description |
|--------|----------|-------|-------------|
| `--chain` | Yes | all | `sol` / `bsc` / `base` / `eth` |
| `--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 |
| `--input-amount` | No* | all | JSON map `{"addr":"amount"}` in smallest unit; one of the three amount fields is required |
| `--input-amount-bps` | No* | all | JSON map `{"addr":"bps"}` where 5000 = 50%; only valid when input token is not a currency |
| `--output-amount` | No* | all | JSON map `{"addr":"amount"}` target output in smallest unit |
| `--slippage` | No | all | Slippage tolerance, e.g. `0.01` = 1% |
| `--auto-slippage` | No | all | Enable automatic slippage |
| `--anti-mev` | No | all | Enable anti-MEV protection |
| `--priority-fee` | No | `sol` | Priority fee in SOL (≥ 0.00001) |
| `--tip-fee` | No | `sol` / `bsc` | Tip fee (SOL ≥ 0.00001 / BSC ≥ 0.000001 BNB) |
| `--gas-price` | No | `bsc` / `base` / `eth` | Gas price in gwei (BSC ≥ 0.05 / BASE/ETH ≥ 0.01) |
| `--gas-level` | No | `eth` | Gas price tier: `low` / `average` / `high`. Mutually exclusive with `--gas-price`. |
| `--auto-fee` | No | `eth` | **Only with `--condition-orders`.** GMGN automatically selects the optimal fee. |
| `--max-fee-per-gas` | No | `bsc` / `base` / `eth` | EIP-1559 max fee per gas |
| `--max-priority-fee-per-gas` | No | `bsc` / `base` / `eth` | EIP-1559 max priority fee per gas |
| `--condition-orders` | No | all | JSON array of take-profit/stop-loss conditions, attached to each successful wallet's swap (best-effort) |
| `--sell-ratio-type` | No | all | **Only with `--condition-orders`.** Sell ratio base: `buy_amount` (default) / `hold_amount` |
**Response fields (data):** Array of per-wallet results:
| Field | Type | Description |
|-------|------|-------------|
| `account` | string | Wallet address |
| `success` | bool | Whether this wallet's swap succeeded |
| `error` | string | Error message on failure |
| `error_code` | string | Error code on failure |
| `result` | object | OrderResponse on success (same fields as `swap` response) |
| `result.strategy_order_id` | string | Strategy order ID; only present when `--condition-orders` passed and strategy creation succeeded |
---
## order get
Query order status. **Requires `GMGN_PRIVATE_KEY` configured in `.env`.**
@@ -673,7 +801,7 @@ Important notes:
| `AUTH_SIGNATURE_INVALID` | 401 | Signature verification failed |
| `AUTH_TIMESTAMP_EXPIRED` | 401 | Timestamp is outside the valid window (±5s) |
| `AUTH_CLIENT_ID_REPLAYED` | 401 | client_id replayed within 7s |
| `AUTH_REPLAY_CHECK_UNAVAILABLE` | 503 | Anti-replay Redis unavailable (critical auth only) |
| `AUTH_REPLAY_CHECK_UNAVAILABLE` | 503 | Anti-replay Redis unavailable (signed auth only) |
| `RATE_LIMIT_EXCEEDED` | 429 | Rate limit exceeded |
| `RATE_LIMIT_BANNED` | 429 | Temporarily banned due to repeated rate limit violations |
| `ERROR_RATE_LIMIT_BLOCKED` | 429 | Temporarily blocked after repeated business errors on `swap` |
@@ -682,5 +810,5 @@ Important notes:
| `BAD_REQUEST` | 400 | Missing or invalid request parameters |
| `INTERNAL_API_UNAVAILABLE` | 502 | Downstream market API unavailable |
| `BROKER_UNAVAILABLE` | 502 | Downstream trade broker unavailable |
| `TRADING_BOT_UNAVAILABLE` | 502 | Trading bot service unreachable (strategy endpoints) |
| `TRADING_BOT_UNAVAILABLE` | 502 | Strategy order service temporarily unreachable |
| `INTERNAL_ERROR` | 500 | Internal server error |
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "gmgn-cli",
"version": "1.2.3",
"version": "1.3.7",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "gmgn-cli",
"version": "1.2.3",
"version": "1.3.7",
"license": "MIT",
"dependencies": {
"commander": "^12.1.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "gmgn-cli",
"version": "1.2.3",
"version": "1.3.7",
"description": "GMGN OpenAPI CLI — call GMGN market, token, portfolio and swap APIs from the command line",
"type": "module",
"bin": {
+7 -7
View File
@@ -1,6 +1,6 @@
---
name: gmgn-cooking
description: "[FINANCIAL EXECUTION] Create tokens on launchpad platforms (Pump.fun, Raydium, PancakeSwap, Flap, FourMeme, Bonk, BAGS, etc.) or query token creation statistics by launchpad. Token creation executes irreversible on-chain transactions. Requires explicit user confirmation before every create. Supports sol / bsc / base / eth / ton."
description: "[FINANCIAL EXECUTION] Create and launch meme coins and crypto tokens on launchpads (Pump.fun, PancakeSwap, FourMeme, Bonk, BAGS, Flap, Raydium, etc.) via bonding curve fair launch, or query token creation stats by launchpad via GMGN API. Requires explicit user confirmation. Use when user asks to create a token, launch a meme coin, cook a coin, deploy on a launchpad, or check launchpad creation stats on Solana, BSC, Base, ETH, or TON."
argument-hint: "stats | [create --chain <chain> --dex <dex> --from <addr> --name <name> --symbol <sym> --buy-amt <n> (--image <base64> | --image-url <url>)]"
metadata:
cliHelp: "gmgn-cli cooking --help"
@@ -26,7 +26,7 @@ Use the `gmgn-cli` tool to create a token on a launchpad platform or query token
- **Status polling via `order get`**`cooking create` is asynchronous. The immediate response may show `pending`. Poll with `gmgn-cli order get --chain <chain> --order-id <order_id>` until `confirmed`. The new token's contract address is in the `output_token` field of the `order get` response, not in the initial create response.
- **Critical auth**`cooking create` requires both `GMGN_API_KEY` and `GMGN_PRIVATE_KEY`. The private key never leaves the machine — the CLI uses it only for local signing. `cooking stats` uses normal auth (API Key only).
- **Signed auth**`cooking create` requires both `GMGN_API_KEY` and `GMGN_PRIVATE_KEY`. The private key never leaves the machine — the CLI uses it only for local signing. `cooking stats` uses exist auth (API Key only).
- **Slippage** — The initial buy is executed as part of the same transaction as token creation. Slippage applies to that buy. Use `--slippage` (decimal, e.g. `0.01` = 1%) or `--auto-slippage`. One of the two is required when `--buy-amt` is set.
@@ -43,8 +43,8 @@ Use the `gmgn-cli` tool to create a token on a launchpad platform or query token
| Sub-command | Description |
|-------------|-------------|
| `cooking stats` | Get token creation count statistics grouped by launchpad platform (normal auth) |
| `cooking create` | Deploy a new token on a launchpad platform (requires private key) |
| `cooking stats` | Get token creation count statistics grouped by launchpad platform (exist auth) |
| `cooking create` | Deploy a new token on a launchpad platform (signed auth) |
## Supported Chains
@@ -74,7 +74,7 @@ If a local `.env` exists but lacks `GMGN_API_KEY` / `GMGN_PRIVATE_KEY`, either a
## Rate Limit Handling
All cooking routes go through GMGN's leaky-bucket limiter with `rate=10` and `capacity=10`. Sustained throughput is roughly `10 ÷ weight` requests/second.
All cooking routes go through GMGN's leaky-bucket limiter with `rate=20` and `capacity=20`. Sustained throughput is roughly `20 ÷ weight` requests/second.
| Command | Weight |
|---------|--------|
@@ -364,8 +364,8 @@ Once all information is collected, present the pre-create confirmation summary (
## Notes
- `cooking create` uses **critical auth** (API Key + signature) — CLI handles signing automatically.
- `cooking stats` uses normal auth (API Key only — no private key needed).
- `cooking create` uses **signed auth** (API Key + signature) — CLI handles signing automatically.
- `cooking stats` uses exist auth (API Key only — no private key needed).
- The new token's mint address is in `output_token` from `gmgn-cli order get`, not in the initial `cooking create` response.
- Use `--raw` on any command to get single-line JSON for further processing.
+148 -11
View File
@@ -1,7 +1,7 @@
---
name: gmgn-market
description: Query GMGN market data — token K-line (candlestick), trending token swap data, and Trenches token lists. Supports sol / bsc / base.
argument-hint: "kline --chain <sol|bsc|base> --address <token_address> --resolution <1m|5m|15m|1h|4h|1d> [--from <unix_ts>] [--to <unix_ts>] | trending --chain <sol|bsc|base> --interval <1m|5m|1h|6h|24h> | trenches --chain <sol|bsc|base>"
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>"
metadata:
cliHelp: "gmgn-cli market --help"
---
@@ -18,7 +18,7 @@ Use the `gmgn-cli` tool to query K-line data for a token, browse trending tokens
- **`--filter` chain defaults** — SOL and EVM chains have different default safety filters that are applied automatically when `--filter` is omitted. Do not assume the same defaults apply across chains:
- **SOL**: defaults to `renounced frozen` (mint and freeze authority renounced)
- **BSC / Base (EVM)**: defaults to `not_honeypot verified renounced`
- **BSC / Base / ETH (EVM)**: defaults to `not_honeypot verified renounced`
- Omitting `--filter` is NOT the same as "no filter" — the chain defaults are always applied. To use a custom filter set, explicitly specify all desired filter tags.
- **`volume` vs `amount` (kline)** — Naming is counterintuitive. `volume` = USD dollar value of trades; `amount` = token units traded. For a token priced at $0.0002, these differ by 5,000×. Always use `volume` for "how much USD was traded" and `amount` for "how many tokens changed hands."
@@ -48,10 +48,11 @@ Use the `gmgn-cli` tool to query K-line data for a token, browse trending tokens
| `market kline` | Token candlestick / OHLCV data and trading volume over a time range |
| `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.** |
## Supported Chains
`sol` / `bsc` / `base`
`sol` / `bsc` / `base` / `eth` (kline / trending only; trenches: `sol` / `bsc` / `base`; signal: `sol` / `bsc` only)
## Prerequisites
@@ -60,13 +61,14 @@ Use the `gmgn-cli` tool to query K-line data for a token, browse trending tokens
## Rate Limit Handling
All market routes used by this skill go through GMGN's leaky-bucket limiter with `rate=10` and `capacity=10`. Sustained throughput is roughly `10 ÷ weight` requests/second, and the max burst is roughly `floor(10 ÷ weight)` when the bucket is full.
All market routes used by this skill go through GMGN's leaky-bucket limiter with `rate=20` and `capacity=20`. Sustained throughput is roughly `20 ÷ weight` requests/second, and the max burst is roughly `floor(20 ÷ weight)` when the bucket is full.
| Command | Route | Weight |
|---------|-------|--------|
| `market kline` | `GET /v1/market/token_kline` | 2 |
| `market trending` | `GET /v1/market/rank` | 1 |
| `market trenches` | `POST /v1/trenches` | 3 |
| `market signal` | `POST /v1/market/token_signal` | 3 |
When a request returns `429`:
@@ -95,7 +97,7 @@ When a request returns `429`:
| Parameter | Required | Description |
|-----------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` |
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
| `--address` | Yes | Token contract address |
| `--resolution` | Yes | Candlestick resolution: `1m` / `5m` / `15m` / `1h` / `4h` / `1d` |
| `--from` | No | Start time (Unix seconds) |
@@ -138,13 +140,13 @@ The response is an object with a `list` array. Each element in `list` is one can
| Option | Description |
|--------|-------------|
| `--chain` | Required. `sol` / `bsc` / `base` |
| `--chain` | Required. `sol` / `bsc` / `base` / `eth` |
| `--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 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` |
| `--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) |
## Usage Examples
@@ -174,6 +176,14 @@ gmgn-cli market kline \
# Raw output for further processing
gmgn-cli market kline --chain sol --address <addr> \
--resolution 5m --from <ts> --to <ts> --raw | jq '.[]'
# ETH token kline — last 24h, 1h candles (macOS)
gmgn-cli market kline \
--chain eth \
--address 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 \
--resolution 1h \
--from $(date -v-24H +%s) \
--to $(date +%s)
```
### Trending — General
@@ -246,6 +256,25 @@ gmgn-cli market trending \
--order-by volume --limit 20 --raw
```
### Trending — ETH (No Platform Filter)
```bash
# ETH 1h trending — all tokens, sorted by volume
gmgn-cli market trending --chain eth --interval 1h --order-by volume --limit 20
# ETH 1h trending — with safety filters
gmgn-cli market trending \
--chain eth --interval 1h \
--filter not_honeypot --filter verified \
--order-by volume --limit 20 --raw
# ETH 24h trending — sorted by smart money count
gmgn-cli market trending \
--chain eth --interval 24h \
--filter not_honeypot --filter verified \
--order-by smart_degen_count --limit 20 --raw
```
### Trending — Base by Launchpad Platform
```bash
@@ -505,7 +534,7 @@ All filter flags are sent as part of the API request body — the server filters
| `--min-progress` / `--max-progress` | float | Bonding curve progress (01) |
| `--min-marketcap` / `--max-marketcap` | float | Market cap (USD) |
| `--min-liquidity` / `--max-liquidity` | float | Liquidity (USD) |
| `--min-created` / `--max-created` | string | Token age (e.g. `1m` / `5m` / `1h` / `24h`) |
| `--min-created` / `--max-created` | duration | Token age — unit suffix recommended: seconds (`30s`, `10s`) or minutes (`0.5m`, `1m`, `5m`, `30m`). Bare numbers (e.g. `5`) are treated as minutes with a warning. |
| `--min-holder-count` / `--max-holder-count` | int | Holder count |
| `--min-top-holder-rate` / `--max-top-holder-rate` | float | Top-10 holder concentration (01) |
| `--min-rug-ratio` / `--max-rug-ratio` | float | Rug pull risk score (01) |
@@ -809,11 +838,119 @@ Present each category separately with a header:
# | Symbol | Market Cap | Volume (1h) | Smart Degens | Social
```
## `market signal` Parameters
Chains: `sol` / `bsc` only. **Maximum 50 results per group** — use multiple groups via `--groups` to cover different signal types in a single request.
**Single-group (individual flags):**
Do **not** pass signal types **14, 15, or 16** in `signal_type` / `--signal-type` / `--groups` JSON — OpenAPI returns **400** if any group includes them. Omitting `--signal-type` (empty filter) still queries all types upstream; responses may still include 1416 in that case.
| Option | Required | Description |
|--------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` |
| `--signal-type` | No | Signal type(s), repeatable (118, default: all). See Signal Types below. |
| `--mc-min` | No | Min market cap at trigger time (USD) |
| `--mc-max` | No | Max market cap at trigger time (USD) |
| `--trigger-mc-min` | No | Min market cap at signal trigger moment (USD) |
| `--trigger-mc-max` | No | Max market cap at signal trigger moment (USD) |
| `--total-fee-min` | No | Min total fees paid (USD) |
| `--total-fee-max` | No | Max total fees paid (USD) |
| `--min-create-or-open-ts` | No | Min token creation or open timestamp (Unix seconds string) |
| `--max-create-or-open-ts` | No | Max token creation or open timestamp (Unix seconds string) |
**Multi-group override:**
Pass `--groups '<json_array>'` to query multiple filter groups in a single request. The upstream executes all groups in parallel and merges results sorted by `trigger_at` descending. When `--groups` is present, all individual flags above are ignored.
```bash
gmgn-cli market signal --chain sol \
--groups '[{"signal_type":[12,13]},{"signal_type":[6,7],"mc_min":50000}]'
```
### Signal Types
| Value | Name | Description |
|-------|------|-------------|
| 1 | SignalType1 | General signal (K-line price spike) |
| 2 | SignalTypeDexAd | Dex ad placement |
| 3 | SignalTypeDexUpdateLink | Dex social link updated |
| 4 | SignalTypeDexTrendingBar | Dex trending bar |
| 5 | SignalTypeDexBoost | Dex Boost |
| 6 | SignalTypePriceUp | Price spike |
| 7 | SignalTypePriceATH | All-time high price |
| 8 | SignalTypeMcpKeyLevel | Market cap key level |
| 9 | SignalTypeLive | Live stream |
| 10 | SignalTypeBundlerSell | Bundler sell |
| 11 | SignalTypeCto | Community takeover (CTO) |
| 12 | SignalTypeSmartDegenBuy | Smart money buy |
| 13 | SignalTypePlatformCall | Platform call |
| 14 | SignalTypeLargeAmountBuy | Large amount buy |
| 15 | SignalTypeMultiBuy | Multiple buys |
| 16 | SignalTypeMultiLargeBuy | Multiple large buys |
| 17 | SignalTypeBagsClaims | Bags Claim |
| 18 | SignalTypePumpClaims | Pump Claim |
### `market signal` Response Fields
Each item in the response array is one signal event:
| Field | Type | Description |
|-------|------|-------------|
| `id` | string | Signal event ID |
| `token_address` | string | Token contract address |
| `signal_type` | number | Signal type (118, see Signal Types above) |
| `trigger_at` | number | Unix timestamp (seconds) when the signal was triggered |
| `trigger_mc` | number | Market cap at signal trigger time (USD) |
| `first_trigger_mc` | number | Market cap at the very first trigger for this token (USD) |
| `market_cap` | number | Current market cap (USD) |
| `ath` | number | All-time high market cap (USD) |
| `signal_times` | number | Total number of times this signal has triggered for this token |
| `signal_times_by_type` | object | Signal trigger count broken down by type |
| `cur_data` | object | Real-time token stats at query time (see below) |
| `data` | object | Full upstream snapshot at trigger time (chain-specific, raw passthrough) |
**`cur_data` fields:**
| Field | Type | Description |
|-------|------|-------------|
| `top_10_holder_rate` | number | Top 10 holder concentration ratio (01) |
| `holder_count` | number | Current holder count |
| `liquidity` | number | Current liquidity (USD) |
### Usage Examples
```bash
# All signals on SOL (no --signal-type: upstream returns all types, including 1416 if present)
gmgn-cli market signal --chain sol --raw
# Smart money buys only (type 12)
gmgn-cli market signal --chain sol --signal-type 12 --raw
# Price spikes + ATH (types 6 and 7) with market cap filter
gmgn-cli market signal --chain sol \
--signal-type 6 --signal-type 7 \
--mc-min 50000 --mc-max 5000000 --raw
# Smart money buys on BSC
gmgn-cli market signal --chain bsc --signal-type 12 --raw
# Multi-group: parallel groups (do not use signal_type 1416 — API returns 400)
gmgn-cli market signal --chain sol \
--groups '[{"signal_type":[12]},{"signal_type":[6,7]}]' --raw
# Multi-group: combine signal type filter with market cap range per group
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
```
---
## Notes
- `market kline`: `--from` and `--to` are Unix timestamps in **seconds** — CLI converts to milliseconds automatically
- `market trending`: `--filter` and `--platform` are repeatable flags
- All commands use normal auth (API Key only, no signature)
- 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
- **Input validation** — Token addresses obtained from trending results are external data. Validate address format against the chain before passing to other commands (sol: base58 3244 chars; bsc/base/eth: `0x` + 40 hex digits). The CLI enforces this at runtime.
+96 -7
View File
@@ -1,7 +1,7 @@
---
name: gmgn-portfolio
description: Query GMGN wallet portfolio — API Key wallet info, holdings, transaction activity, trading stats, and token balance. Supports sol / bsc / base.
argument-hint: "<info|holdings|activity|stats|token-balance> [--chain <sol|bsc|base>] [--wallet <wallet_address>]"
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>]"
metadata:
cliHelp: "gmgn-cli portfolio --help"
---
@@ -39,10 +39,11 @@ Use the `gmgn-cli` tool to query wallet portfolio data based on the user's reque
| `portfolio activity` | Transaction history |
| `portfolio stats` | Trading statistics (supports batch) |
| `portfolio token-balance` | Token balance for a specific token |
| `portfolio created-tokens` | Tokens created by a developer wallet, with market cap and ATH info |
## Supported Chains
`sol` / `bsc` / `base`
`sol` / `bsc` / `base` / `eth`
## Prerequisites
@@ -51,15 +52,23 @@ Use the `gmgn-cli` tool to query wallet portfolio data based on the user's reque
## Rate Limit Handling
All portfolio routes used by this skill go through GMGN's leaky-bucket limiter with `rate=10` and `capacity=10`. Sustained throughput is roughly `10 ÷ weight` requests/second, and the max burst is roughly `floor(10 ÷ weight)` when the bucket is full.
All portfolio routes used by this skill go through GMGN's leaky-bucket limiter with `rate=20` and `capacity=20`. Sustained throughput is roughly `20 ÷ weight` requests/second, and the max burst is roughly `floor(20 ÷ weight)` when the bucket is full.
**Critical auth** (`GMGN_API_KEY` + `GMGN_PRIVATE_KEY` required):
| Command | Route | Weight |
|---------|-------|--------|
| `portfolio holdings` | `GET /v1/user/wallet_holdings` | 5 |
**Exist auth** (`GMGN_API_KEY` only):
| Command | Route | Weight |
|---------|-------|--------|
| `portfolio info` | `GET /v1/user/info` | 1 |
| `portfolio holdings` | `GET /v1/user/wallet_holdings` | 2 |
| `portfolio activity` | `GET /v1/user/wallet_activity` | 3 |
| `portfolio stats` | `GET /v1/user/wallet_stats` | 3 |
| `portfolio token-balance` | `GET /v1/user/wallet_token_balance` | 1 |
| `portfolio created-tokens` | `GET /v1/user/created_tokens` | 2 |
When a request returns `429`:
@@ -125,8 +134,38 @@ gmgn-cli portfolio stats --chain sol \
# Token balance
gmgn-cli portfolio token-balance \
--chain sol --wallet <wallet_address> --token <token_address>
# Tokens created by a developer wallet
gmgn-cli portfolio created-tokens --chain sol --wallet <wallet_address>
# Created tokens sorted by all-time high market cap
gmgn-cli portfolio created-tokens \
--chain sol --wallet <wallet_address> \
--order-by token_ath_mc --direction desc
# Only migrated tokens
gmgn-cli portfolio created-tokens \
--chain sol --wallet <wallet_address> --migrate-state migrated
# ETH wallet holdings
gmgn-cli portfolio holdings --chain eth --wallet <0x_wallet_address>
# ETH wallet transaction activity
gmgn-cli portfolio activity --chain eth --wallet <0x_wallet_address>
# ETH token balance
gmgn-cli portfolio token-balance \
--chain eth --wallet <0x_wallet_address> --token <0x_token_address>
```
## `portfolio created-tokens` Options
| Option | Description |
|--------|-------------|
| `--order-by <field>` | Sort field: `market_cap` / `token_ath_mc` |
| `--direction <asc\|desc>` | Sort direction (default `desc`) |
| `--migrate-state <state>` | Filter by migration status: `migrated` (graduated to DEX) / `non_migrated` (still on bonding curve) |
## `portfolio holdings` Options
| Option | Description |
@@ -194,7 +233,8 @@ The response has a `activities` array and a `next` cursor field for pagination.
| `token.symbol` | Token ticker |
| `token_amount` | Token quantity in this transaction |
| `cost_usd` | USD value of this transaction |
| `price` | Token price in USD at time of transaction |
| `price` | Token price denominated in the quote token of the trading pair at time of transaction |
| `price_usd` | Token price in USD at time of transaction |
| `timestamp` | Unix timestamp of the transaction |
| `next` | Pagination cursor — pass to `--cursor` to fetch the next page |
@@ -228,12 +268,60 @@ The response also includes a `common` object when available (absent if the upstr
| `common.follow_count` | Number of GMGN users following this wallet |
| `common.remark_count` | Number of GMGN users who have remarked this wallet |
| `common.created_token_count` | Tokens created by this wallet |
| `common.created_at` | Wallet creation time (Unix seconds) — records when the first funding transaction arrived; use this as the wallet's age indicator |
| `common.fund_from` | Funding source label |
| `common.fund_from_address` | Address that funded this wallet |
| `common.fund_amount` | Funding amount |
Use `common.tags` and `common.twitter_username` when building a wallet profile narrative. If `common` is absent in the response, omit identity fields silently — do not report it as an error.
### `portfolio created-tokens` — Key Fields
The response `data` object has a `tokens` array plus aggregate stats.
Top-level fields:
| Field | Description |
|-------|-------------|
| `last_create_timestamp` | Unix timestamp of the most recent token creation |
| `inner_count` | Number of tokens still on the bonding curve (NOT graduated) |
| `open_count` | Number of tokens that have graduated to DEX |
| `open_ratio` | Graduation rate (string, e.g. `"0.25"`) |
> **Total created = `inner_count + open_count`**. Do NOT use `len(tokens)` as the total — the `tokens` array is capped at 100 entries and may be truncated.
| `creator_ath_info` | Best-performing token created by this wallet (ATH market cap) |
| `tokens` | Array of created tokens — see below |
`creator_ath_info` fields:
| Field | Description |
|-------|-------------|
| `creator` | Wallet address |
| `ath_token` | Token address with highest ATH market cap |
| `ath_mc` | ATH market cap (USD string) |
| `token_symbol` / `token_name` | Token ticker and name |
| `token_logo` | Logo URL |
Per-token fields (`tokens[*]`):
| Field | Description |
|-------|-------------|
| `token_address` | Token contract address |
| `symbol` | Token ticker |
| `chain` | Chain name |
| `create_timestamp` | Unix timestamp of creation |
| `is_open` | `true` if graduated to DEX |
| `market_cap` | Current market cap (USD string) |
| `token_ath_mc` | All-time high market cap (USD string) |
| `pool_liquidity` | Current liquidity (USD string) |
| `holders` | Current holder count |
| `swap_1h` | Swap count in the last hour |
| `volume_1h` | Trading volume in the last hour (USD string) |
| `launchpad_platform` | Launch platform name (e.g. `Pump.fun`) |
| `is_pump` | `true` if launched on Pump.fun |
| `bundler_rate` | Bundler participation rate (01) |
| `cto_flag` | `true` if community-takeover token |
**Do NOT guess field names not listed here.** If a field appears in the response but is not in this table, do not interpret it without reading the raw output first.
## Output Format
@@ -280,7 +368,7 @@ Show the `[Identity: ...]` line only if `common` is present in the response. For
## Notes
- All portfolio commands use normal auth (API Key only, no signature required)
- `portfolio holdings` uses **critical auth** (`GMGN_API_KEY` + `GMGN_PRIVATE_KEY` required — CLI signs the request automatically). All other portfolio commands use exist auth (API Key only, no signature required).
- `portfolio stats` supports multiple `--wallet` flags for batch queries
- Use `--raw` to get single-line JSON for further processing
- **Input validation** — Wallet and token addresses are validated against the expected chain format at runtime (sol: base58 3244 chars; bsc/base/eth: `0x` + 40 hex digits). The CLI exits with an error on invalid input.
@@ -296,3 +384,4 @@ For in-depth trading style analysis, copy-trade ROI estimation, and smart money
- User asks "is this wallet worth following" → [`docs/workflow-wallet-analysis.md`](../../docs/workflow-wallet-analysis.md)
- User asks "what's this wallet's trading style", "when does he take profit", "smart money profile", "if I copied this wallet what would my return be" → [`docs/workflow-smart-money-profile.md`](../../docs/workflow-smart-money-profile.md)
- User wants to compare multiple smart money wallets by winrate/PnL → [`docs/workflow-smart-money-profile.md`](../../docs/workflow-smart-money-profile.md) Step 5 (leaderboard)
- User asks "what tokens did this dev create", "dev 发过哪些币", "查一下这个 dev 的代币", "dev 创建记录" → use `portfolio created-tokens --chain <chain> --wallet <creator_address>` directly. Get the creator address first via `token info` if only a token address is given.
+389 -115
View File
@@ -1,7 +1,7 @@
---
name: gmgn-swap
description: "[FINANCIAL EXECUTION] Submit a real blockchain token swap or query order status. Executes irreversible on-chain transactions. Requires explicit user confirmation before every swap. Supports sol / bsc / base."
argument-hint: "[--chain <chain> --from <wallet> --input-token <addr> --output-token <addr> --amount <n>] | [order get --chain <chain> --order-id <id>]"
description: "[FINANCIAL EXECUTION] Buy and sell meme coins and crypto tokens on Solana, BSC, Base, or Ethereum — single swap, multi-wallet batch trading, limit orders, stop loss, take profit, trailing stop loss, trailing take profit via GMGN API. Requires explicit user confirmation. Use when user asks to buy, sell, or swap a token, trade from multiple wallets, set a limit order, stop loss, take profit, or check order status."
argument-hint: "[--chain <chain> --from <wallet> --input-token <addr> --output-token <addr> --amount <n>] | [order get --chain <chain> --order-id <id>] | [gas-price --chain <eth|bsc|base|sol>] | [order strategy list --chain <chain> --group-tag <LimitOrder|STMix>] | [order strategy create --chain <chain> --order-type limit_order --sub-order-type <buy_low|buy_high|stop_loss|take_profit> ...]"
metadata:
cliHelp: "gmgn-cli swap --help"
---
@@ -24,9 +24,9 @@ Use the `gmgn-cli` tool to submit a token swap or query an existing order. `GMGN
- **Currency tokens** — Each chain has designated currency tokens (SOL, BNB, ETH, USDC). These are the base assets used to buy other tokens or receive swap proceeds. Their contract addresses are fixed — look them up in the Chain Currencies table, never guess them.
- **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.
- **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.**
- **Critical 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 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.
- **`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`.
@@ -46,26 +46,30 @@ Use the `gmgn-cli` tool to submit a token swap or query an existing order. `GMGN
| Sub-command | Description |
|-------------|-------------|
| `swap` | Submit a token swap |
| `order quote` | Get a swap quote (no transaction submitted; requires critical auth) |
| `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 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) |
| `order strategy list` | List strategy orders (requires private key) |
| `order strategy cancel` | Cancel a strategy order (requires private key) |
## Supported Chains
`sol` / `bsc` / `base`
`sol` / `bsc` / `base` / `eth`
## Chain Currencies
Currency tokens are the base/native assets of each chain. They are used to buy other tokens or receive proceeds from selling. Knowing which tokens are currencies is critical for `--percent` usage (see Swap Parameters below).
| Chain | Currency tokens |
|-------|----------------|
| `sol` | SOL (native, So11111111111111111111111111111111111111112), USDC (`EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`) |
| `bsc` | BNB (native, 0x0000000000000000000000000000000000000000), USDC (`0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d`) |
| `base` | ETH (native, 0x0000000000000000000000000000000000000000), USDC (`0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`) |
> ⚠️ **CRITICAL: Always copy currency addresses from this table — NEVER rely on memory or training data.** A wrong address (e.g. `So11111111111111111111111111111111111111111` instead of `So11111111111111111111111111111111111111112`) will cause silent failures or `jupiter has no route` errors with no clear indication of what went wrong.
| Chain | Currency tokens |
| ------ | --------------- |
| `sol` | SOL (native, `So11111111111111111111111111111111111111112`), USDC (`EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`) |
| `bsc` | BNB (native, `0x0000000000000000000000000000000000000000`), USDC (`0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d`) |
| `base` | ETH (native, `0x0000000000000000000000000000000000000000`), USDC (`0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`) |
| `eth` | ETH (native, `0x0000000000000000000000000000000000000000`) |
## Prerequisites
@@ -76,13 +80,18 @@ Currency tokens are the base/native assets of each chain. They are used to buy o
## Rate Limit Handling
All swap-related routes used by this skill go through GMGN's leaky-bucket limiter with `rate=10` and `capacity=10`. Sustained throughput is roughly `10 ÷ weight` requests/second, and the max burst is roughly `floor(10 ÷ weight)` when the bucket is full.
All swap-related routes used by this skill go through GMGN's leaky-bucket limiter with `rate=20` and `capacity=20`. Sustained throughput is roughly `20 ÷ weight` requests/second, and the max burst is roughly `floor(20 ÷ weight)` when the bucket is full.
| Command | Route | Weight |
|---------|-------|--------|
| `swap` | `POST /v1/trade/swap` | 5 |
| `multi-swap` | `POST /v1/trade/multi_swap` | 5 |
| `order quote` | `GET /v1/trade/quote` | 2 |
| `order get` | `GET /v1/trade/query_order` | 1 |
| `order strategy create` | `POST /v1/trade/strategy/create` | 5 |
| `order strategy cancel` | `POST /v1/trade/strategy/cancel` | 2 |
| `order strategy list` | `GET /v1/trade/strategy/orders` | 1 |
| `gas-price` | `GET /v1/trade/gas_price` | 1 |
When a request returns `429`:
@@ -116,6 +125,8 @@ When a request returns `429`:
- `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
@@ -163,59 +174,29 @@ gmgn-cli swap \
--percent 50
```
## `order quote` Usage
Get an estimated output amount before submitting a swap. All supported quote chains use critical auth and require `GMGN_PRIVATE_KEY`.
```bash
gmgn-cli order quote \
--chain sol \
--from <wallet_address> \
--input-token <input_token_address> \
--output-token <output_token_address> \
--amount <input_amount_smallest_unit> \
--slippage 0.01
```
### `order quote` Response Fields
| Field | Type | Description |
|-------|------|-------------|
| `input_token` | string | Input token contract address |
| `output_token` | string | Output token contract address |
| `input_amount` | string | Input amount (smallest unit) |
| `output_amount` | string | Expected output amount (smallest unit) |
| `min_output_amount` | string | Minimum output after slippage |
| `slippage` | number | Actual slippage percentage |
## `order get` Usage
```bash
gmgn-cli order get --chain sol --order-id <order_id>
```
## `swap` Parameters
| Parameter | Required | Description |
|-----------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` |
| `--from` | Yes | Wallet address (must match API Key binding) |
| `--input-token` | Yes | Input token contract address |
| `--output-token` | Yes | Output token contract address |
| `--amount` | No* | Input amount in smallest unit. **Mutually exclusive with `--percent`** — provide one or the other, never both. Required unless `--percent` is used. |
| `--percent <pct>` | No* | Sell percentage of `input_token`, e.g. `50` = 50%, `1` = 1%. Sets `input_amount` to `0` automatically. **Mutually exclusive with `--amount`. Only valid when `input_token` is NOT a currency (SOL/BNB/ETH/USDC).** |
| `--slippage <n>` | No | Slippage tolerance, e.g. `0.01` = 1%. **Mutually exclusive with `--auto-slippage`** — use one or the other. |
| `--auto-slippage` | No | Enable automatic slippage. **Mutually exclusive with `--slippage`.** |
| `--min-output <n>` | No | Minimum output amount |
| `--anti-mev` | No | Enable anti-MEV protection — **recommended**; protects against frontrunning and sandwich attacks. Default: on |
| `--priority-fee <sol>` | No | Priority fee in SOL (≥ 0.00001, SOL only) |
| `--tip-fee <n>` | No | Tip fee (SOL ≥ 0.00001 / BSC ≥ 0.000001 BNB) |
| `--max-auto-fee <n>` | No | Max automatic fee cap |
| `--gas-price <gwei>` | No | Gas price in gwei (BSC ≥ 0.05 / BASE/ETH ≥ 0.01) |
| `--max-fee-per-gas <n>` | No | EIP-1559 max fee per gas (Base only) |
| `--max-priority-fee-per-gas <n>` | No | EIP-1559 max priority fee per gas (Base only) |
| `--condition-orders <json>` | No | JSON array of condition sub-orders (take-profit / stop-loss) to attach after a successful swap. **Max 10 sub-orders.** Strategy creation is best-effort: if the swap succeeds but strategy creation fails, the swap result is still returned. See ConditionOrder fields below. |
| `--sell-ratio-type <type>` | No | Sell ratio basis for `--condition-orders`: `buy_amount` (default) — when triggered, sells a fixed token amount stored at strategy creation time; `hold_amount` — when triggered, sells a fixed percentage of the position held at trigger time |
| Parameter | Required | Chain | Description |
|-----------|----------|-------|-------------|
| `--chain` | Yes | all | `sol` / `bsc` / `base` / `eth` |
| `--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 |
| `--amount` | No* | all | Input amount in smallest unit. **Mutually exclusive with `--percent`** — provide one or the other, never both. Required unless `--percent` is used. |
| `--percent <pct>` | No* | all | Sell percentage of `input_token`, e.g. `50` = 50%, `1` = 1%. Sets `input_amount` to `0` automatically. **Mutually exclusive with `--amount`. Only valid when `input_token` is NOT a currency (SOL/BNB/ETH/USDC).** |
| `--slippage <n>` | No | all | Slippage tolerance, e.g. `0.01` = 1%. **Mutually exclusive with `--auto-slippage`** — use one or the other. |
| `--auto-slippage` | No | all | Enable automatic slippage. **Mutually exclusive with `--slippage`.** |
| `--min-output <n>` | No | all | Minimum output amount |
| `--anti-mev` | No | sol / bsc / eth | Enable anti-MEV protection — **recommended**; protects against frontrunning and sandwich attacks. Default: on. **Not supported on `base`.** |
| `--priority-fee <sol>` | No | `sol` | Priority fee in SOL (≥ 0.00001). Required when using `--condition-orders` on SOL. |
| `--tip-fee <n>` | No | `sol` / `bsc` | Tip fee (SOL ≥ 0.00001 / BSC ≥ 0.000001 BNB). Required when using `--condition-orders` on SOL. |
| `--gas-price <gwei>` | No | `bsc` / `base` / `eth` | Gas price in gwei (BSC ≥ 0.05 / BASE/ETH ≥ 0.01). Required when using `--condition-orders` on BSC. Mutually exclusive with `--gas-level`. |
| `--gas-level <level>` | No | `eth` | Gas price tier: `low` / `average` / `high`. Mutually exclusive with `--gas-price`. |
| `--auto-fee` | No | `eth` | **Only with `--condition-orders`.** GMGN automatically selects the optimal fee. |
| `--max-fee-per-gas <n>` | No | `bsc` / `base` / `eth` | EIP-1559 max fee per gas. Clamped per chain minimums. Defaults to `--gas-price` if omitted (BASE/ETH). |
| `--max-priority-fee-per-gas <n>` | No | `bsc` / `base` / `eth` | EIP-1559 max priority fee per gas. Clamped per chain minimums; capped to `--max-fee-per-gas`. |
| `--condition-orders <json>` | No | all | JSON array of condition sub-orders (take-profit / stop-loss) to attach after a successful swap. **Max 10 sub-orders.** Strategy creation is best-effort: if the swap succeeds but strategy creation fails, the swap result is still returned. See ConditionOrder fields below. |
| `--sell-ratio-type <type>` | No | all | **Only with `--condition-orders`.** Sell ratio basis: `buy_amount` (default) — sells a fixed token amount stored at strategy creation time; `hold_amount` — sells a fixed percentage of the position held at trigger time |
### ConditionOrder Fields (for `--condition-orders`)
@@ -313,7 +294,7 @@ gmgn-cli swap \
### Pre-swap Confirmation
Before displaying the confirmation, run `order quote` to get the estimated output (requires critical auth and `GMGN_PRIVATE_KEY` on every supported quote chain):
Before displaying the confirmation, run `order quote` to get the estimated output (requires signed auth and `GMGN_PRIVATE_KEY` on every supported quote chain):
```bash
gmgn-cli order quote \
@@ -363,68 +344,172 @@ Order ID: {order_id}
Convert `report.input_amount` and `report.output_amount` from smallest unit using `report.input_token_decimals` and `report.output_token_decimals` before displaying.
## `order strategy create` Parameters
---
| Parameter | Required | Description |
|-----------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` |
| `--from` | Yes | Wallet address (must match API Key binding) |
| `--base-token` | Yes | Base token contract address |
| `--quote-token` | Yes | Quote token contract address |
| `--order-type` | Yes | Order type: `limit_order` |
| `--sub-order-type` | Yes | Sub-order type: `buy_low` / `buy_high` / `stop_loss` / `take_profit` |
| `--check-price` | Yes | Trigger check price |
| `--amount-in` | No* | Input amount (smallest unit). Mutually exclusive with `--amount-in-percent` |
| `--amount-in-percent` | No* | Input as percentage (e.g. `50` = 50%). Mutually exclusive with `--amount-in` |
| `--limit-price-mode` | No | `exact` / `slippage` (default: `slippage`) |
| `--expire-in` | No | Order expiry in seconds |
| `--sell-ratio-type` | No | `buy_amount` (default) — when triggered, sells a fixed token amount stored at strategy creation time; `hold_amount` — when triggered, sells a fixed percentage of the position held at trigger time |
| `--slippage` | No | Slippage tolerance, e.g. `0.01` = 1%. Mutually exclusive with `--auto-slippage` |
| `--auto-slippage` | No | Enable automatic slippage |
| `--priority-fee` | No | Priority fee in SOL (SOL only) |
| `--tip-fee` | No | Tip fee |
| `--gas-price` | No | Gas price in gwei (BSC ≥ 0.05 gwei / BASE/ETH ≥ 0.01 gwei) |
| `--anti-mev` | No | Enable anti-MEV protection |
## `multi-swap` Usage
Submit a token swap across multiple wallets concurrently. Each wallet executes independently — one wallet's failure does not affect others. Up to 100 wallets per request. All wallets must be bound to the API Key. Requires `GMGN_PRIVATE_KEY`.
### `order strategy create` Response Fields
```bash
# Basic multi-wallet swap
gmgn-cli multi-swap \
--chain sol \
--accounts <addr1>,<addr2> \
--input-token <input_token_address> \
--output-token <output_token_address> \
--input-amount '{"<addr1>":"1000000","<addr2>":"2000000"}' \
--slippage 0.01
# Sell a percentage of each wallet's balance (use --input-amount-bps)
gmgn-cli multi-swap \
--chain sol \
--accounts <addr1>,<addr2> \
--input-token <token_address> \
--output-token <sol_address> \
--input-amount-bps '{"<addr1>":"5000","<addr2>":"10000"}' \
--slippage 0.01
# With per-wallet take-profit / stop-loss (condition_orders)
gmgn-cli multi-swap \
--chain sol \
--accounts <addr1>,<addr2> \
--input-token So11111111111111111111111111111111111111112 \
--output-token <token_address> \
--input-amount '{"<addr1>":"1000000","<addr2>":"2000000"}' \
--slippage 0.3 \
--priority-fee 0.00001 \
--tip-fee 0.00001 \
--condition-orders '[{"order_type":"profit_stop","side":"sell","price_scale":"100","sell_ratio":"100"},{"order_type":"loss_stop","side":"sell","price_scale":"50","sell_ratio":"100"}]'
# ETH multi-wallet swap (EIP-1559 gas)
gmgn-cli multi-swap \
--chain eth \
--accounts <0xaddr1>,<0xaddr2> \
--input-token 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \
--output-token <token_address> \
--input-amount '{"<0xaddr1>":"1000000","<0xaddr2>":"2000000"}' \
--slippage 0.01 \
--gas-price 5
```
## `multi-swap` Parameters
| Parameter | Required | Chain | Description |
|-----------|----------|-------|-------------|
| `--chain` | Yes | all | `sol` / `bsc` / `base` / `eth` |
| `--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 |
| `--input-amount` | No* | all | JSON map of `wallet_address → input amount` (smallest unit). One of `--input-amount`, `--input-amount-bps`, or `--output-amount` is required. |
| `--input-amount-bps` | No* | all | JSON map of `wallet_address → percent in bps` (110000; 5000 = 50%). Only valid when `input_token` is NOT a currency. |
| `--output-amount` | No* | all | JSON map of `wallet_address → target output amount` (smallest unit). |
| `--slippage <n>` | No | all | Slippage tolerance, e.g. `0.01` = 1%. Mutually exclusive with `--auto-slippage`. |
| `--auto-slippage` | No | all | Enable automatic slippage. |
| `--anti-mev` | No | sol / bsc / eth | Enable anti-MEV protection. Not supported on `base`. |
| `--priority-fee <sol>` | No | `sol` | Priority fee in SOL (≥ 0.00001). Required when using `--condition-orders` on SOL. |
| `--tip-fee <amount>` | No | `sol` / `bsc` | Tip fee (SOL ≥ 0.00001 / BSC ≥ 0.000001 BNB). Required when using `--condition-orders` on SOL. |
| `--gas-price <gwei>` | No | `bsc` / `base` / `eth` | Gas price in gwei (BSC ≥ 0.05 / BASE/ETH ≥ 0.01). Required when using `--condition-orders` on BSC. Mutually exclusive with `--gas-level`. |
| `--gas-level <level>` | No | `eth` | Gas price tier: `low` / `average` / `high`. Mutually exclusive with `--gas-price`. |
| `--auto-fee` | No | `eth` | **Only with `--condition-orders`.** GMGN automatically selects the optimal fee. |
| `--max-fee-per-gas <amount>` | No | `bsc` / `base` / `eth` | EIP-1559 max fee per gas. Clamped per chain minimums. Defaults to `--gas-price` if omitted (BASE/ETH). |
| `--max-priority-fee-per-gas <amount>` | No | `bsc` / `base` / `eth` | EIP-1559 max priority fee per gas. Clamped per chain minimums; capped to `--max-fee-per-gas`. |
| `--condition-orders <json>` | No | all | JSON array of condition sub-orders (take-profit / stop-loss) attached to each successful wallet's swap. Same structure as `swap --condition-orders`. Strategy creation is best-effort per wallet. |
| `--sell-ratio-type <type>` | No | all | **Only with `--condition-orders`.** Sell ratio base: `buy_amount` (default) / `hold_amount`. |
## `multi-swap` Response Fields
The response `data` is an array — one element per wallet:
| Field | Type | Description |
|-------|------|-------------|
| `order_id` | string | Created strategy order ID |
| `is_update` | bool | `true` if an existing order was updated, `false` if newly created |
| `account` | string | Wallet address |
| `success` | bool | Whether this wallet's swap succeeded |
| `error` | string | Error message on failure; absent on success |
| `error_code` | string | Error code on failure; absent on success |
| `result` | object | On success: OrderResponse (same fields as `swap` response). On failure: absent. |
| `result.strategy_order_id` | string | Strategy order ID; only present when `--condition-orders` was passed and strategy creation succeeded (best-effort) |
## `order strategy list` Parameters
---
| Parameter | Required | Description |
|-----------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` |
| `--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) |
| `--base-token` | No | Filter by token address |
| `--page-token` | No | Pagination cursor from previous response |
| `--limit` | No | Results per page (default 10 for history) |
## `order quote` Usage
### `order strategy list` Response Fields
Get an estimated output amount before submitting a swap. All supported quote chains use signed auth and require `GMGN_PRIVATE_KEY`.
```bash
gmgn-cli order quote \
--chain sol \
--from <wallet_address> \
--input-token <input_token_address> \
--output-token <output_token_address> \
--amount <input_amount_smallest_unit> \
--slippage 0.01
```
### `order quote` Response Fields
| Field | Type | Description |
|-------|------|-------------|
| `next_page_token` | string | Cursor for next page; empty when no more data |
| `total` | int | Total count (only returned when `--type open`) |
| `list` | array | Strategy order list |
| `input_token` | string | Input token contract address |
| `output_token` | string | Output token contract address |
| `input_amount` | string | Input amount (smallest unit) |
| `output_amount` | string | Expected output amount (smallest unit) |
| `min_output_amount` | string | Minimum output after slippage |
| `slippage` | number | Actual slippage percentage |
## `order strategy cancel` Parameters
---
| Parameter | Required | Description |
|-----------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` |
| `--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) |
| `--close-sell-model` | No | Sell model when closing the order |
## `order get` Usage
## `order strategy` Usage Examples
```bash
gmgn-cli order get --chain sol --order-id <order_id>
```
Response fields are shared with `swap` — see [`swap` / `order get` Response Fields](#swap--order-get-response-fields) above.
---
## `gas-price` Usage
Query recommended gas price tiers for any chain. API Key only — no signature or private key required.
```bash
gmgn-cli gas-price --chain eth
gmgn-cli gas-price --chain bsc
gmgn-cli gas-price --chain base
gmgn-cli gas-price --chain sol
```
### `gas-price` Response Fields
All fields are omitempty — fields unsupported by a chain are omitted. Units are chain-native (wei for EVM chains; lamports / chain-native for SOL).
| Field | Type | Description |
| ------------------------ | ------- | ----------- |
| `chain` | string | Chain identifier |
| `auto` | string | Automatic gas price |
| `auto_mev` | string | Anti-MEV automatic gas price |
| `last_block` | int64 | Latest block number |
| `high` | string | High-priority gas price |
| `average` | string | Average-priority gas price |
| `low` | string | Low-priority gas price |
| `suggest_base_fee` | string | Suggested base fee |
| `high_prio_fee` | string | High-priority fee |
| `average_prio_fee` | string | Average-priority fee |
| `low_prio_fee` | string | Low-priority fee |
| `high_prio_fee_mixed` | string | High mixed priority fee |
| `average_prio_fee_mixed` | string | Average mixed priority fee |
| `low_prio_fee_mixed` | string | Low mixed priority fee |
| `native_token_usd_price` | float32 | Native token USD price |
| `high_estimate_time` | int64 | Estimated confirmation time for high tier (seconds) |
| `average_estimate_time` | int64 | Estimated confirmation time for average tier (seconds) |
| `low_estimate_time` | int64 | Estimated confirmation time for low tier (seconds) |
| `high_orign` | string | High-priority raw origin value |
| `average_orign` | string | Average-priority raw origin value |
| `low_orign` | string | Low-priority raw origin value |
---
## `order strategy create` Usage
```bash
# Create a take-profit order: sell when price rises to target
@@ -450,7 +535,47 @@ gmgn-cli order strategy create \
--check-price 0.0005 \
--amount-in-percent 100 \
--slippage 0.01
```
## `order strategy create` Parameters
| Parameter | Required | Chain | Description |
|-----------|----------|-------|-------------|
| `--chain` | Yes | all | `sol` / `bsc` / `base` / `eth` |
| `--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 |
| `--order-type` | Yes | all | Order type: `limit_order` |
| `--sub-order-type` | Yes | all | Sub-order type: `buy_low` / `buy_high` / `stop_loss` / `take_profit` |
| `--check-price` | Yes | all | Trigger price in USD — the order fires when the token's USD price crosses this value |
| `--amount-in` | No* | all | Input amount (smallest unit). Mutually exclusive with `--amount-in-percent` |
| `--amount-in-percent` | No* | all | Input as percentage (e.g. `50` = 50%). Mutually exclusive with `--amount-in` |
| `--limit-price-mode` | No | all | `exact` / `slippage` (default: `slippage`) |
| `--expire-in` | No | all | Order expiry in seconds |
| `--sell-ratio-type` | No | all | `buy_amount` (default) — when triggered, sells a fixed token amount stored at strategy creation time; `hold_amount` — when triggered, sells a fixed percentage of the position held at trigger time |
| `--slippage` | No | all | Slippage tolerance, e.g. `0.01` = 1%. Mutually exclusive with `--auto-slippage` |
| `--auto-slippage` | No | all | Enable automatic slippage |
| `--priority-fee` | No | `sol` | Priority fee in SOL (≥ 0.00001). **Required** for SOL. |
| `--tip-fee` | No | `sol` / `bsc` | Tip fee (SOL ≥ 0.00001 / BSC ≥ 0.000001 BNB). **Required** for SOL. |
| `--auto-fee` | No | `eth` | Auto fee mode — GMGN automatically selects the optimal fee. |
| `--gas-price` | No | `bsc` / `base` / `eth` | Gas price in gwei (BSC ≥ 0.05 / BASE/ETH ≥ 0.01). **Required** for BSC. Mutually exclusive with `--gas-level`. |
| `--gas-level` | No | `eth` | Gas price tier: `low` / `average` / `high`. Mutually exclusive with `--gas-price`. |
| `--max-fee-per-gas` | No | `bsc` / `base` / `eth` | EIP-1559 max fee per gas. Clamped per chain minimums. |
| `--max-priority-fee-per-gas` | No | `bsc` / `base` / `eth` | EIP-1559 max priority fee per gas. Clamped per chain minimums; capped to `--max-fee-per-gas`. |
| `--anti-mev` | No | sol / bsc / eth | Enable anti-MEV protection. Not supported on `base`. |
### `order strategy create` Response Fields
| Field | Type | Description |
|-------|------|-------------|
| `order_id` | string | Created strategy order ID |
| `is_update` | bool | `true` if an existing order was updated, `false` if newly created |
---
## `order strategy list` Usage
```bash
# List open condition orders (profit_stop / loss_stop / trace types) — use STMix
gmgn-cli order strategy list --chain sol --group-tag STMix
@@ -462,7 +587,139 @@ gmgn-cli order strategy list --chain sol --group-tag STMix --type history --limi
# Filter by token
gmgn-cli order strategy list --chain sol --group-tag STMix --base-token <token_address>
```
## `order strategy list` Parameters
| Parameter | Required | Description |
|-----------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
| `--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) |
| `--base-token` | No | Filter by token address |
| `--page-token` | No | Pagination cursor from previous response |
| `--limit` | No | Results per page (default 10 for history) |
### `order strategy list` Response Fields
| Field | Type | Description |
| ----------------- | ------ | ---- |
| `next_page_token` | string | Cursor for next page; empty when no more data |
| `total` | int | Total count (only returned when `--type open`) |
| `list` | array | Array of strategy order objects; see fields below |
#### `list[]` — Strategy Order Object
| Field | Type | Description |
| -------------------------- | ------ | ---- |
| `anti_mev_mode` | string | Anti-MEV mode string; empty when not set |
| `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` |
| `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 |
| `close_sign_hash` | string | Close transaction hash; empty when order is open |
| `close_time` | int | Close timestamp (ms); `0` when order is open |
| `condition_orders` | array | Condition sub-orders; each element is an object — see `condition_orders[]` below |
| `create_time` | int | Creation timestamp (ms) |
| `custom_rpc` | string | Custom RPC endpoint; empty string when not set |
| `dev_sell_ratio` | string | Dev sell trigger ratio; empty when not set |
| `drawdown_rate` | string | Trailing drawdown rate for `profit_stop_trace` / `loss_stop_trace`; empty when not set |
| `expire_time` | int | Expiration timestamp (ms) |
| `fee` | string | Base transaction fee |
| `gas_price` | string | Gas price |
| `is_anti_mev` | bool | Whether anti-MEV protection is active |
| `limit_price_mode` | string | Limit price mode; empty when not set |
| `loss_stop` | string | Stop-loss trigger price; empty when not set |
| `loss_stop_type` | string | Stop-loss type; empty when not set |
| `max_fee_per_gas` | string | EIP-1559 max fee per gas; EVM only; empty on SOL |
| `max_priority_fee_per_gas` | string | EIP-1559 max priority fee per gas; EVM only; empty on SOL |
| `open_amount` | string | Token amount at open (smallest unit) |
| `open_price` | string | Token price at open |
| `open_sign_hash` | string | Open transaction hash; empty before confirmed |
| `order_id` | string | Unique order ID (UUID) |
| `order_statistic` | object | Cumulative order statistics; see `order_statistic` Object below |
| `order_type` | string | Order type: `smart_trade` / `limit_order` |
| `place_action` | string | Placement action; empty when not applicable |
| `prepare_status` | string | Preparation status; empty when not applicable |
| `priority_fee` | string | Priority fee; SOL / BSC only |
| `profit_stop` | string | Take-profit trigger price; empty when not set |
| `profit_stop_type` | string | Take-profit type; empty when not set |
| `quote_decimal` | int | Quote token decimal places |
| `quote_investment` | string | Quote token investment amount (smallest unit) |
| `quote_token` | string | Quote token contract address |
| `reason_by` | string | Entity that triggered the close; empty when open |
| `reason_code` | string | Reason code for the close action; empty when open |
| `record_high_price` | string | Highest recorded price since open; used for trailing stops |
| `sell_param` | object | Sell transaction parameters; see `sell_param` Object below |
| `sell_ratio` | string | Sell ratio; empty when not set |
| `sell_ratio_type` | string | Sell ratio base: `buy_amount` / others |
| `slippage` | int | Slippage tolerance (0 = auto) |
| `status` | string | Order lifecycle status: `open` / `closed` |
| `strategy_status` | string | Strategy running status: `running` / `stopped` |
| `sub_order_type` | string | Sub-order type: `mix_trade` / others |
| `tip_fee` | string | Tip fee; SOL only |
| `token_balance` | string | Remaining token balance; empty when not available |
| `token_logo` | string | Token logo URL |
| `token_name` | string | Token display name |
| `token_price` | string | Current token price; empty when not available |
| `total_supply` | string | Token total supply |
| `version` | int | Order schema version |
| `wallet_address` | string | Wallet address that placed the order |
#### `condition_orders[]` — Condition Sub-Order Object
| Field | Type | Description |
| ------------- | ------ | ---- |
| `cid` | string | Condition sub-order ID (UUID) |
| `order_type` | string | Sub-order type: `profit_stop` / `loss_stop` / `profit_stop_trace` / `loss_stop_trace` |
| `side` | string | Trade side: `sell` |
| `price_scale` | string | Price ratio relative to open price (string); `profit_stop` / `loss_stop` required |
| `sell_ratio` | string | Sell ratio (string), e.g. `"100"` |
| `check_price` | string | Computed trigger price derived from `price_scale` and open price |
| `status` | string | Sub-order status: `cancel` / `success` / `failed` |
#### `order_statistic` Object
| Field | Type | Description |
| ---------------------- | ------ | ---- |
| `buy_amount` | string | Bought token amount (smallest unit) |
| `buy_quote_price` | string | Quote token price at buy |
| `buy_usdt_price` | string | USDT-denominated price at buy |
| `quote_profit` | string | Realized profit in quote token |
| `sell_amount` | string | Total token amount sold |
| `sell_num` | int | Total number of sell attempts |
| `success_sell_amount` | string | Successfully sold token amount |
| `success_sell_num` | int | Number of successful sells |
| `usdt_profit` | string | Realized profit in USDT |
#### `sell_param` Object
| Field | Type | Description |
| -------------------------- | ------ | ---- |
| `anti_mev_mode` | string | Anti-MEV mode for the sell transaction |
| `auto_fee` | bool | Whether auto fee is enabled for the sell |
| `auto_slippage` | bool | Whether auto slippage is enabled for the sell |
| `auto_tip` | bool | Whether auto tip is enabled |
| `custom_rpc` | string | Custom RPC endpoint; empty string when not set |
| `fee` | string | Sell transaction fee |
| `gas_price` | string | Gas price for the sell |
| `is_anti_mev` | bool | Whether anti-MEV protection is active for the sell |
| `max_fee_per_gas` | string | EIP-1559 max fee per gas for the sell; EVM only |
| `max_priority_fee_per_gas` | string | EIP-1559 max priority fee per gas for the sell; EVM only |
| `max_tip_fee` | string | Maximum tip fee; empty when not set |
| `priority_fee` | string | Priority fee for the sell; SOL / BSC only |
| `slippage` | int | Slippage tolerance for the sell (0 = auto) |
| `tip_fee` | string | Tip fee for the sell; SOL only |
---
## `order strategy cancel` Usage
```bash
# Cancel a strategy order
gmgn-cli order strategy cancel \
--chain sol \
@@ -470,13 +727,30 @@ gmgn-cli order strategy cancel \
--order-id <order_id>
```
## `order strategy cancel` Parameters
| Parameter | Required | Description |
|-----------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
| `--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) |
| `--close-sell-model` | No | Sell model when closing the order |
---
## Notes
- Swap uses **critical auth** (API Key + signature) — CLI handles signing automatically, no manual processing needed
- Swap uses **signed auth** (API Key + signature) — CLI handles signing automatically, no manual processing needed
- After submitting a swap, use `order get` to poll for confirmation
- `--amount` is in the **smallest unit** (e.g., lamports for SOL)
- `order strategy create`, `order strategy list`, and `order strategy cancel` use critical auth (require `GMGN_PRIVATE_KEY`)
- `order strategy create`, `order strategy list`, and `order strategy cancel` use signed auth (require `GMGN_PRIVATE_KEY`)
- Use `--raw` to get single-line JSON for further processing
- **Chain restrictions for fee flags** — see the `Chain` column in each parameter table above. `--priority-fee` and `--tip-fee` are SOL/BSC only; `--gas-price`, `--max-fee-per-gas`, `--max-priority-fee-per-gas` are BSC/BASE/ETH only; `--gas-level` and `--auto-fee` are ETH only. The server returns 400 if a chain-restricted flag is sent on the wrong chain. (`gas-price` itself supports all four chains including `sol`.)
- **EIP-1559 minimum values per chain:**
- BSC: `max_fee_per_gas` and `max_priority_fee_per_gas` min 50 000 000 wei (≈ 0.05 gwei); passing `"0"` returns 400
- BASE / ETH: `max_fee_per_gas` and `max_priority_fee_per_gas` min 200 000 wei
- EIP-1559 clamping applies only when `--condition-orders` is present (swap / multi-swap) or on every request (strategy/create)
## Input Validation
@@ -515,7 +789,7 @@ For full token research before swapping, see [`docs/workflow-token-research.md`]
## Execution Guidelines
- **[REQUIRED] Token security check** — Run before every swap. See **Pre-Swap Safety Check (REQUIRED)** section above. Uses normal auth (API Key only — no private key needed for this step).
- **[REQUIRED] Token security check** — Run before every swap. See **Pre-Swap Safety Check (REQUIRED)** section above. Uses exist auth (API Key only — no private key needed for this step).
- **Currency resolution** — When the user names a currency (SOL/BNB/ETH/USDC) instead of providing an address, look up its address in the Chain Currencies table and apply it automatically — never ask the user for it.
- Buy ("buy X SOL of TOKEN", "spend 0.5 USDC on TOKEN") → resolve currency to `--input-token`
- Sell ("sell TOKEN for SOL", "sell 50% of TOKEN to USDC") → resolve currency to `--output-token`
+117 -22
View File
@@ -1,7 +1,7 @@
---
name: gmgn-token
description: Query GMGN token information — basic info, security, pool, top holders and top traders. Supports sol / bsc / base.
argument-hint: "<sub-command> --chain <sol|bsc|base> --address <token_address>"
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>"
metadata:
cliHelp: "gmgn-cli token --help"
---
@@ -17,8 +17,8 @@ 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).
- **Market cap** — Not returned directly by `token info`. Calculate as `price × circulating_supply` (both are top-level fields in the response, already in human-readable units).
- **Chain** — The blockchain network: `sol` = Solana, `bsc` = BNB Smart Chain, `base` = Base (Coinbase L2), `eth` = Ethereum mainnet.
- **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.
- **Trader** — Any wallet that has transacted with the token (bought or sold), regardless of current holdings. `token traders` covers both current holders and past traders.
@@ -34,7 +34,7 @@ Use the `gmgn-cli` tool to query token information based on the user's request.
| Sub-command | Description |
|-------------|-------------|
| `token info` | Basic info + realtime price, liquidity, supply, holder count, social links (market cap = price × circulating_supply) |
| `token info` | Basic info + realtime price, liquidity, market cap, total supply, holder count, social links (market cap = price.price × circulating_supply) |
| `token security` | Security metrics (honeypot, taxes, holder concentration, contract risks) |
| `token pool` | Liquidity pool info (DEX, reserves, liquidity depth) |
| `token holders` | Top token holders list with profit/loss breakdown |
@@ -42,7 +42,7 @@ Use the `gmgn-cli` tool to query token information based on the user's request.
## Supported Chains
`sol` / `bsc` / `base`
`sol` / `bsc` / `base` / `eth`
## Prerequisites
@@ -51,7 +51,7 @@ Use the `gmgn-cli` tool to query token information based on the user's request.
## Rate Limit Handling
All token routes used by this skill go through GMGN's leaky-bucket limiter with `rate=10` and `capacity=10`. Sustained throughput is roughly `10 ÷ weight` requests/second, and the max burst is roughly `floor(10 ÷ weight)` when the bucket is full.
All token routes used by this skill go through GMGN's leaky-bucket limiter with `rate=20` and `capacity=20`. Sustained throughput is roughly `20 ÷ weight` requests/second, and the max burst is roughly `floor(20 ÷ weight)` when the bucket is full.
| Command | Route | Weight |
|---------|-------|--------|
@@ -88,7 +88,7 @@ When a request returns `429`:
| Parameter | Required | Description |
|-----------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` |
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
| `--address` | Yes | Token contract address |
| `--raw` | No | Output raw single-line JSON (for piping or further processing) |
@@ -96,12 +96,12 @@ When a request returns `429`:
| Parameter | Required | Default | Description |
|-----------|----------|---------|-------------|
| `--chain` | Yes | — | `sol` / `bsc` / `base` |
| `--chain` | Yes | — | `sol` / `bsc` / `base` / `eth` |
| `--address` | Yes | — | Token contract address |
| `--limit` | No | `20` | Number of results, max `100` |
| `--order-by` | No | `amount_percentage` | Sort field — see table below |
| `--direction` | No | `desc` | Sort direction: `asc` / `desc` |
| `--tag` | No | — | Wallet filter: `renowned` (KOL wallets) / `smart_degen` (smart money). Omit to return all wallets. |
| `--tag` | No | — | Wallet filter: `smart_degen` / `renowned` / `fresh_wallet` / `dev` / `sniper` / `rat_trader` / `bundler` / `transfer_in` / `dex_bot` / `bluechip_owner`. Omit to return all wallets. |
| `--raw` | No | — | Output raw single-line JSON |
### `--order-by` Values
@@ -116,10 +116,18 @@ When a request returns `429`:
### `--tag` Values
| Value | Description |
|-------|-------------|
| `renowned` | KOL / well-known wallets (influencers, funds, public figures) |
| `smart_degen` | Smart money wallets (historically high-performing traders) |
| Value | Description |
| -------------- | ----------- |
| `smart_degen` | Smart money wallets (historically high-performing traders) |
| `renowned` | KOL / well-known wallets (influencers, funds, public figures) |
| `fresh_wallet` | New wallets with no prior trading history |
| `dev` | Token developer / creator wallets |
| `sniper` | Wallets that sniped the token at launch |
| `rat_trader` | Insider / sneak-trading wallets |
| `bundler` | Bot-bundled buy wallets |
| `transfer_in` | Wallets with a transfer-in record for this token |
| `dex_bot` | DEX bot wallets (Axiom, Photon, BullX, Trojan, GMGN, Drops, PepeBoost, Padre) |
| `bluechip_owner` | Wallets holding established bluechip tokens |
### `--tag` + `--order-by` Combination Guide
@@ -154,7 +162,7 @@ The response has five nested objects: `pool`, `dev`, `link`, `stat`, `wallet_tag
| `total_supply` | Total token supply (same as `circulating_supply` for most tokens) |
| `circulating_supply` | Circulating supply |
| `max_supply` | Maximum supply |
| `price` | Current price in USD |
| `price` | **Object** — price and trading stats (see `price` Object below). Access current price as `price.price`. |
| `liquidity` | Total liquidity in USD (from biggest pool) |
| `holder_count` | Number of unique token holders |
| `logo` | Token logo image URL |
@@ -162,6 +170,15 @@ The response has five nested objects: `pool`, `dev`, `link`, `stat`, `wallet_tag
| `open_timestamp` | Time the token opened for trading (Unix seconds) |
| `biggest_pool_address` | Address of the main liquidity pool |
| `og` | Whether the token is flagged as an OG token (`true` / `false`) |
| `launchpad` | Launchpad identifier (e.g. `pump`, `moonshot`) |
| `launchpad_status` | Launchpad state: `0` = not opened, `1` = live, `2` = migrated |
| `launchpad_progress` | Launchpad bonding-curve progress (01) |
| `launchpad_platform` | Launchpad platform name |
| `migrated_pool` | Pool address after migration |
| `migration_market_cap` | Market cap at migration time (USD, float) |
| `migration_market_cap_quote` | Quote currency for `migration_market_cap` |
| `ath_price` | All-time-high price (USD, float) |
| `locked_ratio` | Ratio of supply locked (01, float) |
**`pool` Object** — Main liquidity pool details
@@ -203,6 +220,13 @@ The response has five nested objects: `pool`, `dev`, `link`, `stat`, `wallet_tag
| `dev.twitter_del_post_token_count` | Number of posts the creator deleted from Twitter |
| `dev.twitter_create_token_count` | Number of tokens the creator has promoted on Twitter |
| `dev.offchain` | Whether the token is an offchain token |
| `dev.ath_token_info` | Creator's all-time-high token info object (optional); see sub-fields below |
| `dev.ath_token_info.ath_token` | Contract address of the creator's best-performing token ever |
| `dev.ath_token_info.ath_mc` | All-time-high market cap of that token (USD, string) |
| `dev.ath_token_info.avatar` | Token logo URL |
| `dev.ath_token_info.symbol` | Token symbol |
| `dev.ath_token_info.name` | Token name |
| `dev.ath_token_info.creation_timestamp` | Token creation time (Unix seconds) |
**`link` Object** — Social and explorer links
@@ -225,8 +249,6 @@ The response has five nested objects: `pool`, `dev`, `link`, `stat`, `wallet_tag
| Field | Description |
|-------|-------------|
| `stat.holder_count` | Number of holders (same as top-level `holder_count`) |
| `stat.bluechip_owner_count` | Number of bluechip wallet holders |
| `stat.bluechip_owner_percentage` | Ratio of holders that are bluechip wallets (01) |
| `stat.top_10_holder_rate` | Ratio of supply held by top 10 wallets (01) |
| `stat.dev_team_hold_rate` | Ratio held by dev team wallets |
| `stat.creator_hold_rate` | Ratio held by creator wallet |
@@ -252,6 +274,57 @@ The response has five nested objects: `pool`, `dev`, `link`, `stat`, `wallet_tag
| `wallet_tags_stat.fresh_wallets` | Number of fresh wallets |
| `wallet_tags_stat.top_wallets` | Number of top-ranked wallets |
**`price` Object** — Price and trading statistics (access current price via `price.price`)
| Field | Description |
|-------|-------------|
| `price.price` | Current price in USD (string) |
| `price.price_{window}` | Price at the start of the window; windows: `1m`, `5m`, `1h`, `6h`, `24h` |
| `price.buys_{window}` | Buy transaction count in the window |
| `price.sells_{window}` | Sell transaction count in the window |
| `price.volume_{window}` | Total trading volume in USD for the window |
| `price.buy_volume_{window}` | Buy volume in USD for the window |
| `price.sell_volume_{window}` | Sell volume in USD for the window |
| `price.swaps_{window}` | Total swap count for the window |
| `price.hot_level` | Heat level integer |
**`fee_distribution` Object** — Launchpad fee-sharing config (optional; present for `pump` / `bankr` tokens). Use `token info` to check fee distribution, creator reward claim status (`has_claimed_fee`), and royalty allocation for pump/bankr tokens.
| Field | Description |
|-------|-------------|
| `fee_distribution.launchpad` | Launchpad identifier: `"pump"`, `"bankr"`, or `""` (unknown) |
| `fee_distribution.platform_data` | Platform-specific fee config; structure varies by `launchpad` (see below) |
When `fee_distribution.launchpad = "pump"`:
| Field | Description |
|-------|-------------|
| `platform_data.fee_authority` | Fee authority wallet address |
| `platform_data.is_locked` | Whether the fee config is locked |
| `platform_data.show` | Whether fee distribution is displayed in the UI |
| `platform_data.list` | Array of fee-share holders (see FeeShareHolder below) |
| `platform_data.bonus_category` | Bonus category list (e.g. `creator_reward`, `cashback`) |
When `fee_distribution.launchpad = "bankr"`:
| Field | Description |
|-------|-------------|
| `platform_data.deployer` | Original deployer wallet address |
| `platform_data.fee_recipient` | Fee recipient wallet address |
| `platform_data.list` | Array of fee-share holders (see FeeShareHolder below) |
FeeShareHolder fields (each item in `platform_data.list`):
| Field | Description |
|-------|-------------|
| `wallet` | Wallet address |
| `royalty_bps` | Royalty share in basis points (10000 = 100%) |
| `is_creator` | Whether this is the original creator |
| `has_claimed_fee` | Whether fees have been claimed |
| `username` | Display name |
| `pfp` | Avatar URL |
| `twitter_username` | Twitter / X username |
---
### `token security` — Key Fields
@@ -396,13 +469,18 @@ The response is an object with a `list` array. Each item in `list` represents on
| `maker_token_tags` | Token-specific behavior tags for this wallet (e.g. `["bundler"]`, `["paper_hands"]`, `["top_holder"]`) |
| `created_at` | Wallet creation timestamp (Unix seconds); `0` if unknown |
**Shared Funding**
| Field | Description |
|-------|-------------|
| `native_transfer` | First native token (SOL/BNB/ETH) transfer into this wallet — indicates the original funding source; wallets sharing the same `native_transfer.address` are likely funded from a common origin (coordinated wallets / same operator) |
**Last Transaction Records**
Each of the following is an object with `name`, `address`, `timestamp`, `tx_hash`, `type`:
| Field | Description |
|-------|-------------|
| `native_transfer` | Most recent native token (SOL/BNB/ETH) transfer associated with this wallet |
| `token_transfer` | Most recent token transfer (buy or sell) |
| `token_transfer_in` | Most recent inbound token transfer |
| `token_transfer_out` | Most recent outbound token transfer |
@@ -423,6 +501,9 @@ gmgn-cli token info --chain bsc --address 0x2170Ed0880ac9A755fd29B2688956BD959F9
# Get basic info for a Base token
gmgn-cli token info --chain base --address 0x4200000000000000000000000000000000000006
# Get basic info for an ETH token
gmgn-cli token info --chain eth --address 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
# Raw JSON output for downstream processing
gmgn-cli token info --chain sol --address EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --raw
```
@@ -439,6 +520,9 @@ gmgn-cli token security --chain bsc --address 0x2170Ed0880ac9A755fd29B2688956BD9
# Check a Base token for tax, rug ratio, and insider concentration
gmgn-cli token security --chain base --address 0x4200000000000000000000000000000000000006
# Check an ETH token for honeypot and contract risks
gmgn-cli token security --chain eth --address 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
# Raw output for parsing key fields (e.g. is_honeypot, buy_tax, rug_ratio)
gmgn-cli token security --chain bsc --address 0x2170Ed0880ac9A755fd29B2688956BD959F933F8 --raw
```
@@ -451,6 +535,9 @@ gmgn-cli token pool --chain sol --address EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZw
# Get pool info for a BSC token
gmgn-cli token pool --chain bsc --address 0x2170Ed0880ac9A755fd29B2688956BD959F933F8
# Get pool info for an ETH token
gmgn-cli token pool --chain eth --address 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
```
### `token holders` — Analyze Holder Distribution
@@ -487,6 +574,10 @@ gmgn-cli token holders --chain sol --address EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGG
gmgn-cli token holders --chain bsc --address 0x2170Ed0880ac9A755fd29B2688956BD959F933F8 \
--tag renowned --order-by profit --direction desc --limit 50
# ETH token holders — smart money by supply percentage
gmgn-cli token holders --chain eth --address 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 \
--tag smart_degen --order-by amount_percentage --direction desc --limit 20
# Raw output for downstream analysis
gmgn-cli token holders --chain sol --address EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
--limit 100 --raw
@@ -535,6 +626,10 @@ gmgn-cli token traders --chain sol --address EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGG
# BSC token traders by profit
gmgn-cli token traders --chain bsc --address 0x2170Ed0880ac9A755fd29B2688956BD959F933F8 \
--tag smart_degen --order-by profit --direction desc --limit 50
# ETH token traders by profit
gmgn-cli token traders --chain eth --address 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 \
--tag smart_degen --order-by profit --direction desc --limit 50
```
---
@@ -585,7 +680,7 @@ Present as a concise card. Do not dump raw JSON.
```
{symbol} ({name})
Price: ${price} | Market Cap: ~${price × circulating_supply} | Liquidity: ${liquidity}
Price: ${price.price} | Market Cap: ~${price.price × circulating_supply} | Liquidity: ${liquidity}
Holders: {holder_count} | Smart Money: {wallet_tags_stat.smart_wallets} | KOLs: {wallet_tags_stat.renowned_wallets}
Social: @{link.twitter_username} | {link.website} | {link.telegram}
```
@@ -628,9 +723,9 @@ Show top rows only. Highlight wallets tagged `kol`, `smart_degen`, or flagged `b
## Notes
- **Market cap is not returned directly** — calculate it as `price × circulating_supply` (both fields are top-level; `circulating_supply` is already in human-readable token units, no decimal adjustment needed). Example: `price=3.11` × `circulating_supply=999999151` ≈ $3.11B market cap.
- **Trading volume (1h, 24h, etc.) is not included in `token info`** — to get volume or OHLCV data, use the `gmgn-market` skill and query K-line data: `gmgn-cli market kline --chain <chain> --address <token_address> --resolution <1m|5m|15m|1h|4h|1d>`. See the `gmgn-market` SKILL.md for full details.
- All token commands use normal auth (API Key only, no signature required)
- **Market cap is not returned directly** — calculate it as `price.price × circulating_supply` (`price` is now a nested object; use `price.price` for the current USD price string, and `circulating_supply` is a top-level field already in human-readable token units). Example: `price.price="3.11"` × `circulating_supply=999999151` ≈ $3.11B market cap.
- **Trading volume and swap counts by window are available in `token info`** via the `price` object: `volume_{window}`, `buy_volume_{window}`, `sell_volume_{window}`, `buys_{window}`, `sells_{window}`, `swaps_{window}` (windows: `1m`, `5m`, `1h`, `6h`, `24h`). For OHLCV candlestick data, use `gmgn-market kline`.
- All token commands use exist auth (API Key only, no signature required)
- Use `--raw` to get single-line JSON for further processing
- `--tag` applies to both `holders` and `traders` and filters to only wallets with that tag — if few results are returned, try the other tag value
- `amount_percentage` in holders/traders is a ratio (01), not a percentage — `0.05` means 5% of supply
+15 -18
View File
@@ -1,7 +1,7 @@
---
name: gmgn-track
description: Query GMGN on-chain tracking data — follow-wallet trade records, KOL trades, and Smart Money trades. Supports sol / bsc / base.
argument-hint: "<follow-wallet|kol|smartmoney> [--chain <sol|bsc|base>] [--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. 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>]"
metadata:
cliHelp: "gmgn-cli track --help"
---
@@ -16,7 +16,7 @@ Use the `gmgn-cli` tool to query on-chain tracking data based on the user's requ
## Core Concepts
- **`follow-wallet` vs `kol` vs `smartmoney`** — Three distinct data sources. `follow-wallet` returns trades from wallets the user has personally followed on the GMGN platform (user-specific, requires private key). `kol` and `smartmoney` return trades from platform-tagged public wallet lists (not user-specific, API Key only). Never substitute one for another.
- **`follow-wallet` vs `kol` vs `smartmoney`** — Three distinct data sources. `follow-wallet` returns trades from wallets the user has personally followed on the GMGN platform (user-specific; the follow list is resolved from the GMGN user account bound to the API Key). `kol` and `smartmoney` return trades from platform-tagged public wallet lists (not user-specific). Never substitute one for another.
- **KOL (Key Opinion Leader)** — Wallets publicly identified as influencers or well-known traders on GMGN. Tagged as `renowned` in the platform's wallet label system. Their trades carry social/marketing signal, not necessarily alpha.
@@ -55,17 +55,17 @@ Use the `gmgn-cli` tool to query on-chain tracking data based on the user's requ
## Supported Chains
`sol` / `bsc` / `base`
`sol` / `bsc` / `base` / `eth`
## Prerequisites
- `gmgn-cli` installed globally — if missing, run: `npm install -g gmgn-cli`
- `GMGN_API_KEY` configured in `~/.config/gmgn/.env`
- `GMGN_PRIVATE_KEY` required only for `track follow-wallet`; not needed for `track kol` / `track smartmoney`
- `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`
## Rate Limit Handling
All tracking routes used by this skill go through GMGN's leaky-bucket limiter with `rate=10` and `capacity=10`. Sustained throughput is roughly `10 ÷ weight` requests/second, and the max burst is roughly `floor(10 ÷ weight)` when the bucket is full.
All tracking routes used by this skill go through GMGN's leaky-bucket limiter with `rate=20` and `capacity=20`. Sustained throughput is roughly `20 ÷ weight` requests/second, and the max burst is roughly `floor(20 ÷ weight)` when the bucket is full.
| Command | Route | Weight |
|---------|-------|--------|
@@ -89,15 +89,13 @@ When a request returns `429`:
```
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:
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_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
```
If the user also needs `track follow-wallet`, append the private key:
```bash
echo 'GMGN_PRIVATE_KEY="<pem_content_from_step_1>"' >> ~/.config/gmgn/.env
rm /tmp/gmgn_private.pem
```
## Usage Examples
@@ -132,7 +130,7 @@ gmgn-cli track smartmoney --chain sol --side sell --limit 10 --raw
| Option | Description |
|--------|-------------|
| `--chain` | Required. `sol` / `bsc` / `base` |
| `--chain` | Required. `sol` / `bsc` / `base` / `eth` |
| `--wallet <address>` | Filter by wallet address |
| `--limit <n>` | Page size (1100, default 10) |
| `--side <side>` | Trade direction: `buy` / `sell` |
@@ -144,7 +142,7 @@ gmgn-cli track smartmoney --chain sol --side sell --limit 10 --raw
| Option | Description |
|--------|-------------|
| `--chain <chain>` | Chain: `sol` / `bsc` / `base` (default `sol`) |
| `--chain <chain>` | Required. Chain: `sol` / `bsc` / `base` / `eth` |
| `--limit <n>` | Page size (1200, default 100) |
| `--side <side>` | Filter by trade direction: `buy` / `sell` (client-side filter — applied locally after fetching results) |
@@ -308,13 +306,12 @@ To research any token surfaced by smart money activity, follow [`docs/workflow-t
## Safety Constraints
- **`track follow-wallet` requires `GMGN_PRIVATE_KEY`** — this signing key is linked to your GMGN account. It is used for authentication only (no on-chain access), but must be protected like any credential. Never expose it in logs or command output.
- **`follow-wallet` reveals your following list** — results expose which wallets you have followed on GMGN. Do not share raw output in public channels.
- **`track kol` / `track smartmoney` expose no personal data** — these use API Key auth only and return platform-tagged public wallet activity. Safe to share raw output.
## Notes
- `track kol` / `track smartmoney` use normal auth (API Key only, no signature required)
- `track follow-wallet` requires `GMGN_PRIVATE_KEY` for signature auth — and wallets must be followed via the GMGN platform first
- `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
- `track kol` / `track smartmoney` `--side` is a **client-side filter** — the CLI fetches all results then filters locally; it is NOT sent to the API
+94 -41
View File
@@ -2,8 +2,8 @@
* OpenApiClient GMGN OpenAPI external client
*
* Auth modes:
* Normal (market/token/portfolio): X-APIKEY + timestamp + client_id
* Critical (swap and order routes): normal auth + X-Signature (private key signature)
* Exist (market/token/portfolio): X-APIKEY + timestamp + client_id
* Signed (swap and order routes): X-APIKEY + timestamp + client_id + X-Signature (private key signature)
*/
import { buildAuthQuery, buildMessage, detectAlgorithm, sign } from "./signer.js";
@@ -80,9 +80,9 @@ export interface SwapParams {
is_anti_mev?: boolean;
priority_fee?: string;
tip_fee?: string;
auto_tip_fee?: boolean;
max_auto_fee?: string;
gas_price?: string;
gas_level?: string;
auto_fee?: boolean;
max_fee_per_gas?: string;
max_priority_fee_per_gas?: string;
condition_orders?: StrategyConditionOrder[];
@@ -97,6 +97,29 @@ export interface StrategyConditionOrder {
drawdown_rate?: string;
}
export interface MultiSwapParams {
chain: string;
accounts: string[];
input_token: string;
output_token: string;
input_amount?: Record<string, string>;
input_amount_bps?: Record<string, string>;
output_amount?: Record<string, string>;
swap_mode?: string;
slippage?: number;
auto_slippage?: boolean;
is_anti_mev?: boolean;
priority_fee?: string;
tip_fee?: string;
gas_price?: string;
gas_level?: string;
auto_fee?: boolean;
max_fee_per_gas?: string;
max_priority_fee_per_gas?: string;
condition_orders?: StrategyConditionOrder[];
sell_ratio_type?: string;
}
export interface StrategyCreateParams {
chain: string;
from_address: string;
@@ -115,7 +138,9 @@ export interface StrategyCreateParams {
slippage?: number;
auto_slippage?: boolean;
fee?: string;
auto_fee?: boolean;
gas_price?: string;
gas_level?: string;
max_fee_per_gas?: string;
max_priority_fee_per_gas?: string;
is_anti_mev?: boolean;
@@ -133,6 +158,18 @@ export interface StrategyCancelParams {
close_sell_model?: string;
}
export interface TokenSignalGroup {
signal_type?: number[];
mc_min?: number;
mc_max?: number;
trigger_mc_min?: number;
trigger_mc_max?: number;
total_fee_min?: number;
total_fee_max?: number;
min_create_or_open_ts?: string;
max_create_or_open_ts?: string;
}
export interface CreateTokenParams {
chain: string;
dex: string;
@@ -167,29 +204,29 @@ export class OpenApiClient {
this.host = config.host.replace(/\/$/, "");
}
// ---- Token endpoints (normal auth) ----
// ---- Token endpoints (exist auth) ----
async getTokenInfo(chain: string, address: string): Promise<unknown> {
return this.normalRequest("GET", "/v1/token/info", { chain, address });
return this.authExistRequest("GET", "/v1/token/info", { chain, address });
}
async getTokenSecurity(chain: string, address: string): Promise<unknown> {
return this.normalRequest("GET", "/v1/token/security", { chain, address });
return this.authExistRequest("GET", "/v1/token/security", { chain, address });
}
async getTokenPoolInfo(chain: string, address: string): Promise<unknown> {
return this.normalRequest("GET", "/v1/token/pool_info", { chain, address });
return this.authExistRequest("GET", "/v1/token/pool_info", { chain, address });
}
async getTokenTopHolders(chain: string, address: string, extra: Record<string, string | number> = {}): Promise<unknown> {
return this.normalRequest("GET", "/v1/market/token_top_holders", { chain, address, ...extra });
return this.authExistRequest("GET", "/v1/market/token_top_holders", { chain, address, ...extra });
}
async getTokenTopTraders(chain: string, address: string, extra: Record<string, string | number> = {}): Promise<unknown> {
return this.normalRequest("GET", "/v1/market/token_top_traders", { chain, address, ...extra });
return this.authExistRequest("GET", "/v1/market/token_top_traders", { chain, address, ...extra });
}
// ---- Market endpoints (normal auth) ----
// ---- Market endpoints (exist auth) ----
async getTokenKline(
chain: string,
@@ -201,21 +238,21 @@ export class OpenApiClient {
const query: Record<string, string | number> = { chain, address, resolution };
if (from != null) query["from"] = from;
if (to != null) query["to"] = to;
return this.normalRequest("GET", "/v1/market/token_kline", query);
return this.authExistRequest("GET", "/v1/market/token_kline", query);
}
// ---- Portfolio endpoints (normal auth) ----
// ---- Portfolio endpoints ----
async getWalletHoldings(
chain: string,
walletAddress: string,
extra: Record<string, string | number> = {}
): Promise<unknown> {
return this.normalRequest("GET", "/v1/user/wallet_holdings", {
return this.authSignedRequest("GET", "/v1/user/wallet_holdings", {
chain,
wallet_address: walletAddress,
...extra,
});
}, null);
}
async getWalletActivity(
@@ -223,7 +260,7 @@ export class OpenApiClient {
walletAddress: string,
extra: Record<string, string | number | string[]> = {}
): Promise<unknown> {
return this.normalRequest("GET", "/v1/user/wallet_activity", {
return this.authExistRequest("GET", "/v1/user/wallet_activity", {
chain,
wallet_address: walletAddress,
...extra,
@@ -231,7 +268,7 @@ export class OpenApiClient {
}
async getWalletStats(chain: string, walletAddresses: string[], period = "7d"): Promise<unknown> {
return this.normalRequest("GET", "/v1/user/wallet_stats", {
return this.authExistRequest("GET", "/v1/user/wallet_stats", {
chain,
wallet_address: walletAddresses,
period,
@@ -243,46 +280,54 @@ export class OpenApiClient {
walletAddress: string,
tokenAddress: string
): Promise<unknown> {
return this.normalRequest("GET", "/v1/user/wallet_token_balance", { chain, wallet_address: walletAddress, token_address: tokenAddress });
return this.authExistRequest("GET", "/v1/user/wallet_token_balance", { chain, wallet_address: walletAddress, token_address: tokenAddress });
}
async getTrenches(chain: string, types?: string[], platforms?: string[], limit?: number, filters?: Record<string, number | string>): Promise<unknown> {
const body = buildTrenchesBody(chain, types, platforms, limit, filters);
return this.normalRequest("POST", "/v1/trenches", { chain }, body);
return this.authExistRequest("POST", "/v1/trenches", { chain }, body);
}
// ---- Market trending endpoints (normal auth) ----
// ---- Market trending endpoints (exist auth) ----
async getTrendingSwaps(
chain: string,
interval: string,
extra: Record<string, string | number | string[]> = {}
): Promise<unknown> {
return this.normalRequest("GET", "/v1/market/rank", { chain, interval, ...extra });
return this.authExistRequest("GET", "/v1/market/rank", { chain, interval, ...extra });
}
// ---- User endpoints (normal auth) ----
async getTokenSignalV2(chain: string, groups: TokenSignalGroup[]): Promise<unknown> {
return this.authExistRequest("POST", "/v1/market/token_signal", {}, { chain, groups });
}
// ---- User endpoints (exist auth) ----
async getUserInfo(): Promise<unknown> {
return this.normalRequest("GET", "/v1/user/info", {});
return this.authExistRequest("GET", "/v1/user/info", {});
}
async getFollowWallet(chain: string, extra: Record<string, string | number | string[]> = {}): Promise<unknown> {
return this.criticalRequest("GET", "/v1/trade/follow_wallet", { chain, ...extra }, null);
return this.authSignedRequest("GET", "/v1/trade/follow_wallet", { chain, ...extra }, null);
}
async getKol(chain?: string, limit?: number): Promise<unknown> {
const query: Record<string, string | number> = {};
if (chain) query["chain"] = chain;
if (limit != null) query["limit"] = limit;
return this.normalRequest("GET", "/v1/user/kol", query);
return this.authExistRequest("GET", "/v1/user/kol", query);
}
async getSmartMoney(chain?: string, limit?: number): Promise<unknown> {
const query: Record<string, string | number> = {};
if (chain) query["chain"] = chain;
if (limit != null) query["limit"] = limit;
return this.normalRequest("GET", "/v1/user/smartmoney", query);
return this.authExistRequest("GET", "/v1/user/smartmoney", query);
}
async getCreatedTokens(chain: string, walletAddress: string, extra: Record<string, string | number> = {}): Promise<unknown> {
return this.authExistRequest("GET", "/v1/user/created_tokens", { chain, wallet_address: walletAddress, ...extra });
}
async quoteOrder(
@@ -294,46 +339,54 @@ export class OpenApiClient {
slippage: number
): Promise<unknown> {
const query = { chain, from_address, input_token, output_token, input_amount, slippage };
return this.criticalRequest("GET", "/v1/trade/quote", query, null);
return this.authSignedRequest("GET", "/v1/trade/quote", query, null);
}
// ---- Swap endpoints (critical auth) ----
// ---- Swap endpoints (signed auth) ----
async swap(params: SwapParams): Promise<unknown> {
return this.criticalRequest("POST", "/v1/trade/swap", {}, params);
return this.authSignedRequest("POST", "/v1/trade/swap", {}, params);
}
async multiSwap(params: MultiSwapParams): Promise<unknown> {
return this.authSignedRequest("POST", "/v1/trade/multi_swap", {}, params);
}
async queryOrder(orderId: string, chain: string): Promise<unknown> {
return this.criticalRequest("GET", "/v1/trade/query_order", { order_id: orderId, chain }, null);
return this.authSignedRequest("GET", "/v1/trade/query_order", { order_id: orderId, chain }, null);
}
// ---- Strategy order endpoints (critical auth) ----
async getGasPrice(chain: string): Promise<unknown> {
return this.authExistRequest("GET", "/v1/trade/gas_price", { chain });
}
// ---- Strategy order endpoints (signed auth) ----
async createStrategyOrder(params: StrategyCreateParams): Promise<unknown> {
return this.criticalRequest("POST", "/v1/trade/strategy/create", {}, params);
return this.authSignedRequest("POST", "/v1/trade/strategy/create", {}, params);
}
async getStrategyOrders(chain: string, extra: Record<string, string | number> = {}): Promise<unknown> {
return this.criticalRequest("GET", "/v1/trade/strategy/orders", { chain, ...extra }, null);
return this.authSignedRequest("GET", "/v1/trade/strategy/orders", { chain, ...extra }, null);
}
async cancelStrategyOrder(params: StrategyCancelParams): Promise<unknown> {
return this.criticalRequest("POST", "/v1/trade/strategy/cancel", {}, params);
return this.authSignedRequest("POST", "/v1/trade/strategy/cancel", {}, params);
}
// ---- Cooking endpoints ----
async getCookingStatistics(): Promise<unknown> {
return this.normalRequest("GET", "/v1/cooking/statistics", {});
return this.authExistRequest("GET", "/v1/cooking/statistics", {});
}
async createToken(params: CreateTokenParams): Promise<unknown> {
return this.criticalRequest("POST", "/v1/cooking/create_token", {}, params);
return this.authSignedRequest("POST", "/v1/cooking/create_token", {}, params);
}
// ---- Internal methods ----
private async normalRequest(
private async authExistRequest(
method: string,
subPath: string,
queryExtra: Record<string, string | number | string[]>,
@@ -359,19 +412,19 @@ export class OpenApiClient {
}, true);
}
private async criticalRequest(
private async authSignedRequest(
method: string,
subPath: string,
queryExtra: Record<string, string | number>,
queryExtra: Record<string, string | number | string[]>,
body: unknown
): Promise<unknown> {
if (!this.privateKeyPem) {
throw new Error("GMGN_PRIVATE_KEY is required for critical-auth commands (swap and all order commands)");
throw new Error("GMGN_PRIVATE_KEY is required for critical-auth commands (swap, order, follow-wallet, and portfolio holdings commands)");
}
return this.executePreparedRequest(() => {
const { timestamp, client_id } = buildAuthQuery();
const query: Record<string, string | number> = { ...queryExtra, timestamp, client_id };
const query: Record<string, string | number | string[]> = { ...queryExtra, timestamp, client_id };
const bodyStr = body !== null ? JSON.stringify(body) : "";
const message = buildMessage(subPath, query, bodyStr, timestamp);
const signature = sign(message, this.privateKeyPem!, detectAlgorithm(this.privateKeyPem!));
+12 -4
View File
@@ -30,19 +30,27 @@ export function buildAuthQuery(): { timestamp: number; client_id: string } {
}
/**
* Build the signature message (critical auth)
* Build the signature message (signed auth)
* Format: {sub_path}:{sorted_query_string}:{request_body}:{timestamp}
* sorted_query_string: all query params (including timestamp, client_id) sorted alphabetically by key
* sorted_query_string: all query params (including timestamp, client_id) sorted alphabetically by key.
* Array values are serialized as repeated k=v pairs (same as buildUrl / URLSearchParams), sorted by value.
*/
export function buildMessage(
subPath: string,
queryParams: Record<string, string | number>,
queryParams: Record<string, string | number | string[]>,
body: string,
timestamp: number
): string {
const sortedQs = Object.keys(queryParams)
.sort()
.map((k) => `${k}=${queryParams[k]}`)
.flatMap((k) => {
const ek = encodeURIComponent(k);
const v = queryParams[k];
if (Array.isArray(v)) {
return [...v].sort().map((item) => `${ek}=${encodeURIComponent(item)}`);
}
return [`${ek}=${encodeURIComponent(String(v))}`];
})
.join("&");
return `${subPath}:${sortedQs}:${body}:${timestamp}`;
}
+1 -1
View File
@@ -9,7 +9,7 @@ export function registerCookingCommands(program: Command): void {
cooking
.command("stats")
.description("Get token creation statistics by launchpad (normal auth)")
.description("Get token creation statistics by launchpad (exist auth)")
.option("--raw", "Output raw JSON")
.action(async (opts) => {
const client = new OpenApiClient(getConfig());
+79 -10
View File
@@ -1,16 +1,32 @@
import { Command } from "commander";
import { OpenApiClient } from "../client/OpenApiClient.js";
import { OpenApiClient, TokenSignalGroup } from "../client/OpenApiClient.js";
import { getConfig } from "../config.js";
import { exitOnError, printResult } from "../output.js";
import { validateAddress, validateChain } from "../validate.js";
// Parse token age string. If a unit suffix is present (s/m), use it as-is.
// Bare numbers (no unit) are treated as minutes with a warning.
function parseDuration(value: string): string {
if (/^\d+(\.\d+)?[sm]$/.test(value)) return value;
if (/^\d+(\.\d+)?$/.test(value)) {
console.warn(
`[gmgn-cli] Warning: no unit specified for duration "${value}" — treating as minutes (${value}m). Use a suffix to be explicit: ${value}s for seconds or ${value}m for minutes.`
);
return `${value}m`;
}
console.error(
`[gmgn-cli] Invalid duration "${value}". Use seconds (e.g. 30s) or minutes (e.g. 0.5m / 1m / 5m).`
);
process.exit(1);
}
export function registerMarketCommands(program: Command): void {
const market = program.command("market").description("Market data commands");
market
.command("kline")
.description("Get token K-line (candlestick) data")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--address <address>", "Token contract address")
.requiredOption("--resolution <resolution>", "Candlestick resolution: 1m / 5m / 15m / 1h / 4h / 1d")
.option("--from <timestamp>", "Start time (Unix seconds)", parseInt)
@@ -35,7 +51,7 @@ export function registerMarketCommands(program: Command): void {
market
.command("trending")
.description("Get trending token swap data")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.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)")
@@ -76,6 +92,8 @@ export function registerMarketCommands(program: Command): void {
trenchesCmd.option(`--${flag} <${def.type}>`, def.desc, parseInt);
} else if (def.type === "float") {
trenchesCmd.option(`--${flag} <${def.type}>`, def.desc, parseFloat);
} else if (def.type === "duration") {
trenchesCmd.option(`--${flag} <duration>`, def.desc, parseDuration);
} else {
trenchesCmd.option(`--${flag} <value>`, def.desc);
}
@@ -115,11 +133,61 @@ export function registerMarketCommands(program: Command): void {
: data;
printResult(result, opts.raw);
});
market
.command("signal")
.description("Query token signals (price spikes, smart money buys, large buys, etc.) — max 50 results per group")
.requiredOption("--chain <chain>", "Chain: sol / bsc")
.option("--signal-type <n...>", "Signal type(s), repeatable: 118 (default: all types)", (v: string, acc: number[]) => { acc.push(parseInt(v, 10)); return acc; }, [] as number[])
.option("--mc-min <usd>", "Min market cap at trigger time (USD)", parseFloat)
.option("--mc-max <usd>", "Max market cap at trigger time (USD)", parseFloat)
.option("--trigger-mc-min <usd>", "Min market cap at signal trigger (USD)", parseFloat)
.option("--trigger-mc-max <usd>", "Max market cap at signal trigger (USD)", parseFloat)
.option("--total-fee-min <usd>", "Min total fees paid (USD)", parseFloat)
.option("--total-fee-max <usd>", "Max total fees paid (USD)", parseFloat)
.option("--min-create-or-open-ts <ts>", "Min token creation or open timestamp (Unix seconds string)")
.option("--max-create-or-open-ts <ts>", "Max token creation or open timestamp (Unix seconds string)")
.option("--groups <json>", "Multi-group override: JSON array of group objects — overrides all individual flags when provided")
.option("--raw", "Output raw JSON")
.action(async (opts: Record<string, unknown>) => {
validateChain(opts["chain"] as string);
if (!["sol", "bsc"].includes(opts["chain"] as string)) {
console.error(`[gmgn-cli] market signal only supports sol and bsc, got "${opts["chain"]}"`);
process.exit(1);
}
let groups: TokenSignalGroup[];
if (opts["groups"] != null) {
try {
groups = JSON.parse(opts["groups"] as string) as TokenSignalGroup[];
} catch {
console.error(`[gmgn-cli] --groups must be a valid JSON array, e.g. '[{"signal_type":[12,14]},{"signal_type":[6,7],"mc_min":50000}]'`);
process.exit(1);
}
} else {
const group: TokenSignalGroup = {};
const signalType = opts["signalType"] as number[] | undefined;
if (signalType?.length) group.signal_type = signalType;
if (opts["mcMin"] != null) group.mc_min = opts["mcMin"] as number;
if (opts["mcMax"] != null) group.mc_max = opts["mcMax"] as number;
if (opts["triggerMcMin"] != null) group.trigger_mc_min = opts["triggerMcMin"] as number;
if (opts["triggerMcMax"] != null) group.trigger_mc_max = opts["triggerMcMax"] as number;
if (opts["totalFeeMin"] != null) group.total_fee_min = opts["totalFeeMin"] as number;
if (opts["totalFeeMax"] != null) group.total_fee_max = opts["totalFeeMax"] as number;
if (opts["minCreateOrOpenTs"] != null) group.min_create_or_open_ts = opts["minCreateOrOpenTs"] as string;
if (opts["maxCreateOrOpenTs"] != null) group.max_create_or_open_ts = opts["maxCreateOrOpenTs"] as string;
groups = [group];
}
const client = new OpenApiClient(getConfig());
const data = await client.getTokenSignalV2(opts["chain"] as string, groups).catch(exitOnError);
printResult(data, opts["raw"] as boolean | undefined);
});
}
// ---- Trenches filter field definitions ----
type TrenchesFieldType = "int" | "float" | "string";
type TrenchesFieldType = "int" | "float" | "string" | "duration";
interface TrenchesFilterField {
api: string;
@@ -151,8 +219,8 @@ const TRENCHES_FILTER_FIELDS: TrenchesFilterField[] = [
{ api: "min_liquidity", type: "float", desc: "Min liquidity (USD)" },
{ api: "max_liquidity", type: "float", desc: "Max liquidity (USD)" },
// Token age
{ api: "min_created", type: "string", desc: "Min token age (e.g. 1m / 5m / 30m / 1h / 6h / 24h)" },
{ api: "max_created", type: "string", desc: "Max token age (e.g. 1m / 5m / 30m / 1h / 6h / 24h)" },
{ api: "min_created", type: "duration", desc: "Min token age — unit recommended: seconds (e.g. 30s) or minutes (e.g. 0.5m / 1m / 5m / 30m). Bare numbers treated as minutes." },
{ api: "max_created", type: "duration", desc: "Max token age — unit recommended: seconds (e.g. 30s) or minutes (e.g. 0.5m / 1m / 5m / 30m). Bare numbers treated as minutes." },
// Holders
{ api: "min_holder_count", type: "int", desc: "Min holder count" },
{ api: "max_holder_count", type: "int", desc: "Max holder count" },
@@ -222,13 +290,14 @@ const TRENCHES_FILTER_PRESETS: Record<string, Record<string, number | string>> =
};
// Convert API snake_case field to Commander.js opts key
// Commander.js camelCase: only converts -[a-z] patterns, digits stay as-is
// e.g. min_volume_24h → min-volume-24h → minVolume-24h (digit prefix -24 is NOT converted)
// e.g. min_smart_degen_count → min-smart-degen-count → minSmartDegenCount (all letters, converts fully)
// Commander.js camelCase: converts -[a-z] to uppercase, and removes hyphen before digits
// e.g. min_volume_24h → min-volume-24h → minVolume-24h → minVolume24h
// e.g. min_smart_degen_count → min-smart-degen-count → minSmartDegenCount
function apiFieldToCliKey(apiField: string): string {
return apiField
.replace(/_/g, '-')
.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase());
.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase())
.replace(/-(\d)/g, '$1');
}
// Client-side sort helpers (API does not support server-side sort for trenches)
+25 -4
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")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.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")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.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")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.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")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--wallet <address>", "Wallet address")
.requiredOption("--token <address>", "Token contract address")
.option("--raw", "Output raw JSON")
@@ -109,5 +109,26 @@ export function registerPortfolioCommands(program: Command): void {
printResult(data, opts.raw);
});
portfolio
.command("created-tokens")
.description("Get tokens created by a developer wallet")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--wallet <address>", "Developer wallet address")
.option("--order-by <field>", "Sort field: market_cap / token_ath_mc")
.option("--direction <dir>", "Sort direction: asc / desc")
.option("--migrate-state <state>", "Filter: migrated / non_migrated")
.option("--raw", "Output raw JSON")
.action(async (opts) => {
validateChain(opts.chain);
validateAddress(opts.wallet, opts.chain, "--wallet");
const extra: Record<string, string | number> = {};
if (opts.orderBy) extra["order_by"] = opts.orderBy;
if (opts.direction) extra["direction"] = opts.direction;
if (opts.migrateState) extra["migrate_state"] = opts.migrateState;
const client = new OpenApiClient(getConfig());
const data = await client.getCreatedTokens(opts.chain, opts.wallet, extra).catch(exitOnError);
printResult(data, opts.raw);
});
}
+107 -14
View File
@@ -1,5 +1,5 @@
import { Command } from "commander";
import { OpenApiClient, SwapParams, StrategyCreateParams, StrategyCancelParams } from "../client/OpenApiClient.js";
import { OpenApiClient, SwapParams, MultiSwapParams, StrategyCreateParams, StrategyCancelParams } from "../client/OpenApiClient.js";
import { getConfig } from "../config.js";
import { exitOnError, printResult } from "../output.js";
import { validateAddress, validateChain, validatePercent, validatePositiveInt } from "../validate.js";
@@ -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")
.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")
@@ -20,10 +20,11 @@ export function registerSwapCommands(program: Command): void {
.option("--anti-mev", "Enable anti-MEV protection, default true")
.option("--priority-fee <sol>", "Priority fee in SOL (≥ 0.00001, SOL only)")
.option("--tip-fee <amount>", "Tip fee (SOL ≥ 0.00001 SOL / BSC ≥ 0.000001 BNB)")
.option("--max-auto-fee <amount>", "Max auto fee cap")
.option("--gas-price <gwei>", "Gas price in gwei (BSC ≥ 0.05 / BASE/ETH ≥ 0.01)")
.option("--max-fee-per-gas <amount>", "EIP-1559 max fee per gas (Base)")
.option("--max-priority-fee-per-gas <amount>", "EIP-1559 max priority fee per gas (Base)")
.option("--gas-price <gwei>", "Gas price in gwei (BSC ≥ 0.05 / BASE/ETH ≥ 0.01); mutually exclusive with --gas-level")
.option("--gas-level <level>", "Gas price tier (eth only): low / average / high; mutually exclusive with --gas-price")
.option("--auto-fee", "Auto fee mode (eth only); delegates fee selection to trading bot for condition_orders strategy")
.option("--max-fee-per-gas <amount>", "EIP-1559 max fee per gas (BSC / BASE / ETH)")
.option("--max-priority-fee-per-gas <amount>", "EIP-1559 max priority fee per gas (BSC / BASE / ETH)")
.option("--condition-orders <json>", 'JSON array of take-profit/stop-loss conditions, e.g. \'[{"order_type":"profit_stop","side":"sell","price_scale":"150","sell_ratio":"100"}]\'; trace types: \'[{"order_type":"profit_stop_trace","side":"sell","price_scale":"150","sell_ratio":"100","drawdown_rate":"50"}]\'')
.option("--sell-ratio-type <type>", "Sell ratio base: buy_amount (default) / hold_amount; only used with --condition-orders")
.option("--raw", "Output raw JSON")
@@ -40,7 +41,7 @@ export function registerSwapCommands(program: Command): void {
if (opts.percent != null) validatePercent(opts.percent);
const params: SwapParams = {
chain: opts.chain,
from_address: opts.from,
from_address: opts.chain === "sol" ? opts.from : opts.from.toLowerCase(),
input_token: opts.inputToken,
output_token: opts.outputToken,
input_amount: opts.percent != null ? (opts.amount ?? "0") : opts.amount,
@@ -52,8 +53,9 @@ export function registerSwapCommands(program: Command): void {
if (opts.antiMev) params.is_anti_mev = true;
if (opts.priorityFee) params.priority_fee = opts.priorityFee;
if (opts.tipFee) params.tip_fee = opts.tipFee;
if (opts.maxAutoFee) params.max_auto_fee = opts.maxAutoFee;
if (opts.autoFee) params.auto_fee = true;
if (opts.gasPrice) params.gas_price = String(Math.round(parseFloat(opts.gasPrice) * 1e9));
if (opts.gasLevel) params.gas_level = opts.gasLevel;
if (opts.maxFeePerGas) params.max_fee_per_gas = opts.maxFeePerGas;
if (opts.maxPriorityFeePerGas) params.max_priority_fee_per_gas = opts.maxPriorityFeePerGas;
if (opts.conditionOrders) {
@@ -71,12 +73,84 @@ export function registerSwapCommands(program: Command): void {
printResult(data, opts.raw);
});
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("--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")
.option("--input-amount <json>", 'JSON map of wallet→amount (smallest unit), e.g. \'{"addr1":"1000000","addr2":"2000000"}\'')
.option("--input-amount-bps <json>", 'JSON map of wallet→percent in bps (110000, e.g. 5000=50%), e.g. \'{"addr1":"5000"}\'')
.option("--output-amount <json>", "JSON map of wallet→target output amount")
.option("--slippage <n>", "Slippage tolerance (e.g. 0.01 = 1%)", parseFloat)
.option("--auto-slippage", "Enable automatic slippage")
.option("--anti-mev", "Enable anti-MEV protection")
.option("--priority-fee <sol>", "Priority fee in SOL (SOL only, ≥ 0.00001)")
.option("--tip-fee <amount>", "Tip fee (SOL ≥ 0.00001 / BSC ≥ 0.000001 BNB)")
.option("--gas-price <gwei>", "Gas price in gwei (BSC ≥ 0.05 / BASE/ETH ≥ 0.01); mutually exclusive with --gas-level")
.option("--gas-level <level>", "Gas price tier (eth only): low / average / high; mutually exclusive with --gas-price")
.option("--auto-fee", "Auto fee mode (eth only); delegates fee selection to trading bot for condition_orders strategy")
.option("--max-fee-per-gas <amount>", "EIP-1559 max fee per gas (BSC / BASE / ETH)")
.option("--max-priority-fee-per-gas <amount>", "EIP-1559 max priority fee per gas (BSC / BASE / ETH)")
.option("--condition-orders <json>", "JSON array of take-profit/stop-loss conditions attached to each successful wallet's swap")
.option("--sell-ratio-type <type>", "Sell ratio base: buy_amount (default) / hold_amount; only used with --condition-orders")
.option("--raw", "Output raw JSON")
.action(async (opts) => {
if (!opts.inputAmount && !opts.inputAmountBps && !opts.outputAmount) {
console.error("[gmgn-cli] At least one of --input-amount, --input-amount-bps, or --output-amount must be provided");
process.exit(1);
}
validateChain(opts.chain);
const accounts = (opts.accounts as string).split(",").map((a: string) => a.trim()).filter(Boolean);
if (accounts.length === 0 || accounts.length > 100) {
console.error("[gmgn-cli] --accounts must be 1100 comma-separated wallet addresses");
process.exit(1);
}
const params: MultiSwapParams = {
chain: opts.chain,
accounts: opts.chain === "sol" ? accounts : accounts.map((a: string) => a.toLowerCase()),
input_token: opts.inputToken,
output_token: opts.outputToken,
};
if (opts.inputAmount) {
try { params.input_amount = JSON.parse(opts.inputAmount); }
catch { console.error("[gmgn-cli] --input-amount must be valid JSON"); process.exit(1); }
}
if (opts.inputAmountBps) {
try { params.input_amount_bps = JSON.parse(opts.inputAmountBps); }
catch { console.error("[gmgn-cli] --input-amount-bps must be valid JSON"); process.exit(1); }
}
if (opts.outputAmount) {
try { params.output_amount = JSON.parse(opts.outputAmount); }
catch { console.error("[gmgn-cli] --output-amount must be valid JSON"); process.exit(1); }
}
if (opts.slippage != null) params.slippage = opts.slippage;
if (opts.autoSlippage) params.auto_slippage = true;
if (opts.antiMev) params.is_anti_mev = true;
if (opts.priorityFee) params.priority_fee = opts.priorityFee;
if (opts.tipFee) params.tip_fee = opts.tipFee;
if (opts.autoFee) params.auto_fee = true;
if (opts.gasPrice) params.gas_price = String(Math.round(parseFloat(opts.gasPrice) * 1e9));
if (opts.gasLevel) params.gas_level = opts.gasLevel;
if (opts.maxFeePerGas) params.max_fee_per_gas = opts.maxFeePerGas;
if (opts.maxPriorityFeePerGas) params.max_priority_fee_per_gas = opts.maxPriorityFeePerGas;
if (opts.conditionOrders) {
try { params.condition_orders = JSON.parse(opts.conditionOrders); }
catch { console.error("[gmgn-cli] --condition-orders must be valid JSON"); process.exit(1); }
}
if (opts.sellRatioType) params.sell_ratio_type = opts.sellRatioType;
const client = new OpenApiClient(getConfig(true));
const data = await client.multiSwap(params).catch(exitOnError);
printResult(data, opts.raw);
});
const order = program.command("order").description("Order management commands");
order
.command("quote")
.description("Get a swap quote without submitting a transaction (requires critical auth)")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base (requires GMGN_PRIVATE_KEY)")
.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)")
.requiredOption("--input-token <address>", "Input token contract address")
.requiredOption("--output-token <address>", "Output token contract address")
@@ -109,12 +183,23 @@ export function registerSwapCommands(program: Command): void {
printResult(data, opts.raw);
});
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")
.option("--raw", "Output raw JSON")
.action(async (opts) => {
const client = new OpenApiClient(getConfig(false));
const data = await client.getGasPrice(opts.chain).catch(exitOnError);
printResult(data, opts.raw);
});
const strategy = order.command("strategy").description("Limit/strategy order management");
strategy
.command("create")
.description("Create a limit/strategy order (requires private key)")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.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")
@@ -130,7 +215,11 @@ export function registerSwapCommands(program: Command): void {
.option("--auto-slippage", "Enable automatic slippage")
.option("--priority-fee <sol>", "Priority fee in SOL (required for SOL chain)")
.option("--tip-fee <amount>", "Tip fee (required for SOL chain)")
.option("--gas-price <gwei>", "Gas price in gwei (required for BSC; ≥ 0.05 gwei / BASE/ETH ≥ 0.01 gwei)")
.option("--auto-fee", "Auto fee mode (eth only); delegates fee selection to trading bot")
.option("--gas-price <gwei>", "Gas price in gwei (BSC ≥ 0.05 / BASE/ETH ≥ 0.01 gwei); mutually exclusive with --gas-level")
.option("--gas-level <level>", "Gas price tier (eth only): low / average / high; mutually exclusive with --gas-price")
.option("--max-fee-per-gas <amount>", "EIP-1559 max fee per gas (BSC / BASE / ETH)")
.option("--max-priority-fee-per-gas <amount>", "EIP-1559 max priority fee per gas (BSC / BASE / ETH)")
.option("--anti-mev", "Enable anti-MEV protection")
.option("--raw", "Output raw JSON")
.action(async (opts) => {
@@ -161,7 +250,11 @@ export function registerSwapCommands(program: Command): void {
if (opts.autoSlippage) params.auto_slippage = true;
if (opts.priorityFee) params.priority_fee = opts.priorityFee;
if (opts.tipFee) params.tip_fee = opts.tipFee;
if (opts.autoFee) params.auto_fee = true;
if (opts.gasPrice) params.gas_price = String(Math.round(parseFloat(opts.gasPrice) * 1e9));
if (opts.gasLevel) params.gas_level = opts.gasLevel;
if (opts.maxFeePerGas) params.max_fee_per_gas = opts.maxFeePerGas;
if (opts.maxPriorityFeePerGas) params.max_priority_fee_per_gas = opts.maxPriorityFeePerGas;
if (opts.antiMev) params.is_anti_mev = true;
const client = new OpenApiClient(getConfig(true));
const data = await client.createStrategyOrder(params).catch(exitOnError);
@@ -171,7 +264,7 @@ export function registerSwapCommands(program: Command): void {
strategy
.command("list")
.description("List strategy orders (requires private key)")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.option("--type <type>", "open (default) / history")
.option("--from <address>", "Filter by wallet address")
.option("--group-tag <tag>", "Filter by group: LimitOrder / STMix")
@@ -196,7 +289,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")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.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")
+7 -7
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")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.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")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.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")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.requiredOption("--address <address>", "Token contract address")
.option("--raw", "Output raw JSON")
.action(async (opts) => {
@@ -52,12 +52,12 @@ export function registerTokenCommands(program: Command): void {
token
.command("holders")
.description("Get top token holders")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.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")
.option("--direction <dir>", "Sort direction: asc / desc", "desc")
.option("--tag <tag>", "Wallet tag filter: renowned / smart_degen")
.option("--tag <tag>", "Wallet tag filter: smart_degen / renowned / fresh_wallet / dev / sniper / rat_trader / bundler / transfer_in / dex_bot / bluechip_owner")
.option("--raw", "Output raw JSON")
.action(async (opts) => {
validateChain(opts.chain);
@@ -75,12 +75,12 @@ export function registerTokenCommands(program: Command): void {
token
.command("traders")
.description("Get top token traders")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.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")
.option("--direction <dir>", "Sort direction: asc / desc", "desc")
.option("--tag <tag>", "Wallet tag filter: renowned / smart_degen")
.option("--tag <tag>", "Wallet tag filter: smart_degen / renowned / fresh_wallet / dev / sniper / rat_trader / bundler / transfer_in / dex_bot / bluechip_owner")
.option("--raw", "Output raw JSON")
.action(async (opts) => {
validateChain(opts.chain);
+4 -4
View File
@@ -10,7 +10,7 @@ export function registerTrackCommands(program: Command): void {
track
.command("follow-wallet")
.description("Get follow-wallet trade records")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.option("--wallet <address>", "Filter by wallet address")
.option("--limit <n>", "Page size (1100, default 10)", parseInt)
.option("--side <side>", "Trade direction filter: buy / sell")
@@ -27,7 +27,7 @@ export function registerTrackCommands(program: Command): void {
if (opts.filter?.length) extra["filters"] = opts.filter;
if (opts.minAmountUsd != null) extra["min_amount_usd"] = opts.minAmountUsd;
if (opts.maxAmountUsd != null) extra["max_amount_usd"] = opts.maxAmountUsd;
const client = new OpenApiClient(getConfig(true));
const client = new OpenApiClient(getConfig());
const data = await client.getFollowWallet(opts.chain, extra).catch(exitOnError);
printResult(data, opts.raw);
});
@@ -35,7 +35,7 @@ export function registerTrackCommands(program: Command): void {
track
.command("kol")
.description("Get KOL trade records")
.option("--chain <chain>", "Chain: sol / bsc / base")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.option("--limit <n>", "Page size (1200, default 100)", parseInt)
.option("--side <side>", "Filter by trade direction: buy / sell (client-side filter)")
.option("--raw", "Output raw JSON")
@@ -52,7 +52,7 @@ export function registerTrackCommands(program: Command): void {
track
.command("smartmoney")
.description("Get Smart Money trade records")
.option("--chain <chain>", "Chain: sol / bsc / base")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.option("--limit <n>", "Page size (1200, default 100)", parseInt)
.option("--side <side>", "Filter by trade direction: buy / sell (client-side filter)")
.option("--raw", "Output raw JSON")
+5 -5
View File
@@ -3,9 +3,9 @@ import { homedir } from "os";
import { join } from "path";
// Load global config first (~/.config/gmgn/.env), then project .env (project takes precedence)
loadDotenv({ path: join(homedir(), ".config", "gmgn", ".env") });
loadDotenv({ override: true });
// Load global config first (~/.config/gmgn/.env, takes precedence), then project .env (supplements only)
loadDotenv({ path: join(homedir(), ".config", "gmgn", ".env"), override: true });
loadDotenv();
export interface Config {
apiKey: string;
@@ -15,7 +15,7 @@ export interface Config {
let _config: Config | null = null;
const PRIVATE_KEY_REQUIRED_MSG =
"GMGN_PRIVATE_KEY is required for critical-auth commands (swap and all order commands)";
"GMGN_PRIVATE_KEY is required for critical-auth commands (swap, order, and follow-wallet commands)";
export function getConfig(requirePrivateKey = false): Config {
if (_config) {
@@ -39,7 +39,7 @@ export function getConfig(requirePrivateKey = false): Config {
die(PRIVATE_KEY_REQUIRED_MSG);
}
const host = process.env.GMGN_HOST ?? "https://openapi.gmgn.ai";
const host = "https://openapi.gmgn.ai";
_config = { apiKey: apiKey!, privateKeyPem, host };
return _config;
}