gmgn-cli 1.1.8 → 1.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +131 -29
- package/Readme.zh.md +73 -35
- package/dist/client/OpenApiClient.d.ts +70 -1
- package/dist/client/OpenApiClient.d.ts.map +1 -1
- package/dist/client/OpenApiClient.js +192 -29
- package/dist/client/OpenApiClient.js.map +1 -1
- package/dist/commands/cooking.d.ts +3 -0
- package/dist/commands/cooking.d.ts.map +1 -0
- package/dist/commands/cooking.js +82 -0
- package/dist/commands/cooking.js.map +1 -0
- package/dist/commands/market.d.ts.map +1 -1
- package/dist/commands/market.js +167 -5
- package/dist/commands/market.js.map +1 -1
- package/dist/commands/swap.d.ts.map +1 -1
- package/dist/commands/swap.js +135 -0
- package/dist/commands/swap.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/gmgn-cooking/SKILL.md +363 -0
- package/skills/gmgn-market/SKILL.md +158 -3
- package/skills/gmgn-portfolio/SKILL.md +36 -3
- package/skills/gmgn-swap/SKILL.md +136 -5
- package/skills/gmgn-token/SKILL.md +36 -3
- package/skills/gmgn-track/SKILL.md +39 -4
|
@@ -55,9 +55,40 @@ Use the `gmgn-cli` tool to query K-line data for a token, browse trending tokens
|
|
|
55
55
|
|
|
56
56
|
## Prerequisites
|
|
57
57
|
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
|
|
58
|
+
- `gmgn-cli` installed globally — if missing, run: `npm install -g gmgn-cli`
|
|
59
|
+
- `GMGN_API_KEY` configured in `~/.config/gmgn/.env`
|
|
60
|
+
|
|
61
|
+
## Rate Limit Handling
|
|
62
|
+
|
|
63
|
+
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.
|
|
64
|
+
|
|
65
|
+
| Command | Route | Weight |
|
|
66
|
+
|---------|-------|--------|
|
|
67
|
+
| `market kline` | `GET /v1/market/token_kline` | 2 |
|
|
68
|
+
| `market trending` | `GET /v1/market/rank` | 1 |
|
|
69
|
+
| `market trenches` | `POST /v1/trenches` | 3 |
|
|
70
|
+
|
|
71
|
+
When a request returns `429`:
|
|
72
|
+
|
|
73
|
+
- Read `X-RateLimit-Reset` from the response headers. It is a Unix timestamp in seconds that marks when the limit is expected to reset.
|
|
74
|
+
- 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.
|
|
75
|
+
- 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.
|
|
76
|
+
|
|
77
|
+
**First-time setup** (if `GMGN_API_KEY` is not configured):
|
|
78
|
+
|
|
79
|
+
1. Generate key pair and show the public key to the user:
|
|
80
|
+
```bash
|
|
81
|
+
openssl genpkey -algorithm ed25519 -out /tmp/gmgn_private.pem 2>/dev/null && \
|
|
82
|
+
openssl pkey -in /tmp/gmgn_private.pem -pubout 2>/dev/null
|
|
83
|
+
```
|
|
84
|
+
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."*
|
|
85
|
+
|
|
86
|
+
2. Wait for the user's API key, then configure:
|
|
87
|
+
```bash
|
|
88
|
+
mkdir -p ~/.config/gmgn
|
|
89
|
+
echo 'GMGN_API_KEY=<key_from_user>' > ~/.config/gmgn/.env
|
|
90
|
+
chmod 600 ~/.config/gmgn/.env
|
|
91
|
+
```
|
|
61
92
|
|
|
62
93
|
## `market kline` Parameters
|
|
63
94
|
|
|
@@ -437,9 +468,95 @@ Use field combinations to determine what stage a token is in. This affects how s
|
|
|
437
468
|
| `--type` | No | Categories to query, repeatable: `new_creation` / `near_completion` / `completed` (default: all three) |
|
|
438
469
|
| `--launchpad-platform` | No | Launchpad platform filter, repeatable (default: all platforms for the chain) |
|
|
439
470
|
| `--limit` | No | Max results per category, max 80 (default: 80) |
|
|
471
|
+
| `--filter-preset` | No | Named server-side filter preset: `safe` / `smart-money` / `strict` |
|
|
472
|
+
| `--sort-by` | No | Client-side sort per category: `smart_degen_count` / `renowned_count` / `volume_24h` / `volume_1h` / `swaps_24h` / `swaps_1h` / `rug_ratio` / `holder_count` / `usd_market_cap` / `created_timestamp` |
|
|
473
|
+
| `--direction` | No | Sort direction: `asc` / `desc` (default: `desc`; `asc` for `rug_ratio`) |
|
|
474
|
+
| `--min-*` / `--max-*` | No | Server-side filter range flags — see Filter Fields Reference below |
|
|
475
|
+
|
|
476
|
+
### Filter Presets
|
|
477
|
+
|
|
478
|
+
Presets are applied server-side: the API filters tokens before returning results.
|
|
479
|
+
|
|
480
|
+
| Preset | Server-side filters applied |
|
|
481
|
+
|--------|----------------------------|
|
|
482
|
+
| `safe` | `max_rug_ratio=0.3` + `max_bundler_rate=0.3` + `max_insider_ratio=0.3` |
|
|
483
|
+
| `smart-money` | `min_smart_degen_count=1` |
|
|
484
|
+
| `strict` | `max_rug_ratio=0.3` + `max_bundler_rate=0.3` + `max_insider_ratio=0.3` + `min_smart_degen_count=1` + `min_volume_24h=1000` |
|
|
485
|
+
|
|
486
|
+
**Preset + explicit flag interaction:** Explicit filter flags always override preset values. For example, `--filter-preset safe --max-rug-ratio 0.1` applies the `safe` preset but overrides rug_ratio threshold to `0.1`.
|
|
487
|
+
|
|
488
|
+
**All filter flags are sent as part of the API request body (server-side)** — the server filters tokens before returning results. Use `--limit 80` (the default maximum) to maximise the pool.
|
|
440
489
|
|
|
441
490
|
Response fields: `data.new_creation`, `data.pump`, `data.completed` — each is an array of `RankItem` (same fields as `market trending` rank items). **Important: `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`.**
|
|
442
491
|
|
|
492
|
+
### Server-Side Filter Fields
|
|
493
|
+
|
|
494
|
+
All filter flags are sent as part of the API request body — the server filters tokens before returning results. Flags follow the naming convention `--min-{field}` / `--max-{field}`.
|
|
495
|
+
|
|
496
|
+
| Flag pair | Type | Description |
|
|
497
|
+
|-----------|------|-------------|
|
|
498
|
+
| `--min-volume-24h` / `--max-volume-24h` | float | 24h trading volume (USD) |
|
|
499
|
+
| `--min-net-buy-24h` / `--max-net-buy-24h` | float | 24h net buy volume (USD) |
|
|
500
|
+
| `--min-swaps-24h` / `--max-swaps-24h` | int | 24h total swap count |
|
|
501
|
+
| `--min-buys-24h` / `--max-buys-24h` | int | 24h buy count |
|
|
502
|
+
| `--min-sells-24h` / `--max-sells-24h` | int | 24h sell count |
|
|
503
|
+
| `--min-visiting-count` / `--max-visiting-count` | int | Visitor count |
|
|
504
|
+
| `--min-progress` / `--max-progress` | float | Bonding curve progress (0–1) |
|
|
505
|
+
| `--min-marketcap` / `--max-marketcap` | float | Market cap (USD) |
|
|
506
|
+
| `--min-liquidity` / `--max-liquidity` | float | Liquidity (USD) |
|
|
507
|
+
| `--min-created` / `--max-created` | string | Token age (e.g. `1m` / `5m` / `1h` / `24h`) |
|
|
508
|
+
| `--min-holder-count` / `--max-holder-count` | int | Holder count |
|
|
509
|
+
| `--min-top-holder-rate` / `--max-top-holder-rate` | float | Top-10 holder concentration (0–1) |
|
|
510
|
+
| `--min-rug-ratio` / `--max-rug-ratio` | float | Rug pull risk score (0–1) |
|
|
511
|
+
| `--min-bundler-rate` / `--max-bundler-rate` | float | Bundle-bot trading ratio (0–1) |
|
|
512
|
+
| `--min-insider-ratio` / `--max-insider-ratio` | float | Insider trading ratio (0–1) |
|
|
513
|
+
| `--min-entrapment-ratio` / `--max-entrapment-ratio` | float | Entrapment/Phishing trading ratio (0–1) |
|
|
514
|
+
| `--min-private-vault-hold-rate` / `--max-private-vault-hold-rate` | float | Private vault holding ratio (0–1) |
|
|
515
|
+
| `--min-top70-sniper-hold-rate` / `--max-top70-sniper-hold-rate` | float | Top-70 sniper holding ratio (0–1) |
|
|
516
|
+
| `--min-bot-count` / `--max-bot-count` | int | Bot wallet count |
|
|
517
|
+
| `--min-bot-degen-rate` / `--max-bot-degen-rate` | float | Bot-degen wallet ratio (0–1) |
|
|
518
|
+
| `--min-fresh-wallet-rate` / `--max-fresh-wallet-rate` | float | Fresh wallet ratio (0–1) |
|
|
519
|
+
| `--min-total-fee` / `--max-total-fee` | float | Total fee |
|
|
520
|
+
| `--min-smart-degen-count` / `--max-smart-degen-count` | int | Smart-money holder count |
|
|
521
|
+
| `--min-renowned-count` / `--max-renowned-count` | int | KOL / renowned wallet count |
|
|
522
|
+
| `--min-creator-balance-rate` / `--max-creator-balance-rate` | float | Creator holding ratio (0–1) |
|
|
523
|
+
| `--min-creator-created-count` / `--max-creator-created-count` | int | Creator's total token creation count |
|
|
524
|
+
| `--min-creator-created-open-count` / `--max-creator-created-open-count` | int | Creator's graduated token count |
|
|
525
|
+
| `--min-creator-created-open-ratio` / `--max-creator-created-open-ratio` | float | Creator's graduation ratio (0–1) |
|
|
526
|
+
| `--min-x-follower` / `--max-x-follower` | int | Twitter / X follower count |
|
|
527
|
+
| `--min-twitter-rename-count` / `--max-twitter-rename-count` | int | Twitter rename count |
|
|
528
|
+
| `--min-tg-call-count` / `--max-tg-call-count` | int | Telegram call count |
|
|
529
|
+
|
|
530
|
+
### Trenches Filter Examples
|
|
531
|
+
|
|
532
|
+
```bash
|
|
533
|
+
# Apply the safe preset (server-side)
|
|
534
|
+
gmgn-cli market trenches --chain sol --type new_creation --filter-preset safe
|
|
535
|
+
|
|
536
|
+
# Require at least 1 smart money holder (server-side)
|
|
537
|
+
gmgn-cli market trenches --chain sol --type new_creation --min-smart-degen-count 1
|
|
538
|
+
|
|
539
|
+
# Safe preset + require smart money + sort by smart degen count (server-side filter, client-side sort)
|
|
540
|
+
gmgn-cli market trenches --chain sol --type new_creation \
|
|
541
|
+
--filter-preset safe --min-smart-degen-count 1 --sort-by smart_degen_count
|
|
542
|
+
|
|
543
|
+
# Strict preset — safe + smart money + min $1k volume (server-side)
|
|
544
|
+
gmgn-cli market trenches --chain sol --type new_creation --type near_completion \
|
|
545
|
+
--filter-preset strict --sort-by smart_degen_count
|
|
546
|
+
|
|
547
|
+
# Manual range filters (all sent server-side)
|
|
548
|
+
gmgn-cli market trenches --chain sol --type new_creation \
|
|
549
|
+
--max-rug-ratio 0.3 --max-bundler-rate 0.3 --max-insider-ratio 0.3 \
|
|
550
|
+
--min-smart-degen-count 1 --min-volume-24h 1000
|
|
551
|
+
|
|
552
|
+
# Filter by token age: only tokens created within the last 30 minutes
|
|
553
|
+
gmgn-cli market trenches --chain sol --type new_creation --max-created 30m
|
|
554
|
+
|
|
555
|
+
# Filter by market cap range
|
|
556
|
+
gmgn-cli market trenches --chain sol --type new_creation \
|
|
557
|
+
--min-marketcap 10000 --max-marketcap 500000
|
|
558
|
+
```
|
|
559
|
+
|
|
443
560
|
## `market trenches` Response Fields
|
|
444
561
|
|
|
445
562
|
**Basic Info**
|
|
@@ -526,6 +643,44 @@ Response fields: `data.new_creation`, `data.pump`, `data.completed` — each is
|
|
|
526
643
|
|
|
527
644
|
**After fetching trenches results, apply the Token Quality Filter Criteria section before presenting tokens to the user.** Do not dump raw results — filter first, then surface the strongest candidates.
|
|
528
645
|
|
|
646
|
+
### Trenches Filter Examples
|
|
647
|
+
|
|
648
|
+
```bash
|
|
649
|
+
# Quick safe screen — exclude rugs, wash trading, and bundlers
|
|
650
|
+
gmgn-cli market trenches --chain sol --type new_creation \
|
|
651
|
+
--filter-preset safe --raw
|
|
652
|
+
|
|
653
|
+
# Smart money screen — only tokens with smart money or KOL presence
|
|
654
|
+
gmgn-cli market trenches --chain sol \
|
|
655
|
+
--type new_creation --type near_completion \
|
|
656
|
+
--filter-preset smart-money \
|
|
657
|
+
--sort-by smart_degen_count --raw
|
|
658
|
+
|
|
659
|
+
# Strict screen — safe + smart money + minimum volume, sorted by smart degens
|
|
660
|
+
gmgn-cli market trenches --chain sol --type completed \
|
|
661
|
+
--filter-preset strict --sort-by smart_degen_count --raw
|
|
662
|
+
|
|
663
|
+
# Custom filter — no wash trading, rug_ratio <= 0.2, at least 1 smart degen
|
|
664
|
+
gmgn-cli market trenches --chain sol \
|
|
665
|
+
--type new_creation --type near_completion \
|
|
666
|
+
--exclude-wash-trading --max-rug-ratio 0.2 --min-smart-degen 1 \
|
|
667
|
+
--sort-by smart_degen_count --raw
|
|
668
|
+
|
|
669
|
+
# BSC — safe screen on new tokens from fourmeme
|
|
670
|
+
gmgn-cli market trenches --chain bsc --type new_creation \
|
|
671
|
+
--launchpad-platform fourmeme --launchpad-platform fourmeme_agent \
|
|
672
|
+
--filter-preset safe --sort-by volume_1h --raw
|
|
673
|
+
|
|
674
|
+
# Sort by rug_ratio ascending (safest first), no other filters
|
|
675
|
+
gmgn-cli market trenches --chain sol --type completed \
|
|
676
|
+
--sort-by rug_ratio --raw
|
|
677
|
+
|
|
678
|
+
# Find tokens with many holders and strong 1h swap activity
|
|
679
|
+
gmgn-cli market trenches --chain sol --type completed \
|
|
680
|
+
--min-holders 100 --min-swaps 50 \
|
|
681
|
+
--sort-by swaps_1h --raw
|
|
682
|
+
```
|
|
683
|
+
|
|
529
684
|
### Solana Trenches Examples
|
|
530
685
|
|
|
531
686
|
```bash
|
|
@@ -46,9 +46,42 @@ Use the `gmgn-cli` tool to query wallet portfolio data based on the user's reque
|
|
|
46
46
|
|
|
47
47
|
## Prerequisites
|
|
48
48
|
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
|
|
49
|
+
- `gmgn-cli` installed globally — if missing, run: `npm install -g gmgn-cli`
|
|
50
|
+
- `GMGN_API_KEY` configured in `~/.config/gmgn/.env`
|
|
51
|
+
|
|
52
|
+
## Rate Limit Handling
|
|
53
|
+
|
|
54
|
+
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.
|
|
55
|
+
|
|
56
|
+
| Command | Route | Weight |
|
|
57
|
+
|---------|-------|--------|
|
|
58
|
+
| `portfolio info` | `GET /v1/user/info` | 1 |
|
|
59
|
+
| `portfolio holdings` | `GET /v1/user/wallet_holdings` | 2 |
|
|
60
|
+
| `portfolio activity` | `GET /v1/user/wallet_activity` | 3 |
|
|
61
|
+
| `portfolio stats` | `GET /v1/user/wallet_stats` | 3 |
|
|
62
|
+
| `portfolio token-balance` | `GET /v1/user/wallet_token_balance` | 1 |
|
|
63
|
+
|
|
64
|
+
When a request returns `429`:
|
|
65
|
+
|
|
66
|
+
- Read `X-RateLimit-Reset` from the response headers. It is a Unix timestamp in seconds that marks when the limit is expected to reset.
|
|
67
|
+
- 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.
|
|
68
|
+
- 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.
|
|
69
|
+
|
|
70
|
+
**First-time setup** (if `GMGN_API_KEY` is not configured):
|
|
71
|
+
|
|
72
|
+
1. Generate key pair and show the public key to the user:
|
|
73
|
+
```bash
|
|
74
|
+
openssl genpkey -algorithm ed25519 -out /tmp/gmgn_private.pem 2>/dev/null && \
|
|
75
|
+
openssl pkey -in /tmp/gmgn_private.pem -pubout 2>/dev/null
|
|
76
|
+
```
|
|
77
|
+
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."*
|
|
78
|
+
|
|
79
|
+
2. Wait for the user's API key, then configure:
|
|
80
|
+
```bash
|
|
81
|
+
mkdir -p ~/.config/gmgn
|
|
82
|
+
echo 'GMGN_API_KEY=<key_from_user>' > ~/.config/gmgn/.env
|
|
83
|
+
chmod 600 ~/.config/gmgn/.env
|
|
84
|
+
```
|
|
52
85
|
|
|
53
86
|
## Usage Examples
|
|
54
87
|
|
|
@@ -48,6 +48,9 @@ Use the `gmgn-cli` tool to submit a token swap or query an existing order. **Req
|
|
|
48
48
|
| `swap` | Submit a token swap |
|
|
49
49
|
| `order quote` | Get a swap quote (no transaction submitted) |
|
|
50
50
|
| `order get` | Query order status |
|
|
51
|
+
| `order strategy create` | Create a limit/strategy order (requires private key) |
|
|
52
|
+
| `order strategy list` | List strategy orders (normal auth) |
|
|
53
|
+
| `order strategy cancel` | Cancel a strategy order (requires private key) |
|
|
51
54
|
|
|
52
55
|
## Supported Chains
|
|
53
56
|
|
|
@@ -67,13 +70,44 @@ Currency tokens are the base/native assets of each chain. They are used to buy o
|
|
|
67
70
|
|
|
68
71
|
## Prerequisites
|
|
69
72
|
|
|
70
|
-
Both `GMGN_API_KEY` and `GMGN_PRIVATE_KEY` must be
|
|
73
|
+
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.
|
|
71
74
|
|
|
72
|
-
`gmgn-cli`
|
|
75
|
+
- `gmgn-cli` installed globally — if missing, run: `npm install -g gmgn-cli`
|
|
73
76
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
## Rate Limit Handling
|
|
78
|
+
|
|
79
|
+
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.
|
|
80
|
+
|
|
81
|
+
| Command | Route | Weight |
|
|
82
|
+
|---------|-------|--------|
|
|
83
|
+
| `swap` | `POST /v1/trade/swap` | 5 |
|
|
84
|
+
| `order quote` | `GET /v1/trade/quote` | 2 |
|
|
85
|
+
| `order get` | `GET /v1/trade/query_order` | 1 |
|
|
86
|
+
|
|
87
|
+
When a request returns `429`:
|
|
88
|
+
|
|
89
|
+
- Read `X-RateLimit-Reset` from the response headers. It is a Unix timestamp in seconds that marks when the limit is expected to reset.
|
|
90
|
+
- `swap` is a real transaction: never loop or auto-submit repeated swap attempts after a `429`. Wait until the reset time, then ask for confirmation again before retrying.
|
|
91
|
+
- The CLI may wait and retry once automatically for short cooldowns on read-only commands such as `order quote` and `order get`. If it still fails, stop and tell the user the exact retry time instead of sending more requests.
|
|
92
|
+
- 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.
|
|
93
|
+
- `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.
|
|
94
|
+
|
|
95
|
+
**First-time setup** (if credentials are not configured):
|
|
96
|
+
|
|
97
|
+
1. Generate key pair and show the public key to the user:
|
|
98
|
+
```bash
|
|
99
|
+
openssl genpkey -algorithm ed25519 -out /tmp/gmgn_private.pem 2>/dev/null && \
|
|
100
|
+
openssl pkey -in /tmp/gmgn_private.pem -pubout 2>/dev/null
|
|
101
|
+
```
|
|
102
|
+
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."*
|
|
103
|
+
|
|
104
|
+
2. Wait for the user's API key, then configure both credentials:
|
|
105
|
+
```bash
|
|
106
|
+
mkdir -p ~/.config/gmgn
|
|
107
|
+
echo 'GMGN_API_KEY=<key_from_user>' > ~/.config/gmgn/.env
|
|
108
|
+
echo 'GMGN_PRIVATE_KEY="<pem_content_from_step_1>"' >> ~/.config/gmgn/.env
|
|
109
|
+
chmod 600 ~/.config/gmgn/.env
|
|
110
|
+
```
|
|
77
111
|
|
|
78
112
|
### Credential Model
|
|
79
113
|
|
|
@@ -248,11 +282,108 @@ Order ID: {order_id}
|
|
|
248
282
|
|
|
249
283
|
Convert `filled_input_amount` and `filled_output_amount` from smallest unit using token decimals before displaying.
|
|
250
284
|
|
|
285
|
+
## `order strategy create` Parameters
|
|
286
|
+
|
|
287
|
+
| Parameter | Required | Description |
|
|
288
|
+
|-----------|----------|-------------|
|
|
289
|
+
| `--chain` | Yes | `sol` / `bsc` / `base` |
|
|
290
|
+
| `--from` | Yes | Wallet address (must match API Key binding) |
|
|
291
|
+
| `--base-token` | Yes | Base token contract address |
|
|
292
|
+
| `--quote-token` | Yes | Quote token contract address |
|
|
293
|
+
| `--side` | Yes | Direction: `buy` / `sell` |
|
|
294
|
+
| `--check-price` | Yes | Trigger check price |
|
|
295
|
+
| `--amount-in` | No* | Input amount (smallest unit). Mutually exclusive with `--amount-in-percent` |
|
|
296
|
+
| `--amount-in-percent` | No* | Input as percentage (e.g. `50` = 50%). Mutually exclusive with `--amount-in` |
|
|
297
|
+
| `--limit-price-mode` | No | `exact` / `slippage` (default: `slippage`) |
|
|
298
|
+
| `--expire-in` | No | Order expiry in seconds |
|
|
299
|
+
| `--sell-ratio-type` | No | `buy_amount` (default) / `hold_amount` |
|
|
300
|
+
| `--slippage` | No | Slippage tolerance, e.g. `0.01` = 1%. Mutually exclusive with `--auto-slippage` |
|
|
301
|
+
| `--auto-slippage` | No | Enable automatic slippage |
|
|
302
|
+
| `--priority-fee` | No | Priority fee in SOL (SOL only) |
|
|
303
|
+
| `--tip-fee` | No | Tip fee |
|
|
304
|
+
| `--gas-price` | No | Gas price in wei (EVM chains) |
|
|
305
|
+
| `--anti-mev` | No | Enable anti-MEV protection |
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
**`order strategy create` Response Fields:**
|
|
309
|
+
|
|
310
|
+
| Field | Type | Description |
|
|
311
|
+
|-------|------|-------------|
|
|
312
|
+
| `order_id` | string | Created strategy order ID |
|
|
313
|
+
| `is_update` | bool | `true` if an existing order was updated, `false` if newly created |
|
|
314
|
+
|
|
315
|
+
## `order strategy list` Parameters
|
|
316
|
+
|
|
317
|
+
| Parameter | Required | Description |
|
|
318
|
+
|-----------|----------|-------------|
|
|
319
|
+
| `--chain` | Yes | `sol` / `bsc` / `base` |
|
|
320
|
+
| `--type` | No | `open` (default) / `history` |
|
|
321
|
+
| `--from` | No | Filter by wallet address |
|
|
322
|
+
| `--base-token` | No | Filter by token address |
|
|
323
|
+
| `--page-token` | No | Pagination cursor from previous response |
|
|
324
|
+
| `--limit` | No | Results per page (default 10 for history) |
|
|
325
|
+
|
|
326
|
+
**`order strategy list` Response Fields:**
|
|
327
|
+
|
|
328
|
+
| Field | Type | Description |
|
|
329
|
+
|-------|------|-------------|
|
|
330
|
+
| `next_page_token` | string | Cursor for next page; empty when no more data |
|
|
331
|
+
| `total` | int | Total count (only returned when `--type open`) |
|
|
332
|
+
| `list` | array | Strategy order list |
|
|
333
|
+
|
|
334
|
+
## `order strategy cancel` Parameters
|
|
335
|
+
|
|
336
|
+
| Parameter | Required | Description |
|
|
337
|
+
|-----------|----------|-------------|
|
|
338
|
+
| `--chain` | Yes | `sol` / `bsc` / `base` |
|
|
339
|
+
| `--from` | Yes | Wallet address (must match API Key binding) |
|
|
340
|
+
| `--order-id` | Yes | Order ID to cancel |
|
|
341
|
+
| `--close-sell-model` | No | Sell model when closing the order |
|
|
342
|
+
|
|
343
|
+
## `order strategy` Usage Examples
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
# Create a take-profit order: sell when price rises to target
|
|
347
|
+
gmgn-cli order strategy create \
|
|
348
|
+
--chain sol \
|
|
349
|
+
--from <wallet_address> \
|
|
350
|
+
--base-token <token_address> \
|
|
351
|
+
--quote-token <sol_address> \
|
|
352
|
+
--sub-order-type take_profit \
|
|
353
|
+
--check-price 0.002 \
|
|
354
|
+
--amount-in 1000000 \
|
|
355
|
+
--slippage 0.01
|
|
356
|
+
|
|
357
|
+
# Create a stop-loss order: sell when price drops to target
|
|
358
|
+
gmgn-cli order strategy create \
|
|
359
|
+
--chain sol \
|
|
360
|
+
--from <wallet_address> \
|
|
361
|
+
--base-token <token_address> \
|
|
362
|
+
--quote-token <sol_address> \
|
|
363
|
+
--sub-order-type stop_loss \
|
|
364
|
+
--check-price 0.0005 \
|
|
365
|
+
--amount-in-percent 100 \
|
|
366
|
+
--slippage 0.01
|
|
367
|
+
|
|
368
|
+
# List open strategy orders
|
|
369
|
+
gmgn-cli order strategy list --chain sol
|
|
370
|
+
|
|
371
|
+
# List history orders with pagination
|
|
372
|
+
gmgn-cli order strategy list --chain sol --type history --limit 20
|
|
373
|
+
|
|
374
|
+
# Cancel a strategy order
|
|
375
|
+
gmgn-cli order strategy cancel \
|
|
376
|
+
--chain sol \
|
|
377
|
+
--from <wallet_address> \
|
|
378
|
+
--order-id <order_id>
|
|
379
|
+
```
|
|
380
|
+
|
|
251
381
|
## Notes
|
|
252
382
|
|
|
253
383
|
- Swap uses **critical auth** (API Key + signature) — CLI handles signing automatically, no manual processing needed
|
|
254
384
|
- After submitting a swap, use `order get` to poll for confirmation
|
|
255
385
|
- `--amount` is in the **smallest unit** (e.g., lamports for SOL)
|
|
386
|
+
- `order strategy create` and `order strategy cancel` use critical auth (require `GMGN_PRIVATE_KEY`); `order strategy list` uses normal auth
|
|
256
387
|
- Use `--raw` to get single-line JSON for further processing
|
|
257
388
|
|
|
258
389
|
## Input Validation
|
|
@@ -46,9 +46,42 @@ Use the `gmgn-cli` tool to query token information based on the user's request.
|
|
|
46
46
|
|
|
47
47
|
## Prerequisites
|
|
48
48
|
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
|
|
49
|
+
- `gmgn-cli` installed globally — if missing, run: `npm install -g gmgn-cli`
|
|
50
|
+
- `GMGN_API_KEY` configured in `~/.config/gmgn/.env`
|
|
51
|
+
|
|
52
|
+
## Rate Limit Handling
|
|
53
|
+
|
|
54
|
+
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.
|
|
55
|
+
|
|
56
|
+
| Command | Route | Weight |
|
|
57
|
+
|---------|-------|--------|
|
|
58
|
+
| `token info` | `GET /v1/token/info` | 1 |
|
|
59
|
+
| `token security` | `GET /v1/token/security` | 1 |
|
|
60
|
+
| `token pool` | `GET /v1/token/pool_info` | 1 |
|
|
61
|
+
| `token holders` | `GET /v1/market/token_top_holders` | 5 |
|
|
62
|
+
| `token traders` | `GET /v1/market/token_top_traders` | 5 |
|
|
63
|
+
|
|
64
|
+
When a request returns `429`:
|
|
65
|
+
|
|
66
|
+
- Read `X-RateLimit-Reset` from the response headers. It is a Unix timestamp in seconds that marks when the limit is expected to reset.
|
|
67
|
+
- 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.
|
|
68
|
+
- 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.
|
|
69
|
+
|
|
70
|
+
**First-time setup** (if `GMGN_API_KEY` is not configured):
|
|
71
|
+
|
|
72
|
+
1. Generate key pair and show the public key to the user:
|
|
73
|
+
```bash
|
|
74
|
+
openssl genpkey -algorithm ed25519 -out /tmp/gmgn_private.pem 2>/dev/null && \
|
|
75
|
+
openssl pkey -in /tmp/gmgn_private.pem -pubout 2>/dev/null
|
|
76
|
+
```
|
|
77
|
+
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."*
|
|
78
|
+
|
|
79
|
+
2. Wait for the user's API key, then configure:
|
|
80
|
+
```bash
|
|
81
|
+
mkdir -p ~/.config/gmgn
|
|
82
|
+
echo 'GMGN_API_KEY=<key_from_user>' > ~/.config/gmgn/.env
|
|
83
|
+
chmod 600 ~/.config/gmgn/.env
|
|
84
|
+
```
|
|
52
85
|
|
|
53
86
|
## Parameters — `token info` / `token security` / `token pool`
|
|
54
87
|
|
|
@@ -59,10 +59,45 @@ Use the `gmgn-cli` tool to query on-chain tracking data based on the user's requ
|
|
|
59
59
|
|
|
60
60
|
## Prerequisites
|
|
61
61
|
|
|
62
|
-
-
|
|
63
|
-
- `
|
|
64
|
-
-
|
|
65
|
-
|
|
62
|
+
- `gmgn-cli` installed globally — if missing, run: `npm install -g gmgn-cli`
|
|
63
|
+
- `GMGN_API_KEY` configured in `~/.config/gmgn/.env`
|
|
64
|
+
- `GMGN_PRIVATE_KEY` required only for `track follow-wallet`; not needed for `track kol` / `track smartmoney`
|
|
65
|
+
|
|
66
|
+
## Rate Limit Handling
|
|
67
|
+
|
|
68
|
+
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.
|
|
69
|
+
|
|
70
|
+
| Command | Route | Weight |
|
|
71
|
+
|---------|-------|--------|
|
|
72
|
+
| `track follow-wallet` | `GET /v1/trade/follow_wallet` | 3 |
|
|
73
|
+
| `track kol` | `GET /v1/user/kol` | 1 |
|
|
74
|
+
| `track smartmoney` | `GET /v1/user/smartmoney` | 1 |
|
|
75
|
+
|
|
76
|
+
When a request returns `429`:
|
|
77
|
+
|
|
78
|
+
- Read `X-RateLimit-Reset` from the response headers. It is a Unix timestamp in seconds that marks when the limit is expected to reset.
|
|
79
|
+
- 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.
|
|
80
|
+
- 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.
|
|
81
|
+
|
|
82
|
+
**First-time setup** (if `GMGN_API_KEY` is not configured):
|
|
83
|
+
|
|
84
|
+
1. Generate key pair and show the public key to the user:
|
|
85
|
+
```bash
|
|
86
|
+
openssl genpkey -algorithm ed25519 -out /tmp/gmgn_private.pem 2>/dev/null && \
|
|
87
|
+
openssl pkey -in /tmp/gmgn_private.pem -pubout 2>/dev/null
|
|
88
|
+
```
|
|
89
|
+
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."*
|
|
90
|
+
|
|
91
|
+
2. Wait for the user's API key, then configure:
|
|
92
|
+
```bash
|
|
93
|
+
mkdir -p ~/.config/gmgn
|
|
94
|
+
echo 'GMGN_API_KEY=<key_from_user>' > ~/.config/gmgn/.env
|
|
95
|
+
chmod 600 ~/.config/gmgn/.env
|
|
96
|
+
```
|
|
97
|
+
If the user also needs `track follow-wallet`, append the private key:
|
|
98
|
+
```bash
|
|
99
|
+
echo 'GMGN_PRIVATE_KEY="<pem_content_from_step_1>"' >> ~/.config/gmgn/.env
|
|
100
|
+
```
|
|
66
101
|
|
|
67
102
|
## Usage Examples
|
|
68
103
|
|