mirror of
https://github.com/GMGNAI/gmgn-skills.git
synced 2026-07-28 01:07:44 +00:00
Compare commits
185 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e1ba6181c | |||
| b7b6250766 | |||
| e3b713b150 | |||
| ac1ea2e336 | |||
| b782743c8c | |||
| d56c904b26 | |||
| 3ecd76c572 | |||
| d0e9e42f17 | |||
| 18a0bf98b1 | |||
| 1b27af9bb8 | |||
| 1ab38a1685 | |||
| bdf1996e2f | |||
| 36771529d7 | |||
| 01a376a951 | |||
| 88643ca05c | |||
| d701420705 | |||
| 48a94a46a5 | |||
| ec35707d15 | |||
| cc2fc0ed00 | |||
| 5453373ffa | |||
| e8af4b88b5 | |||
| 845a8aaa62 | |||
| ed58e67180 | |||
| ca55a80d12 | |||
| 4205bda0af | |||
| 0b140b4a5f | |||
| aa74d04839 | |||
| 6461d2f8df | |||
| 22d2ad25d5 | |||
| 25f4207351 | |||
| d0ca1b40ce | |||
| 4e54086137 | |||
| fcd14effbf | |||
| d34315ce98 | |||
| b6c4ff50f2 | |||
| e6dfca48d8 | |||
| 362d180910 | |||
| d5c43eed51 | |||
| 968013ebce | |||
| 3d11f8c6d6 | |||
| f15e8271f9 | |||
| eda0ac9f52 | |||
| b940c66c00 | |||
| 1964e927cd | |||
| 0f3d550736 | |||
| 23ca9d8670 | |||
| 67d53cd3e4 | |||
| ca51ee6a7a | |||
| f5442f6247 | |||
| 0dabd4b93b | |||
| 73d81fa0b2 | |||
| 4ef54b0bcc | |||
| dd41e38755 | |||
| 2d0cb7348d | |||
| ddc025bb97 | |||
| e9b08214a2 | |||
| f96519941e | |||
| fd8a1c4d2a | |||
| 0282a9a09b | |||
| 17d7de841e | |||
| bc64360e80 | |||
| 134a11593c | |||
| 32d2fd2aac | |||
| 8ed53df6d7 | |||
| a161bd733d | |||
| f172b1922d | |||
| 31f5b9f5b6 | |||
| c6fae6afe7 | |||
| ec5719ce12 | |||
| aebe509f29 | |||
| 26ebfe6843 | |||
| 412531f04e | |||
| b0b25118aa | |||
| 0a12f0615d | |||
| 0979d14d6a | |||
| 8729cff4d3 | |||
| 0cf2e514e6 | |||
| 693a63c723 | |||
| 81d67808fa | |||
| 8a095a99a8 | |||
| 0bc73a6430 | |||
| d00a1d3ce3 | |||
| 30e535617f | |||
| f64a3e086b | |||
| 60438dff5c | |||
| 6f0d4464e2 | |||
| 48e7346d8e | |||
| 2f76b375c5 | |||
| a65d5fd1cb | |||
| 7d16bd80e8 | |||
| 9dfccd129d | |||
| ce7f762e5b | |||
| d51f1c49d3 | |||
| 17b901c29f | |||
| f3738e0bd4 | |||
| f05e1d5d20 | |||
| beedf14b5b | |||
| 1b9e2c24d6 | |||
| a3dfa99763 | |||
| 317c7d982b | |||
| 15872373cd | |||
| 674c7032a8 | |||
| 4649a7a287 | |||
| 2b33ee666c | |||
| 123bdba738 | |||
| 1d03fb1672 | |||
| 6f79600869 | |||
| 12ab55bb63 | |||
| aa09490a9b | |||
| b3e99dde94 | |||
| 2b6c220581 | |||
| 072b180119 | |||
| e181cba142 | |||
| ee04212098 | |||
| e4496eafeb | |||
| f56cf1f966 | |||
| 698ae707e8 | |||
| 34fc2f9e2a | |||
| 5ef03579cf | |||
| 1d433724d3 | |||
| 26a50c7046 | |||
| 56a3a60352 | |||
| 211f7d6fd0 | |||
| 5e1560188e | |||
| 08f7b66251 | |||
| 48c596ab10 | |||
| ec099ea399 | |||
| 1012cfffb8 | |||
| f6f1d56b82 | |||
| b83422769f | |||
| 8922811e04 | |||
| cc1cb48db9 | |||
| 981600f170 | |||
| 1f49d61363 | |||
| 3046c6d6cd | |||
| ee4838d565 | |||
| f19a1919da | |||
| 4cfe0e0fb5 | |||
| 5755206b58 | |||
| 6ab9cb108b | |||
| 51d2214253 | |||
| 8d3541c2a3 | |||
| 39d80429f6 | |||
| fd226c654b | |||
| a08fc7b580 | |||
| f49c89e609 | |||
| ad4eab3852 | |||
| 6fd302af60 | |||
| cdcf4e11d3 | |||
| 319c4bbf33 | |||
| 2b61eb807a | |||
| 46c56b7e5d | |||
| b18738177c | |||
| cfb4270816 | |||
| 932bf8c82c | |||
| 4143e07266 | |||
| 4f96fedbb1 | |||
| eeb4a77cf7 | |||
| f7c051e2d1 | |||
| 8bc1b2be6b | |||
| 990601d031 | |||
| db55c77a26 | |||
| 91473cc366 | |||
| 38bff1aecb | |||
| 6d09536349 | |||
| cd9b285b3f | |||
| c6141c880f | |||
| 3551bc3a25 | |||
| 8448787176 | |||
| 04389b98f0 | |||
| 2949ea7de3 | |||
| 4dde77c481 | |||
| 02d497df92 | |||
| 48a06cd9b4 | |||
| 9e90bb9c07 | |||
| 31fababfd8 | |||
| 6833ff19cd | |||
| ccf3dc1c23 | |||
| 3c1ffdd7eb | |||
| 10d9c592d2 | |||
| ff3f52f3d8 | |||
| 1ea71149d9 | |||
| ca3c640afc | |||
| 2073b5fdaf | |||
| fce314b9ab |
@@ -4,6 +4,7 @@ on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -18,3 +18,8 @@ dist
|
||||
|
||||
# Internal / testing (not for public release)
|
||||
testing/
|
||||
|
||||
# Local Claude Code configs (dev environment only)
|
||||
.claude/
|
||||
.agents/
|
||||
skills-lock.json
|
||||
|
||||
@@ -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 / **order quote** | `GMGN_API_KEY` only, no signature |
|
||||
| Critical | swap / order (except order quote) / portfolio holdings / track follow-wallet | `GMGN_API_KEY` + `GMGN_PRIVATE_KEY` — CLI handles signing automatically |
|
||||
|
||||
## SKILL.md Authoring Rules
|
||||
|
||||
|
||||
@@ -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 |
|
||||
|------|-------------|
|
||||
@@ -42,6 +42,14 @@ Data across SOL / BSC / Base is live on every query. Supports multi-parameter cu
|
||||
- Market orders, limit orders, and strategy orders (take-profit / stop-loss) in a single command.
|
||||
- Sell by position percentage (`--percent 50`) without calculating exact amounts.
|
||||
|
||||
| Order Type | Description |
|
||||
|------------|-------------|
|
||||
| Market Order | Instant execution at current market price |
|
||||
| Limit Order | Trigger buy or sell at a specified price |
|
||||
| Take-Profit / Stop-Loss | Fixed-price exit conditions attached to a swap |
|
||||
| Trailing Take-Profit / Trailing Stop-Loss | Tracks price peak; fires after a specified drawdown % — rides momentum while protecting gains |
|
||||
| Multi-Wallet Batch Trading | Buy with multiple wallets simultaneously, each with its own take-profit / stop-loss / trailing take-profit / trailing stop-loss orders |
|
||||
|
||||
### 3. More comprehensive token data
|
||||
|
||||
No more scraping web pages or getting blocked by Cloudflare. Query all the professional analytics needed for high-frequency Meme token trading, with high concurrency in real time (including but not limited to):
|
||||
@@ -158,7 +166,7 @@ echo 'GMGN_API_KEY=<user_api_key>' > ~/.config/gmgn/.env
|
||||
chmod 600 ~/.config/gmgn/.env
|
||||
```
|
||||
|
||||
If the user also needs swap capability, append the private key:
|
||||
If the user also needs swap or order capability, append the private key:
|
||||
|
||||
```bash
|
||||
# Append private key (use the PEM content from Step 3)
|
||||
@@ -453,6 +461,13 @@ gmgn-cli market trending \
|
||||
--order-by volume --limit 20 \
|
||||
--filter not_risk --filter not_honeypot
|
||||
|
||||
# Trending with numeric range filters (min_*/max_* are forwarded as query params)
|
||||
gmgn-cli market trending \
|
||||
--chain sol --interval 1h \
|
||||
--min-liquidity 10000 --max-liquidity 1000000 \
|
||||
--max-created 30m --min-smart-degen-count 1 \
|
||||
--order-by volume --limit 30
|
||||
|
||||
gmgn-cli market trenches \
|
||||
--chain sol \
|
||||
--type new_creation --type near_completion --type completed \
|
||||
@@ -463,6 +478,23 @@ 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
|
||||
|
||||
# Hot searches — most-searched tokens (default 7-chain set, 24h)
|
||||
gmgn-cli market hot-searches --raw
|
||||
|
||||
# Hot searches — SOL only, 1h window, top 50
|
||||
gmgn-cli market hot-searches --chain sol --interval 1h --limit 50 --raw
|
||||
|
||||
# Hot searches — SOL with range filters (same metric names as trending)
|
||||
gmgn-cli market hot-searches --chain sol --interval 1h \
|
||||
--min-liquidity 10000 --min-smart-degen-count 1 --raw
|
||||
```
|
||||
|
||||
### Portfolio
|
||||
@@ -482,14 +514,20 @@ 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)
|
||||
# Followed token map for a wallet
|
||||
gmgn-cli track follow-tokens --chain sol --wallet <wallet_address>
|
||||
|
||||
# Follow-wallet trade records
|
||||
gmgn-cli track follow-wallet --chain sol
|
||||
gmgn-cli track follow-wallet --chain sol --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
|
||||
@@ -500,7 +538,7 @@ gmgn-cli track smartmoney --limit 100 --raw
|
||||
gmgn-cli track smartmoney --chain sol --side sell --limit 50 --raw
|
||||
```
|
||||
|
||||
### Swap (requires private key)
|
||||
### Swap / Quote / Query
|
||||
|
||||
```bash
|
||||
# Submit swap with fixed slippage
|
||||
@@ -510,7 +548,7 @@ gmgn-cli swap \
|
||||
--input-token <input-token-addr> \
|
||||
--output-token <output-token-addr> \
|
||||
--amount 1000000 \
|
||||
--slippage 0.01
|
||||
--slippage 30
|
||||
|
||||
# Submit swap with automatic slippage
|
||||
gmgn-cli swap \
|
||||
@@ -537,12 +575,66 @@ gmgn-cli order quote \
|
||||
--input-token <input-token-addr> \
|
||||
--output-token <output-token-addr> \
|
||||
--amount 1000000 \
|
||||
--slippage 0.01
|
||||
--slippage 30
|
||||
|
||||
# Quotes use signed auth and require GMGN_PRIVATE_KEY on every chain
|
||||
gmgn-cli order quote \
|
||||
--chain bsc \
|
||||
--from <wallet-address> \
|
||||
--input-token <input-token-addr> \
|
||||
--output-token <output-token-addr> \
|
||||
--amount 1000000000000000000 \
|
||||
--slippage 30
|
||||
|
||||
# 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 30
|
||||
```
|
||||
|
||||
> `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 30 \
|
||||
--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 30 \
|
||||
--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)
|
||||
|
||||
**`hold_amount` mode** — each condition order fires based on current holdings at trigger time:
|
||||
@@ -555,7 +647,7 @@ gmgn-cli swap \
|
||||
--input-token So11111111111111111111111111111111111111112 \
|
||||
--output-token <token_A_address> \
|
||||
--amount 10000000 \
|
||||
--slippage 0.3 \
|
||||
--slippage 30 \
|
||||
--anti-mev \
|
||||
--condition-orders '[{"order_type":"profit_stop","side":"sell","price_scale":"100","sell_ratio":"50"},{"order_type":"profit_stop","side":"sell","price_scale":"300","sell_ratio":"100"},{"order_type":"loss_stop","side":"sell","price_scale":"65","sell_ratio":"100"}]' \
|
||||
--sell-ratio-type hold_amount
|
||||
@@ -574,7 +666,7 @@ gmgn-cli swap \
|
||||
--input-token So11111111111111111111111111111111111111112 \
|
||||
--output-token <token_A_address> \
|
||||
--amount 10000000 \
|
||||
--slippage 0.3 \
|
||||
--slippage 30 \
|
||||
--anti-mev \
|
||||
--condition-orders '[{"order_type":"profit_stop","side":"sell","price_scale":"100","sell_ratio":"50"},{"order_type":"profit_stop","side":"sell","price_scale":"300","sell_ratio":"50"},{"order_type":"loss_stop","side":"sell","price_scale":"65","sell_ratio":"100"}]' \
|
||||
--sell-ratio-type buy_amount
|
||||
@@ -596,7 +688,7 @@ gmgn-cli order strategy create \
|
||||
--sub-order-type take_profit \
|
||||
--check-price 0.002 \
|
||||
--amount-in-percent 100 \
|
||||
--slippage 0.01
|
||||
--slippage 30
|
||||
|
||||
# Create a stop-loss order
|
||||
gmgn-cli order strategy create \
|
||||
@@ -607,7 +699,7 @@ gmgn-cli order strategy create \
|
||||
--sub-order-type stop_loss \
|
||||
--check-price 0.0005 \
|
||||
--amount-in-percent 100 \
|
||||
--slippage 0.01
|
||||
--slippage 30
|
||||
|
||||
# List open strategy orders (requires private key)
|
||||
gmgn-cli order strategy list --chain sol
|
||||
@@ -626,7 +718,7 @@ gmgn-cli cooking \
|
||||
--input-token So11111111111111111111111111111111111111112 \
|
||||
--output-token <token_address> \
|
||||
--amount 1000000000 \
|
||||
--slippage 0.3 \
|
||||
--slippage 30 \
|
||||
--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"}]'
|
||||
```
|
||||
|
||||
@@ -634,8 +726,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` | — |
|
||||
|
||||
---
|
||||
|
||||
|
||||
+100
-15
@@ -22,7 +22,7 @@
|
||||
|
||||
### 1. 链上实时数据查询快
|
||||
|
||||
SOL / BSC / Base 多链数据每次查询均为实时,支持多参数个性化调用,无快照缓存,方便AI Agent实时决策(包括不限于下表)。
|
||||
SOL / BSC / Base / ETH 多链数据每次查询均为实时,支持多参数个性化调用,无快照缓存,方便AI Agent实时决策(包括不限于下表)。
|
||||
|
||||
| 数据类型 | 粒度 |
|
||||
|---------|------|
|
||||
@@ -45,6 +45,14 @@ SOL / BSC / Base 多链数据每次查询均为实时,支持多参数个性化
|
||||
- 单条命令支持市价单、限价单、策略单(止盈 / 止损)。
|
||||
- 支持按仓位比例卖出(`--percent 50`),无需手动计算数量。
|
||||
|
||||
| 订单类型 | 说明 |
|
||||
|----------|------|
|
||||
| 市价单 | 以当前市价即时成交 |
|
||||
| 限价单 | 设定触发价格,到价买入或卖出 |
|
||||
| 止盈 / 止损 | 随买单附带固定价格的退出条件 |
|
||||
| 追踪止盈 / 追踪止损 | 跟踪价格峰值,回撤达到指定比例后触发,吃满行情同时保护收益 |
|
||||
| 多钱包批量交易 | 多个钱包同时买入,每个钱包分别创建对应的止盈 / 止损 / 追踪止盈 / 追踪止损订单 |
|
||||
|
||||
### 3. 特色数据更全
|
||||
|
||||
不用再爬网页,不会被Claudeflare拦截,现在就可以快速/多并发实时查询多链的 Meme 代币高频交易所需的所有专业分析指标数据 (包括不限于):
|
||||
@@ -164,7 +172,7 @@ echo 'GMGN_API_KEY=<user_api_key>' > ~/.config/gmgn/.env
|
||||
chmod 600 ~/.config/gmgn/.env
|
||||
```
|
||||
|
||||
如果用户需要 swap 能力,追加私钥:
|
||||
如果用户需要 swap 或 order 能力,追加私钥:
|
||||
|
||||
```bash
|
||||
# 追加私钥(使用第 3 步输出的 PEM 内容)
|
||||
@@ -443,7 +451,6 @@ solana 上的 <token_address> 安全吗,值得买入吗?
|
||||
完整参数说明:[docs/cli-usage.md](docs/cli-usage.md)。所有命令均支持 `--raw` 输出单行 JSON(方便 `jq` 等工具处理)。
|
||||
|
||||
### Token
|
||||
|
||||
```bash
|
||||
# 基本信息 + 实时价格
|
||||
gmgn-cli token info --chain sol --address <addr>
|
||||
@@ -484,6 +491,13 @@ gmgn-cli market trending \
|
||||
--order-by volume --limit 20 \
|
||||
--filter not_risk --filter not_honeypot
|
||||
|
||||
# 热门榜 + 数值范围过滤(min_*/max_* 以查询参数透传)
|
||||
gmgn-cli market trending \
|
||||
--chain sol --interval 1h \
|
||||
--min-liquidity 10000 --max-liquidity 1000000 \
|
||||
--max-created 30m --min-smart-degen-count 1 \
|
||||
--order-by volume --limit 30
|
||||
|
||||
# 战壕新币列表
|
||||
gmgn-cli market trenches \
|
||||
--chain sol \
|
||||
@@ -495,6 +509,16 @@ gmgn-cli market trenches \
|
||||
gmgn-cli market trenches \
|
||||
--chain sol --type new_creation \
|
||||
--filter-preset safe --min-smart-degen-count 1 --sort-by smart_degen_count
|
||||
|
||||
# 热搜榜——搜索热度最高的代币(默认 7 链,24h)
|
||||
gmgn-cli market hot-searches --raw
|
||||
|
||||
# 热搜榜——仅 SOL,1h 档,前 50
|
||||
gmgn-cli market hot-searches --chain sol --interval 1h --limit 50 --raw
|
||||
|
||||
# 热搜榜——SOL 数值范围过滤(指标名与 trending 一致)
|
||||
gmgn-cli market hot-searches --chain sol --interval 1h \
|
||||
--min-liquidity 10000 --min-smart-degen-count 1 --raw
|
||||
```
|
||||
|
||||
### Portfolio
|
||||
@@ -514,14 +538,20 @@ 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-tokens --chain sol --wallet <wallet_address>
|
||||
|
||||
# 追踪关注钱包的交易动态
|
||||
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
|
||||
@@ -532,7 +562,7 @@ gmgn-cli track smartmoney --limit 100 --raw
|
||||
gmgn-cli track smartmoney --chain sol --side sell --limit 50 --raw
|
||||
```
|
||||
|
||||
### Swap(需要私钥)
|
||||
### Swap / Quote / Query
|
||||
|
||||
```bash
|
||||
# 提交兑换(固定滑点)
|
||||
@@ -542,7 +572,7 @@ gmgn-cli swap \
|
||||
--input-token <input-token-addr> \
|
||||
--output-token <output-token-addr> \
|
||||
--amount 1000000 \
|
||||
--slippage 0.01
|
||||
--slippage 30
|
||||
|
||||
# 提交兑换(自动滑点)
|
||||
gmgn-cli swap \
|
||||
@@ -569,12 +599,66 @@ gmgn-cli order quote \
|
||||
--input-token <input-token-addr> \
|
||||
--output-token <output-token-addr> \
|
||||
--amount 1000000 \
|
||||
--slippage 0.01
|
||||
--slippage 30
|
||||
|
||||
# 所有链上的 quote 都走关键鉴权,需要 GMGN_PRIVATE_KEY
|
||||
gmgn-cli order quote \
|
||||
--chain bsc \
|
||||
--from <wallet-address> \
|
||||
--input-token <input-token-addr> \
|
||||
--output-token <output-token-addr> \
|
||||
--amount 1000000000000000000 \
|
||||
--slippage 30
|
||||
|
||||
# 查询订单状态
|
||||
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 30
|
||||
```
|
||||
|
||||
> `order quote` 在 `sol` / `bsc` / `base` / `eth` 上都走关键鉴权,必须配置 `GMGN_PRIVATE_KEY`。
|
||||
|
||||
### ETH Gas 档位控制(仅限 ETH)
|
||||
|
||||
```bash
|
||||
# 按档位设置 Gas(low / average / high),替代手动填写 gwei
|
||||
gmgn-cli swap \
|
||||
--chain eth \
|
||||
--from <wallet-address> \
|
||||
--input-token <input-token-addr> \
|
||||
--output-token <output-token-addr> \
|
||||
--amount <amount> \
|
||||
--slippage 30 \
|
||||
--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 30 \
|
||||
--condition-orders '[...]' \
|
||||
--auto-fee
|
||||
```
|
||||
|
||||
> `--gas-level` 和 `--auto-fee` 仅支持 ETH 链。`--auto-fee` 仅在携带 `--condition-orders` 时生效。
|
||||
> 其他链(SOL / BSC / BASE)请先用 `gas-price` 查询当前 Gas,再通过 `--gas-price` 手动传入。
|
||||
|
||||
### 带止盈止损的 Swap(需要私钥)
|
||||
|
||||
**`hold_amount` 模式** — 按触发时的实际持仓比例卖出:
|
||||
@@ -587,7 +671,7 @@ gmgn-cli swap \
|
||||
--input-token So11111111111111111111111111111111111111112 \
|
||||
--output-token <token_A_address> \
|
||||
--amount 10000000 \
|
||||
--slippage 0.3 \
|
||||
--slippage 30 \
|
||||
--anti-mev \
|
||||
--condition-orders '[{"order_type":"profit_stop","side":"sell","price_scale":"100","sell_ratio":"50"},{"order_type":"profit_stop","side":"sell","price_scale":"300","sell_ratio":"100"},{"order_type":"loss_stop","side":"sell","price_scale":"65","sell_ratio":"100"}]' \
|
||||
--sell-ratio-type hold_amount
|
||||
@@ -606,7 +690,7 @@ gmgn-cli swap \
|
||||
--input-token So11111111111111111111111111111111111111112 \
|
||||
--output-token <token_A_address> \
|
||||
--amount 10000000 \
|
||||
--slippage 0.3 \
|
||||
--slippage 30 \
|
||||
--anti-mev \
|
||||
--condition-orders '[{"order_type":"profit_stop","side":"sell","price_scale":"100","sell_ratio":"50"},{"order_type":"profit_stop","side":"sell","price_scale":"300","sell_ratio":"50"},{"order_type":"loss_stop","side":"sell","price_scale":"65","sell_ratio":"100"}]' \
|
||||
--sell-ratio-type buy_amount
|
||||
@@ -628,7 +712,7 @@ gmgn-cli order strategy create \
|
||||
--sub-order-type take_profit \
|
||||
--check-price 0.002 \
|
||||
--amount-in-percent 100 \
|
||||
--slippage 0.01
|
||||
--slippage 30
|
||||
|
||||
# 创建止损单
|
||||
gmgn-cli order strategy create \
|
||||
@@ -639,7 +723,7 @@ gmgn-cli order strategy create \
|
||||
--sub-order-type stop_loss \
|
||||
--check-price 0.0005 \
|
||||
--amount-in-percent 100 \
|
||||
--slippage 0.01
|
||||
--slippage 30
|
||||
|
||||
# 查看当前挂单(需要私钥)
|
||||
gmgn-cli order strategy list --chain sol
|
||||
@@ -658,7 +742,7 @@ gmgn-cli cooking \
|
||||
--input-token So11111111111111111111111111111111111111112 \
|
||||
--output-token <token_address> \
|
||||
--amount 1000000000 \
|
||||
--slippage 0.3 \
|
||||
--slippage 30 \
|
||||
--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"}]'
|
||||
```
|
||||
|
||||
@@ -666,8 +750,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` | — |
|
||||
|
||||
---
|
||||
|
||||
|
||||
+337
-77
@@ -101,7 +101,7 @@ npx gmgn-cli market kline \
|
||||
|--------|----------|-------------|
|
||||
| `--chain` | Yes | `sol` / `bsc` / `base` |
|
||||
| `--address` | Yes | Token contract address |
|
||||
| `--resolution` | Yes | Candlestick resolution: `1m` / `5m` / `15m` / `1h` / `4h` / `1d` |
|
||||
| `--resolution` | Yes | Candlestick resolution: `30s` / `1m` / `5m` / `15m` / `1h` / `4h` / `1d` |
|
||||
| `--from` | No | Start time (Unix seconds) |
|
||||
| `--to` | No | End time (Unix seconds) |
|
||||
|
||||
@@ -120,18 +120,21 @@ npx gmgn-cli market trending \
|
||||
[--direction asc|desc] \
|
||||
[--filter <tag>] \
|
||||
[--platform <name>] \
|
||||
[--min-<metric> <n>] [--max-<metric> <n>] \
|
||||
[--raw]
|
||||
```
|
||||
|
||||
| Option | Required | Description |
|
||||
|--------|----------|-------------|
|
||||
| `--chain` | Yes | `sol` / `bsc` / `base` |
|
||||
| `--interval` | Yes | `1h` / `3h` / `6h` / `24h` |
|
||||
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
|
||||
| `--interval` | Yes | `1m` / `5m` / `1h` / `6h` / `24h` |
|
||||
| `--limit` | No | Number of results (default 100, max 100) |
|
||||
| `--order-by` | No | Sort field: `volume` / `swaps` / `liquidity` / `marketcap` / `holders` / `price` / `change` / `change1m` / `change5m` / `change1h` / `renowned_count` / `smart_degen_count` / `bluechip_owner_percentage` / `rank` / `creation_timestamp` / `square_mentions` / `history_highest_market_cap` / `gas_fee` |
|
||||
| `--direction` | No | Sort direction: `asc` / `desc` (default `desc`) |
|
||||
| `--filter` | No | Filter tag (repeatable): `has_social` / `not_risk` / `not_honeypot` / `verified` / `locked` / `renounced` / `distributed` / `frozen` / `burn` / `token_burnt` / `creator_hold` / `creator_close` / `creator_add_liquidity` / `creator_remove_liquidity` / `creator_sell` / `creator_buy` / `not_wash_trading` / `not_social_dup` / `not_image_dup` / `is_internal_market` / `is_out_market` |
|
||||
| `--filter` | No | Filter tag (repeatable): `has_social` / `not_risk` / `not_honeypot` / `verified` / `locked` / `renounced` / `distributed` / `frozen` / `burn` / `token_burnt` / `creator_hold` / `creator_close` / `creator_add_liquidity` / `creator_remove_liquidity` / `creator_sell` / `creator_buy` / `not_wash_trading` / `not_social_dup` / `not_image_dup` / `is_internal_market` / `is_out_market`. The gmgn web client also sends aliases `social_not_duplicate` / `img_not_duplicate` / `is_burnt` / `launching` / `migrated`, which are accepted but only the canonical tags change behavior. |
|
||||
| `--platform` | No | Platform filter (repeatable). Omit (or pass an empty list) to include **all** platforms. Available values depend on chain — see below. |
|
||||
| `--min-<metric>` / `--max-<metric>` | No | Numeric range filters (inclusive). Supported metrics: `volume` / `liquidity` / `marketcap` / `history-highest-marketcap` / `swaps` / `holder-count` / `gas-fee` / `renowned-count` / `smart-degen-count` / `bot-degen-count` / `visiting-count` / `price-change-percent` / `insider-rate` / `bundler-rate` / `entrapment-ratio` / `top10-holder-rate` / `top70-sniper-hold-rate` / `dev-team-hold-rate`. Unknown metrics are ignored by the service. |
|
||||
| `--min-created` / `--max-created` | No | Token-age window, duration string with a `m` (minutes) / `h` (hours) / `d` (days) suffix, e.g. `30m` / `6h` / `7d`. `--min-created` is a minimum age (excludes younger tokens); `--max-created` a maximum age (excludes older tokens). The raw upstream rank interface accepts minutes only; the openapi-service does not forward this field — it evaluates the age window itself (cutoff = now − duration, native for `m`/`h`/`d`), so `6h`/`7d` work here. A bare number with no unit suffix is not accepted. |
|
||||
|
||||
**`sol` platforms:** `Pump.fun` / `pump_mayhem` / `pump_mayhem_agent` / `pump_agent` / `letsbonk` / `bonkers` / `bags` / `memoo` / `liquid` / `bankr` / `zora` / `surge` / `anoncoin` / `moonshot_app` / `wendotdev` / `heaven` / `sugar` / `token_mill` / `believe` / `trendsfun` / `trends_fun` / `jup_studio` / `Moonshot` / `boop` / `xstocks` / `ray_launchpad` / `meteora_virtual_curve` / `pool_ray` / `pool_meteora` / `pool_pump_amm` / `pool_orca`
|
||||
|
||||
@@ -139,6 +142,8 @@ npx gmgn-cli market trending \
|
||||
|
||||
**`base` platforms:** `clanker` / `bankr` / `flaunch` / `zora` / `zora_creator` / `baseapp` / `basememe` / `virtuals_v2` / `klik`
|
||||
|
||||
**`eth` platforms:** `trench` / `clanker` / `klik` / `livo` / `stroid` / `pool_uniswap_v2` / `pool_uniswap_v3` / `printr`
|
||||
|
||||
---
|
||||
|
||||
## portfolio holdings
|
||||
@@ -255,6 +260,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).
|
||||
@@ -265,86 +294,213 @@ npx gmgn-cli market trenches --chain <chain> [--type <type...>] [--launchpad-pla
|
||||
|
||||
| Option | Required | Description |
|
||||
|--------|----------|-------------|
|
||||
| `--chain` | Yes | `sol` / `bsc` / `base` |
|
||||
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
|
||||
| `--type` | No | Categories to query, repeatable: `new_creation` / `near_completion` / `completed` (default: all three) |
|
||||
| `--launchpad-platform` | No | Launchpad platform filter, repeatable (default: all platforms for the chain) |
|
||||
| `--launchpad-platform` | No | Launchpad platform filter, repeatable (default: all platforms for the chain). Values depend on chain — see below. |
|
||||
| `--limit` | No | Max results per category, max 80 (default: 80) |
|
||||
|
||||
**`sol` platforms:** `Pump.fun` / `pump_mayhem` / `pump_mayhem_agent` / `pump_agent` / `letsbonk` / `bonkers` / `bags` / `memoo` / `liquid` / `bankr` / `zora` / `surge` / `anoncoin` / `moonshot_app` / `wendotdev` / `heaven` / `sugar` / `token_mill` / `believe` / `trendsfun` / `trends_fun` / `jup_studio` / `Moonshot` / `boop` / `ray_launchpad` / `meteora_virtual_curve` / `xstocks`
|
||||
|
||||
**`bsc` platforms:** `fourmeme` / `fourmeme_agent` / `bn_fourmeme` / `four_xmode_agent` / `cubepeg` / `likwid` / `goplus_creator` / `goplus_skills` / `openfour` / `flap` / `flap_stocks` / `flap_aioracle` / `clanker` / `lunafun`
|
||||
|
||||
**`base` platforms:** `clanker` / `bankr` / `flaunch` / `zora` / `zora_creator` / `baseapp` / `basememe` / `virtuals_v2` / `klik`
|
||||
|
||||
**`eth` platforms:** `trench` / `clanker` / `klik` / `livo` / `stroid` / `pool_uniswap_v2` / `pool_uniswap_v3` / `printr`
|
||||
|
||||
**Response:** `data.new_creation`, `data.pump`, `data.completed` — each is an array of `RankItem` (same structure as `market trending` rank items). **Note: `data.pump` in the response corresponds to `--type near_completion` in the request. The API always returns this category under the key `pump`, not `near_completion`.**
|
||||
|
||||
---
|
||||
|
||||
## 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 (1–18, 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 |
|
||||
|
||||
---
|
||||
|
||||
## market hot-searches
|
||||
|
||||
Query the hot-search ranking — the most-searched tokens, ranked by `visiting_count` (search heat). Cross-chain top-500; one request can cover several chains at once. API Key auth only.
|
||||
|
||||
```bash
|
||||
# Default 7-chain set (sol/bsc/base/eth/hyperevm/megaeth/monad, each 24h):
|
||||
gmgn-cli market hot-searches [--raw]
|
||||
|
||||
# Specific chain(s) and interval:
|
||||
gmgn-cli market hot-searches --chain <chain...> [--interval <1m|5m|1h|6h|24h>] [--limit <n>] [--filter <tag...>] [--min-* <n>] [--max-* <n>] [--raw]
|
||||
|
||||
# Full per-param override (JSON array):
|
||||
gmgn-cli market hot-searches --params '<json_array>' [--raw]
|
||||
```
|
||||
|
||||
| Option | Required | Description |
|
||||
|--------|----------|-------------|
|
||||
| `--chain` | No | Repeatable: `sol` / `bsc` / `base` / `eth` / `monad` / `megaeth` / `hyperevm` / `tron`. Omit for the default 7-chain set. |
|
||||
| `--interval` | No | `1m` / `5m` / `1h` / `6h` / `24h` (default `24h`). Applies to every `--chain`. |
|
||||
| `--limit` | No | Max results per chain (default `500`). |
|
||||
| `--filter` | No | Repeatable **boolean** filter tags (downstream `filter.filters`). sol defaults: `renounced` / `frozen`; EVM defaults: `not_honeypot` / `verified` / `renounced`. Recognised tags: `renounced` / `frozen` (sol) / `is_burnt` / `token_burnt` / `not_wash_trading` / `not_honeypot` (EVM) / `verified` (EVM) / `locked` (EVM) / `has_social` / `distribed` / `not_risk` / `img_not_duplicate` / `social_not_duplicate` / `creator_hold` / `creator_close` / `dexscr_update_link` / `launching` / `migrated` / `hide_b20` (base) / `hide_non_b20` (base). Unknown tags are silent no-ops. |
|
||||
| `--min-*` / `--max-*` | No | Numeric range bounds, **same metric names as `market trending`** (`--min-liquidity`, `--max-marketcap`, `--min-volume`, `--min-swaps`, `--min-smart-degen-count`, …, plus `--min-created`/`--max-created` durations). Translated server-side per `--interval`. `price_change_percent` only applies to `1m`/`5m`/`1h`. |
|
||||
| `--params` | No | Full JSON array override — overrides `--chain` / `--interval` / `--limit` / `--filter` and range flags when provided. Filter fields are flattened onto each param (no nested `filter` object): a param accepts `filters`, `limit`, `min_created`/`max_created`, and rank-style `min_<metric>`/`max_<metric>` keys. |
|
||||
|
||||
**Response:** `data` is an array of `(interval, chain)` blocks; each block has `interval`, `chain`, `version`, and `tokens`. `tokens` uses the **same long-form fields as `market trending`** (`address`, `symbol`, `visiting_count`, `market_cap`, …) — the server maps the upstream shortcodes for you — and each token carries a 1-based `rank`. Ranked by search heat (`visiting_count`), max 500 per chain. **Note:** `--chain all` is not valid — pass `--chain` multiple times to aggregate across chains. Boolean tag names differ from `market trending`: this path uses `launching`/`migrated` and `img_not_duplicate`/`social_not_duplicate`.
|
||||
|
||||
---
|
||||
|
||||
## track follow-tokens
|
||||
|
||||
Query the followed token list for a wallet. Returns a paginated list of tokens the wallet has bookmarked on GMGN, with full market data. API Key auth only.
|
||||
|
||||
```bash
|
||||
gmgn-cli track follow-tokens \
|
||||
--chain <chain> \
|
||||
[--wallet <wallet_address>] \
|
||||
[--base-token <token_address>] \
|
||||
[--page-token <cursor>] \
|
||||
--wallet <wallet_address> \
|
||||
[--group-id <id>] \
|
||||
[--order-by <field>] \
|
||||
[--direction <asc|desc>] \
|
||||
[--limit <n>] \
|
||||
[--side <side>] \
|
||||
[--cost <cost>] \
|
||||
[--filter <tag>] \
|
||||
[--with-balance] \
|
||||
[--with-security] \
|
||||
[--min-amount-usd <n>] \
|
||||
[--max-amount-usd <n>] \
|
||||
[--is-gray] \
|
||||
[--cursor <cursor>] \
|
||||
[--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 (1–200, default 100) |
|
||||
| `--side` | No | Trade direction filter |
|
||||
| `--cost` | No | Cost filter |
|
||||
| `--wallet` | Yes | Wallet address |
|
||||
| `--group-id` | No | `all_group` (all tokens), `default`, or a user-defined group ID |
|
||||
| `--interval` | No | Time interval for price change stats: `1m` / `5m` / `1h` / `6h` / `24h` |
|
||||
| `--order-by` | No | `created_at` / `swaps` / `volume` / `market_cap` / `liquidity` / `price` / `open_timestamp` |
|
||||
| `--direction` | No | Sort direction: `asc` / `desc` |
|
||||
| `--limit` | No | Page size |
|
||||
| `--cursor` | No | Pagination cursor from previous response |
|
||||
| `--search` | No | Search by token name or address |
|
||||
|
||||
---
|
||||
|
||||
## track follow-token-groups
|
||||
|
||||
Query the follow token group names for a wallet. Returns the groups a wallet uses to organise its followed tokens on GMGN. API Key auth only.
|
||||
|
||||
```bash
|
||||
gmgn-cli track follow-token-groups \
|
||||
--chain <chain> \
|
||||
--wallet <wallet_address> \
|
||||
[--raw]
|
||||
```
|
||||
|
||||
| Option | Required | Description |
|
||||
|--------|----------|-------------|
|
||||
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
|
||||
| `--wallet` | Yes | Wallet address |
|
||||
|
||||
---
|
||||
|
||||
## portfolio follow-wallet
|
||||
|
||||
Query follow-wallet trade records. Returns trades from wallets you personally follow on the GMGN platform. The follow list is resolved automatically from the GMGN user account bound to the API Key — `--wallet` is optional. Signed auth (API Key + private key signature).
|
||||
|
||||
```bash
|
||||
gmgn-cli track follow-wallet \
|
||||
--chain <chain> \
|
||||
[--wallet <wallet_address>] \
|
||||
[--limit <n>] \
|
||||
[--side <side>] \
|
||||
[--filter <tag>] \
|
||||
[--min-amount-usd <n>] \
|
||||
[--max-amount-usd <n>] \
|
||||
[--raw]
|
||||
```
|
||||
|
||||
| Option | Required | Description |
|
||||
|--------|----------|-------------|
|
||||
| `--chain` | Yes | `sol` / `bsc` / `base` |
|
||||
| `--wallet` | No | Wallet address (optional; follow list resolved from API Key's bound user account) |
|
||||
| `--limit` | No | Page size (1–100, 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 (1–200, 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 (1–200, default 100) |
|
||||
| `--side` | No | Filter by trade direction: `buy` / `sell` (client-side filter) |
|
||||
|
||||
---
|
||||
|
||||
## order quote
|
||||
|
||||
Get a swap quote without submitting a transaction. Uses normal auth — no private key required.
|
||||
Get a swap quote without submitting a transaction. Uses normal auth — only `GMGN_API_KEY` is required, no `GMGN_PRIVATE_KEY` needed.
|
||||
|
||||
```bash
|
||||
npx gmgn-cli order quote \
|
||||
@@ -360,11 +516,11 @@ npx gmgn-cli order quote \
|
||||
| Option | Required | Description |
|
||||
|--------|----------|-------------|
|
||||
| `--chain` | Yes | `sol` / `bsc` / `base` |
|
||||
| `--from` | Yes | Wallet address (must match API Key binding) |
|
||||
| `--from` | Yes | Wallet address |
|
||||
| `--input-token` | Yes | Input token contract address |
|
||||
| `--output-token` | Yes | Output token contract address |
|
||||
| `--amount` | Yes | Input amount (smallest unit) |
|
||||
| `--slippage` | Yes | Slippage tolerance, e.g. `0.01` = 1% |
|
||||
| `--slippage` | Yes | Slippage tolerance as an integer 0–100, e.g. `30` = 30% |
|
||||
|
||||
**Response fields (data):**
|
||||
|
||||
@@ -396,7 +552,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 +560,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 as an integer 0–100, e.g. `30` = 30% |
|
||||
| `--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 +611,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 (1–100, 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 as an integer 0–100, e.g. `30` = 30% |
|
||||
| `--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`.**
|
||||
@@ -480,14 +697,17 @@ gmgn-cli order strategy create \
|
||||
--from <wallet_address> \
|
||||
--base-token <base_token_address> \
|
||||
--quote-token <quote_token_address> \
|
||||
--order-type <limit_order> \
|
||||
--sub-order-type <buy_low|buy_high|stop_loss|take_profit> \
|
||||
--check-price <price> \
|
||||
--order-type <limit_order|smart_trade> \
|
||||
--sub-order-type <buy_low|buy_high|stop_loss|take_profit|mix_trade> \
|
||||
[--check-price <price>] \
|
||||
[--open-price <price>] \
|
||||
[--amount-in <amount> | --amount-in-percent <pct>] \
|
||||
[--slippage <n> | --auto-slippage] \
|
||||
[--limit-price-mode <exact|slippage>] \
|
||||
[--expire-in <seconds>] \
|
||||
[--sell-ratio-type <buy_amount|hold_amount>] \
|
||||
[--quote-investment <amount>] \
|
||||
[--condition-orders <json>] \
|
||||
[--priority-fee <sol>] \
|
||||
[--tip-fee <amount>] \
|
||||
[--gas-price <gwei>] \
|
||||
@@ -497,19 +717,22 @@ gmgn-cli order strategy create \
|
||||
|
||||
| Option | Required | Description |
|
||||
|--------|----------|-------------|
|
||||
| `--chain` | Yes | `sol` / `bsc` / `base` |
|
||||
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
|
||||
| `--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 |
|
||||
| `--order-type` | Yes | Order type: `limit_order` / `smart_trade` |
|
||||
| `--sub-order-type` | Yes | `limit_order`: `buy_low` / `buy_high` / `stop_loss` / `take_profit`; `smart_trade` with condition_orders: `mix_trade` |
|
||||
| `--check-price` | No* | Trigger check price — required for `limit_order`; omit for `smart_trade` (trigger is in the `buy_low` condition order) |
|
||||
| `--open-price` | No | Open price of the position |
|
||||
| `--amount-in` | No* | Input amount (smallest unit); required unless `--amount-in-percent` is used |
|
||||
| `--amount-in-percent` | No* | Input as percentage (e.g. `50` = 50%); required unless `--amount-in` is used |
|
||||
| `--limit-price-mode` | No | `exact` / `slippage` (default: `slippage`) |
|
||||
| `--expire-in` | No | Order expiry in seconds |
|
||||
| `--sell-ratio-type` | No | `buy_amount` (default) / `hold_amount` |
|
||||
| `--slippage` | No | Slippage tolerance, e.g. `0.01` = 1% |
|
||||
| `--quote-investment` | No | Quote token investment amount (`smart_trade`) |
|
||||
| `--condition-orders` | No | JSON array of condition sub-orders for `smart_trade`. Must include one `buy_low` entry (with `check_price` lower than `open_price`) plus at least one TP/SL entry |
|
||||
| `--slippage` | No | Slippage tolerance as an integer 0–100, e.g. `30` = 30% |
|
||||
| `--auto-slippage` | No | Enable automatic slippage |
|
||||
| `--priority-fee` | No | Priority fee in SOL (**required for SOL chain**) |
|
||||
| `--tip-fee` | No | Tip fee (**required for SOL chain**) |
|
||||
@@ -603,30 +826,67 @@ gmgn-cli cooking create \
|
||||
[--image <base64> | --image-url <url>] \
|
||||
[--slippage <n> | --auto-slippage] \
|
||||
[--website <url>] [--twitter <url>] [--telegram <url>] \
|
||||
[--priority-fee <sol>] [--tip-fee <amount>] [--gas-price <amount>] \
|
||||
[--anti-mev] \
|
||||
[--fee <amount>] [--priority-fee <sol>] [--tip-fee <amount>] [--gas-price <amount>] \
|
||||
[--max-fee-per-gas <amount>] [--max-priority-fee-per-gas <amount>] \
|
||||
[--anti-mev] [--anti-mev-mode <off|normal|secure>] \
|
||||
[--raised-token <symbol>] \
|
||||
[--dev-wallet-bps <n>] [--dev-gas <amount>] [--dev-priority <amount>] [--dev-tip <amount>] [--dev-max-fee-per-gas <amount>] \
|
||||
[--approve-vision <v1|v2>] [--source <source>] \
|
||||
[--is-mayhem] [--is-cashback] [--is-buy-back] \
|
||||
[--pump-fee-share-list <json>] \
|
||||
[--flap-rate-conf <json>] \
|
||||
[--fourmeme-rate-conf <json>] \
|
||||
[--bags-fee-share-list <json>] \
|
||||
[--bonk-model <model>] \
|
||||
[--buy-wallets <json>] [--snip-buy-wallets <json>] \
|
||||
[--buy-trade-config <json>] [--sell-trade-config <json>] [--sell-configs <json>] \
|
||||
[--raw]
|
||||
```
|
||||
|
||||
| Option | Required | Description |
|
||||
|--------|----------|-------------|
|
||||
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` / `ton` |
|
||||
| `--dex` | Yes | Launchpad: `pump` / `raydium` / `pancakeswap` / `flap` / `fourmeme` / `bonk` / `bags` / ... |
|
||||
| `--chain` | Yes | `sol` / `bsc` / `base` |
|
||||
| `--dex` | Yes | Launchpad per chain: `pump` / `bonk` / `bags` (sol), `fourmeme` / `flap` (bsc), `klik` / `clanker` (base) |
|
||||
| `--from` | Yes | Wallet address (must match API Key binding) |
|
||||
| `--name` | Yes | Token name |
|
||||
| `--symbol` | Yes | Token symbol |
|
||||
| `--buy-amt` | Yes | Initial buy amount in native token (e.g. `0.01` SOL) |
|
||||
| `--image` | No* | Token logo as base64-encoded data (max 2MB decoded); required unless `--image-url` is used |
|
||||
| `--image-url` | No* | Token logo URL; required unless `--image` is used |
|
||||
| `--slippage` | No* | Slippage tolerance as an integer 0–100, e.g. `30` = 30%; required unless `--auto-slippage` is used |
|
||||
| `--auto-slippage` | No* | Enable automatic slippage; required unless `--slippage` is used |
|
||||
| `--website` | No | Website URL |
|
||||
| `--twitter` | No | Twitter link |
|
||||
| `--telegram` | No | Telegram link |
|
||||
| `--slippage` | No | Slippage tolerance, e.g. `0.01` = 1% |
|
||||
| `--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 wei (EVM chains) |
|
||||
| `--anti-mev` | No | Enable anti-MEV protection |
|
||||
| `--fee` | No | Base gas / fee |
|
||||
| `--priority-fee` | No | Priority fee in SOL (**SOL only**, ≥ 0.0001 SOL) |
|
||||
| `--tip-fee` | No | Tip fee (SOL ≥ 0.00001 / BSC ≥ 0.000001 BNB; ignored on BASE) |
|
||||
| `--gas-price` | No | Gas price in wei (**EVM only**) |
|
||||
| `--max-fee-per-gas` | No | Max fee per gas in wei (**EVM only**) |
|
||||
| `--max-priority-fee-per-gas` | No | Max priority fee per gas in wei (**EVM only**) |
|
||||
| `--anti-mev` | No | Enable anti-MEV protection (**SOL only**) |
|
||||
| `--anti-mev-mode` | No | Anti-MEV mode: `off` / `normal` / `secure` (**SOL only**) |
|
||||
| `--raised-token` | No | Raise token symbol: `pump`→`USDC`; `bonk`→`USD1`; `fourmeme`→`USDT`/`USD1`; omit for native |
|
||||
| `--dev-wallet-bps` | No | Dev wallet fee share in basis points (100 = 1%) |
|
||||
| `--dev-gas` | No | Dev gas amount |
|
||||
| `--dev-priority` | No | Dev priority fee |
|
||||
| `--dev-tip` | No | Dev tip fee |
|
||||
| `--dev-max-fee-per-gas` | No | Dev tx feeCap in wei (**EVM EIP-1559**) |
|
||||
| `--approve-vision` | No | Approve vision version: `v1` / `v2` (default: `v2`) |
|
||||
| `--source` | No | Traffic source identifier |
|
||||
| `--is-mayhem` | No | Enable Mayhem mode (**Pump.fun only**) |
|
||||
| `--is-cashback` | No | Enable Cashback (**Pump.fun only**) |
|
||||
| `--is-buy-back` | No | Enable Agent Auto Buyback (**Pump.fun only**) |
|
||||
| `--pump-fee-share-list` | No | Fee share list as JSON array: `[{"provider":"twitter","username":"<handle>","basic_points":<n>}]` (**Pump.fun only**) |
|
||||
| `--flap-rate-conf` | No | Rate config as JSON object (**Flap only**) |
|
||||
| `--fourmeme-rate-conf` | No | Rate config as JSON object (**FourMeme only**) |
|
||||
| `--bags-fee-share-list` | No | Fee share list as JSON array: `[{"provider":"twitter","username":"<handle>","basic_points":<n>}]` (**BAGS only**) |
|
||||
| `--bonk-model` | No | Bonk model identifier (**bonk DEX only**) |
|
||||
| `--buy-wallets` | No | Multi-wallet buy config as JSON array: `[{"from_address":"<addr>","buy_amt":"<n>"}]` |
|
||||
| `--snip-buy-wallets` | No | Snipe-buy wallet config as JSON array: `[{"from_address":"<addr>","buy_amt":"<n>"}]` |
|
||||
| `--buy-trade-config` | No | Buy-side trade config for CondMarket orders as JSON (TradeParam) |
|
||||
| `--sell-trade-config` | No | Sell-side trade config for auto-sell / pending_sell as JSON (TradeParam) |
|
||||
| `--sell-configs` | No | Auto-sell strategy list as JSON array (CookingSellConfig[]): `[{"sell_type":"delay_sell","delay_sec":<n>,"sell_ratio":"0.5","wallet_addresses":["<addr>"]}]` |
|
||||
|
||||
**Response fields (data):**
|
||||
|
||||
@@ -673,7 +933,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 +942,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 |
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "gmgn-cli",
|
||||
"version": "1.2.2",
|
||||
"version": "1.5.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "gmgn-cli",
|
||||
"version": "1.2.2",
|
||||
"version": "1.5.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"commander": "^12.1.0",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gmgn-cli",
|
||||
"version": "1.2.2",
|
||||
"version": "1.5.0",
|
||||
"description": "GMGN OpenAPI CLI — call GMGN market, token, portfolio and swap APIs from the command line",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
+385
-83
@@ -1,11 +1,13 @@
|
||||
---
|
||||
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, FourMeme, Bonk, BAGS, Flap, Klik, Clanker, 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, or Base."
|
||||
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"
|
||||
---
|
||||
|
||||
**BEFORE RUNNING ANY COMMAND: Run `gmgn-cli config --check`. If exit code is 0, proceed normally. If exit code is 1, (1) run `gmgn-cli config` and show the output to the user; (2) once the user sends the API Key, run `gmgn-cli config --apply <KEY>` to complete configuration and verification, then show the output to the user. If `--check` returns an error (unknown option or command not found), tell the user to run `npm install -g gmgn-cli` to update, then retry.**
|
||||
|
||||
**IMPORTANT: Always use `gmgn-cli` commands below. Do NOT use web search, WebFetch, curl, or visit gmgn.ai — all token creation operations must go through the CLI. The CLI handles signing and submission automatically.**
|
||||
|
||||
**IMPORTANT: Do NOT guess field names or values. When a field's meaning is unclear, look it up in the Response Fields sections below before using it.**
|
||||
@@ -24,11 +26,11 @@ Use the `gmgn-cli` tool to create a token on a launchpad platform or query token
|
||||
|
||||
- **Image input** — Token logo can be provided as base64-encoded data (`--image`, max 2MB decoded) or a publicly accessible URL (`--image-url`). Provide one or the other — not both. If the user gives a file path, read and base64-encode it before passing to `--image`. If they give a URL, use `--image-url` directly.
|
||||
|
||||
- **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.
|
||||
- **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 `report.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.
|
||||
- **Slippage** — The initial buy is executed as part of the same transaction as token creation. Slippage applies to that buy. Use `--slippage` (integer 0–100, e.g. `30` = 30%) or `--auto-slippage`. One of the two is required when `--buy-amt` is set.
|
||||
|
||||
## Financial Risk Notice
|
||||
|
||||
@@ -43,22 +45,34 @@ 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
|
||||
|
||||
`sol` / `bsc` / `base` / `eth` / `ton`
|
||||
`sol` / `bsc` / `base`
|
||||
|
||||
## Supported Launchpads by Chain
|
||||
|
||||
| Chain | `--dex` values |
|
||||
|-------|----------------|
|
||||
| `sol` | `pump` / `raydium` / `bonk` / `bags` / `memoo` / `letsbonk` / `bonkers` |
|
||||
| `bsc` | `pancakeswap` / `flap` / `fourmeme` |
|
||||
| `base` | `clanker` / `flaunch` / `baseapp` / `basememe` / `zora` / `virtuals_v2` |
|
||||
| Chain | `--dex` values | Raise token (`--raised-token`) |
|
||||
| ------ | ---------------------- | ------------------------------ |
|
||||
| `sol` | `pump`, `bonk`, `bags` | `pump`: `""` (SOL) or `USDC`; `bonk`: `""` (SOL) or `USD1`; `bags`: `""` (SOL only) |
|
||||
| `bsc` | `fourmeme`, `flap` | `fourmeme`: `""` (BNB), `USD1`, `USDT`; `flap`: `""` (BNB only) |
|
||||
| `base` | `klik`, `clanker` | `""` only (quote token fixed to WETH) |
|
||||
|
||||
When the user names a platform colloquially (e.g. "pump.fun", "four.meme", "PancakeSwap"), map it to the correct `--dex` identifier from this table before running the command.
|
||||
When the user names a platform colloquially (e.g. "pump.fun", "four.meme"), map it to the correct `--dex` identifier from this table before running the command.
|
||||
|
||||
**Anti-MEV** (`--anti-mev`) is only supported on `sol`. Passing it on `bsc` or `base` will return a 400 error.
|
||||
|
||||
### Quote Token conversion (when `--raised-token` is set)
|
||||
|
||||
`--buy-amt` is **always in native token units** (SOL / BNB / ETH), even when raising with a quote token like USDC / USD1 / USDT. If the user states the amount in the quote token, convert it to native yourself before passing it:
|
||||
|
||||
```
|
||||
buy_amt_in_native = quote_amount × quote_price / native_price
|
||||
```
|
||||
|
||||
This conversion applies to **`--buy-amt`, and the `buy_amt` field inside `--buy-wallets` and `--snip-buy-wallets`**. It does **not** apply to `--sell-configs` (`check_price` there is always a USD market cap, not a token amount). Round to the chain's native decimals. When `--raised-token` is empty/native, no conversion is needed.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
@@ -74,7 +88,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 |
|
||||
|---------|--------|
|
||||
@@ -88,23 +102,6 @@ When a request returns `429`:
|
||||
- `cooking create` is a real transaction: **never loop or auto-resubmit** after a `429`. Wait until the reset time, then ask for confirmation again before retrying.
|
||||
- For `RATE_LIMIT_EXCEEDED` or `RATE_LIMIT_BANNED`, repeated requests during cooldown extend the ban by 5 seconds each time, up to 5 minutes.
|
||||
|
||||
**First-time setup** (if credentials are not configured):
|
||||
|
||||
1. Generate key pair and show the public key to the user:
|
||||
```bash
|
||||
openssl genpkey -algorithm ed25519 -out /tmp/gmgn_private.pem 2>/dev/null && \
|
||||
openssl pkey -in /tmp/gmgn_private.pem -pubout 2>/dev/null
|
||||
```
|
||||
Tell the user: *"This is your Ed25519 public key. Go to **https://gmgn.ai/ai**, paste it into the API key creation form (enable swap/cooking capability), then send me the API Key value shown on the page."*
|
||||
|
||||
2. Wait for the user's API key, then configure both credentials:
|
||||
```bash
|
||||
mkdir -p ~/.config/gmgn
|
||||
echo 'GMGN_API_KEY=<key_from_user>' > ~/.config/gmgn/.env
|
||||
echo 'GMGN_PRIVATE_KEY="<pem_content_from_step_1>"' >> ~/.config/gmgn/.env
|
||||
chmod 600 ~/.config/gmgn/.env
|
||||
```
|
||||
|
||||
### Credential Model
|
||||
|
||||
- `GMGN_PRIVATE_KEY` is used exclusively for **local message signing** — the private key never leaves the machine. The CLI computes an Ed25519 signature in-process and transmits only the base64-encoded result in the `X-Signature` request header.
|
||||
@@ -121,34 +118,222 @@ gmgn-cli cooking stats [--raw]
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `launchpad` | string | Launchpad identifier (e.g. `pump`, `raydium`, `pancakeswap`) |
|
||||
| `launchpad` | string | Launchpad identifier (e.g. `pump`, `bonk`, `fourmeme`) |
|
||||
| `token_count` | int | Number of tokens created via GMGN on that launchpad |
|
||||
|
||||
## `cooking create` Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
|-----------|----------|-------------|
|
||||
| `--chain` | Yes | Chain: `sol` / `bsc` / `base` / `eth` / `ton` |
|
||||
| `--chain` | Yes | Chain: `sol` / `bsc` / `base` |
|
||||
| `--dex` | Yes | Launchpad platform identifier — see Supported Launchpads table. Never guess this value. |
|
||||
| `--from` | Yes | Wallet address (must match API Key binding) |
|
||||
| `--name` | Yes | Token full name (e.g. `Doge Killer`) |
|
||||
| `--symbol` | Yes | Token ticker symbol (e.g. `DOGEK`) |
|
||||
| `--description` | No | Token description / project pitch |
|
||||
| `--buy-amt` | Yes | Initial buy amount in **human-readable native token units** (e.g. `0.01` = 0.01 SOL). This is NOT in smallest unit. |
|
||||
| `--image` | No* | Token logo as **base64-encoded** data (max 2MB decoded). Mutually exclusive with `--image-url`. One of the two is required. |
|
||||
| `--image-url` | No* | Token logo as a publicly accessible URL. Mutually exclusive with `--image`. One of the two is required. |
|
||||
| `--slippage` | No* | Slippage tolerance, e.g. `0.01` = 1%. **Mutually exclusive with `--auto-slippage`** — provide one or the other. |
|
||||
| `--slippage` | No* | Slippage tolerance as an integer 0–100, e.g. `30` = 30%. **Mutually exclusive with `--auto-slippage`** — provide one or the other. |
|
||||
| `--auto-slippage` | No* | Enable automatic slippage. **Mutually exclusive with `--slippage`.** |
|
||||
| `--description` | No | Token description / project pitch |
|
||||
| `--website` | No | Project website URL |
|
||||
| `--twitter` | No | Twitter / X URL |
|
||||
| `--telegram` | No | Telegram group URL |
|
||||
| `--priority-fee` | No | Priority fee in SOL (SOL only, ≥ 0.0001 SOL) |
|
||||
| `--tip-fee` | No | Tip fee (SOL ≥ 0.00001 / BSC ≥ 0.000001 BNB; ignored on ETH/BASE) |
|
||||
| `--gas-price` | No | Gas price in wei (EVM chains) |
|
||||
| `--anti-mev` | No | Enable anti-MEV protection |
|
||||
| `--fee` | No | Base gas / fee |
|
||||
| `--priority-fee` | No | Priority fee in SOL (**SOL only**, ≥ 0.0001 SOL) |
|
||||
| `--tip-fee` | No | Tip fee (SOL ≥ 0.00001 / BSC ≥ 0.000001 BNB; ignored on BASE) |
|
||||
| `--gas-price` | No | Gas price in wei (EVM chains: BSC / BASE) |
|
||||
| `--max-fee-per-gas` | No | Max fee per gas in wei (**EVM only**) |
|
||||
| `--max-priority-fee-per-gas` | No | Max priority fee per gas in wei (**EVM only**) |
|
||||
| `--anti-mev` | No | Enable anti-MEV protection (**SOL only**; rejected on BSC / BASE) |
|
||||
| `--anti-mev-mode` | No | Anti-MEV mode: `off` / `normal` / `secure` (**SOL only**) |
|
||||
| `--raised-token` | No | Raise token symbol. `pump`: `USDC`; `bonk`: `USD1`; `fourmeme`: `USDT` / `USD1`; omit or `""` for native |
|
||||
| `--dev-wallet-bps` | No | Dev wallet fee share in basis points (100 = 1%) |
|
||||
| `--dev-gas` | No | Dev gas amount |
|
||||
| `--dev-priority` | No | Dev priority fee |
|
||||
| `--dev-tip` | No | Dev tip fee |
|
||||
| `--dev-max-fee-per-gas` | No | Dev tx feeCap in wei (**EVM EIP-1559**) |
|
||||
| `--approve-vision` | No | Approve vision version: `v1` / `v2` (default: `v2`) |
|
||||
| `--source` | No | Traffic source identifier |
|
||||
| `--is-mayhem` | No | Enable Mayhem mode (**Pump.fun only**) |
|
||||
| `--is-cashback` | No | Enable Cashback (**Pump.fun only**) |
|
||||
| `--is-buy-back` | No | Enable Agent Auto Buyback (**Pump.fun only**) |
|
||||
| `--pump-fee-share-list` | No | Pump.fun fee share list as JSON array: `[{"provider":"twitter","username":"<handle>","basic_points":<n>}]` (**Pump.fun only**) |
|
||||
| `--flap-rate-conf` | No | Flap rate config as JSON object (**Flap only**) |
|
||||
| `--fourmeme-rate-conf` | No | FourMeme rate config as JSON object (**FourMeme only**) |
|
||||
| `--bags-fee-share-list` | No | BAGS fee share list as JSON array: `[{"provider":"twitter","username":"<handle>","basic_points":<n>}]` (**BAGS only**) |
|
||||
| `--bonk-model` | No | Bonk model identifier (**bonk DEX only**) |
|
||||
| `--buy-wallets` | No | Multi-wallet buy config as JSON array: `[{"from_address":"<addr>","buy_amt":"<n>"}]` |
|
||||
| `--snip-buy-wallets` | No | Snipe-buy wallet config as JSON array: `[{"from_address":"<addr>","buy_amt":"<n>"}]` |
|
||||
| `--buy-trade-config` | No | Buy-side trade config for CondMarket orders as JSON (TradeParam) — see Advanced API Fields |
|
||||
| `--sell-trade-config` | No | Sell-side trade config for auto-sell / pending_sell as JSON (TradeParam) — see Advanced API Fields |
|
||||
| `--sell-configs` | No | Auto-sell strategy list as JSON array (CookingSellConfig[]) — see Auto-Sell Configuration |
|
||||
|
||||
\* `--image` or `--image-url`: provide exactly one. `--slippage` or `--auto-slippage`: provide exactly one.
|
||||
|
||||
## Advanced API Fields
|
||||
|
||||
The structured flags (`--pump-fee-share-list`, `--bags-fee-share-list`, `--flap-rate-conf`, `--fourmeme-rate-conf`, `--buy-wallets`, `--snip-buy-wallets`, `--buy-trade-config`, `--sell-trade-config`, `--sell-configs`) each accept a **JSON string**. This section documents the exact JSON schema for each.
|
||||
|
||||
### Platform capability matrix
|
||||
|
||||
Which advanced features each platform supports. Do not send a field a platform does not support.
|
||||
|
||||
| Platform | `--dex` | Chain | Platform-specific fields | Bundle (`--buy-wallets`) | Sniper (`--snip-buy-wallets`) | Cashback | Mayhem |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| Pump.fun | `pump` | SOL | `--pump-fee-share-list` / `--dev-wallet-bps` / `--is-buy-back` | ✅ up to 12 wallets | ✅ up to 10 | ✅ | ✅ |
|
||||
| Bonk | `bonk` | SOL | `--bonk-model` | ❌ | ✅ up to 10 | ❌ | ❌ |
|
||||
| BAGS | `bags` | SOL | `--bags-fee-share-list` / `--dev-wallet-bps` | ❌ | ✅ up to 10 | ❌ | ❌ |
|
||||
| FourMeme | `fourmeme` | BSC | `--fourmeme-rate-conf` | ✅ up to 3 wallets | ✅ up to 10 | ❌ | ❌ |
|
||||
| Flap | `flap` | BSC | `--flap-rate-conf` | ❌ | ✅ up to 10 | ❌ | ❌ |
|
||||
| Klik | `klik` | Base | — | ❌ | ✅ up to 10 | ❌ | ❌ |
|
||||
| Clanker | `clanker` | Base | — | ❌ | ✅ up to 10 | ❌ | ❌ |
|
||||
|
||||
- `--is-cashback` / `--is-mayhem` are **Pump.fun only** — other platforms reject them.
|
||||
- Bundle/auto-sell (`--sell-configs`) and sniper (`--snip-buy-wallets`) are available where the matrix shows ✅.
|
||||
|
||||
**Basis-points rule:** any field named `*_bps` / `basic_points` is in basis points (`100` = 1%). Where a section says the shares must sum, all entries must add up to exactly **10000** (FourMeme uses whole percents summing to **100** instead — see below).
|
||||
|
||||
**Always talk to the user in percentages, never basis points.** When asking for or confirming any share, fee, or split, phrase it as a percentage (e.g. *"What % goes to this wallet?"* → user says `"50%"`). Convert to the field's unit yourself when building the JSON — never ask the user for a raw bps number:
|
||||
|
||||
| User says | `*_bps` field (×100) | FourMeme `*_rate` field (×1) |
|
||||
|---|---|---|
|
||||
| `5%` | `500` | `5` |
|
||||
| `50%` | `5000` | `50` |
|
||||
| `100%` | `10000` | `100` |
|
||||
|
||||
Never set a fee-share split without the user's explicit instruction — it permanently routes token revenue to the listed accounts.
|
||||
|
||||
### Pump.fun (`--dex pump`)
|
||||
|
||||
> `is_mayhem`, `is_cashback`, `is_buy_back` use their matching CLI flags (`--is-mayhem`, `--is-cashback`, `--is-buy-back`). `pump_fee_share_list` is passed via `--pump-fee-share-list`.
|
||||
|
||||
| Field | CLI flag | Description |
|
||||
|---|---|---|
|
||||
| `pump_fee_share_list` | `--pump-fee-share-list <json>` | Fee-share list — see JSON schema below |
|
||||
| `is_buy_back` | `--is-buy-back` | Enable Agent Auto Buyback |
|
||||
|
||||
**JSON schema for `--pump-fee-share-list`** — array of objects:
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|---|---|---|---|
|
||||
| `provider` | string | Yes | `solana` / `twitter` / `github` |
|
||||
| `username` | string | Yes | Platform username; a SOL address when `provider` = `solana` |
|
||||
| `basic_points` | int | Yes | Share in bps — all entries must sum to **10000** |
|
||||
|
||||
Example: `--pump-fee-share-list '[{"provider":"twitter","username":"handle","basic_points":10000}]'`
|
||||
|
||||
### Bonk (`--dex bonk`)
|
||||
|
||||
`dev_wallet_bps` → `--dev-wallet-bps`, `bonk_model` → `--bonk-model`. No additional structured fields.
|
||||
|
||||
### BAGS (`--dex bags`)
|
||||
|
||||
`dev_wallet_bps` → `--dev-wallet-bps`. `bags_fee_share_list` is passed via `--bags-fee-share-list`.
|
||||
|
||||
**JSON schema for `--bags-fee-share-list`** — array of objects:
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|---|---|---|---|
|
||||
| `provider` | string | Yes | `twitter` / `solana` / `kick` / `github` |
|
||||
| `username` | string | Yes | Platform username |
|
||||
| `basic_points` | int | Yes | Share in bps — combined with `dev_wallet_bps`, all must sum to **10000** |
|
||||
|
||||
### Flap (`--dex flap`)
|
||||
|
||||
`flap_rate_conf` is passed via `--flap-rate-conf`.
|
||||
|
||||
**JSON schema for `--flap-rate-conf`** — single object:
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|---|---|---|---|
|
||||
| `buy_tax_rate` | int | Conditional | V6 separate buy tax rate in bps, e.g. 1% → `100`. Use together with `sell_tax_rate`. |
|
||||
| `sell_tax_rate` | int | Conditional | V6 separate sell tax rate in bps |
|
||||
| `tax_rate` | int | Conditional | V5 unified tax rate in bps, e.g. 5% → `500`. Use instead of `buy_tax_rate` + `sell_tax_rate`. |
|
||||
| `mkt_bps` | int | Yes | **Tax recipient share** — the slice of the collected tax routed to the recipient(s): the X handle when `recipient_type = gift`, or the `split_conf` addresses when `recipient_type = split`. This is NOT a generic "marketing" fund. |
|
||||
| `deflation_bps` | int | Yes | Burn (supply-reduction) share |
|
||||
| `dividend_bps` | int | Yes | Dividend (holder-reward) share |
|
||||
| `lp_bps` | int | Yes | Liquidity share |
|
||||
| `recipient_type` | string | Yes | `gift` (route the recipient share to an X handle) / `split` (route it to specific addresses) |
|
||||
| `twitter_account` | string | Conditional | X / Twitter handle that receives the recipient share — **required when `recipient_type = gift`**; leave `""` when `split`. |
|
||||
| `split_conf` | array | Conditional | Recipient address split list — **required when `recipient_type = split`**; leave `[]` when `gift`. |
|
||||
| `minimum_share_balance` | int | Yes | Min holding to qualify for dividends — minimum **10000** tokens |
|
||||
| `beneficiary` | string | No | Legacy single fee-recipient address. Omit when using `recipient_type` + `twitter_account` / `split_conf`. |
|
||||
|
||||
`split_conf` entries: `{ "recipient": "<address>", "bps": <n> }` — all `bps` must sum to **10000**.
|
||||
|
||||
> - **Tax distribution:** whenever the tax rate > 0, `mkt_bps + deflation_bps + dividend_bps + lp_bps` must sum to **10000**. `mkt_bps` is the recipient's cut; the other three are burn / dividend / liquidity.
|
||||
> - **Recipient routing:** set `recipient_type = gift` + `twitter_account` to send the recipient cut to an X handle, OR `recipient_type = split` + `split_conf` to send it to one or more addresses. Fill only the field that matches the chosen mode; leave the other empty (`""` / `[]`).
|
||||
> - Use `tax_rate` for V5 (unified rate); use `buy_tax_rate` + `sell_tax_rate` for V6 (separate rates).
|
||||
> - When `lp_bps > 0`: `minimum_share_balance` must be > 0.
|
||||
|
||||
### FourMeme (`--dex fourmeme`)
|
||||
|
||||
`fourmeme_rate_conf` is passed via `--fourmeme-rate-conf`.
|
||||
|
||||
> `fourmeme_user_login_sign`, `is_approve_allowance`, `is_raised_swap` are broker/jobs **internal** fields — the public API does not accept them, so there is no flag. The multi-quote raise-token retry is handled server-side automatically (poll `order get`); the caller never sets these.
|
||||
|
||||
**JSON schema for `--fourmeme-rate-conf`** — single object:
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|---|---|---|---|
|
||||
| `fee_plan` | bool | No | Enable the fee plan |
|
||||
| `recipient_address` | string | Yes | Fee recipient address |
|
||||
| `fee_rate` | int | Yes | Fee rate, e.g. 5% → `5` (whole percent, not bps) |
|
||||
| `burn_rate` | int | Yes | Burn share |
|
||||
| `divide_rate` | int | Yes | Dividend share |
|
||||
| `liquidity_rate` | int | Yes | Liquidity share |
|
||||
| `recipient_rate` | int | Yes | Recipient share |
|
||||
| `min_sharing` | int | Yes | Minimum sharing threshold |
|
||||
|
||||
> When `fee_rate > 0`: `burn_rate + divide_rate + liquidity_rate + recipient_rate` must sum to **100**. When `recipient_rate > 0`: `min_sharing` must be > 0.
|
||||
|
||||
## Auto-Sell Configuration
|
||||
|
||||
`sell_configs` is passed via `--sell-configs` as a JSON array. It schedules conditional sell orders to execute automatically once the token launch succeeds. Omit entirely for a standard launch with no auto-sell.
|
||||
|
||||
`--sell-configs` is a JSON array of `CookingSellConfig` objects:
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|---|---|---|---|
|
||||
| `sell_type` | string | Yes | `delay_sell` / `limit_order` |
|
||||
| `delay_sec` | int64 | Conditional | Seconds after buy to trigger; required when `sell_type = delay_sell` |
|
||||
| `delay_mili_sec` | int64 | No | Milliseconds after buy to trigger; takes precedence over `delay_sec` |
|
||||
| `sell_ratio` | string | Yes | Fraction to sell — `"1"` = 100%, `"0.5"` = 50% |
|
||||
| `check_price` | string | Conditional | Market cap in USD to trigger sell; required when `sell_type = limit_order` |
|
||||
| `wallet_addresses` | []string | Yes | Wallets this strategy applies to (empty array = inert) |
|
||||
|
||||
Example: `--sell-configs '[{"sell_type":"delay_sell","delay_sec":60,"sell_ratio":"0.5","wallet_addresses":["<addr>"]}]'`
|
||||
|
||||
The buy/sell execution params for these CondMarket orders (slippage, fees, anti-MEV) can be tuned separately via `--buy-trade-config` / `--sell-trade-config` (TradeParam JSON). They do **not** affect the main creation tx, and fall back to the outer-level transaction flags when omitted.
|
||||
|
||||
> - **`check_price` is total market cap in USD** — e.g. `"50000"` triggers at a $50,000 market cap.
|
||||
> - `wallet_addresses` may mix `from_address` and `buy_wallets` entries. The server creates `signal_cooking` for snipe wallets and `pending_sell` for main/bundle wallets automatically.
|
||||
> - A wallet can carry multiple strategies (e.g. delay-sell 50%, then limit-sell the rest); each applies independently.
|
||||
|
||||
### TradeParam (`--buy-trade-config` / `--sell-trade-config`)
|
||||
|
||||
These tune the **execution params for the CondMarket buy/sell orders** (bundle buys, sniper buys, and auto-sell). They do **not** affect the main creation transaction (the dev tx uses the outer-level `--dev-*` flags). When omitted, they fall back to the outer-level transaction flags.
|
||||
|
||||
`--buy-trade-config` / `--sell-trade-config` each accept a single JSON object:
|
||||
|
||||
| Field | Type | Description |
|
||||
|---|---|---|
|
||||
| `slippage` | number | Slippage; only sent when truthy |
|
||||
| `fee` | string | Base gas / fee; only sent when truthy |
|
||||
| `priority_fee` | string | Priority fee; only sent when truthy |
|
||||
| `tip_fee` | string | SOL Jito tip; only sent when truthy |
|
||||
| `gas_price` | string | Gas price in wei (EVM); only sent when truthy |
|
||||
| `max_priority_fee_per_gas` | string | EVM EIP-1559; only sent when truthy |
|
||||
| `max_fee_per_gas` | string | EVM EIP-1559; only sent when truthy |
|
||||
| `auto_slippage` | bool | Always sent |
|
||||
| `is_anti_mev` | bool | Always sent |
|
||||
| `anti_mev_mode` | string | `off` / `normal` / `secure`; always sent |
|
||||
|
||||
Example: `--buy-trade-config '{"slippage":50,"auto_slippage":false,"priority_fee":"0.0005","tip_fee":"0.0001","is_anti_mev":true,"anti_mev_mode":"secure"}'`
|
||||
|
||||
> A standard launch with no `buyConfig` sends `{"is_anti_mev":false,"anti_mev_mode":"off"}` and an empty `buy_wallets` list.
|
||||
|
||||
## `cooking create` Response Fields
|
||||
|
||||
| Field | Type | Description |
|
||||
@@ -167,13 +352,15 @@ Token creation is **asynchronous**. If the initial `cooking create` response sho
|
||||
```bash
|
||||
gmgn-cli order get --chain <chain> --order-id <order_id>
|
||||
```
|
||||
2. The new token's contract / mint address is in the **`output_token`** field of the `order get` response — it is NOT returned by `cooking create` directly.
|
||||
2. The new token's contract / mint address is in the **`report.output_token`** field of the `order get` response (only present when `state = 30` and `status = "successful"`) — it is NOT returned by `cooking create` directly.
|
||||
3. Stop polling once `status` is `confirmed`, `failed`, or `expired`.
|
||||
4. On `confirmed`: display `output_token` as the token address and include the block explorer link.
|
||||
5. On `failed` / `expired`: report the `error_status` and do not retry automatically.
|
||||
|
||||
## Usage Examples
|
||||
|
||||
Examples run shortest-first: basic single-launch commands, then full end-to-end configurations. Every JSON flag below is a valid payload shape — copy and adapt.
|
||||
|
||||
```bash
|
||||
# Get token creation statistics per launchpad
|
||||
gmgn-cli cooking stats
|
||||
@@ -187,24 +374,10 @@ gmgn-cli cooking create \
|
||||
--symbol MAT \
|
||||
--buy-amt 0.01 \
|
||||
--image-url https://example.com/logo.png \
|
||||
--slippage 0.01 \
|
||||
--slippage 30 \
|
||||
--priority-fee 0.001
|
||||
|
||||
# Create a token on PancakeSwap (BSC) — with URL image and social links
|
||||
gmgn-cli cooking create \
|
||||
--chain bsc \
|
||||
--dex pancakeswap \
|
||||
--from <wallet_address> \
|
||||
--name "BSC Token" \
|
||||
--symbol BSCT \
|
||||
--buy-amt 0.05 \
|
||||
--image-url https://example.com/logo.png \
|
||||
--slippage 0.02 \
|
||||
--gas-price 5000000000 \
|
||||
--website https://mytoken.io \
|
||||
--twitter https://twitter.com/mytoken
|
||||
|
||||
# Create a token on FourMeme (BSC) — using base64 image from local file
|
||||
# Create a token on FourMeme (BSC) — base64 image + USD1 raise token
|
||||
gmgn-cli cooking create \
|
||||
--chain bsc \
|
||||
--dex fourmeme \
|
||||
@@ -213,12 +386,13 @@ gmgn-cli cooking create \
|
||||
--symbol FOUR \
|
||||
--buy-amt 0.05 \
|
||||
--image "$(base64 -i /path/to/logo.png)" \
|
||||
--auto-slippage
|
||||
--auto-slippage \
|
||||
--raised-token USD1
|
||||
|
||||
# Create a token on letsbonk (SOL)
|
||||
# Create a token on Bonk (SOL) with anti-MEV
|
||||
gmgn-cli cooking create \
|
||||
--chain sol \
|
||||
--dex letsbonk \
|
||||
--dex bonk \
|
||||
--from <wallet_address> \
|
||||
--name "Bonk Token" \
|
||||
--symbol BNKT \
|
||||
@@ -227,8 +401,112 @@ gmgn-cli cooking create \
|
||||
--auto-slippage \
|
||||
--anti-mev
|
||||
|
||||
# Create on Pump.fun with auto-sell: sell 50% 60s after buy
|
||||
gmgn-cli cooking create \
|
||||
--chain sol \
|
||||
--dex pump \
|
||||
--from <wallet_address> \
|
||||
--name "My Token" \
|
||||
--symbol MAT \
|
||||
--buy-amt 0.01 \
|
||||
--image-url https://example.com/logo.png \
|
||||
--auto-slippage \
|
||||
--sell-configs '[{"sell_type":"delay_sell","delay_sec":60,"sell_ratio":"0.5","wallet_addresses":["<wallet_address>"]}]'
|
||||
```
|
||||
|
||||
These mirror real launch configurations end-to-end.
|
||||
|
||||
**Pump.fun (SOL) — Bundle + Sniper + Auto-Sell + Agent Auto Buyback**
|
||||
|
||||
```bash
|
||||
gmgn-cli cooking create \
|
||||
--chain sol \
|
||||
--dex pump \
|
||||
--from DevWallet... \
|
||||
--name "Demo Coin" \
|
||||
--symbol DEMO \
|
||||
--buy-amt 0.5 \
|
||||
--image-url https://cdn.example.com/coin.png \
|
||||
--twitter https://x.com/handle/status/123 \
|
||||
--priority-fee 0.0005 \
|
||||
--tip-fee 0.0001 \
|
||||
--is-buy-back \
|
||||
--buy-trade-config '{"slippage":50,"auto_slippage":false,"priority_fee":"0.0005","tip_fee":"0.0001","is_anti_mev":true,"anti_mev_mode":"secure"}' \
|
||||
--buy-wallets '[{"from_address":"Wallet1...","buy_amt":"0.1"},{"from_address":"Wallet2...","buy_amt":"0.1"}]' \
|
||||
--snip-buy-wallets '[{"from_address":"Sniper1...","buy_amt":"0.05"}]' \
|
||||
--sell-configs '[{"sell_type":"delay_sell","sell_ratio":"1","wallet_addresses":["Wallet1..."],"delay_mili_sec":5000}]'
|
||||
```
|
||||
|
||||
- `--is-buy-back` is the Agent Auto Buyback mode (the backend also sets the agent fee internally).
|
||||
- `buy_amt` values in `--buy-wallets` / `--snip-buy-wallets` are in native SOL.
|
||||
- Bundle wallets ≤ 12, sniper wallets ≤ 10 on Pump.fun (see capability matrix).
|
||||
|
||||
**FourMeme (BSC) — user fee split + raise token USDT**
|
||||
|
||||
```bash
|
||||
gmgn-cli cooking create \
|
||||
--chain bsc \
|
||||
--dex fourmeme \
|
||||
--from 0xDev... \
|
||||
--name "Demo BSC" \
|
||||
--symbol DBSC \
|
||||
--buy-amt 0.0123 \
|
||||
--image-url https://cdn.example.com/coin.png \
|
||||
--raised-token USDT \
|
||||
--website https://demo.com \
|
||||
--gas-price 1000000000 \
|
||||
--auto-slippage \
|
||||
--fourmeme-rate-conf '{"fee_rate":1,"recipient_rate":50,"burn_rate":20,"divide_rate":20,"liquidity_rate":10,"min_sharing":100000,"recipient_address":"0xDev..."}'
|
||||
```
|
||||
|
||||
- `--buy-amt 0.0123` is **already converted to native BNB** from the USDT amount the user wanted (see Quote Token conversion). Do the conversion before building the command.
|
||||
- `--gas-price 1000000000` is wei (1 Gwei).
|
||||
- In `--fourmeme-rate-conf`, `recipient_rate + burn_rate + divide_rate + liquidity_rate` must sum to **100**.
|
||||
|
||||
**Flap (BSC) — `split` mode: route the recipient cut to a BSC address**
|
||||
|
||||
```bash
|
||||
gmgn-cli cooking create \
|
||||
--chain bsc \
|
||||
--dex flap \
|
||||
--from 0x1f8d977b6843e1bbcb306c4a3664c9fb0277979d \
|
||||
--name "refer" \
|
||||
--symbol refer \
|
||||
--buy-amt 2 \
|
||||
--image-url https://gmgn.ai/external-res-va/11ad7747dcefcfaae87d3f53a4d7330d_v2l.webp \
|
||||
--website https://www.refercoins.bond/ \
|
||||
--twitter https://x.com/referdotfun \
|
||||
--dev-gas 50000000 \
|
||||
--auto-slippage \
|
||||
--flap-rate-conf '{"buy_tax_rate":100,"sell_tax_rate":100,"mkt_bps":10000,"deflation_bps":0,"dividend_bps":0,"lp_bps":0,"minimum_share_balance":10000,"recipient_type":"split","twitter_account":"","split_conf":[{"recipient":"0x1f8d977b6843e1bbcb306c4a3664c9fb0277979d","bps":10000}]}'
|
||||
```
|
||||
|
||||
- `recipient_type: split` → the recipient cut goes to `split_conf` addresses; `twitter_account` is left `""`.
|
||||
- `mkt_bps:10000` means the **entire** tax (1% buy / 1% sell) goes to the recipient — `deflation_bps + dividend_bps + lp_bps` are all `0`, and the four still sum to **10000**.
|
||||
- `split_conf` has one address taking all `10000` bps (100%). Multiple addresses are allowed as long as their `bps` sum to `10000`.
|
||||
|
||||
**Flap (BSC) — `gift` mode: route the recipient cut to an X handle, split the rest across burn / dividend / LP**
|
||||
|
||||
```bash
|
||||
gmgn-cli cooking create \
|
||||
--chain bsc \
|
||||
--dex flap \
|
||||
--from 0x1f8d977b6843e1bbcb306c4a3664c9fb0277979d \
|
||||
--name "refer" \
|
||||
--symbol refer \
|
||||
--buy-amt 2 \
|
||||
--image-url https://gmgn.ai/external-res-va/11ad7747dcefcfaae87d3f53a4d7330d_v2l.webp \
|
||||
--website https://www.refercoins.bond/ \
|
||||
--twitter https://x.com/referdotfun \
|
||||
--dev-gas 50000000 \
|
||||
--auto-slippage \
|
||||
--flap-rate-conf '{"buy_tax_rate":100,"sell_tax_rate":100,"mkt_bps":5000,"deflation_bps":2700,"dividend_bps":1800,"lp_bps":500,"minimum_share_balance":10000,"recipient_type":"gift","twitter_account":"handleName","split_conf":[]}'
|
||||
```
|
||||
|
||||
- `recipient_type: gift` → the recipient cut goes to the `twitter_account` X handle; `split_conf` is left `[]`.
|
||||
- Tax distribution: `mkt_bps:5000` (50% to the handle) + `deflation_bps:2700` (27% burn) + `dividend_bps:1800` (18% dividend) + `lp_bps:500` (5% LP) = **10000**.
|
||||
- `lp_bps > 0`, so `minimum_share_balance` must be > 0 (`10000` here).
|
||||
|
||||
## Output Format
|
||||
|
||||
### Pre-create Confirmation
|
||||
@@ -247,10 +525,15 @@ Initial Buy: {--buy-amt} {native currency} (e.g. 0.01 SOL)
|
||||
Slippage: {--slippage}% (or "auto")
|
||||
Image: {--image-url or "base64 provided"}
|
||||
Social: {twitter / telegram / website if provided}
|
||||
Modes: {Mayhem / Cashback / Agent Auto Buyback if set, else "none"}
|
||||
Fee Share: {recipient → % list if set, else "none"}
|
||||
Auto-Sell: {sell_configs summary if set, else "none"}
|
||||
|
||||
Reply "confirm" to deploy this token. This action is IRREVERSIBLE.
|
||||
```
|
||||
|
||||
Omit the Modes / Fee Share / Auto-Sell lines if none were configured — or show them as `none` — but if any **are** set, they MUST appear here so the user re-confirms them explicitly.
|
||||
|
||||
### Post-create Receipt
|
||||
|
||||
After polling confirms a successful deployment:
|
||||
@@ -259,7 +542,7 @@ After polling confirms a successful deployment:
|
||||
✅ Token Created
|
||||
|
||||
Token: {--name} ({--symbol})
|
||||
Address: {output_token from order get}
|
||||
Address: {report.output_token from order get}
|
||||
Chain: {chain}
|
||||
Platform: {--dex}
|
||||
Tx: {explorer link for hash}
|
||||
@@ -273,7 +556,6 @@ Block explorer links:
|
||||
| sol | `https://solscan.io/tx/<hash>` |
|
||||
| bsc | `https://bscscan.com/tx/<hash>` |
|
||||
| base | `https://basescan.org/tx/<hash>` |
|
||||
| eth | `https://etherscan.io/tx/<hash>` |
|
||||
|
||||
## Guided Launch Flow
|
||||
|
||||
@@ -287,24 +569,20 @@ Ask: *"Which chain and platform?"*
|
||||
|
||||
Show the options concisely:
|
||||
|
||||
| Chain | Platform | `--dex` |
|
||||
|-------|----------|---------|
|
||||
| Solana | Pump.fun | `pump` |
|
||||
| Solana | letsbonk | `letsbonk` |
|
||||
| Solana | Raydium | `raydium` |
|
||||
| Solana | BAGS | `bags` |
|
||||
| Solana | Memoo | `memoo` |
|
||||
| Solana | Bonkers | `bonkers` |
|
||||
| BSC | FourMeme | `fourmeme` |
|
||||
| BSC | PancakeSwap | `pancakeswap` |
|
||||
| BSC | Flap | `flap` |
|
||||
| Base | Clanker | `clanker` |
|
||||
| Base | Zora | `zora` |
|
||||
| Base | Flaunch | `flaunch` |
|
||||
| Base | Virtuals | `virtuals_v2` |
|
||||
| Chain | Platform | `--dex` |
|
||||
| ------ | ---------- | ---------- |
|
||||
| Solana | Pump.fun | `pump` |
|
||||
| Solana | Bonk | `bonk` |
|
||||
| Solana | BAGS | `bags` |
|
||||
| BSC | FourMeme | `fourmeme` |
|
||||
| BSC | Flap | `flap` |
|
||||
| Base | Klik | `klik` |
|
||||
| Base | Clanker | `clanker` |
|
||||
|
||||
If the user is unsure, recommend: **Pump.fun (SOL)** or **FourMeme (BSC)**.
|
||||
|
||||
The chosen platform determines which advanced options are available later in Step 7 (e.g. Mayhem/Cashback/Agent Auto Buyback on Pump.fun, fee-share splits on BAGS/Flap/FourMeme). Note the platform now; do not ask about advanced options yet.
|
||||
|
||||
### Step 2 — Token Name
|
||||
|
||||
Ask: *"Token name?"*
|
||||
@@ -343,9 +621,32 @@ Ask all optional fields together in one message:
|
||||
|
||||
The user can reply with just the ones they have, or say "skip" / "none" to proceed.
|
||||
|
||||
### Step 7 — Confirmation & Execute
|
||||
### Step 7 — Platform Modes, Fees & Auto-Sell (platform-dependent)
|
||||
|
||||
Once all information is collected, present the pre-create confirmation summary (see Output Format section) and wait for the user to reply "confirm" before executing.
|
||||
After the basics are collected, ask **once** whether the user wants any advanced options for the platform they chose. Default everyone to a plain fair launch — only configure these when the user explicitly asks. Tailor the question to the selected platform; do not list options that don't apply to it.
|
||||
|
||||
Ask: *"Want any advanced options, or launch with defaults? (reply 'defaults' to skip)"* — then offer the relevant subset.
|
||||
|
||||
**Phrase the question around the platform the user picked — only ask about modes that exist on that platform.** For example, on **Pump.fun** ask specifically:
|
||||
- *"Enable Cashback mode?"* (`--is-cashback`)
|
||||
- *"Enable Agent Auto Buyback mode?"* (`--is-buy-back`)
|
||||
- *"Enable Mayhem mode?"* (`--is-mayhem`)
|
||||
- *"Set up a fee-share split?"* (`--pump-fee-share-list`)
|
||||
- *"Want me to remember these advanced settings for your next launch?"* — if yes, save them to memory so future launches can pre-fill the same choices.
|
||||
|
||||
Bonk / BAGS / Flap / FourMeme have **no mode toggles** — for those, skip the mode questions and only ask about fee-share split and auto-sell.
|
||||
|
||||
The relevant options per platform:
|
||||
|
||||
- **Pump.fun modes** — Mayhem (`--is-mayhem`), Cashback (`--is-cashback`), Agent Auto Buyback (`--is-buy-back`).
|
||||
- **Fee-share split** — Pump.fun (`--pump-fee-share-list`), BAGS (`--dev-wallet-bps` + `--bags-fee-share-list`), Bonk (`--dev-wallet-bps`), Flap (`--flap-rate-conf`), FourMeme (`--fourmeme-rate-conf`). See [Advanced API Fields](#advanced-api-fields) for JSON schemas. **Warn the user this permanently routes token revenue to the listed accounts.** Always ask the user for shares as percentages — convert to bps yourself. Shares must add up to 100%.
|
||||
- **Auto-sell** — `--sell-configs` (JSON): delay-sell (sell a fraction N seconds after the buy) and/or limit-sell (sell once market cap hits a USD target). See [Auto-Sell Configuration](#auto-sell-configuration). Confirm the sell ratio and trigger before setting it.
|
||||
|
||||
If the user says "defaults" / "skip" / "none", proceed with none of these set.
|
||||
|
||||
### Step 8 — Confirmation & Execute
|
||||
|
||||
Once all information is collected, present the pre-create confirmation summary (see Output Format section) and wait for the user to reply "confirm" before executing. If any advanced options from Step 7 were set, they MUST appear in the summary so the user re-confirms them explicitly.
|
||||
|
||||
---
|
||||
|
||||
@@ -355,18 +656,19 @@ Once all information is collected, present the pre-create confirmation summary (
|
||||
- **[REQUIRED] `--dex` validation** — Before running, look up the user's named platform in the Supported Launchpads table and resolve to the correct `--dex` identifier. Never guess or pass a freeform platform name. If the chain/platform combination is not in the table, tell the user it is unsupported.
|
||||
- **Slippage requirement** — Either `--slippage` or `--auto-slippage` must be provided. If the user did not specify, suggest `--auto-slippage` for volatile new tokens or ask for a preference.
|
||||
- **Image handling** — If the user provides a file path, run `base64 -i <path>` and pass the result to `--image`. If they provide a URL, use `--image-url`. If neither is provided, ask before building the confirmation — most platforms require a logo.
|
||||
- **Fee-share / bps inputs** — Always collect and confirm shares as percentages with the user; convert to basis points yourself (50% → `5000`). Never ask for a raw bps value.
|
||||
- **Address validation** — Validate `--from` wallet address format before submitting:
|
||||
- `sol`: base58, 32–44 characters
|
||||
- `bsc` / `base` / `eth`: `0x` + 40 hex digits
|
||||
- `bsc` / `base`: `0x` + 40 hex digits
|
||||
- **Chain-wallet compatibility** — SOL addresses are incompatible with EVM chains and vice versa. Warn the user and abort if the address format does not match the chain.
|
||||
- **Order polling** — After `cooking create`, if `status` is `pending`, poll `order get` every 2 seconds up to 30 seconds. The token address is in `output_token`. Do not report success until `status` is `confirmed`.
|
||||
- **Order polling** — After `cooking create`, if `status` is `pending`, poll `order get` every 2 seconds up to 30 seconds. The token address is in `report.output_token`. Do not report success until `status` is `confirmed`.
|
||||
- **Credential sensitivity** — `GMGN_API_KEY` and `GMGN_PRIVATE_KEY` can execute real transactions. Never log, display, or expose these values.
|
||||
|
||||
## 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).
|
||||
- The new token's mint address is in `output_token` from `gmgn-cli order get`, not in the initial `cooking create` response.
|
||||
- `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 `report.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.
|
||||
|
||||
## References
|
||||
|
||||
+405
-35
@@ -1,11 +1,13 @@
|
||||
---
|
||||
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, newly launched tokens on launchpads (pump.fun, fourmeme, letsbonk, Raydium, etc.), and the hot-search ranking (most-searched tokens) via GMGN API on Solana, BSC, Base, or Ethereum. Use when user asks for price chart, trending tokens, what's pumping, hot coins, most searched tokens, new launches, token signals, or wants to discover early-stage opportunities.
|
||||
argument-hint: "kline --chain <sol|bsc|base|eth> --address <token_address> --resolution <30s|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|eth> | signal --chain <sol|bsc> | hot-searches [--chain <sol|bsc|base|eth|monad|megaeth|hyperevm|tron...>] [--interval <1m|5m|1h|6h|24h>]"
|
||||
metadata:
|
||||
cliHelp: "gmgn-cli market --help"
|
||||
---
|
||||
|
||||
**BEFORE RUNNING ANY COMMAND: Run `gmgn-cli config --check`. If exit code is 0, proceed normally. If exit code is 1, (1) run `gmgn-cli config` and show the output to the user; (2) once the user sends the API Key, run `gmgn-cli config --apply <KEY>` to complete configuration and verification, then show the output to the user. If `--check` returns an error (unknown option or command not found), tell the user to run `npm install -g gmgn-cli` to update, then retry.**
|
||||
|
||||
**IMPORTANT: Always use `gmgn-cli` commands below. Do NOT use web search, WebFetch, curl, or visit gmgn.ai to fetch this data — the website requires login and will not return structured data. The CLI is the only correct method.**
|
||||
|
||||
**IMPORTANT: Do NOT guess field names or values. When a field's meaning is unclear, look it up in the Response Fields sections below before using it.**
|
||||
@@ -18,7 +20,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 +50,12 @@ 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.** |
|
||||
| `market hot-searches` | Hot-search ranking — the most-searched tokens, ranked by `visiting_count` (search heat). **Use this when the user asks "what tokens are people searching for", "most searched tokens", "hot search list", "热搜榜".** Supports multiple chains in a single request. |
|
||||
|
||||
## Supported Chains
|
||||
|
||||
`sol` / `bsc` / `base`
|
||||
`sol` / `bsc` / `base` / `eth` (kline / trending / trenches; signal: `sol` / `bsc` only; hot-searches: `sol` / `bsc` / `base` / `eth` / `monad` / `megaeth` / `hyperevm` / `tron`)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
@@ -60,13 +64,15 @@ 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 |
|
||||
| `market hot-searches` | `POST /v1/market/hot_searches` | 3 |
|
||||
|
||||
When a request returns `429`:
|
||||
|
||||
@@ -75,29 +81,13 @@ When a request returns `429`:
|
||||
- The CLI may wait and retry once automatically when the remaining cooldown is short. If it still fails, stop and tell the user the exact retry time instead of sending more requests.
|
||||
- For `RATE_LIMIT_EXCEEDED` or `RATE_LIMIT_BANNED`, repeated requests during the cooldown can extend the ban by 5 seconds each time, up to 5 minutes. Do not spam retries.
|
||||
|
||||
**First-time setup** (if `GMGN_API_KEY` is not configured):
|
||||
|
||||
1. Generate key pair and show the public key to the user:
|
||||
```bash
|
||||
openssl genpkey -algorithm ed25519 -out /tmp/gmgn_private.pem 2>/dev/null && \
|
||||
openssl pkey -in /tmp/gmgn_private.pem -pubout 2>/dev/null
|
||||
```
|
||||
Tell the user: *"This is your Ed25519 public key. Go to **https://gmgn.ai/ai**, paste it into the API key creation form, then send me the API Key value shown on the page."*
|
||||
|
||||
2. Wait for the user's API key, then configure:
|
||||
```bash
|
||||
mkdir -p ~/.config/gmgn
|
||||
echo 'GMGN_API_KEY=<key_from_user>' > ~/.config/gmgn/.env
|
||||
chmod 600 ~/.config/gmgn/.env
|
||||
```
|
||||
|
||||
## `market kline` Parameters
|
||||
|
||||
| Parameter | Required | Description |
|
||||
|-----------|----------|-------------|
|
||||
| `--chain` | Yes | `sol` / `bsc` / `base` |
|
||||
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
|
||||
| `--address` | Yes | Token contract address |
|
||||
| `--resolution` | Yes | Candlestick resolution: `1m` / `5m` / `15m` / `1h` / `4h` / `1d` |
|
||||
| `--resolution` | Yes | Candlestick resolution: `30s` / `1m` / `5m` / `15m` / `1h` / `4h` / `1d` |
|
||||
| `--from` | No | Start time (Unix seconds) |
|
||||
| `--to` | No | End time (Unix seconds) |
|
||||
|
||||
@@ -138,13 +128,39 @@ The response is an object with a `list` array. Each element in `list` is one can
|
||||
|
||||
| Option | Description |
|
||||
|--------|-------------|
|
||||
| `--chain` | Required. `sol` / `bsc` / `base` |
|
||||
| `--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` / `four_xmode_agent` / `cubepeg` / `likwid` / `goplus_creator` / `goplus_skills` / `openfour` / `flap` / `flap_stocks` / `flap_aioracle` / `clanker` / `lunafun` / `pool_uniswap` / `pool_pancake`. **base**: `clanker` / `bankr` / `flaunch` / `zora` / `zora_creator` / `baseapp` / `basememe` / `virtuals_v2` / `klik`. **eth**: `trench` / `clanker` / `klik` / `livo` / `stroid` / `pool_uniswap_v2` / `pool_uniswap_v3` / `printr` |
|
||||
|
||||
### `market trending` Range Filters
|
||||
|
||||
Optional `--min-*` / `--max-*` flags apply server-side numeric range filtering (inclusive). Unknown metrics are ignored by the service.
|
||||
|
||||
| Option | Description |
|
||||
|--------|-------------|
|
||||
| `--min-volume` / `--max-volume` | Trading volume (USD) |
|
||||
| `--min-liquidity` / `--max-liquidity` | Liquidity (USD) |
|
||||
| `--min-marketcap` / `--max-marketcap` | Market cap (USD) |
|
||||
| `--min-history-highest-marketcap` / `--max-history-highest-marketcap` | Historical highest market cap (USD) |
|
||||
| `--min-swaps` / `--max-swaps` | Swap count |
|
||||
| `--min-holder-count` / `--max-holder-count` | Holder count |
|
||||
| `--min-gas-fee` / `--max-gas-fee` | Gas fee |
|
||||
| `--min-renowned-count` / `--max-renowned-count` | KOL / renowned wallet count |
|
||||
| `--min-smart-degen-count` / `--max-smart-degen-count` | Smart-money holder count |
|
||||
| `--min-bot-degen-count` / `--max-bot-degen-count` | Bot-degen wallet count |
|
||||
| `--min-visiting-count` / `--max-visiting-count` | Visitor count |
|
||||
| `--min-price-change-percent` / `--max-price-change-percent` | Price change ratio over the interval |
|
||||
| `--min-insider-rate` / `--max-insider-rate` | Insider trading ratio (0–1); tokens lacking this field are excluded |
|
||||
| `--min-bundler-rate` / `--max-bundler-rate` | Bundle-bot trading ratio (0–1); tokens lacking this field are excluded |
|
||||
| `--min-entrapment-ratio` / `--max-entrapment-ratio` | Entrapment trading ratio (0–1); tokens lacking this field are excluded |
|
||||
| `--min-top10-holder-rate` / `--max-top10-holder-rate` | Top-10 holder concentration (0–1) |
|
||||
| `--min-top70-sniper-hold-rate` / `--max-top70-sniper-hold-rate` | Top-70 sniper holding ratio (0–1) |
|
||||
| `--min-dev-team-hold-rate` / `--max-dev-team-hold-rate` | Dev-team holding ratio (0–1); `--min-dev-team-hold-rate` also excludes creator-close tokens |
|
||||
| `--min-created` / `--max-created` | Token age window, duration string with a `m` (minutes) / `h` (hours) / `d` (days) suffix, e.g. `30m` / `6h` / `7d`. `--min-created` is a minimum age (excludes younger tokens); `--max-created` a maximum age (excludes older tokens). **Note:** the raw upstream rank interface accepts minutes only; the openapi-service does not forward this field — it evaluates the age window itself (cutoff = now − duration, computed natively for `m`/`h`/`d`), so `6h` / `7d` work here. Always include a unit suffix — a bare number is **not** accepted. |
|
||||
|
||||
## Usage Examples
|
||||
|
||||
@@ -174,6 +190,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
|
||||
@@ -232,20 +256,73 @@ gmgn-cli market trending \
|
||||
--platform fourmeme --platform four_xmode_agent \
|
||||
--order-by volume --limit 50 --raw
|
||||
|
||||
# BSC 5m hottest — fourmeme family, sorted by volume
|
||||
# BSC 5m hottest — all BSC launchpads, sorted by volume
|
||||
gmgn-cli market trending \
|
||||
--chain bsc --interval 5m \
|
||||
--platform fourmeme --platform fourmeme_agent --platform bn_fourmeme --platform four_xmode_agent \
|
||||
--platform cubepeg --platform likwid --platform goplus_creator --platform goplus_skills --platform openfour \
|
||||
--platform flap --platform flap_stocks --platform flap_aioracle --platform clanker --platform lunafun \
|
||||
--order-by volume --limit 50 --raw
|
||||
|
||||
# BSC 1h trending — fourmeme with safety filters
|
||||
# BSC 1h trending — all BSC launchpads with safety filters
|
||||
gmgn-cli market trending \
|
||||
--chain bsc --interval 1h \
|
||||
--platform fourmeme --platform fourmeme_agent --platform bn_fourmeme --platform four_xmode_agent \
|
||||
--platform cubepeg --platform likwid --platform goplus_creator --platform goplus_skills --platform openfour \
|
||||
--platform flap --platform flap_stocks --platform flap_aioracle --platform clanker --platform lunafun \
|
||||
--filter not_honeypot --filter verified \
|
||||
--order-by volume --limit 20 --raw
|
||||
```
|
||||
|
||||
### Trending — ETH by Launchpad Platform
|
||||
|
||||
```bash
|
||||
# ETH 1h trending — all platforms, sorted by volume
|
||||
gmgn-cli market trending --chain eth --interval 1h --order-by volume --limit 20
|
||||
|
||||
# ETH 1h trending — specific platforms only
|
||||
gmgn-cli market trending \
|
||||
--chain eth --interval 1h \
|
||||
--platform trench --platform clanker --platform klik \
|
||||
--order-by volume --limit 50 --raw
|
||||
|
||||
# ETH 1h trending — all ETH platforms with safety filters
|
||||
gmgn-cli market trending \
|
||||
--chain eth --interval 1h \
|
||||
--platform trench --platform clanker --platform klik --platform livo --platform stroid \
|
||||
--platform pool_uniswap_v2 --platform pool_uniswap_v3 --platform printr \
|
||||
--filter not_honeypot --filter verified \
|
||||
--order-by volume --limit 20 --raw
|
||||
|
||||
# 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 — Numeric Range Filters
|
||||
|
||||
```bash
|
||||
# SOL 1h trending — liquidity 10k–1M, market cap above 50k, sorted by volume
|
||||
gmgn-cli market trending \
|
||||
--chain sol --interval 1h \
|
||||
--min-liquidity 10000 --max-liquidity 1000000 --min-marketcap 50000 \
|
||||
--order-by volume --limit 30 --raw
|
||||
|
||||
# SOL 5m hottest — fresh tokens (under 30 min old) with smart money interest
|
||||
gmgn-cli market trending \
|
||||
--chain sol --interval 5m \
|
||||
--max-created 30m --min-smart-degen-count 1 \
|
||||
--order-by volume --limit 50 --raw
|
||||
|
||||
# SOL 1h trending — exclude high-insider / high-bundler tokens
|
||||
gmgn-cli market trending \
|
||||
--chain sol --interval 1h \
|
||||
--max-insider-rate 0.3 --max-bundler-rate 0.3 \
|
||||
--order-by volume --limit 20 --raw
|
||||
```
|
||||
|
||||
### Trending — Base by Launchpad Platform
|
||||
|
||||
```bash
|
||||
@@ -465,7 +542,7 @@ Use field combinations to determine what stage a token is in. This affects how s
|
||||
|
||||
| Parameter | Required | Description |
|
||||
|-----------|----------|-------------|
|
||||
| `--chain` | Yes | `sol` / `bsc` / `base` |
|
||||
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
|
||||
| `--type` | No | Categories to query, repeatable: `new_creation` / `near_completion` / `completed` (default: all three) |
|
||||
| `--launchpad-platform` | No | Launchpad platform filter, repeatable (default: all platforms for the chain) |
|
||||
| `--limit` | No | Max results per category, max 80 (default: 80) |
|
||||
@@ -474,6 +551,15 @@ Use field combinations to determine what stage a token is in. This affects how s
|
||||
| `--direction` | No | Sort direction: `asc` / `desc` (default: `desc`; `asc` for `rug_ratio`) |
|
||||
| `--min-*` / `--max-*` | No | Server-side filter range flags — see Filter Fields Reference below |
|
||||
|
||||
**`--launchpad-platform` values by chain** (omit `--launchpad-platform` to use all of the chain's platforms):
|
||||
|
||||
| Chain | Platforms |
|
||||
|-------|-----------|
|
||||
| `sol` | `Pump.fun` / `pump_mayhem` / `pump_mayhem_agent` / `pump_agent` / `letsbonk` / `bonkers` / `bags` / `memoo` / `liquid` / `bankr` / `zora` / `surge` / `anoncoin` / `moonshot_app` / `wendotdev` / `heaven` / `sugar` / `token_mill` / `believe` / `trendsfun` / `trends_fun` / `jup_studio` / `Moonshot` / `boop` / `ray_launchpad` / `meteora_virtual_curve` / `xstocks` |
|
||||
| `bsc` | `fourmeme` / `fourmeme_agent` / `bn_fourmeme` / `four_xmode_agent` / `cubepeg` / `likwid` / `goplus_creator` / `goplus_skills` / `openfour` / `flap` / `flap_stocks` / `flap_aioracle` / `clanker` / `lunafun` |
|
||||
| `base` | `clanker` / `bankr` / `flaunch` / `zora` / `zora_creator` / `baseapp` / `basememe` / `virtuals_v2` / `klik` |
|
||||
| `eth` | `trench` / `clanker` / `klik` / `livo` / `stroid` / `pool_uniswap_v2` / `pool_uniswap_v3` / `printr` |
|
||||
|
||||
### Filter Presets
|
||||
|
||||
Presets are applied server-side: the API filters tokens before returning results.
|
||||
@@ -505,7 +591,7 @@ All filter flags are sent as part of the API request body — the server filters
|
||||
| `--min-progress` / `--max-progress` | float | Bonding curve progress (0–1) |
|
||||
| `--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 (0–1) |
|
||||
| `--min-rug-ratio` / `--max-rug-ratio` | float | Rug pull risk score (0–1) |
|
||||
@@ -716,25 +802,33 @@ gmgn-cli market trenches --chain sol --raw \
|
||||
# All three categories at once
|
||||
gmgn-cli market trenches --chain bsc --raw \
|
||||
--type new_creation --type near_completion --type completed \
|
||||
--launchpad-platform fourmeme --launchpad-platform fourmeme_agent --launchpad-platform bn_fourmeme --launchpad-platform four_xmode_agent --launchpad-platform flap --launchpad-platform clanker --launchpad-platform lunafun \
|
||||
--launchpad-platform fourmeme --launchpad-platform fourmeme_agent --launchpad-platform bn_fourmeme --launchpad-platform four_xmode_agent \
|
||||
--launchpad-platform cubepeg --launchpad-platform likwid --launchpad-platform goplus_creator --launchpad-platform goplus_skills --launchpad-platform openfour \
|
||||
--launchpad-platform flap --launchpad-platform flap_stocks --launchpad-platform flap_aioracle --launchpad-platform clanker --launchpad-platform lunafun \
|
||||
--limit 80
|
||||
|
||||
# New creation only
|
||||
gmgn-cli market trenches --chain bsc --raw \
|
||||
--type new_creation \
|
||||
--launchpad-platform fourmeme --launchpad-platform fourmeme_agent --launchpad-platform bn_fourmeme --launchpad-platform four_xmode_agent --launchpad-platform flap --launchpad-platform clanker --launchpad-platform lunafun \
|
||||
--launchpad-platform fourmeme --launchpad-platform fourmeme_agent --launchpad-platform bn_fourmeme --launchpad-platform four_xmode_agent \
|
||||
--launchpad-platform cubepeg --launchpad-platform likwid --launchpad-platform goplus_creator --launchpad-platform goplus_skills --launchpad-platform openfour \
|
||||
--launchpad-platform flap --launchpad-platform flap_stocks --launchpad-platform flap_aioracle --launchpad-platform clanker --launchpad-platform lunafun \
|
||||
--limit 80
|
||||
|
||||
# Near completion only
|
||||
gmgn-cli market trenches --chain bsc --raw \
|
||||
--type near_completion \
|
||||
--launchpad-platform fourmeme --launchpad-platform fourmeme_agent --launchpad-platform bn_fourmeme --launchpad-platform four_xmode_agent --launchpad-platform flap --launchpad-platform clanker --launchpad-platform lunafun \
|
||||
--launchpad-platform fourmeme --launchpad-platform fourmeme_agent --launchpad-platform bn_fourmeme --launchpad-platform four_xmode_agent \
|
||||
--launchpad-platform cubepeg --launchpad-platform likwid --launchpad-platform goplus_creator --launchpad-platform goplus_skills --launchpad-platform openfour \
|
||||
--launchpad-platform flap --launchpad-platform flap_stocks --launchpad-platform flap_aioracle --launchpad-platform clanker --launchpad-platform lunafun \
|
||||
--limit 80
|
||||
|
||||
# Completed (open market) only
|
||||
gmgn-cli market trenches --chain bsc --raw \
|
||||
--type completed \
|
||||
--launchpad-platform fourmeme --launchpad-platform fourmeme_agent --launchpad-platform bn_fourmeme --launchpad-platform four_xmode_agent --launchpad-platform flap --launchpad-platform clanker --launchpad-platform lunafun \
|
||||
--launchpad-platform fourmeme --launchpad-platform fourmeme_agent --launchpad-platform bn_fourmeme --launchpad-platform four_xmode_agent \
|
||||
--launchpad-platform cubepeg --launchpad-platform likwid --launchpad-platform goplus_creator --launchpad-platform goplus_skills --launchpad-platform openfour \
|
||||
--launchpad-platform flap --launchpad-platform flap_stocks --launchpad-platform flap_aioracle --launchpad-platform clanker --launchpad-platform lunafun \
|
||||
--limit 80
|
||||
```
|
||||
|
||||
@@ -766,6 +860,28 @@ gmgn-cli market trenches --chain base --raw \
|
||||
--limit 80
|
||||
```
|
||||
|
||||
### ETH Trenches Examples
|
||||
|
||||
```bash
|
||||
# All three categories at once
|
||||
gmgn-cli market trenches --chain eth --raw \
|
||||
--type new_creation --type near_completion --type completed \
|
||||
--launchpad-platform trench --launchpad-platform clanker --launchpad-platform klik --launchpad-platform livo --launchpad-platform stroid --launchpad-platform pool_uniswap_v2 --launchpad-platform pool_uniswap_v3 --launchpad-platform printr \
|
||||
--limit 80
|
||||
|
||||
# New creation only
|
||||
gmgn-cli market trenches --chain eth --raw \
|
||||
--type new_creation \
|
||||
--launchpad-platform trench --launchpad-platform clanker --launchpad-platform klik --launchpad-platform livo --launchpad-platform stroid --launchpad-platform pool_uniswap_v2 --launchpad-platform pool_uniswap_v3 --launchpad-platform printr \
|
||||
--limit 80
|
||||
|
||||
# Completed (open market) only
|
||||
gmgn-cli market trenches --chain eth --raw \
|
||||
--type completed \
|
||||
--launchpad-platform trench --launchpad-platform clanker --launchpad-platform klik --launchpad-platform livo --launchpad-platform stroid --launchpad-platform pool_uniswap_v2 --launchpad-platform pool_uniswap_v3 --launchpad-platform printr \
|
||||
--limit 80
|
||||
```
|
||||
|
||||
## Output Format
|
||||
|
||||
### `market kline` — Price Summary
|
||||
@@ -809,11 +925,265 @@ 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 14–16 in that case.
|
||||
|
||||
| Option | Required | Description |
|
||||
|--------|----------|-------------|
|
||||
| `--chain` | Yes | `sol` / `bsc` |
|
||||
| `--signal-type` | No | Signal type(s), repeatable (1–18, 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 (1–18, 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 (0–1) |
|
||||
| `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 14–16 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 14–16 — 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
|
||||
```
|
||||
|
||||
## `market hot-searches` Parameters
|
||||
|
||||
Returns the hot-search ranking — the tokens people are searching for most right now, ranked by `visiting_count` (search heat). Cross-chain top-500 ranking; one request can cover several chains at once. **Use this for "most searched tokens", "hot search list", "热搜榜", "what is everyone looking at"** — this is distinct from `market trending` (ranked by swap activity), which answers "what is being traded most."
|
||||
|
||||
| Option | Description |
|
||||
|--------|-------------|
|
||||
| `--chain <chain...>` | Repeatable. `sol` / `bsc` / `base` / `eth` / `monad` / `megaeth` / `hyperevm` / `tron`. **Omit to query the default 7-chain set** (sol / bsc / base / eth / hyperevm / megaeth / monad, each at `24h` with chain-appropriate safety filters). |
|
||||
| `--interval <interval>` | `1m` / `5m` / `1h` / `6h` / `24h` (default `24h`). Applies to every `--chain` provided. |
|
||||
| `--limit <n>` | Max results per chain (default `500`). |
|
||||
| `--filter <tag...>` | Repeatable **boolean** filter tags (the downstream `filter.filters` array). **⚠️ SOL defaults: `renounced frozen`; EVM defaults: `not_honeypot verified renounced`.** Omitting `--filter` is NOT "no filter" — the server applies chain defaults. See the Filter Tags table below for the exact vocabulary. |
|
||||
| `--min-* / --max-* <n>` | Numeric range bounds, **same metric names as `market trending`** (e.g. `--min-liquidity`, `--max-marketcap`, `--min-smart-degen-count`). Translated server-side per `--interval`. `--min-created` / `--max-created` are token-age durations. See the Range Filters table below. |
|
||||
| `--params <json>` | Full override: a JSON array of param objects. When provided, `--chain` / `--interval` / `--limit` / `--filter` and all range flags are ignored. Filter fields are **flattened onto each param** (no nested `filter` object): `{ "label": "...", "chain": "...", "interval": "...", "filters": [...], "limit": 500, "min_liquidity": 1000 }` — a param accepts `filters`, `limit`, `min_created`/`max_created`, and rank-style `min_<metric>`/`max_<metric>` keys. |
|
||||
|
||||
### `market hot-searches` Filter Tags (`--filter` / `filter.filters`)
|
||||
|
||||
The downstream (gmgn rank filter-service) evaluates each tag as an AND condition — a token must pass **every** tag to stay in the list. **Unknown tags are silently accepted but do nothing** (pass-through), so an unrecognised tag will NOT filter anything — spelling matters. This tag set is the filter-service vocabulary and differs slightly from `market trending`'s tag names (see the alias note below).
|
||||
|
||||
**These are the only recognised tags** (anything else is a no-op):
|
||||
|
||||
| Tag | Chains | Passes when |
|
||||
|----------------------|-------------|-------------|
|
||||
| `renounced` | sol / EVM | sol: mint authority renounced (`renounced_mint == 1`); EVM: owner renounced (`is_renounced == 1`; lenient — nil passes) |
|
||||
| `frozen` | sol only | freeze authority renounced (`renounced_freeze_account == 1`); non-sol always fails |
|
||||
| `is_burnt` | all | LP pool burned (`burn_status == "burn"`) |
|
||||
| `token_burnt` | all | creator burned tokens (`dev_token_burn_ratio > 0`) |
|
||||
| `not_wash_trading` | all | not flagged as wash trading |
|
||||
| `not_honeypot` | EVM | not a honeypot (`is_honeypot == 0`; lenient — nil passes) |
|
||||
| `verified` | EVM | contract open-source (`is_open_source == 1`; lenient — nil passes) |
|
||||
| `locked` | EVM | liquidity locked ≥ 50% (`lock_percent >= 0.5`) |
|
||||
| `has_social` | all | has Twitter, Telegram, or Website |
|
||||
| `distribed` | all | top-10 holder rate in (0, 0.3] (well distributed) |
|
||||
| `not_risk` | all | composite low-risk filter (sol: liquidity≥4000 + mint renounced + top10<0.3 + freeze renounced + LP burned; EVM: not honeypot + liquidity≥4000 + open-source + renounced + lock≥0.5) |
|
||||
| `img_not_duplicate` | all | avatar image not duplicated (`image_dup == "0"`) |
|
||||
| `social_not_duplicate` | all | social links not shared (`twitter_dup == 0 && telegram_dup == 0 && website_dup == 0`) |
|
||||
| `creator_hold` | all | dev still holding (not `creator_close`) |
|
||||
| `creator_close` | all | dev sold/closed (`creator_token_status == "creator_close"`) |
|
||||
| `dexscr_update_link` | all | social links updated on DexScreener (`> 0`) |
|
||||
| `launching` | all | still on the launchpad bonding curve (`launchpad_status == "0"`); pair with `migrated` to allow both |
|
||||
| `migrated` | all | graduated / migrated to DEX (`launchpad_status == "1"`); pair with `launching` to allow both |
|
||||
| `hide_b20` | base only | token standard is not `b20` (no-op on non-base) |
|
||||
| `hide_non_b20` | base only | token standard is `b20` (no-op on non-base) |
|
||||
|
||||
> **⚠️ Different names than `market trending`.** This path uses `launching` / `migrated` (NOT `is_internal_market` / `is_out_market`) and `img_not_duplicate` / `social_not_duplicate` (NOT `not_image_dup` / `not_social_dup`). Tags that `market trending` supports but this endpoint does **not** recognise (they become silent no-ops here): `dexscr_ad`, `dexscr_trending_bar`, `dexscr_boost`, `cto_flag`, `is_internal_market`, `is_out_market`, `not_image_dup`, `not_social_dup`.
|
||||
|
||||
### `market hot-searches` Range Filters (`--min-*` / `--max-*`)
|
||||
|
||||
Numeric bounds use the **same rank-style metric names as `market trending`**. They are sent flattened on each param and translated server-side to the downstream field for the param's `--interval`. Closed intervals; metrics the downstream cannot read are dropped (not silent no-ops on the wire — they are removed before the request).
|
||||
|
||||
| Flag pair | Type | Metric |
|
||||
|------------------------------------------------------------|----------|--------|
|
||||
| `--min-volume` / `--max-volume` | float | Trading volume (USD) — bound to the `--interval` window |
|
||||
| `--min-swaps` / `--max-swaps` | int | Swap count — bound to the `--interval` window |
|
||||
| `--min-price-change-percent` / `--max-price-change-percent` | float | Price change ratio — **only `1m` / `5m` / `1h`; dropped for `6h` / `24h`** |
|
||||
| `--min-liquidity` / `--max-liquidity` | float | Liquidity (USD) |
|
||||
| `--min-marketcap` / `--max-marketcap` | float | Market cap (USD) |
|
||||
| `--min-history-highest-marketcap` / `--max-history-highest-marketcap` | float | All-time-high market cap (USD) |
|
||||
| `--min-holder-count` / `--max-holder-count` | int | Holder count |
|
||||
| `--min-gas-fee` / `--max-gas-fee` | float | Gas fee |
|
||||
| `--min-renowned-count` / `--max-renowned-count` | int | KOL / renowned holder count |
|
||||
| `--min-smart-degen-count` / `--max-smart-degen-count` | int | Smart-money holder count |
|
||||
| `--min-bot-degen-count` / `--max-bot-degen-count` | int | Bot-degen wallet count |
|
||||
| `--min-visiting-count` / `--max-visiting-count` | int | Visitor count |
|
||||
| `--min-insider-rate` / `--max-insider-rate` | float | Insider trading ratio (0–1); tokens lacking this field are excluded |
|
||||
| `--min-bundler-rate` / `--max-bundler-rate` | float | Bundle-bot trading ratio (0–1); tokens lacking this field are excluded |
|
||||
| `--min-entrapment-ratio` / `--max-entrapment-ratio` | float | Entrapment trading ratio (0–1); tokens lacking this field are excluded |
|
||||
| `--min-top10-holder-rate` / `--max-top10-holder-rate` | float | Top-10 holder concentration (0–1) |
|
||||
| `--min-top70-sniper-hold-rate` / `--max-top70-sniper-hold-rate` | float | Top-70 sniper holding ratio (0–1) |
|
||||
| `--min-dev-team-hold-rate` / `--max-dev-team-hold-rate` | float | Dev-team holding ratio (0–1) |
|
||||
| `--min-created` / `--max-created` | duration | Token age window (`30m` / `6h` / `7d`). `min_created` = minimum age; `max_created` = maximum age |
|
||||
|
||||
**Notes on behaviour:**
|
||||
|
||||
- `--chain all` is **not** valid. To aggregate across chains, pass `--chain` multiple times (or omit `--chain` for the default 7-chain set).
|
||||
- When you pass `--chain` but omit `--filter`, the **server** applies the chain-appropriate default filters — so each chain is filtered even without an explicit `--filter`.
|
||||
- Different chains return different counts: a chain's token count depends on how many of its tokens made the global top-500 (sol is usually the largest; monad / megaeth are small).
|
||||
|
||||
## `market hot-searches` Response Fields
|
||||
|
||||
The response `data` is an array. Each element is one `(interval, chain)` result block:
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `interval` | string | The interval for this block |
|
||||
| `chain` | string | The chain for this block |
|
||||
| `version` | string | Subscription version — persist it for WebSocket reconnect |
|
||||
| `tokens` | array | Ranked tokens (search heat desc), max 500. Each token carries a 1-based `rank` |
|
||||
|
||||
**Token fields are the same long-form fields as `market trending`** — the server maps the upstream shortcodes for you, so you read `visiting_count` / `market_cap` / `symbol` directly (NOT `v_c` / `mc` / `s`). Key fields:
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| `address` | Token contract address |
|
||||
| `chain` | Chain |
|
||||
| `name` / `symbol` | Token name / ticker |
|
||||
| `price` | Current price (USD) |
|
||||
| `visiting_count` | **Primary ranking key — search / visit heat** |
|
||||
| `market_cap` | Market cap (USD) |
|
||||
| `volume` | Volume in this interval (USD) |
|
||||
| `liquidity` | Liquidity (USD) |
|
||||
| `swaps` / `buys` / `sells` | Swap / buy / sell counts |
|
||||
| `holder_count` | Holder count |
|
||||
| `rank` | 1-based position within the block |
|
||||
|
||||
See the [`market trending` Response Fields](#market-trending-response-fields) section above for the full field set — hot-searches tokens use the identical `RankItem` shape.
|
||||
|
||||
### `market hot-searches` Usage Examples
|
||||
|
||||
```bash
|
||||
# Default 7-chain hot-search ranking (sol/bsc/base/eth/hyperevm/megaeth/monad, each 24h)
|
||||
gmgn-cli market hot-searches --raw
|
||||
|
||||
# SOL only, 24h hot-search list
|
||||
gmgn-cli market hot-searches --chain sol --interval 24h --raw
|
||||
|
||||
# SOL + BSC + Base, 1h window, top 50 per chain
|
||||
gmgn-cli market hot-searches --chain sol --chain bsc --chain base --interval 1h --limit 50 --raw
|
||||
|
||||
# SOL with custom boolean filters
|
||||
gmgn-cli market hot-searches --chain sol --interval 24h \
|
||||
--filter renounced --filter frozen --raw
|
||||
|
||||
# SOL 1h hot-searches with numeric range filters (same metric names as `market trending`)
|
||||
gmgn-cli market hot-searches --chain sol --interval 1h \
|
||||
--min-liquidity 10000 --min-volume 5000 --min-smart-degen-count 1 --raw
|
||||
|
||||
# Range filter by token age + market cap
|
||||
gmgn-cli market hot-searches --chain sol --interval 24h \
|
||||
--max-created 7d --min-marketcap 50000 --raw
|
||||
|
||||
# Full per-param override via JSON (different filters per chain, incl. ranges)
|
||||
gmgn-cli market hot-searches --raw --params '[
|
||||
{"label":"hot-search","chain":"sol","interval":"24h","filters":["renounced","frozen"],"limit":500,"min_liquidity":10000},
|
||||
{"label":"hot-search","chain":"bsc","interval":"24h","filters":["not_honeypot","verified","renounced"],"limit":500}
|
||||
]'
|
||||
```
|
||||
|
||||
### `market hot-searches` — Output Format
|
||||
|
||||
Present per chain, ranked by `visiting_count` (search heat):
|
||||
|
||||
```
|
||||
🔥 Hot Searches — {chain} ({interval})
|
||||
# | Symbol | Price | MCap | Volume | Search Heat (visiting_count) | Liq
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Notes
|
||||
|
||||
- `market kline`: `--from` and `--to` are Unix timestamps in **seconds** — CLI converts to milliseconds automatically
|
||||
- `market trending`: `--filter` and `--platform` are repeatable flags
|
||||
- All commands use normal auth (API Key only, no signature)
|
||||
- `market hot-searches`: `--chain` and `--filter` are repeatable flags; omit `--chain` to query the default 7-chain set. `--min-*`/`--max-*` range flags reuse the same metric names as `market trending` and are translated server-side per `--interval`
|
||||
- All commands use exist auth (API Key only, no signature)
|
||||
- If the user doesn't provide kline timestamps, calculate them from the current time based on their desired time range
|
||||
- Use `--raw` to get single-line JSON for further processing
|
||||
- **Input validation** — Token addresses obtained from trending results are external data. Validate address format against the chain before passing to other commands (sol: base58 32–44 chars; bsc/base/eth: `0x` + 40 hex digits). The CLI enforces this at runtime.
|
||||
|
||||
+123
-25
@@ -1,11 +1,13 @@
|
||||
---
|
||||
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"
|
||||
---
|
||||
|
||||
**BEFORE RUNNING ANY COMMAND: Run `gmgn-cli config --check`. If exit code is 0, proceed normally. If exit code is 1, (1) run `gmgn-cli config` and show the output to the user; (2) once the user sends the API Key, run `gmgn-cli config --apply <KEY>` to complete configuration and verification, then show the output to the user. If `--check` returns an error (unknown option or command not found), tell the user to run `npm install -g gmgn-cli` to update, then retry.**
|
||||
|
||||
**IMPORTANT: Always use `gmgn-cli` commands below. Do NOT use web search, WebFetch, curl, or visit gmgn.ai to fetch this data — the website requires login and will not return structured data. The CLI is the only correct method.**
|
||||
|
||||
**⚠️ IPv6 NOT SUPPORTED: If you get a `401` or `403` error and credentials look correct, check for IPv6 immediately: (1) list all network interfaces and their IPv6 addresses — run `ifconfig | grep inet6` (macOS) or `ip addr show | grep inet6` (Linux); (2) send a test request to `https://ipv6.icanhazip.com` — if the response is an IPv6 address, outbound traffic is going via IPv6. Tell the user immediately: "Please disable IPv6 on your network interface — gmgn-cli commands only work over IPv4."**
|
||||
@@ -39,10 +41,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 +54,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`:
|
||||
|
||||
@@ -68,22 +79,6 @@ When a request returns `429`:
|
||||
- The CLI may wait and retry once automatically when the remaining cooldown is short. If it still fails, stop and tell the user the exact retry time instead of sending more requests.
|
||||
- For `RATE_LIMIT_EXCEEDED` or `RATE_LIMIT_BANNED`, repeated requests during the cooldown can extend the ban by 5 seconds each time, up to 5 minutes. Do not spam retries.
|
||||
|
||||
**First-time setup** (if `GMGN_API_KEY` is not configured):
|
||||
|
||||
1. Generate key pair and show the public key to the user:
|
||||
```bash
|
||||
openssl genpkey -algorithm ed25519 -out /tmp/gmgn_private.pem 2>/dev/null && \
|
||||
openssl pkey -in /tmp/gmgn_private.pem -pubout 2>/dev/null
|
||||
```
|
||||
Tell the user: *"This is your Ed25519 public key. Go to **https://gmgn.ai/ai**, paste it into the API key creation form, then send me the API Key value shown on the page."*
|
||||
|
||||
2. Wait for the user's API key, then configure:
|
||||
```bash
|
||||
mkdir -p ~/.config/gmgn
|
||||
echo 'GMGN_API_KEY=<key_from_user>' > ~/.config/gmgn/.env
|
||||
chmod 600 ~/.config/gmgn/.env
|
||||
```
|
||||
|
||||
## Usage Examples
|
||||
|
||||
```bash
|
||||
@@ -125,8 +120,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 |
|
||||
@@ -147,7 +172,7 @@ gmgn-cli portfolio token-balance \
|
||||
| `--token <address>` | Filter by token |
|
||||
| `--limit <n>` | Page size |
|
||||
| `--cursor <cursor>` | Pagination cursor (pass the `next` value from the previous response) |
|
||||
| `--type <type>` | Repeatable: `buy` / `sell` / `add` / `remove` / `transfer` |
|
||||
| `--type <type>` | Repeatable: `buy` / `sell` / `transferIn` / `transferOut` / `add` / `remove` |
|
||||
|
||||
The activity response includes a `next` field. Pass it to `--cursor` to fetch the next page.
|
||||
|
||||
@@ -194,7 +219,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 |
|
||||
|
||||
@@ -212,6 +238,76 @@ The response is an object (or array for batch). Key fields:
|
||||
| `sell_count` | Number of sell transactions |
|
||||
| `pnl` | Profit/loss ratio = `realized_profit / total_cost` |
|
||||
|
||||
The response also includes a `common` object when available (absent if the upstream identity service is unavailable):
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| `common.avatar` | Wallet avatar URL |
|
||||
| `common.name` | Display name |
|
||||
| `common.ens` | ENS domain (EVM chains only) |
|
||||
| `common.tag` | Primary wallet tag |
|
||||
| `common.tags` | All wallet tags (e.g. `["smart_money"]`) |
|
||||
| `common.twitter_username` | Twitter handle |
|
||||
| `common.twitter_name` | Twitter display name |
|
||||
| `common.followers_count` | Twitter follower count |
|
||||
| `common.is_blue_verified` | Twitter blue-verified badge |
|
||||
| `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 (0–1) |
|
||||
| `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
|
||||
@@ -251,13 +347,14 @@ Win Rate: {winrate × 100}%
|
||||
Total Spent: ${total_cost}
|
||||
Buys / Sells: {buy_count} / {sell_count}
|
||||
PnL Ratio: {pnl}x
|
||||
[Identity: {common.name or common.twitter_username} | Tags: {common.tags}]
|
||||
```
|
||||
|
||||
For batch queries (multiple wallets), present one summary block per wallet.
|
||||
Show the `[Identity: ...]` line only if `common` is present in the response. For batch queries (multiple wallets), present one summary block per wallet.
|
||||
|
||||
## 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 32–44 chars; bsc/base/eth: `0x` + 40 hex digits). The CLI exits with an error on invalid input.
|
||||
@@ -273,3 +370,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.
|
||||
|
||||
+476
-178
@@ -1,36 +1,38 @@
|
||||
---
|
||||
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|smart_trade> --sub-order-type <buy_low|buy_high|stop_loss|take_profit|mix_trade> ...]"
|
||||
metadata:
|
||||
cliHelp: "gmgn-cli swap --help"
|
||||
---
|
||||
|
||||
**BEFORE RUNNING ANY COMMAND: Run `gmgn-cli config --check`. If exit code is 0, proceed normally. If exit code is 1, (1) run `gmgn-cli config` and show the output to the user; (2) once the user sends the API Key, run `gmgn-cli config --apply <KEY>` to complete configuration and verification, then show the output to the user. If `--check` returns an error (unknown option or command not found), tell the user to run `npm install -g gmgn-cli` to update, then retry.**
|
||||
|
||||
**IMPORTANT: Always use `gmgn-cli` commands below. Do NOT use web search, WebFetch, curl, or visit gmgn.ai — all swap operations must go through the CLI. The CLI handles signing and submission automatically.**
|
||||
|
||||
**IMPORTANT: Do NOT guess field names or values. When a field's meaning is unclear, look it up in the Response Fields sections below before using it.**
|
||||
|
||||
**⚠️ IPv6 NOT SUPPORTED: If you get a `401` or `403` error and credentials look correct, check for IPv6 immediately: (1) list all network interfaces and their IPv6 addresses — run `ifconfig | grep inet6` (macOS) or `ip addr show | grep inet6` (Linux); (2) send a test request to `https://ipv6.icanhazip.com` — if the response is an IPv6 address, outbound traffic is going via IPv6. Tell the user immediately: "Please disable IPv6 on your network interface — gmgn-cli commands only work over IPv4."**
|
||||
|
||||
Use the `gmgn-cli` tool to submit a token swap or query an existing order. **Requires private key** (`GMGN_PRIVATE_KEY` in `.env`).
|
||||
Use the `gmgn-cli` tool to submit a token swap or query an existing order. `GMGN_API_KEY` is always required. `GMGN_PRIVATE_KEY` is required for critical-auth commands such as `swap` and `order` subcommands — except `order quote`, which only requires `GMGN_API_KEY`.
|
||||
|
||||
## Core Concepts
|
||||
|
||||
- **Smallest unit** — `--amount` is always in the token's smallest indivisible unit, not human-readable amounts. For SOL: 1 SOL = 1,000,000,000 lamports. For EVM tokens: depends on decimals (most ERC-20 tokens use 18 decimals). Always convert before passing to the command — do not pass human amounts directly.
|
||||
|
||||
- **`slippage`** — Price tolerance expressed as a decimal, not a percentage. `0.01` = 1% slippage. `0.5` = 50% slippage. If the price moves beyond this threshold before the transaction confirms, the swap is rejected. Use `--auto-slippage` for volatile tokens to let GMGN set an appropriate value automatically.
|
||||
- **`slippage`** — Price tolerance as an integer 0–100, e.g. `30` = 30%. If the price moves beyond this threshold before the transaction confirms, the swap is rejected. Use `--auto-slippage` for volatile tokens to let GMGN set an appropriate value automatically.
|
||||
|
||||
- **`--amount` vs `--percent`** — Mutually exclusive. `--amount` specifies an exact input quantity (in smallest unit). `--percent` sells a percentage of the current balance and is only valid when `input_token` is NOT a currency (SOL/BNB/ETH/USDC). Never use `--percent` to spend a fraction of SOL/BNB/ETH.
|
||||
|
||||
- **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` requires 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. Normal commands (like `order quote`) use API Key alone.
|
||||
- **Signed auth** — `swap` and most `order` subcommands require both `GMGN_API_KEY` and `GMGN_PRIVATE_KEY`. The private key never leaves the machine — the CLI uses it only for local signing and sends only the resulting signature. Exception: `order quote` only requires `GMGN_API_KEY`.
|
||||
|
||||
- **`order_id` / `status`** — After submitting a swap, the response includes an `order_id`. Use `order get --order-id` to poll for final status. Possible values: `pending` → `processed` → `confirmed` (success) or `failed` / `expired`. Do not report success until status is `confirmed`.
|
||||
|
||||
- **`filled_input_amount` / `filled_output_amount`** — Actual amounts consumed/received, in smallest unit. Convert to human-readable using token decimals before displaying to the user.
|
||||
- **`report.input_amount` / `report.output_amount`** — Actual amounts consumed/received, in smallest unit. Only present when `state = 30` and `status = "successful"`. Convert to human-readable using `report.input_token_decimals` / `report.output_token_decimals` before displaying to the user.
|
||||
|
||||
## Financial Risk Notice
|
||||
|
||||
@@ -46,43 +48,51 @@ Use the `gmgn-cli` tool to submit a token swap or query an existing order. **Req
|
||||
| Sub-command | Description |
|
||||
|-------------|-------------|
|
||||
| `swap` | Submit a token swap |
|
||||
| `order quote` | Get a swap quote (no transaction submitted) |
|
||||
| `multi-swap` | Submit token swaps across multiple wallets concurrently (up to 100) |
|
||||
| `order quote` | Get a swap quote (no transaction submitted; exist auth — API Key only, no private key needed) |
|
||||
| `order get` | Query order status |
|
||||
| `gas-price` | Query recommended gas price (low / average / high tiers) for any chain; exist auth (API Key only) |
|
||||
| `order strategy create` | Create a limit/strategy order (requires private key) |
|
||||
| `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
|
||||
|
||||
Both `GMGN_API_KEY` and `GMGN_PRIVATE_KEY` must be configured in `~/.config/gmgn/.env`. The private key must correspond to the wallet bound to the API Key.
|
||||
`GMGN_API_KEY` must be configured in `~/.config/gmgn/.env`. `GMGN_PRIVATE_KEY` is additionally required for `swap` and `order` subcommands other than `order quote`. The private key must correspond to the wallet bound to the API Key.
|
||||
|
||||
- `gmgn-cli` installed globally — if missing, run: `npm install -g gmgn-cli`
|
||||
|
||||
## 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`:
|
||||
|
||||
@@ -93,29 +103,6 @@ When a request returns `429`:
|
||||
- For `RATE_LIMIT_EXCEEDED` or `RATE_LIMIT_BANNED`, repeated requests during the cooldown can extend the ban by 5 seconds each time, up to 5 minutes.
|
||||
- `POST /v1/trade/swap` also has an error-count limiter. Repeatedly triggering the same business error, especially `40003701` (insufficient token balance), can return `ERROR_RATE_LIMIT_BLOCKED`. When this happens, do not retry until the reset time and fix the underlying request first.
|
||||
|
||||
**First-time setup** (if credentials are not configured):
|
||||
|
||||
1. Generate key pair and show the public key to the user:
|
||||
```bash
|
||||
openssl genpkey -algorithm ed25519 -out /tmp/gmgn_private.pem 2>/dev/null && \
|
||||
openssl pkey -in /tmp/gmgn_private.pem -pubout 2>/dev/null
|
||||
```
|
||||
Tell the user: *"This is your Ed25519 public key. Go to **https://gmgn.ai/ai**, paste it into the API key creation form (enable swap capability), then send me the API Key value shown on the page."*
|
||||
|
||||
2. Wait for the user's API key, then configure both credentials:
|
||||
```bash
|
||||
mkdir -p ~/.config/gmgn
|
||||
echo 'GMGN_API_KEY=<key_from_user>' > ~/.config/gmgn/.env
|
||||
echo 'GMGN_PRIVATE_KEY="<pem_content_from_step_1>"' >> ~/.config/gmgn/.env
|
||||
chmod 600 ~/.config/gmgn/.env
|
||||
```
|
||||
|
||||
### Credential Model
|
||||
|
||||
- Both `GMGN_API_KEY` and `GMGN_PRIVATE_KEY` are read from the `.env` file by the CLI at startup. They are **never passed as command-line arguments** and never appear in shell command strings.
|
||||
- `GMGN_PRIVATE_KEY` is used exclusively for **local message signing** — the private key never leaves the machine. The CLI computes an Ed25519 or RSA-SHA256 signature in-process and transmits only the base64-encoded result in the `X-Signature` request header.
|
||||
- `GMGN_API_KEY` is transmitted in the `X-APIKEY` request header to GMGN's servers over HTTPS.
|
||||
|
||||
## `swap` Usage
|
||||
|
||||
```bash
|
||||
@@ -134,7 +121,7 @@ gmgn-cli swap \
|
||||
--input-token <input_token_address> \
|
||||
--output-token <output_token_address> \
|
||||
--amount 1000000 \
|
||||
--slippage 0.01
|
||||
--slippage 30
|
||||
|
||||
# With automatic slippage
|
||||
gmgn-cli swap \
|
||||
@@ -163,59 +150,29 @@ gmgn-cli swap \
|
||||
--percent 50
|
||||
```
|
||||
|
||||
## `order quote` Usage
|
||||
|
||||
Get an estimated output amount before submitting a swap. Uses normal auth — no private key required.
|
||||
|
||||
```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 as an integer 0–100, e.g. `30` = 30%. **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`)
|
||||
|
||||
@@ -247,7 +204,7 @@ gmgn-cli swap \
|
||||
--input-token So11111111111111111111111111111111111111112 \
|
||||
--output-token <token_A_address> \
|
||||
--amount 10000000 \
|
||||
--slippage 0.3 \
|
||||
--slippage 30 \
|
||||
--anti-mev \
|
||||
--condition-orders '[{"order_type":"profit_stop","side":"sell","price_scale":"100","sell_ratio":"50"},{"order_type":"profit_stop","side":"sell","price_scale":"300","sell_ratio":"100"},{"order_type":"loss_stop","side":"sell","price_scale":"65","sell_ratio":"100"}]' \
|
||||
--sell-ratio-type hold_amount
|
||||
@@ -265,7 +222,7 @@ gmgn-cli swap \
|
||||
--input-token So11111111111111111111111111111111111111112 \
|
||||
--output-token <token_A_address> \
|
||||
--amount 10000000 \
|
||||
--slippage 0.3 \
|
||||
--slippage 30 \
|
||||
--anti-mev \
|
||||
--condition-orders '[{"order_type":"profit_stop","side":"sell","price_scale":"100","sell_ratio":"50"},{"order_type":"profit_stop","side":"sell","price_scale":"300","sell_ratio":"50"},{"order_type":"loss_stop","side":"sell","price_scale":"65","sell_ratio":"100"}]' \
|
||||
--sell-ratio-type buy_amount
|
||||
@@ -273,26 +230,47 @@ gmgn-cli swap \
|
||||
|
||||
> `buy_amount`: each take-profit sells 50% of the **original** bought amount. Stop-loss sells 100% of the original bought amount.
|
||||
|
||||
## `swap` Response Fields
|
||||
## `swap` / `order get` Response Fields
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `order_id` | string | Order ID for follow-up queries |
|
||||
| `hash` | string | Transaction hash |
|
||||
| `status` | string | Order status: `pending` / `processed` / `confirmed` / `failed` / `expired` |
|
||||
| `error_code` | string | Error code on failure |
|
||||
| `error_status` | string | Error description on failure |
|
||||
| `input_token` | string | Input token contract address |
|
||||
| `output_token` | string | Output token contract address |
|
||||
| `filled_input_amount` | string | Actual input consumed (smallest unit); empty if not filled |
|
||||
| `filled_output_amount` | string | Actual output received (smallest unit); empty if not filled |
|
||||
| Field | Type | Description |
|
||||
| ------------------- | ------ | ---- |
|
||||
| `order_id` | string | Order ID for follow-up queries |
|
||||
| `hash` | string | Transaction hash |
|
||||
| `status` | string | Order status: `pending` / `processed` / `confirmed` / `failed` / `expired` |
|
||||
| `error_code` | string | Error code on failure |
|
||||
| `error_status` | string | Error description on failure |
|
||||
| `strategy_order_id` | string | Strategy order ID; only present when `--condition-orders` was passed and strategy creation succeeded (best-effort) |
|
||||
| `report` | object | Execution report; only present when `state = 30` and `status = "successful"`. See Report Fields below. |
|
||||
|
||||
### Report Fields (present only when `status = "successful"`)
|
||||
|
||||
| Field | Type | Description |
|
||||
| ----------------------- | ------- | ---- |
|
||||
| `input_token` | string | Input token contract address |
|
||||
| `input_token_decimals` | integer | Input token decimal places |
|
||||
| `swap_mode` | string | Swap mode: `ExactIn` / `ExactOut` |
|
||||
| `input_amount` | string | Actual input consumed (smallest unit) |
|
||||
| `output_token` | string | Output token contract address |
|
||||
| `output_token_decimals` | integer | Output token decimal places |
|
||||
| `output_amount` | string | Actual output received (smallest unit) |
|
||||
| `quote_token` | string | Quote token contract address |
|
||||
| `quote_decimals` | integer | Quote token decimal places |
|
||||
| `quote_amount` | string | Quote amount (smallest unit) |
|
||||
| `base_token` | string | Base token contract address |
|
||||
| `base_decimals` | integer | Base token decimal places |
|
||||
| `base_amount` | string | Base token amount (smallest unit) |
|
||||
| `price` | string | Execution price (quote/base token) |
|
||||
| `price_usd` | string | Execution price in USD |
|
||||
| `height` | integer | Block height of execution |
|
||||
| `order_height` | integer | Block height when order was placed |
|
||||
| `gas_native` | string | Gas fee in native token |
|
||||
| `gas_usd` | string | Gas fee in USD |
|
||||
|
||||
## Output Format
|
||||
|
||||
### Pre-swap Confirmation
|
||||
|
||||
Before displaying the confirmation, run `order quote` to get the estimated output (uses normal auth — no private key required):
|
||||
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 \
|
||||
@@ -334,79 +312,191 @@ After a confirmed swap, display:
|
||||
```
|
||||
✅ Swap Confirmed
|
||||
|
||||
Spent: {filled_input_amount in human units} {input symbol}
|
||||
Received: {filled_output_amount in human units} {output symbol}
|
||||
Spent: {report.input_amount in human units} {input symbol}
|
||||
Received: {report.output_amount in human units} {output symbol}
|
||||
Tx: {explorer link for hash}
|
||||
Order ID: {order_id}
|
||||
```
|
||||
|
||||
Convert `filled_input_amount` and `filled_output_amount` from smallest unit using token decimals before displaying.
|
||||
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
|
||||
|
||||
|
||||
### `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` 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 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 | Strategy order list |
|
||||
|
||||
## `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 strategy` Usage Examples
|
||||
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`.
|
||||
|
||||
```bash
|
||||
# Create a take-profit order: sell when price rises to target
|
||||
# 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 30
|
||||
|
||||
# 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 30
|
||||
|
||||
# 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 30 \
|
||||
--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 30 \
|
||||
--gas-price 5
|
||||
```
|
||||
|
||||
## `multi-swap` Parameters
|
||||
|
||||
| Parameter | Required | Chain | Description |
|
||||
|-----------|----------|-------|-------------|
|
||||
| `--chain` | Yes | all | `sol` / `bsc` / `base` / `eth` |
|
||||
| `--accounts` | Yes | all | Comma-separated wallet addresses (1–100, 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` (1–10000; 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 as an integer 0–100, e.g. `30` = 30%. 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 |
|
||||
|-------|------|-------------|
|
||||
| `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) |
|
||||
|
||||
---
|
||||
|
||||
### Credential Model
|
||||
|
||||
- Both `GMGN_API_KEY` and `GMGN_PRIVATE_KEY` are read from the `.env` file by the CLI at startup. They are **never passed as command-line arguments** and never appear in shell command strings.
|
||||
- `GMGN_PRIVATE_KEY` is used exclusively for **local message signing** — the private key never leaves the machine. The CLI computes an Ed25519 or RSA-SHA256 signature in-process and transmits only the base64-encoded result in the `X-Signature` request header.
|
||||
- `GMGN_API_KEY` is transmitted in the `X-APIKEY` request header to GMGN's servers over HTTPS.
|
||||
|
||||
---
|
||||
|
||||
## `order quote` Usage
|
||||
|
||||
Get an estimated output amount before submitting a swap. Uses normal auth — only `GMGN_API_KEY` required, no `GMGN_PRIVATE_KEY` needed.
|
||||
|
||||
```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 30
|
||||
```
|
||||
|
||||
### `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>
|
||||
```
|
||||
|
||||
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 (limit_order)
|
||||
gmgn-cli order strategy create \
|
||||
--chain sol \
|
||||
--from <wallet_address> \
|
||||
@@ -416,9 +506,9 @@ gmgn-cli order strategy create \
|
||||
--sub-order-type take_profit \
|
||||
--check-price 0.002 \
|
||||
--amount-in 1000000 \
|
||||
--slippage 0.01
|
||||
--slippage 30
|
||||
|
||||
# Create a stop-loss order: sell when price drops to target
|
||||
# Create a stop-loss order: sell when price drops to target (limit_order)
|
||||
gmgn-cli order strategy create \
|
||||
--chain sol \
|
||||
--from <wallet_address> \
|
||||
@@ -428,8 +518,67 @@ gmgn-cli order strategy create \
|
||||
--sub-order-type stop_loss \
|
||||
--check-price 0.0005 \
|
||||
--amount-in-percent 100 \
|
||||
--slippage 0.01
|
||||
--slippage 30
|
||||
|
||||
# Create a smart_trade with buy_low entry + take-profit + stop-loss (smart_trade)
|
||||
gmgn-cli order strategy create \
|
||||
--chain sol \
|
||||
--from <wallet_address> \
|
||||
--base-token <token_address> \
|
||||
--quote-token <sol_address> \
|
||||
--order-type smart_trade \
|
||||
--sub-order-type mix_trade \
|
||||
--open-price 0.000082 \
|
||||
--amount-in 1000000 \
|
||||
--slippage 30 \
|
||||
--sell-param '{"slippage":30,"priority_fee":"0.00001","tip_fee":"0.00001"}' \
|
||||
--condition-orders '[{"order_type":"buy_low","side":"buy","check_price":"0.00008"},{"order_type":"profit_stop","side":"sell","price_scale":"100","sell_ratio":"50"},{"order_type":"loss_stop","side":"sell","price_scale":"50","sell_ratio":"100"}]'
|
||||
```
|
||||
|
||||
## `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` / `smart_trade` |
|
||||
| `--sub-order-type` | Yes | all | `limit_order`: `buy_low` / `buy_high` / `stop_loss` / `take_profit`; `smart_trade` with condition_orders: `mix_trade` |
|
||||
| `--check-price` | No* | all | Trigger price — required for `limit_order`; omit for `smart_trade` (trigger is in the `buy_low` condition order) |
|
||||
| `--open-price` | No | all | Open price of the position |
|
||||
| `--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 |
|
||||
| `--quote-investment` | No | all | Quote token investment amount (`smart_trade`) |
|
||||
| `--sell-param` | Yes (`smart_trade`) | all | JSON object of sell-side trade params (slippage, fee, gas, etc.) used when a TP/SL condition fires. **Required for `smart_trade`.** Same fields as the root TradeParam; `slippage` is 0–100 integer. |
|
||||
| `--buy-param` | No | all | JSON object of buy-side trade params override for `smart_trade`. Same fields as root TradeParam; `slippage` is 0–100 integer. |
|
||||
| `--slippage` | No | all | Slippage tolerance as an integer 0–100, e.g. `30` = 30%. Mutually exclusive with `--auto-slippage`. Defaults to auto-slippage if neither is set. |
|
||||
| `--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`. |
|
||||
| `--condition-orders` | No | all | JSON array of condition sub-orders for `smart_trade`. Must include one `buy_low` entry (with `check_price` lower than `open_price`) plus at least one TP/SL entry. |
|
||||
|
||||
### `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
|
||||
|
||||
@@ -441,7 +590,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 \
|
||||
@@ -449,13 +730,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
|
||||
|
||||
@@ -494,7 +792,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`
|
||||
@@ -502,7 +800,7 @@ For full token research before swapping, see [`docs/workflow-token-research.md`]
|
||||
- **Percentage sell restriction** — `--percent` is ONLY valid when `input_token` is NOT a currency. Do NOT use `--percent` when `input_token` is SOL/BNB/ETH (native) or USDC. This includes: "sell 50% of my SOL", "use 30% of my BNB to buy X", "spend 50% of my USDC on X" — all unsupported. Explain the restriction to the user and ask for an explicit absolute amount instead.
|
||||
- **Chain-wallet compatibility** — SOL addresses are incompatible with EVM chains (bsc/base). Warn the user and abort if the address format does not match the chain.
|
||||
- **Credential sensitivity** — `GMGN_API_KEY` and `GMGN_PRIVATE_KEY` can directly execute trades on the linked wallet. Never log, display, or expose these values.
|
||||
- **Order polling** — After a swap, if `status` is not yet `confirmed` / `failed` / `expired`, poll with `order get` up to 3 times at 5-second intervals before reporting a timeout. Once confirmed, display the trade result using `filled_input_amount` and `filled_output_amount` (convert from smallest unit using token decimals), e.g. "Spent 0.1 SOL → received 98.5 USDC" or "Sold 1000 TOKEN → received 0.08 SOL".
|
||||
- **Order polling** — After a swap, if `status` is not yet `confirmed` / `failed` / `expired`, poll with `order get` up to 3 times at 5-second intervals before reporting a timeout. Once confirmed, display the trade result using `report.input_amount` and `report.output_amount` (convert from smallest unit using `report.input_token_decimals` / `report.output_token_decimals`), e.g. "Spent 0.1 SOL → received 98.5 USDC" or "Sold 1000 TOKEN → received 0.08 SOL".
|
||||
- **Block explorer links** — After a successful swap, display a clickable explorer link for the returned `hash`:
|
||||
|
||||
| Chain | Explorer |
|
||||
|
||||
+146
-39
@@ -1,11 +1,13 @@
|
||||
---
|
||||
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"
|
||||
---
|
||||
|
||||
**BEFORE RUNNING ANY COMMAND: Run `gmgn-cli config --check`. If exit code is 0, proceed normally. If exit code is 1, (1) run `gmgn-cli config` and show the output to the user; (2) once the user sends the API Key, run `gmgn-cli config --apply <KEY>` to complete configuration and verification, then show the output to the user. If `--check` returns an error (unknown option or command not found), tell the user to run `npm install -g gmgn-cli` to update, then retry.**
|
||||
|
||||
**IMPORTANT: Always use `gmgn-cli` commands below. Do NOT use web search, WebFetch, curl, or visit gmgn.ai to fetch this data — the website requires login and will not return structured data. The CLI is the only correct method.**
|
||||
|
||||
**⚠️ IPv6 NOT SUPPORTED: If you get a `401` or `403` error and credentials look correct, check for IPv6 immediately: (1) list all network interfaces and their IPv6 addresses — run `ifconfig | grep inet6` (macOS) or `ip addr show | grep inet6` (Linux); (2) send a test request to `https://ipv6.icanhazip.com` — if the response is an IPv6 address, outbound traffic is going via IPv6. Tell the user immediately: "Please disable IPv6 on your network interface — gmgn-cli commands only work over IPv4."**
|
||||
@@ -17,8 +19,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 +36,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 +44,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 +53,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 |
|
||||
|---------|-------|--------|
|
||||
@@ -68,27 +70,11 @@ When a request returns `429`:
|
||||
- The CLI may wait and retry once automatically when the remaining cooldown is short. If it still fails, stop and tell the user the exact retry time instead of sending more requests.
|
||||
- For `RATE_LIMIT_EXCEEDED` or `RATE_LIMIT_BANNED`, repeated requests during the cooldown can extend the ban by 5 seconds each time, up to 5 minutes. Do not spam retries.
|
||||
|
||||
**First-time setup** (if `GMGN_API_KEY` is not configured):
|
||||
|
||||
1. Generate key pair and show the public key to the user:
|
||||
```bash
|
||||
openssl genpkey -algorithm ed25519 -out /tmp/gmgn_private.pem 2>/dev/null && \
|
||||
openssl pkey -in /tmp/gmgn_private.pem -pubout 2>/dev/null
|
||||
```
|
||||
Tell the user: *"This is your Ed25519 public key. Go to **https://gmgn.ai/ai**, paste it into the API key creation form, then send me the API Key value shown on the page."*
|
||||
|
||||
2. Wait for the user's API key, then configure:
|
||||
```bash
|
||||
mkdir -p ~/.config/gmgn
|
||||
echo 'GMGN_API_KEY=<key_from_user>' > ~/.config/gmgn/.env
|
||||
chmod 600 ~/.config/gmgn/.env
|
||||
```
|
||||
|
||||
## Parameters — `token info` / `token security` / `token pool`
|
||||
|
||||
| Parameter | Required | Description |
|
||||
|-----------|----------|-------------|
|
||||
| `--chain` | Yes | `sol` / `bsc` / `base` |
|
||||
| `--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 +82,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 +102,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
|
||||
|
||||
@@ -142,7 +136,7 @@ Recommended combinations for common use cases:
|
||||
|
||||
### `token info` — Key Fields
|
||||
|
||||
The response has four nested objects: `pool`, `link`, `stat`, `wallet_tags_stat`. Access fields with dot notation when parsing (e.g. `link.website`, `stat.top_10_holder_rate`).
|
||||
The response has five nested objects: `pool`, `dev`, `link`, `stat`, `wallet_tags_stat`. Access fields with dot notation when parsing (e.g. `link.website`, `stat.top_10_holder_rate`, `dev.creator_address`).
|
||||
|
||||
**Top-level Fields**
|
||||
|
||||
@@ -154,7 +148,7 @@ The response has four nested objects: `pool`, `link`, `stat`, `wallet_tags_stat`
|
||||
| `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 +156,15 @@ The response has four nested objects: `pool`, `link`, `stat`, `wallet_tags_stat`
|
||||
| `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 (0–1) |
|
||||
| `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 (0–1, float) |
|
||||
|
||||
**`pool` Object** — Main liquidity pool details
|
||||
|
||||
@@ -179,6 +182,38 @@ The response has four nested objects: `pool`, `link`, `stat`, `wallet_tags_stat`
|
||||
| `pool.fee_ratio` | Pool trading fee ratio (e.g. `0.1` = 0.1%) |
|
||||
| `pool.creation_timestamp` | Pool creation time (Unix seconds) |
|
||||
|
||||
**`dev` Object** — Token creator / developer info
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| `dev.creator_address` | Creator wallet address |
|
||||
| `dev.creator_token_balance` | Creator's current token balance |
|
||||
| `dev.creator_token_status` | Creator holding status: `hold` (still holding) / `sell` (sold/exited) |
|
||||
| `dev.top_10_holder_rate` | Ratio of supply held by top 10 wallets (0–1) |
|
||||
| `dev.twitter_name_change_history` | Array of past Twitter username changes (each entry has `twitter_username`, `rename_timestamp`) |
|
||||
| `dev.dexscr_ad` | Creator bought a DEXScreener ad: `1` = yes, `0` = no |
|
||||
| `dev.dexscr_update_link` | Creator updated DEXScreener socials/links: `1` = yes, `0` = no |
|
||||
| `dev.dexscr_boost_fee` | Creator used DEXScreener Boost: `1` = yes, `0` = no |
|
||||
| `dev.dexscr_trending_bar` | Token appeared in DEXScreener trending bar: `1` = yes, `0` = no |
|
||||
| `dev.dexscr_ad_ts` | Timestamp of DEXScreener ad purchase (Unix seconds) |
|
||||
| `dev.dexscr_update_link_ts` | Timestamp of DEXScreener link update (Unix seconds) |
|
||||
| `dev.dexscr_boost_ts` | Timestamp of DEXScreener Boost (Unix seconds) |
|
||||
| `dev.dexscr_trending_bar_ts` | Timestamp of DEXScreener trending bar appearance (Unix seconds) |
|
||||
| `dev.cto_flag` | Token has been Community Takeover'd (original dev abandoned): `1` = yes, `0` = no |
|
||||
| `dev.fund_from` | Address that funded the creator wallet |
|
||||
| `dev.fund_from_ts` | Timestamp of that funding event (Unix seconds) |
|
||||
| `dev.creator_open_count` | Number of tokens this creator has previously launched |
|
||||
| `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
|
||||
|
||||
| Field | Description |
|
||||
@@ -200,8 +235,6 @@ The response has four nested objects: `pool`, `link`, `stat`, `wallet_tags_stat`
|
||||
| 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 (0–1) |
|
||||
| `stat.top_10_holder_rate` | Ratio of supply held by top 10 wallets (0–1) |
|
||||
| `stat.dev_team_hold_rate` | Ratio held by dev team wallets |
|
||||
| `stat.creator_hold_rate` | Ratio held by creator wallet |
|
||||
@@ -212,6 +245,7 @@ The response has four nested objects: `pool`, `link`, `stat`, `wallet_tags_stat`
|
||||
| `stat.bot_degen_count` | Number of bot degen wallets |
|
||||
| `stat.bot_degen_rate` | Ratio of bot degen wallets |
|
||||
| `stat.fresh_wallet_rate` | Ratio of fresh/new wallets among holders |
|
||||
| `stat.private_vault_hold_rate` | Ratio held by private vault (vanish) addresses — displayed as "vanish" in GMGN UI (0–1) |
|
||||
|
||||
**`wallet_tags_stat` Object** — Wallet type breakdown
|
||||
|
||||
@@ -226,6 +260,57 @@ The response has four nested objects: `pool`, `link`, `stat`, `wallet_tags_stat`
|
||||
| `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
|
||||
@@ -370,13 +455,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 |
|
||||
@@ -397,6 +487,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
|
||||
```
|
||||
@@ -413,6 +506,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
|
||||
```
|
||||
@@ -425,6 +521,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
|
||||
@@ -461,6 +560,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
|
||||
@@ -509,6 +612,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
|
||||
```
|
||||
|
||||
---
|
||||
@@ -559,7 +666,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}
|
||||
```
|
||||
@@ -602,9 +709,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 (0–1), not a percentage — `0.05` means 5% of supply
|
||||
|
||||
+90
-32
@@ -1,11 +1,13 @@
|
||||
---
|
||||
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. Also query which tokens a wallet has followed (bookmarked) on GMGN. Use when user asks what smart money or KOLs are buying, wants whale alerts, on-chain alpha, copy-trade signals, or wants to check a wallet's followed tokens. (For a specific wallet address's portfolio, use gmgn-portfolio.)
|
||||
argument-hint: "<follow-tokens|follow-wallet|kol|smartmoney> --chain <sol|bsc|base|eth> [--wallet <wallet_address>]"
|
||||
metadata:
|
||||
cliHelp: "gmgn-cli track --help"
|
||||
---
|
||||
|
||||
**BEFORE RUNNING ANY COMMAND: Run `gmgn-cli config --check`. If exit code is 0, proceed normally. If exit code is 1, (1) run `gmgn-cli config` and show the output to the user; (2) once the user sends the API Key, run `gmgn-cli config --apply <KEY>` to complete configuration and verification, then show the output to the user. If `--check` returns an error (unknown option or command not found), tell the user to run `npm install -g gmgn-cli` to update, then retry.**
|
||||
|
||||
**IMPORTANT: Always use `gmgn-cli` commands below. Do NOT use web search, WebFetch, curl, or visit gmgn.ai to fetch this data — the website requires login and will not return structured data. The CLI is the only correct method.**
|
||||
|
||||
**IMPORTANT: Do NOT guess field names or values. When a field's meaning is unclear, look it up in the Response Fields sections below before using it.**
|
||||
@@ -16,7 +18,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.
|
||||
|
||||
@@ -49,26 +51,30 @@ Use the `gmgn-cli` tool to query on-chain tracking data based on the user's requ
|
||||
|
||||
| Sub-command | Description |
|
||||
|-------------|-------------|
|
||||
| `track follow-tokens` | Followed token list for a wallet — which tokens a wallet has bookmarked on GMGN, with full market data |
|
||||
| `track follow-token-groups` | Follow token group names for a wallet — the group names and IDs the wallet uses to organise followed tokens |
|
||||
| `track follow-wallet` | Trade records from wallets the user personally follows on GMGN |
|
||||
| `track kol` | Real-time trades from KOL / influencer wallets tagged by GMGN |
|
||||
| `track smartmoney` | Real-time trades from smart money / whale wallets tagged by GMGN |
|
||||
|
||||
## Supported Chains
|
||||
|
||||
`sol` / `bsc` / `base`
|
||||
`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 `follow-tokens`, `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 |
|
||||
|---------|-------|--------|
|
||||
| `track follow-tokens` | `GET /v1/user/follow_tokens` | 3 |
|
||||
| `track follow-token-groups` | `GET /v1/user/follow_token_groups` | 1 |
|
||||
| `track follow-wallet` | `GET /v1/trade/follow_wallet` | 3 |
|
||||
| `track kol` | `GET /v1/user/kol` | 1 |
|
||||
| `track smartmoney` | `GET /v1/user/smartmoney` | 1 |
|
||||
@@ -80,29 +86,21 @@ When a request returns `429`:
|
||||
- The CLI may wait and retry once automatically when the remaining cooldown is short. If it still fails, stop and tell the user the exact retry time instead of sending more requests.
|
||||
- For `RATE_LIMIT_EXCEEDED` or `RATE_LIMIT_BANNED`, repeated requests during the cooldown can extend the ban by 5 seconds each time, up to 5 minutes. Do not spam retries.
|
||||
|
||||
**First-time setup** (if `GMGN_API_KEY` is not configured):
|
||||
|
||||
1. Generate key pair and show the public key to the user:
|
||||
```bash
|
||||
openssl genpkey -algorithm ed25519 -out /tmp/gmgn_private.pem 2>/dev/null && \
|
||||
openssl pkey -in /tmp/gmgn_private.pem -pubout 2>/dev/null
|
||||
```
|
||||
Tell the user: *"This is your Ed25519 public key. Go to **https://gmgn.ai/ai**, paste it into the API key creation form, then send me the API Key value shown on the page."*
|
||||
|
||||
2. Wait for the user's API key, then configure:
|
||||
```bash
|
||||
mkdir -p ~/.config/gmgn
|
||||
echo 'GMGN_API_KEY=<key_from_user>' > ~/.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
|
||||
```
|
||||
|
||||
## Usage Examples
|
||||
|
||||
```bash
|
||||
# Followed token list for a wallet on SOL
|
||||
gmgn-cli track follow-tokens --chain sol --wallet <wallet_address>
|
||||
|
||||
# Followed token list on BSC, raw JSON output
|
||||
gmgn-cli track follow-tokens --chain bsc --wallet <wallet_address> --raw
|
||||
|
||||
# Follow token group names for a wallet on SOL
|
||||
gmgn-cli track follow-token-groups --chain sol --wallet <wallet_address>
|
||||
|
||||
# Follow token group names, raw JSON output
|
||||
gmgn-cli track follow-token-groups --chain sol --wallet <wallet_address> --raw
|
||||
|
||||
# Follow-wallet trades (all wallets you follow)
|
||||
gmgn-cli track follow-wallet --chain sol
|
||||
|
||||
@@ -128,11 +126,71 @@ gmgn-cli track smartmoney --limit 10 --raw
|
||||
gmgn-cli track smartmoney --chain sol --side sell --limit 10 --raw
|
||||
```
|
||||
|
||||
## `track follow-tokens` Options
|
||||
|
||||
| Option | Description |
|
||||
|--------|-------------|
|
||||
| `--chain` | Required. `sol` / `bsc` / `base` / `eth` |
|
||||
| `--wallet <address>` | Required. Wallet address to query |
|
||||
| `--group-id <id>` | Filter by group: `all_group` (all tokens across groups), `default` (default group), or a user-defined group ID |
|
||||
| `--interval <interval>` | Time interval for price change stats (e.g. `1m`, `5m`, `1h`, `6h`, `24h`) |
|
||||
| `--order-by <field>` | Sort field: `created_at` / `swaps` / `volume` / `market_cap` / `liquidity` / `price` / `open_timestamp` |
|
||||
| `--direction <dir>` | Required when `--order-by` is set. `asc` / `desc` |
|
||||
| `--limit <n>` | Page size |
|
||||
| `--cursor <cursor>` | Pagination cursor from previous response |
|
||||
| `--search <text>` | Search by token name or address |
|
||||
|
||||
## `track follow-tokens` Response Fields
|
||||
|
||||
Top-level fields:
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| `cursor` | Opaque cursor for fetching the next page |
|
||||
| `all_following` | Total number of followed tokens |
|
||||
| `is_recommend` | Whether results include recommended tokens |
|
||||
| `followings` | Array of followed token objects |
|
||||
|
||||
Each item in `followings` contains:
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| `address` | Token contract address |
|
||||
| `symbol` | Token ticker symbol |
|
||||
| `name` | Token name |
|
||||
| `chain` | Chain the token is on |
|
||||
| `price` | Current token price |
|
||||
| `price_change_percent` | Price change percentage |
|
||||
| `volume` | Trading volume |
|
||||
| `liquidity` | Pool liquidity |
|
||||
| `market_cap` | Market cap |
|
||||
| `swaps` | Total swaps |
|
||||
| `group_ids` | Follow groups this token belongs to |
|
||||
| `open_timestamp` | Unix timestamp when trading opened |
|
||||
|
||||
## `track follow-token-groups` Options
|
||||
|
||||
| Option | Description |
|
||||
|--------|-------------|
|
||||
| `--chain` | Required. `sol` / `bsc` / `base` / `eth` |
|
||||
| `--wallet <address>` | Required. Wallet address to query |
|
||||
|
||||
## `track follow-token-groups` Response Fields
|
||||
|
||||
`data` is an array. Each item contains:
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| `chain` | Chain the group is on |
|
||||
| `group_id` | Group identifier (e.g. `default`, or a user-defined ID) |
|
||||
| `group_name` | Human-readable group name |
|
||||
| `rank` | Display order / sort rank |
|
||||
|
||||
## `track follow-wallet` Options
|
||||
|
||||
| Option | Description |
|
||||
|--------|-------------|
|
||||
| `--chain` | Required. `sol` / `bsc` / `base` |
|
||||
| `--chain` | Required. `sol` / `bsc` / `base` / `eth` |
|
||||
| `--wallet <address>` | Filter by wallet address |
|
||||
| `--limit <n>` | Page size (1–100, default 10) |
|
||||
| `--side <side>` | Trade direction: `buy` / `sell` |
|
||||
@@ -144,7 +202,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 (1–200, default 100) |
|
||||
| `--side <side>` | Filter by trade direction: `buy` / `sell` (client-side filter — applied locally after fetching results) |
|
||||
|
||||
@@ -308,13 +366,13 @@ 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-tokens` uses exist auth (API Key only); `--wallet` is required
|
||||
- `track follow-wallet` uses signed auth (API Key + private key signature); `track kol` and `track smartmoney` use exist auth (API Key only)
|
||||
- `track follow-wallet` returns trades from wallets followed on the GMGN platform; the follow list is resolved automatically from the GMGN user account bound to the API Key — `--wallet` is optional
|
||||
- Use `--raw` to get single-line JSON for further processing
|
||||
- `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
|
||||
|
||||
+259
-45
@@ -2,15 +2,20 @@
|
||||
* OpenApiClient — GMGN OpenAPI external client
|
||||
*
|
||||
* Auth modes:
|
||||
* Normal (market/token/portfolio): X-APIKEY + timestamp + client_id
|
||||
* Critical (swap/order): 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 { createRequire } from "node:module";
|
||||
|
||||
import { buildAuthQuery, buildMessage, detectAlgorithm, sign } from "./signer.js";
|
||||
|
||||
const RATE_LIMIT_RETRY_BUFFER_MS = 1000;
|
||||
const DEFAULT_RATE_LIMIT_AUTO_RETRY_MAX_WAIT_MS = 5000;
|
||||
|
||||
const { version: CLI_VERSION } = createRequire(import.meta.url)("../../package.json") as { version: string };
|
||||
const USER_AGENT = `gmgn-cli/${CLI_VERSION}`;
|
||||
|
||||
interface PreparedRequest {
|
||||
method: string;
|
||||
subPath: string;
|
||||
@@ -80,9 +85,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 +102,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;
|
||||
@@ -104,7 +132,7 @@ export interface StrategyCreateParams {
|
||||
quote_token: string;
|
||||
order_type: string;
|
||||
sub_order_type: string;
|
||||
check_price: string;
|
||||
check_price?: string;
|
||||
open_price?: string;
|
||||
amount_in?: string;
|
||||
amount_in_percent?: string;
|
||||
@@ -115,7 +143,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;
|
||||
@@ -123,6 +153,10 @@ export interface StrategyCreateParams {
|
||||
priority_fee?: string;
|
||||
tip_fee?: string;
|
||||
custom_rpc?: string;
|
||||
condition_orders?: StrategyConditionOrder[];
|
||||
quote_investment?: string;
|
||||
sell_param?: TradeParam;
|
||||
buy_param?: TradeParam;
|
||||
}
|
||||
|
||||
export interface StrategyCancelParams {
|
||||
@@ -133,27 +167,172 @@ 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;
|
||||
}
|
||||
|
||||
// HotSearchesParam carries its filter fields flattened (no nested `filter` object):
|
||||
// label/interval/chain plus optional `filters` boolean tags, `limit`, and rank-style
|
||||
// numeric range bounds (min_<metric>/max_<metric>) incl. min_created/max_created.
|
||||
// Extra range keys are forwarded verbatim; the service translates metric names per
|
||||
// interval. See `market hot-searches` docs for the supported metric list.
|
||||
export interface HotSearchesParam {
|
||||
label?: string;
|
||||
interval: string; // "1m" | "5m" | "1h" | "6h" | "24h"
|
||||
chain: string; // "sol" | "bsc" | "base" | "eth" | "monad" | "megaeth" | "hyperevm" | "tron"
|
||||
filters?: string[];
|
||||
limit?: number;
|
||||
[key: string]: string[] | number | string | undefined;
|
||||
}
|
||||
|
||||
export interface PumpFeeShareInfo {
|
||||
provider: string; // "solana" | "twitter" | "github"
|
||||
username: string; // platform username; a SOL address when provider = "solana"
|
||||
basic_points: number;
|
||||
}
|
||||
|
||||
export interface BAGSFeeShareInfo {
|
||||
provider: string; // "twitter" | "solana" | "kick" | "github"
|
||||
username: string;
|
||||
basic_points: number;
|
||||
}
|
||||
|
||||
export interface FlapRateConf {
|
||||
tax_rate?: number; // V5 unified tax rate, e.g. 5% -> 500
|
||||
buy_tax_rate?: number; // V6 separate buy tax rate
|
||||
sell_tax_rate?: number; // V6 separate sell tax rate
|
||||
mkt_bps?: number;
|
||||
deflation_bps?: number;
|
||||
dividend_bps?: number;
|
||||
lp_bps?: number;
|
||||
minimum_share_balance?: number;
|
||||
recipient_type?: string;
|
||||
beneficiary?: string;
|
||||
twitter_account?: string;
|
||||
split_conf?: Array<{ recipient: string; bps: number }>;
|
||||
}
|
||||
|
||||
export interface FourmemeRateConf {
|
||||
fee_plan?: boolean;
|
||||
fee_rate?: number;
|
||||
burn_rate?: number;
|
||||
divide_rate?: number;
|
||||
liquidity_rate?: number;
|
||||
recipient_rate?: number;
|
||||
recipient_address?: string;
|
||||
min_sharing?: number;
|
||||
}
|
||||
|
||||
export interface BuyWalletInfo {
|
||||
from_address: string;
|
||||
buy_amt: string;
|
||||
}
|
||||
|
||||
// Buy/sell execution config for CondMarket orders (snipe buy, auto-sell, pending_sell).
|
||||
// Does NOT affect the main creation tx. Falls back to outer-level fields when omitted.
|
||||
export interface TradeParam {
|
||||
slippage?: number;
|
||||
auto_slippage?: boolean;
|
||||
fee?: string;
|
||||
priority_fee?: string;
|
||||
tip_fee?: string;
|
||||
gas_price?: string;
|
||||
max_priority_fee_per_gas?: string;
|
||||
max_fee_per_gas?: string;
|
||||
is_anti_mev?: boolean; // backend currently forces true; passing has no effect
|
||||
anti_mev_mode?: string; // backend currently forces "secure"; passing has no effect
|
||||
}
|
||||
|
||||
export interface CookingSellConfig {
|
||||
sell_type: string; // "delay_sell" | "limit_order"
|
||||
delay_sec?: number; // required when sell_type = "delay_sell"
|
||||
delay_mili_sec?: number; // optional; takes precedence over delay_sec
|
||||
sell_ratio: string; // "1" = 100%, "0.5" = 50%
|
||||
check_price?: string; // trigger market cap in USD; required when sell_type = "limit_order"
|
||||
wallet_addresses: string[]; // empty array means the strategy is inert
|
||||
}
|
||||
|
||||
export interface CreateTokenParams {
|
||||
// Required
|
||||
chain: string;
|
||||
dex: string;
|
||||
from_address: string;
|
||||
name: string;
|
||||
symbol: string;
|
||||
buy_amt: string;
|
||||
|
||||
// Image (one required)
|
||||
image?: string;
|
||||
image_url?: string;
|
||||
|
||||
// Social
|
||||
description?: string;
|
||||
website?: string;
|
||||
twitter?: string;
|
||||
telegram?: string;
|
||||
|
||||
// Transaction
|
||||
slippage?: number;
|
||||
auto_slippage?: boolean;
|
||||
|
||||
// Fees
|
||||
fee?: string;
|
||||
priority_fee?: string;
|
||||
tip_fee?: string;
|
||||
gas_price?: string;
|
||||
max_priority_fee_per_gas?: string;
|
||||
max_fee_per_gas?: string;
|
||||
|
||||
// Anti-MEV (SOL only)
|
||||
is_anti_mev?: boolean;
|
||||
anti_mev_mode?: string;
|
||||
|
||||
// Advanced
|
||||
raised_token?: string;
|
||||
dev_gas?: string;
|
||||
dev_priority?: string;
|
||||
dev_tip?: string;
|
||||
dev_max_fee_per_gas?: string;
|
||||
approve_vision?: string;
|
||||
source?: string;
|
||||
dev_wallet_bps?: number;
|
||||
|
||||
// CondMarket buy/sell execution config (snipe / bundle / auto-sell)
|
||||
buy_trade_config?: TradeParam;
|
||||
sell_trade_config?: TradeParam;
|
||||
|
||||
// Auto-sell strategies created after a successful launch
|
||||
sell_configs?: CookingSellConfig[];
|
||||
|
||||
// Pump.fun specific
|
||||
is_mayhem?: boolean;
|
||||
is_cashback?: boolean;
|
||||
is_buy_back?: boolean;
|
||||
pump_fee_share_list?: PumpFeeShareInfo[];
|
||||
|
||||
// Flap specific
|
||||
flap_rate_conf?: FlapRateConf;
|
||||
|
||||
// FourMeme specific
|
||||
fourmeme_rate_conf?: FourmemeRateConf;
|
||||
|
||||
// BAGS specific
|
||||
bags_fee_share_list?: BAGSFeeShareInfo[];
|
||||
|
||||
// Bonk specific
|
||||
bonk_model?: string;
|
||||
|
||||
// Multi-wallet buy
|
||||
buy_wallets?: BuyWalletInfo[];
|
||||
snip_buy_wallets?: BuyWalletInfo[];
|
||||
}
|
||||
|
||||
export class OpenApiClient {
|
||||
@@ -167,29 +346,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 +380,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 +402,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 +410,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 +422,66 @@ 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 });
|
||||
}
|
||||
|
||||
async getHotSearches(params: HotSearchesParam[]): Promise<unknown> {
|
||||
return this.authExistRequest("POST", "/v1/market/hot_searches", {}, { params });
|
||||
}
|
||||
|
||||
// ---- 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 getFollowTokens(chain: string, walletAddress: string, extra: Record<string, string | number> = {}): Promise<unknown> {
|
||||
return this.authExistRequest("GET", "/v1/user/follow_tokens", { chain, wallet_address: walletAddress, ...extra });
|
||||
}
|
||||
|
||||
async getFollowGroupNames(chain: string, walletAddress: string): Promise<unknown> {
|
||||
return this.authExistRequest("GET", "/v1/user/follow_token_groups", { chain, wallet_address: walletAddress });
|
||||
}
|
||||
|
||||
async getKol(chain?: string, limit?: number): Promise<unknown> {
|
||||
const query: Record<string, string | number> = {};
|
||||
if (chain) query["chain"] = chain;
|
||||
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(
|
||||
@@ -293,48 +492,55 @@ export class OpenApiClient {
|
||||
input_amount: string,
|
||||
slippage: number
|
||||
): Promise<unknown> {
|
||||
return this.normalRequest("GET", "/v1/trade/quote", {
|
||||
chain, from_address, input_token, output_token, input_amount, slippage,
|
||||
});
|
||||
const query = { chain, from_address, input_token, output_token, input_amount, slippage };
|
||||
return this.authExistRequest("GET", "/v1/trade/quote", query);
|
||||
}
|
||||
|
||||
// ---- 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[]>,
|
||||
@@ -347,6 +553,7 @@ export class OpenApiClient {
|
||||
const headers: Record<string, string> = {
|
||||
"X-APIKEY": this.apiKey,
|
||||
"Content-Type": "application/json",
|
||||
"User-Agent": USER_AGENT,
|
||||
};
|
||||
const bodyStr = body !== null ? JSON.stringify(body) : null;
|
||||
return {
|
||||
@@ -360,19 +567,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 swap/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!));
|
||||
@@ -382,6 +589,7 @@ export class OpenApiClient {
|
||||
"X-APIKEY": this.apiKey,
|
||||
"X-Signature": signature,
|
||||
"Content-Type": "application/json",
|
||||
"User-Agent": USER_AGENT,
|
||||
};
|
||||
return {
|
||||
method,
|
||||
@@ -623,18 +831,24 @@ const TRENCHES_PLATFORMS: Record<string, string[]> = {
|
||||
],
|
||||
bsc: [
|
||||
"fourmeme", "fourmeme_agent", "bn_fourmeme", "four_xmode_agent",
|
||||
"flap", "clanker", "lunafun",
|
||||
"cubepeg", "likwid", "goplus_creator", "goplus_skills", "openfour",
|
||||
"flap", "flap_stocks", "flap_aioracle", "clanker", "lunafun",
|
||||
],
|
||||
base: [
|
||||
"clanker", "bankr", "flaunch", "zora", "zora_creator",
|
||||
"baseapp", "basememe", "virtuals_v2", "klik",
|
||||
],
|
||||
eth: [
|
||||
"trench", "clanker", "klik", "livo", "stroid",
|
||||
"pool_uniswap_v2", "pool_uniswap_v3", "printr",
|
||||
],
|
||||
};
|
||||
|
||||
const TRENCHES_QUOTE_ADDRESS_TYPES: Record<string, number[]> = {
|
||||
sol: [4, 5, 3, 1, 13, 0],
|
||||
bsc: [6, 7, 1, 16, 8, 3, 9, 10, 2, 17, 18, 0],
|
||||
base: [11, 3, 12, 13, 0],
|
||||
eth: [20, 11, 8, 3, 12, 1, 0],
|
||||
};
|
||||
|
||||
function buildTrenchesBody(chain: string, types?: string[], platforms?: string[], limit?: number, filters?: Record<string, number | string>): Record<string, unknown> {
|
||||
|
||||
+12
-4
@@ -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}`;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
import { config as loadDotenv } from "dotenv";
|
||||
import { Command } from "commander";
|
||||
import * as crypto from "crypto";
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import * as os from "os";
|
||||
import { execSync } from "child_process";
|
||||
|
||||
const GMGN_CONFIG_DIR = path.join(os.homedir(), ".config", "gmgn");
|
||||
const KEYPAIR_FILE = path.join(GMGN_CONFIG_DIR, "keypair.pem");
|
||||
const ENV_FILE = path.join(GMGN_CONFIG_DIR, ".env");
|
||||
const GMGN_API_URL = "https://gmgn.ai/ai/generateapi";
|
||||
|
||||
type Lang = "zh-CN" | "zh-TW" | "en";
|
||||
|
||||
function detectLang(): Lang {
|
||||
const locale =
|
||||
process.env.LANG ||
|
||||
process.env.LC_ALL ||
|
||||
process.env.LC_MESSAGES ||
|
||||
Intl.DateTimeFormat().resolvedOptions().locale ||
|
||||
"en";
|
||||
const l = locale.toLowerCase();
|
||||
if (l.startsWith("zh_tw") || l.startsWith("zh-tw") || l.startsWith("zh_hk") || l.startsWith("zh-hk")) return "zh-TW";
|
||||
if (l.startsWith("zh")) return "zh-CN";
|
||||
return "en";
|
||||
}
|
||||
|
||||
const MESSAGES = {
|
||||
linkGuide: {
|
||||
"zh-CN": (link: string) =>
|
||||
`请点击下方链接创建你的 GMGN API Key,完成后将 Key 发给我,我来帮你完成配置:\n${link}`,
|
||||
"zh-TW": (link: string) =>
|
||||
`請點擊下方連結建立你的 GMGN API Key,完成後將 Key 發給我,我來幫你完成配置:\n${link}`,
|
||||
en: (link: string) =>
|
||||
`Please click the link below to create your GMGN API Key. Once created, send me the API Key and I will finish the configuration:\n${link}`,
|
||||
},
|
||||
verifySuccess: {
|
||||
"zh-CN": "配置验证成功,可以开始使用了。",
|
||||
"zh-TW": "配置驗證成功,可以開始使用了。",
|
||||
en: "Configuration verified successfully. You are ready to use GMGN.",
|
||||
},
|
||||
verifyFail: {
|
||||
"zh-CN":
|
||||
"配置验证失败:API Key 与本地密钥不匹配。\n请确认:\n1. API Key 是否填写正确;\n2. 创建 API Key 时,是否使用的是页面自动填入的公钥。",
|
||||
"zh-TW":
|
||||
"配置驗證失敗:API Key 與本地密鑰不匹配。\n請確認:\n1. API Key 是否填寫正確;\n2. 創建 API Key 時,是否使用的是頁面自動填入的公鑰。",
|
||||
en: "Configuration verification failed: API Key does not match your local key pair.\nPlease confirm:\n1. Whether the API Key was entered correctly.\n2. Whether you used the public key that was pre-filled on the page when creating the API Key.",
|
||||
},
|
||||
verifyNetworkFail: {
|
||||
"zh-CN": "配置已写入,但验证请求失败(可能是网络问题)。你可以先尝试使用,如遇接口报错再重新配置。",
|
||||
"zh-TW": "配置已寫入,但驗證請求失敗(可能是網路問題)。你可以先嘗試使用,如遇介面報錯再重新配置。",
|
||||
en: "Configuration saved, but the verification request failed (possibly a network issue). You can try using it now and reconfigure if you encounter API errors.",
|
||||
},
|
||||
};
|
||||
|
||||
function getOrCreateKeypair(): string {
|
||||
fs.mkdirSync(GMGN_CONFIG_DIR, { recursive: true });
|
||||
|
||||
if (fs.existsSync(KEYPAIR_FILE)) {
|
||||
const content = fs.readFileSync(KEYPAIR_FILE, "utf-8");
|
||||
const match = content.match(/(-----BEGIN PUBLIC KEY-----[\s\S]+?-----END PUBLIC KEY-----)/);
|
||||
if (!match) {
|
||||
console.error("Error: keypair.pem exists but public key could not be parsed. Delete ~/.config/gmgn/keypair.pem and try again.");
|
||||
process.exit(1);
|
||||
}
|
||||
return match[1] + "\n";
|
||||
}
|
||||
|
||||
const { privateKey, publicKey } = crypto.generateKeyPairSync("ed25519");
|
||||
const privatePem = privateKey.export({ type: "pkcs8", format: "pem" }) as string;
|
||||
const publicPem = publicKey.export({ type: "spki", format: "pem" }) as string;
|
||||
const entry = `# Private Key\n${privatePem}\n# Public Key\n${publicPem}\n`;
|
||||
fs.writeFileSync(KEYPAIR_FILE, entry, { mode: 0o600 });
|
||||
return publicPem;
|
||||
}
|
||||
|
||||
function writeEnv(apiKey: string, privatePem: string): void {
|
||||
const pkOneLine = privatePem.replace(/\r?\n/g, "\\n");
|
||||
let existing = fs.existsSync(ENV_FILE) ? fs.readFileSync(ENV_FILE, "utf-8") : "";
|
||||
existing = existing
|
||||
.split("\n")
|
||||
.filter((l) => !/^GMGN_API_KEY=|^GMGN_PRIVATE_KEY=/.test(l))
|
||||
.join("\n")
|
||||
.trim();
|
||||
const content = (existing ? existing + "\n" : "") + `GMGN_API_KEY=${apiKey}\nGMGN_PRIVATE_KEY=${pkOneLine}\n`;
|
||||
fs.mkdirSync(GMGN_CONFIG_DIR, { recursive: true });
|
||||
fs.writeFileSync(ENV_FILE, content, { mode: 0o600 });
|
||||
}
|
||||
|
||||
function verify(): "ok" | "auth_fail" | "network_fail" {
|
||||
try {
|
||||
execSync("gmgn-cli track follow-wallet --chain sol --limit 1", { stdio: "pipe" });
|
||||
return "ok";
|
||||
} catch (e: unknown) {
|
||||
const output = [
|
||||
(e as any).stderr?.toString() ?? "",
|
||||
(e as any).stdout?.toString() ?? "",
|
||||
].join(" ");
|
||||
if (/401|403|unauthorized|forbidden|invalid.*key|key.*invalid|signature/i.test(output)) {
|
||||
return "auth_fail";
|
||||
}
|
||||
return "network_fail";
|
||||
}
|
||||
}
|
||||
|
||||
export function registerConfigCommands(program: Command): void {
|
||||
const cmd = program
|
||||
.command("config")
|
||||
.description("Generate an Ed25519 key pair and output a pre-filled GMGN API Key creation link, or apply an API Key");
|
||||
|
||||
cmd
|
||||
.option("--check", "Check if GMGN_API_KEY is configured (exit 0 = found, exit 1 = not found)")
|
||||
.option("--apply <api_key>", "Write API Key + private key to ~/.config/gmgn/.env and verify")
|
||||
.action(async (opts) => {
|
||||
const lang = detectLang();
|
||||
|
||||
if (opts.check) {
|
||||
loadDotenv({ path: ENV_FILE, override: true });
|
||||
loadDotenv();
|
||||
process.exit(process.env.GMGN_API_KEY ? 0 : 1);
|
||||
}
|
||||
|
||||
if (opts.apply) {
|
||||
// --apply: read private key from keypair.pem, write .env, verify
|
||||
if (!fs.existsSync(KEYPAIR_FILE)) {
|
||||
console.error("Error: ~/.config/gmgn/keypair.pem not found. Run `gmgn-cli config` first to generate a key pair.");
|
||||
process.exit(1);
|
||||
}
|
||||
const content = fs.readFileSync(KEYPAIR_FILE, "utf-8");
|
||||
const match = content.match(/(-----BEGIN PRIVATE KEY-----[\s\S]+?-----END PRIVATE KEY-----)/);
|
||||
if (!match) {
|
||||
console.error("Error: keypair.pem exists but private key could not be parsed. Delete ~/.config/gmgn/keypair.pem and run `gmgn-cli config` again.");
|
||||
process.exit(1);
|
||||
}
|
||||
writeEnv(opts.apply, match[1]);
|
||||
|
||||
const result = verify();
|
||||
if (result === "ok") {
|
||||
console.log(MESSAGES.verifySuccess[lang]);
|
||||
} else if (result === "auth_fail") {
|
||||
console.error(MESSAGES.verifyFail[lang]);
|
||||
process.exit(1);
|
||||
} else {
|
||||
console.log(MESSAGES.verifyNetworkFail[lang]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Default: generate/reuse keypair, output link with guidance
|
||||
const publicPem = getOrCreateKeypair();
|
||||
const link = `${GMGN_API_URL}?pbk=${encodeURIComponent(publicPem)}`;
|
||||
console.log(MESSAGES.linkGuide[lang](link));
|
||||
});
|
||||
}
|
||||
+64
-5
@@ -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());
|
||||
@@ -20,23 +20,56 @@ export function registerCookingCommands(program: Command): void {
|
||||
cooking
|
||||
.command("create")
|
||||
.description("Create a token on a launchpad platform (requires private key)")
|
||||
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth / ton")
|
||||
.requiredOption("--dex <dex>", "Launchpad: pump / raydium / pancakeswap / flap / fourmeme / bonk / bags / ...")
|
||||
.requiredOption("--chain <chain>", "Chain: sol / bsc / base")
|
||||
.requiredOption("--dex <dex>", "Launchpad: pump / bonk / bags (sol) / fourmeme / flap (bsc) / klik / clanker (base)")
|
||||
.requiredOption("--from <address>", "Wallet address (must match API Key binding)")
|
||||
.requiredOption("--name <name>", "Token name")
|
||||
.requiredOption("--symbol <symbol>", "Token symbol")
|
||||
.requiredOption("--buy-amt <amount>", "Initial buy amount in native token (e.g. 0.01 SOL)")
|
||||
.option("--image <base64>", "Token logo as base64-encoded data (max 2MB decoded)")
|
||||
.option("--image-url <url>", "Token logo URL")
|
||||
.option("--description <text>", "Token description / project pitch")
|
||||
.option("--website <url>", "Website URL")
|
||||
.option("--twitter <url>", "Twitter link")
|
||||
.option("--telegram <url>", "Telegram link")
|
||||
.option("--slippage <n>", "Slippage tolerance (e.g. 0.01 = 1%)", parseFloat)
|
||||
.option("--slippage <n>", "Slippage tolerance (e.g. 30 = 30%)", parseFloat)
|
||||
.option("--auto-slippage", "Enable automatic slippage")
|
||||
.option("--fee <amount>", "Base gas / fee")
|
||||
.option("--priority-fee <sol>", "Priority fee in SOL (SOL only)")
|
||||
.option("--tip-fee <amount>", "Tip fee")
|
||||
.option("--gas-price <amount>", "Gas price in wei (EVM chains)")
|
||||
.option("--anti-mev", "Enable anti-MEV protection")
|
||||
.option("--max-fee-per-gas <amount>", "Max fee per gas in wei (EVM only)")
|
||||
.option("--max-priority-fee-per-gas <amount>", "Max priority fee per gas in wei (EVM only)")
|
||||
.option("--anti-mev", "Enable anti-MEV protection (SOL only)")
|
||||
.option("--anti-mev-mode <mode>", "Anti-MEV mode: off / normal / secure (SOL only)")
|
||||
.option("--raised-token <symbol>", "Raise token symbol: pump→USDC; bonk→USD1; fourmeme→USDT/USD1; leave empty for native")
|
||||
.option("--dev-wallet-bps <n>", "Dev wallet fee in basis points (100 = 1%)", parseInt)
|
||||
.option("--dev-gas <amount>", "Dev gas amount")
|
||||
.option("--dev-priority <amount>", "Dev priority fee")
|
||||
.option("--dev-tip <amount>", "Dev tip fee")
|
||||
.option("--dev-max-fee-per-gas <amount>", "Dev tx feeCap in wei (EVM EIP-1559)")
|
||||
.option("--approve-vision <version>", "Approve vision version: v1 / v2 (default: v2)")
|
||||
.option("--source <source>", "Traffic source identifier")
|
||||
// Pump.fun specific
|
||||
.option("--is-mayhem", "Enable Mayhem mode (Pump.fun only)")
|
||||
.option("--is-cashback", "Enable Cashback (Pump.fun only)")
|
||||
.option("--is-buy-back", "Enable Agent Auto Buyback (Pump.fun only)")
|
||||
.option("--pump-fee-share-list <json>", "Pump.fun fee share list as JSON array (Pump.fun only)")
|
||||
// Flap specific
|
||||
.option("--flap-rate-conf <json>", "Flap rate config as JSON object (Flap only)")
|
||||
// FourMeme specific
|
||||
.option("--fourmeme-rate-conf <json>", "FourMeme rate config as JSON object (FourMeme only)")
|
||||
// BAGS specific
|
||||
.option("--bags-fee-share-list <json>", "BAGS fee share list as JSON array (BAGS only)")
|
||||
// Bonk specific
|
||||
.option("--bonk-model <model>", "Bonk model identifier (bonk DEX only)")
|
||||
// Multi-wallet buy
|
||||
.option("--buy-wallets <json>", "Multi-wallet buy config as JSON array [{from_address, buy_amt}]")
|
||||
.option("--snip-buy-wallets <json>", "Snipe-buy wallet config as JSON array [{from_address, buy_amt}]")
|
||||
// CondMarket execution config + auto-sell (JSON)
|
||||
.option("--buy-trade-config <json>", "Buy-side trade config for CondMarket orders as JSON (TradeParam)")
|
||||
.option("--sell-trade-config <json>", "Sell-side trade config for auto-sell / pending_sell as JSON (TradeParam)")
|
||||
.option("--sell-configs <json>", "Auto-sell strategy list as JSON array (CookingSellConfig[])")
|
||||
.option("--raw", "Output raw JSON")
|
||||
.action(async (opts) => {
|
||||
if (!opts.image && !opts.imageUrl) {
|
||||
@@ -58,15 +91,41 @@ export function registerCookingCommands(program: Command): void {
|
||||
};
|
||||
if (opts.image) params.image = opts.image;
|
||||
if (opts.imageUrl) params.image_url = opts.imageUrl;
|
||||
if (opts.description) params.description = opts.description;
|
||||
if (opts.website) params.website = opts.website;
|
||||
if (opts.twitter) params.twitter = opts.twitter;
|
||||
if (opts.telegram) params.telegram = opts.telegram;
|
||||
if (opts.slippage != null) params.slippage = opts.slippage;
|
||||
if (opts.autoSlippage) params.auto_slippage = true;
|
||||
if (opts.fee) params.fee = opts.fee;
|
||||
if (opts.priorityFee) params.priority_fee = opts.priorityFee;
|
||||
if (opts.tipFee) params.tip_fee = opts.tipFee;
|
||||
if (opts.gasPrice) params.gas_price = opts.gasPrice;
|
||||
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;
|
||||
if (opts.antiMevMode) params.anti_mev_mode = opts.antiMevMode;
|
||||
if (opts.raisedToken != null) params.raised_token = opts.raisedToken;
|
||||
if (opts.devWalletBps != null) params.dev_wallet_bps = opts.devWalletBps;
|
||||
if (opts.devGas) params.dev_gas = opts.devGas;
|
||||
if (opts.devPriority) params.dev_priority = opts.devPriority;
|
||||
if (opts.devTip) params.dev_tip = opts.devTip;
|
||||
if (opts.devMaxFeePerGas) params.dev_max_fee_per_gas = opts.devMaxFeePerGas;
|
||||
if (opts.approveVision) params.approve_vision = opts.approveVision;
|
||||
if (opts.source) params.source = opts.source;
|
||||
if (opts.isMayhem) params.is_mayhem = true;
|
||||
if (opts.isCashback) params.is_cashback = true;
|
||||
if (opts.isBuyBack) params.is_buy_back = true;
|
||||
if (opts.pumpFeeShareList) params.pump_fee_share_list = JSON.parse(opts.pumpFeeShareList);
|
||||
if (opts.flapRateConf) params.flap_rate_conf = JSON.parse(opts.flapRateConf);
|
||||
if (opts.fourmemeRateConf) params.fourmeme_rate_conf = JSON.parse(opts.fourmemeRateConf);
|
||||
if (opts.bagsFeeShareList) params.bags_fee_share_list = JSON.parse(opts.bagsFeeShareList);
|
||||
if (opts.bonkModel) params.bonk_model = opts.bonkModel;
|
||||
if (opts.buyWallets) params.buy_wallets = JSON.parse(opts.buyWallets);
|
||||
if (opts.snipBuyWallets) params.snip_buy_wallets = JSON.parse(opts.snipBuyWallets);
|
||||
if (opts.buyTradeConfig) params.buy_trade_config = JSON.parse(opts.buyTradeConfig);
|
||||
if (opts.sellTradeConfig) params.sell_trade_config = JSON.parse(opts.sellTradeConfig);
|
||||
if (opts.sellConfigs) params.sell_configs = JSON.parse(opts.sellConfigs);
|
||||
const client = new OpenApiClient(getConfig(true));
|
||||
const data = await client.createToken(params).catch(exitOnError);
|
||||
printResult(data, opts.raw);
|
||||
|
||||
+232
-27
@@ -1,18 +1,34 @@
|
||||
import { Command } from "commander";
|
||||
import { OpenApiClient } from "../client/OpenApiClient.js";
|
||||
import { OpenApiClient, TokenSignalGroup, HotSearchesParam } from "../client/OpenApiClient.js";
|
||||
import { getConfig } from "../config.js";
|
||||
import { exitOnError, printResult } from "../output.js";
|
||||
import { validateAddress, validateChain } from "../validate.js";
|
||||
|
||||
// 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")
|
||||
.requiredOption("--resolution <resolution>", "Candlestick resolution: 30s / 1m / 5m / 15m / 1h / 4h / 1d")
|
||||
.option("--from <timestamp>", "Start time (Unix seconds)", parseInt)
|
||||
.option("--to <timestamp>", "End time (Unix seconds)", parseInt)
|
||||
.option("--raw", "Output raw JSON")
|
||||
@@ -32,35 +48,55 @@ export function registerMarketCommands(program: Command): void {
|
||||
printResult(data, opts.raw);
|
||||
});
|
||||
|
||||
market
|
||||
const trendingCmd = market
|
||||
.command("trending")
|
||||
.description("Get trending token swap data")
|
||||
.requiredOption("--chain <chain>", "Chain: sol / bsc / base")
|
||||
.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)")
|
||||
.option("--direction <dir>", "Sort direction: asc / desc")
|
||||
.option("--filter <tag...>", "Filter tags, repeatable. sol: renounced / frozen / has_social / not_wash_trading / ... evm: not_honeypot / verified / renounced / locked / ... (see docs for full list)")
|
||||
.option("--platform <name...>", "Platform filter, repeatable. sol: Pump.fun / letsbonk / moonshot_app / ... bsc: fourmeme / flap / clanker / ... base: clanker / flaunch / zora / ... (see docs for full list)")
|
||||
.option("--raw", "Output raw JSON")
|
||||
.action(async (opts) => {
|
||||
validateChain(opts.chain);
|
||||
const extra: Record<string, string | number | string[]> = {};
|
||||
if (opts.limit != null) extra["limit"] = opts.limit;
|
||||
if (opts.orderBy) extra["order_by"] = opts.orderBy;
|
||||
if (opts.direction) extra["direction"] = opts.direction;
|
||||
if (opts.filter?.length) extra["filters"] = opts.filter;
|
||||
if (opts.platform?.length) extra["platforms"] = opts.platform;
|
||||
.option("--platform <name...>", "Platform filter, repeatable. sol: Pump.fun / letsbonk / moonshot_app / ... bsc: fourmeme / four_xmode_agent / cubepeg / likwid / goplus_creator / goplus_skills / openfour / flap / flap_stocks / flap_aioracle / clanker / ... base: clanker / flaunch / zora / ... eth: trench / clanker / klik / livo / stroid / pool_uniswap_v2 / pool_uniswap_v3 / printr (see docs for full list)")
|
||||
.option("--raw", "Output raw JSON");
|
||||
|
||||
const client = new OpenApiClient(getConfig());
|
||||
const data = await client.getTrendingSwaps(opts.chain, opts.interval, extra).catch(exitOnError);
|
||||
printResult(data, opts.raw);
|
||||
});
|
||||
// Dynamically register all server-side min_*/max_* range filter flags
|
||||
for (const def of RANK_RANGE_FIELDS) {
|
||||
const flag = def.api.replace(/_/g, "-");
|
||||
if (def.type === "int") {
|
||||
trendingCmd.option(`--${flag} <${def.type}>`, def.desc, parseInt);
|
||||
} else if (def.type === "float") {
|
||||
trendingCmd.option(`--${flag} <${def.type}>`, def.desc, parseFloat);
|
||||
} else {
|
||||
trendingCmd.option(`--${flag} <value>`, def.desc);
|
||||
}
|
||||
}
|
||||
|
||||
trendingCmd.action(async (opts) => {
|
||||
validateChain(opts.chain);
|
||||
const extra: Record<string, string | number | string[]> = {};
|
||||
if (opts.limit != null) extra["limit"] = opts.limit;
|
||||
if (opts.orderBy) extra["order_by"] = opts.orderBy;
|
||||
if (opts.direction) extra["direction"] = opts.direction;
|
||||
if (opts.filter?.length) extra["filters"] = opts.filter;
|
||||
if (opts.platform?.length) extra["platforms"] = opts.platform;
|
||||
|
||||
// Apply server-side min_*/max_* range filters
|
||||
const optsMap = opts as Record<string, unknown>;
|
||||
for (const def of RANK_RANGE_FIELDS) {
|
||||
const val = optsMap[apiFieldToCliKey(def.api)];
|
||||
if (val != null) extra[def.api] = val as string | number;
|
||||
}
|
||||
|
||||
const client = new OpenApiClient(getConfig());
|
||||
const data = await client.getTrendingSwaps(opts.chain, opts.interval, extra).catch(exitOnError);
|
||||
printResult(data, opts.raw);
|
||||
});
|
||||
|
||||
const trenchesCmd = market
|
||||
.command("trenches")
|
||||
.description("Get Trenches token data (new creation, near completion, completed)")
|
||||
.requiredOption("--chain <chain>", "Chain: sol / bsc / base")
|
||||
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
|
||||
.option("--type <type...>", "Categories to query, repeatable: new_creation / near_completion / completed (default: all three)")
|
||||
.option("--launchpad-platform <platform...>", "Launchpad platform filter, repeatable (default: all platforms for the chain)")
|
||||
.option("--limit <n>", "Max results per category, max 80 (default: 80)", parseInt)
|
||||
@@ -76,6 +112,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 +153,127 @@ 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: 1–18 (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);
|
||||
});
|
||||
|
||||
const hotSearchesCmd = market
|
||||
.command("hot-searches")
|
||||
.description("Get the hot-search ranking (most-searched tokens) for one or more chains")
|
||||
.option("--chain <chain...>", "Chain(s), repeatable: sol / bsc / base / eth / monad / megaeth / hyperevm / tron (default: all 7 chains)")
|
||||
.option("--interval <interval>", "Time window: 1m / 5m / 1h / 6h / 24h (default 24h)", "24h")
|
||||
.option("--limit <n>", "Max results per chain (default 500)", parseInt)
|
||||
.option("--filter <tag...>", "Boolean filter tags, repeatable. sol defaults: renounced / frozen; EVM defaults: not_honeypot / verified / renounced")
|
||||
.option("--params <json>", "Full params override: JSON array of param objects — overrides --chain/--interval/--limit/--filter and all range flags when provided")
|
||||
.option("--raw", "Output raw JSON");
|
||||
|
||||
// Reuse the same min_*/max_* range flags as `market trending` — the hot_searches
|
||||
// endpoint accepts the identical rank-style metric names inside `filter` and
|
||||
// translates them server-side per interval (min_created/max_created are durations).
|
||||
for (const def of RANK_RANGE_FIELDS) {
|
||||
const flag = def.api.replace(/_/g, "-");
|
||||
if (def.type === "int") {
|
||||
hotSearchesCmd.option(`--${flag} <${def.type}>`, def.desc, parseInt);
|
||||
} else if (def.type === "float") {
|
||||
hotSearchesCmd.option(`--${flag} <${def.type}>`, def.desc, parseFloat);
|
||||
} else if (def.type === "duration") {
|
||||
hotSearchesCmd.option(`--${flag} <duration>`, def.desc, parseDuration);
|
||||
} else {
|
||||
hotSearchesCmd.option(`--${flag} <value>`, def.desc);
|
||||
}
|
||||
}
|
||||
|
||||
hotSearchesCmd.action(async (opts) => {
|
||||
const interval = String(opts.interval);
|
||||
if (!HOT_SEARCHES_INTERVALS.has(interval)) {
|
||||
console.error(`[gmgn-cli] Invalid --interval "${interval}". Must be one of: ${[...HOT_SEARCHES_INTERVALS].join(", ")}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
let params: HotSearchesParam[];
|
||||
if (opts.params != null) {
|
||||
try {
|
||||
params = JSON.parse(opts.params as string) as HotSearchesParam[];
|
||||
} catch {
|
||||
console.error(`[gmgn-cli] --params must be a valid JSON array, e.g. '[{"chain":"sol","interval":"24h","filters":["renounced","frozen"],"limit":500,"min_liquidity":1000}]'`);
|
||||
process.exit(1);
|
||||
}
|
||||
} else {
|
||||
// Empty params lets the server apply its default 7-chain config. Filter fields
|
||||
// are flattened directly onto each param (no nested `filter` object).
|
||||
const optsMap = opts as Record<string, unknown>;
|
||||
const chains: string[] = opts.chain?.length ? (opts.chain as string[]) : [];
|
||||
params = chains.map((chain) => {
|
||||
const param: HotSearchesParam = { label: "hot-search", chain, interval };
|
||||
if (opts.filter?.length) param.filters = opts.filter as string[];
|
||||
if (opts.limit != null) param.limit = opts.limit as number;
|
||||
// Fold in any rank-style min_*/max_* range flags (incl. min_created/max_created).
|
||||
for (const def of RANK_RANGE_FIELDS) {
|
||||
const val = optsMap[apiFieldToCliKey(def.api)];
|
||||
if (val != null) param[def.api] = val as number | string;
|
||||
}
|
||||
return param;
|
||||
});
|
||||
}
|
||||
|
||||
const client = new OpenApiClient(getConfig());
|
||||
const data = await client.getHotSearches(params).catch(exitOnError);
|
||||
printResult(data, opts.raw);
|
||||
});
|
||||
}
|
||||
|
||||
const HOT_SEARCHES_INTERVALS = new Set(["1m", "5m", "1h", "6h", "24h"]);
|
||||
|
||||
// ---- Trenches filter field definitions ----
|
||||
|
||||
type TrenchesFieldType = "int" | "float" | "string";
|
||||
type TrenchesFieldType = "int" | "float" | "string" | "duration";
|
||||
|
||||
interface TrenchesFilterField {
|
||||
api: string;
|
||||
@@ -151,8 +305,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" },
|
||||
@@ -202,6 +356,56 @@ const TRENCHES_FILTER_FIELDS: TrenchesFilterField[] = [
|
||||
{ api: "max_tg_call_count", type: "int", desc: "Max Telegram call count" },
|
||||
];
|
||||
|
||||
// Server-side numeric range filters for `market trending` (/v1/market/rank).
|
||||
// Passed through as min_<metric>/max_<metric> query params; the service applies the
|
||||
// metrics it understands and ignores the rest. min_created/max_created are token-age
|
||||
// windows expressed as duration strings (e.g. 30m / 6h / 7d) — note these use m/h/d,
|
||||
// NOT the s/m form used by trenches; min_created is a minimum age, max_created a maximum.
|
||||
// The raw upstream rank interface accepts minutes only; the openapi-service does not
|
||||
// forward this field — it evaluates the age window itself (cutoff = now - duration,
|
||||
// native for m/h/d), so h/d are valid through this CLI. Passed through verbatim
|
||||
// (string); a bare number with no unit suffix is rejected.
|
||||
const RANK_RANGE_FIELDS: TrenchesFilterField[] = [
|
||||
{ api: "min_volume", type: "float", desc: "Min trading volume (USD)" },
|
||||
{ api: "max_volume", type: "float", desc: "Max trading volume (USD)" },
|
||||
{ api: "min_liquidity", type: "float", desc: "Min liquidity (USD)" },
|
||||
{ api: "max_liquidity", type: "float", desc: "Max liquidity (USD)" },
|
||||
{ api: "min_marketcap", type: "float", desc: "Min market cap (USD)" },
|
||||
{ api: "max_marketcap", type: "float", desc: "Max market cap (USD)" },
|
||||
{ api: "min_history_highest_marketcap", type: "float", desc: "Min historical highest market cap (USD)" },
|
||||
{ api: "max_history_highest_marketcap", type: "float", desc: "Max historical highest market cap (USD)" },
|
||||
{ api: "min_swaps", type: "int", desc: "Min swap count" },
|
||||
{ api: "max_swaps", type: "int", desc: "Max swap count" },
|
||||
{ api: "min_holder_count", type: "int", desc: "Min holder count" },
|
||||
{ api: "max_holder_count", type: "int", desc: "Max holder count" },
|
||||
{ api: "min_gas_fee", type: "float", desc: "Min gas fee" },
|
||||
{ api: "max_gas_fee", type: "float", desc: "Max gas fee" },
|
||||
{ api: "min_renowned_count", type: "int", desc: "Min KOL / renowned wallet count" },
|
||||
{ api: "max_renowned_count", type: "int", desc: "Max KOL / renowned wallet count" },
|
||||
{ api: "min_smart_degen_count", type: "int", desc: "Min smart-money holder count" },
|
||||
{ api: "max_smart_degen_count", type: "int", desc: "Max smart-money holder count" },
|
||||
{ api: "min_bot_degen_count", type: "int", desc: "Min bot-degen wallet count" },
|
||||
{ api: "max_bot_degen_count", type: "int", desc: "Max bot-degen wallet count" },
|
||||
{ api: "min_visiting_count", type: "int", desc: "Min visitor count" },
|
||||
{ api: "max_visiting_count", type: "int", desc: "Max visitor count" },
|
||||
{ api: "min_price_change_percent", type: "float", desc: "Min price change ratio over the interval" },
|
||||
{ api: "max_price_change_percent", type: "float", desc: "Max price change ratio over the interval" },
|
||||
{ api: "min_insider_rate", type: "float", desc: "Min insider trading ratio (0–1); tokens lacking this field are excluded" },
|
||||
{ api: "max_insider_rate", type: "float", desc: "Max insider trading ratio (0–1); tokens lacking this field are excluded" },
|
||||
{ api: "min_bundler_rate", type: "float", desc: "Min bundle-bot trading ratio (0–1); tokens lacking this field are excluded" },
|
||||
{ api: "max_bundler_rate", type: "float", desc: "Max bundle-bot trading ratio (0–1); tokens lacking this field are excluded" },
|
||||
{ api: "min_entrapment_ratio", type: "float", desc: "Min entrapment trading ratio (0–1); tokens lacking this field are excluded" },
|
||||
{ api: "max_entrapment_ratio", type: "float", desc: "Max entrapment trading ratio (0–1); tokens lacking this field are excluded" },
|
||||
{ api: "min_top10_holder_rate", type: "float", desc: "Min top-10 holder concentration (0–1)" },
|
||||
{ api: "max_top10_holder_rate", type: "float", desc: "Max top-10 holder concentration (0–1)" },
|
||||
{ api: "min_top70_sniper_hold_rate", type: "float", desc: "Min top-70 sniper holding ratio (0–1)" },
|
||||
{ api: "max_top70_sniper_hold_rate", type: "float", desc: "Max top-70 sniper holding ratio (0–1)" },
|
||||
{ api: "min_dev_team_hold_rate", type: "float", desc: "Min dev-team holding ratio (0–1); also excludes creator-close tokens" },
|
||||
{ api: "max_dev_team_hold_rate", type: "float", desc: "Max dev-team holding ratio (0–1)" },
|
||||
{ api: "min_created", type: "string", desc: "Min token age (minimum age). Duration with unit suffix m/h/d, e.g. 30m / 6h / 7d (h/d evaluated server-side; raw upstream takes minutes only). A bare number with no unit is rejected." },
|
||||
{ api: "max_created", type: "string", desc: "Max token age (maximum age). Duration with unit suffix m/h/d, e.g. 600m / 24h (h/d evaluated server-side; raw upstream takes minutes only). A bare number with no unit is rejected." },
|
||||
];
|
||||
|
||||
// Named filter presets using actual server-side API field names
|
||||
const TRENCHES_FILTER_PRESETS: Record<string, Record<string, number | string>> = {
|
||||
safe: {
|
||||
@@ -222,13 +426,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)
|
||||
|
||||
@@ -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,12 +46,12 @@ 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)
|
||||
.option("--cursor <cursor>", "Pagination cursor")
|
||||
.option("--type <type...>", "Activity type filter, repeatable: buy / sell / add / remove / transfer")
|
||||
.option("--type <type...>", "Activity type filter, repeatable: buy / sell / transferIn / transferOut / add / remove")
|
||||
.option("--raw", "Output raw JSON")
|
||||
.action(async (opts) => {
|
||||
validateChain(opts.chain);
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
+135
-23
@@ -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,22 +8,23 @@ 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")
|
||||
.option("--amount <amount>", "Input raw amount (smallest unit)")
|
||||
.option("--percent <pct>", "Input amount as a percentage, e.g. 50 = 50%, 1 = 1%; only valid when input_token is NOT a currency", parseFloat)
|
||||
.option("--slippage <n>", "Slippage tolerance (e.g. 0.01 = 1%)", parseFloat)
|
||||
.option("--slippage <n>", "Slippage tolerance (e.g. 30 = 30%)", parseFloat)
|
||||
.option("--auto-slippage", "Enable automatic slippage")
|
||||
.option("--min-output <amount>", "Minimum output amount")
|
||||
.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,17 +73,89 @@ 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 (1–10000, 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. 30 = 30%)", 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 1–100 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")
|
||||
.requiredOption("--chain <chain>", "Chain: sol / bsc / base")
|
||||
.requiredOption("--from <address>", "Wallet address (must match API Key binding)")
|
||||
.description("Get a swap quote without submitting a transaction (exist auth — GMGN_API_KEY only, no private key needed)")
|
||||
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
|
||||
.requiredOption("--from <address>", "Wallet address")
|
||||
.requiredOption("--input-token <address>", "Input token contract address")
|
||||
.requiredOption("--output-token <address>", "Output token contract address")
|
||||
.requiredOption("--amount <amount>", "Input amount (smallest unit)")
|
||||
.requiredOption("--slippage <n>", "Slippage tolerance (e.g. 0.01 = 1%)", parseFloat)
|
||||
.requiredOption("--slippage <n>", "Slippage tolerance (e.g. 30 = 30%)", parseFloat)
|
||||
.option("--raw", "Output raw JSON")
|
||||
.action(async (opts) => {
|
||||
validateChain(opts.chain);
|
||||
@@ -89,7 +163,7 @@ export function registerSwapCommands(program: Command): void {
|
||||
validateAddress(opts.inputToken, opts.chain, "--input-token");
|
||||
validateAddress(opts.outputToken, opts.chain, "--output-token");
|
||||
validatePositiveInt(opts.amount, "--amount");
|
||||
const client = new OpenApiClient(getConfig());
|
||||
const client = new OpenApiClient(getConfig(true));
|
||||
const data = await client
|
||||
.quoteOrder(opts.chain, opts.from, opts.inputToken, opts.outputToken, opts.amount, opts.slippage)
|
||||
.catch(exitOnError);
|
||||
@@ -109,29 +183,49 @@ 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")
|
||||
.requiredOption("--order-type <type>", "Order type: limit_order")
|
||||
.requiredOption("--sub-order-type <type>", "Sub-order type: buy_low / buy_high / stop_loss / take_profit")
|
||||
.requiredOption("--check-price <price>", "Trigger check price")
|
||||
.requiredOption("--order-type <type>", "Order type: limit_order / smart_trade")
|
||||
.requiredOption("--sub-order-type <type>", "Sub-order type: buy_low / buy_high / stop_loss / take_profit (limit_order); mix_trade (smart_trade with condition_orders)")
|
||||
.option("--check-price <price>", "Trigger check price (required for limit_order; omit for smart_trade)")
|
||||
.option("--open-price <price>", "Open price of the position")
|
||||
.option("--amount-in <amount>", "Input amount (smallest unit)")
|
||||
.option("--amount-in-percent <pct>", "Input amount as a percentage (e.g. 50 = 50%)")
|
||||
.option("--limit-price-mode <mode>", "Price mode: exact / slippage (default: slippage)")
|
||||
.option("--expire-in <seconds>", "Order expiry in seconds", parseInt)
|
||||
.option("--sell-ratio-type <type>", "Sell ratio basis: buy_amount (default) / hold_amount")
|
||||
.option("--slippage <n>", "Slippage tolerance (e.g. 0.01 = 1%)", parseFloat)
|
||||
.option("--quote-investment <amount>", "Quote token investment amount (smart_trade)")
|
||||
.option("--slippage <n>", "Slippage tolerance (e.g. 30 = 30%)", parseFloat)
|
||||
.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("--condition-orders <json>", "JSON array of condition sub-orders for smart_trade (must include a buy_low entry + TP/SL entries)")
|
||||
.option("--sell-param <json>", "JSON object of sell-side trade params used when a TP/SL condition fires (required for smart_trade)")
|
||||
.option("--buy-param <json>", "JSON object of buy-side trade params override for smart_trade")
|
||||
.option("--raw", "Output raw JSON")
|
||||
.action(async (opts) => {
|
||||
if (!opts.amountIn && !opts.amountInPercent) {
|
||||
@@ -150,19 +244,37 @@ export function registerSwapCommands(program: Command): void {
|
||||
quote_token: opts.quoteToken,
|
||||
order_type: opts.orderType,
|
||||
sub_order_type: opts.subOrderType,
|
||||
check_price: opts.checkPrice,
|
||||
};
|
||||
if (opts.checkPrice) params.check_price = opts.checkPrice;
|
||||
if (opts.openPrice) params.open_price = opts.openPrice;
|
||||
if (opts.amountIn) params.amount_in = opts.amountIn;
|
||||
if (opts.amountInPercent) params.amount_in_percent = opts.amountInPercent;
|
||||
if (opts.limitPriceMode) params.limit_price_mode = opts.limitPriceMode;
|
||||
if (opts.expireIn != null) params.expire_in = opts.expireIn;
|
||||
if (opts.sellRatioType) params.sell_ratio_type = opts.sellRatioType;
|
||||
if (opts.quoteInvestment) params.quote_investment = opts.quoteInvestment;
|
||||
if (opts.slippage != null) params.slippage = opts.slippage;
|
||||
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;
|
||||
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.sellParam) {
|
||||
try { params.sell_param = JSON.parse(opts.sellParam); }
|
||||
catch { console.error("[gmgn-cli] --sell-param must be valid JSON"); process.exit(1); }
|
||||
}
|
||||
if (opts.buyParam) {
|
||||
try { params.buy_param = JSON.parse(opts.buyParam); }
|
||||
catch { console.error("[gmgn-cli] --buy-param must be valid JSON"); process.exit(1); }
|
||||
}
|
||||
const client = new OpenApiClient(getConfig(true));
|
||||
const data = await client.createStrategyOrder(params).catch(exitOnError);
|
||||
printResult(data, opts.raw);
|
||||
@@ -171,7 +283,7 @@ export function registerSwapCommands(program: Command): void {
|
||||
strategy
|
||||
.command("list")
|
||||
.description("List strategy orders (requires private key)")
|
||||
.requiredOption("--chain <chain>", "Chain: sol / bsc / base")
|
||||
.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 +308,7 @@ export function registerSwapCommands(program: Command): void {
|
||||
strategy
|
||||
.command("cancel")
|
||||
.description("Cancel a strategy order (requires private key)")
|
||||
.requiredOption("--chain <chain>", "Chain: sol / bsc / base")
|
||||
.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")
|
||||
|
||||
@@ -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);
|
||||
|
||||
+45
-4
@@ -7,10 +7,51 @@ import { validateChain } from "../validate.js";
|
||||
export function registerTrackCommands(program: Command): void {
|
||||
const track = program.command("track").description("On-chain tracking commands: follow-wallet trades, KOL trades, Smart Money trades");
|
||||
|
||||
track
|
||||
.command("follow-tokens")
|
||||
.description("Get the followed token list for a wallet on a given chain")
|
||||
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
|
||||
.requiredOption("--wallet <address>", "Wallet address")
|
||||
.option("--group-id <id>", "Filter by group: all_group (all), default, or a user-defined group ID")
|
||||
.option("--interval <interval>", "Time interval for price change stats (e.g. 1m, 5m, 1h, 6h, 24h)")
|
||||
.option("--order-by <field>", "Sort field: created_at / swaps / volume / market_cap / liquidity / price / open_timestamp")
|
||||
.option("--direction <dir>", "Sort direction: asc / desc")
|
||||
.option("--limit <n>", "Page size", parseInt)
|
||||
.option("--cursor <cursor>", "Pagination cursor")
|
||||
.option("--search <text>", "Search by token name or address")
|
||||
.option("--raw", "Output raw JSON")
|
||||
.action(async (opts) => {
|
||||
validateChain(opts.chain);
|
||||
const extra: Record<string, string | number> = {};
|
||||
if (opts.groupId) extra["group_id"] = opts.groupId;
|
||||
if (opts.interval) extra["interval"] = opts.interval;
|
||||
if (opts.orderBy) extra["order_by"] = opts.orderBy;
|
||||
if (opts.direction) extra["direction"] = opts.direction;
|
||||
if (opts.limit != null) extra["limit"] = opts.limit;
|
||||
if (opts.cursor) extra["cursor"] = opts.cursor;
|
||||
if (opts.search) extra["search_text"] = opts.search;
|
||||
const client = new OpenApiClient(getConfig());
|
||||
const data = await client.getFollowTokens(opts.chain, opts.wallet, extra).catch(exitOnError);
|
||||
printResult(data, opts.raw);
|
||||
});
|
||||
|
||||
track
|
||||
.command("follow-token-groups")
|
||||
.description("Get the follow token group names for a wallet on a given chain")
|
||||
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
|
||||
.requiredOption("--wallet <address>", "Wallet address")
|
||||
.option("--raw", "Output raw JSON")
|
||||
.action(async (opts) => {
|
||||
validateChain(opts.chain);
|
||||
const client = new OpenApiClient(getConfig());
|
||||
const data = await client.getFollowGroupNames(opts.chain, opts.wallet).catch(exitOnError);
|
||||
printResult(data, opts.raw);
|
||||
});
|
||||
|
||||
track
|
||||
.command("follow-wallet")
|
||||
.description("Get follow-wallet trade records")
|
||||
.requiredOption("--chain <chain>", "Chain: sol / bsc / base")
|
||||
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
|
||||
.option("--wallet <address>", "Filter by wallet address")
|
||||
.option("--limit <n>", "Page size (1–100, default 10)", parseInt)
|
||||
.option("--side <side>", "Trade direction filter: buy / sell")
|
||||
@@ -27,7 +68,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 +76,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 (1–200, default 100)", parseInt)
|
||||
.option("--side <side>", "Filter by trade direction: buy / sell (client-side filter)")
|
||||
.option("--raw", "Output raw JSON")
|
||||
@@ -52,7 +93,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 (1–200, default 100)", parseInt)
|
||||
.option("--side <side>", "Filter by trade direction: buy / sell (client-side filter)")
|
||||
.option("--raw", "Output raw JSON")
|
||||
|
||||
+8
-6
@@ -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;
|
||||
@@ -14,11 +14,13 @@ export interface Config {
|
||||
}
|
||||
|
||||
let _config: Config | null = null;
|
||||
const PRIVATE_KEY_REQUIRED_MSG =
|
||||
"GMGN_PRIVATE_KEY is required for critical-auth commands (swap, order, and follow-wallet commands)";
|
||||
|
||||
export function getConfig(requirePrivateKey = false): Config {
|
||||
if (_config) {
|
||||
if (requirePrivateKey && !_config.privateKeyPem) {
|
||||
die("GMGN_PRIVATE_KEY is required for swap/order commands");
|
||||
die(PRIVATE_KEY_REQUIRED_MSG);
|
||||
}
|
||||
return _config;
|
||||
}
|
||||
@@ -34,10 +36,10 @@ export function getConfig(requirePrivateKey = false): Config {
|
||||
// Support escaped newlines (e.g. from single-line .env values)
|
||||
privateKeyPem = privateKey.replace(/\\n/g, "\n");
|
||||
} else if (requirePrivateKey) {
|
||||
die("GMGN_PRIVATE_KEY is required for swap/order commands");
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import { registerPortfolioCommands } from "./commands/portfolio.js";
|
||||
import { registerTrackCommands } from "./commands/track.js";
|
||||
import { registerSwapCommands } from "./commands/swap.js";
|
||||
import { registerCookingCommands } from "./commands/cooking.js";
|
||||
import { registerConfigCommands } from "./commands/config.js";
|
||||
|
||||
const proxy = process.env.HTTPS_PROXY ?? process.env.https_proxy
|
||||
?? process.env.HTTP_PROXY ?? process.env.http_proxy;
|
||||
@@ -60,6 +61,7 @@ registerPortfolioCommands(program);
|
||||
registerTrackCommands(program);
|
||||
registerSwapCommands(program);
|
||||
registerCookingCommands(program);
|
||||
registerConfigCommands(program);
|
||||
|
||||
program.parseAsync().catch((err) => {
|
||||
console.error(`[gmgn-cli] ${err.message}`);
|
||||
|
||||
Reference in New Issue
Block a user