gmgn-cli 1.0.1 → 1.1.0
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 +146 -66
- package/Readme.zh.md +150 -70
- package/dist/client/OpenApiClient.d.ts +8 -3
- package/dist/client/OpenApiClient.d.ts.map +1 -1
- package/dist/client/OpenApiClient.js +72 -5
- package/dist/client/OpenApiClient.js.map +1 -1
- package/dist/commands/market.d.ts.map +1 -1
- package/dist/commands/market.js +20 -9
- package/dist/commands/market.js.map +1 -1
- package/dist/commands/portfolio.d.ts.map +1 -1
- package/dist/commands/portfolio.js +70 -2
- package/dist/commands/portfolio.js.map +1 -1
- package/dist/commands/swap.d.ts.map +1 -1
- package/dist/commands/swap.js +22 -0
- package/dist/commands/swap.js.map +1 -1
- package/dist/commands/token.d.ts.map +1 -1
- package/dist/commands/token.js +28 -2
- package/dist/commands/token.js.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/skills/gmgn-market/SKILL.md +33 -20
- package/skills/gmgn-portfolio/SKILL.md +50 -5
- package/skills/gmgn-swap/SKILL.md +43 -7
- package/skills/gmgn-token/SKILL.md +19 -3
package/Readme.md
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<img src="static/gmgnagentskills.png" alt="GMGN Agent Skills" />
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://x.com/gmgnai) [](https://t.me/gmgnagentapi) [](https://discord.gg/gmgnai)
|
|
6
|
+
|
|
7
|
+
English | [简体中文](Readme.zh.md)
|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
## GMGN Agent Skills
|
|
12
|
+
|
|
13
|
+
With GMGN Agent Skills, you can use AI agents to query real-time trending token rankings across multiple chains, token fundamentals, social media signals, live trading activity, new tokens in Trenches, top holders, top traders, smart money positions, KOL holdings, insider wallets, bundled wallet exposure, and other professional on-chain analytics. It also supports market orders, limit orders, advanced take-profit/stop-loss strategy orders, and wallet management — including real-time holdings, recent P&L, and transaction history — all through natural language.
|
|
6
14
|
|
|
7
15
|
---
|
|
8
16
|
|
|
@@ -15,50 +23,127 @@ GMGN AI skills for on-chain operations — token research, market data, wallet a
|
|
|
15
23
|
| [`/gmgn-portfolio`](skills/gmgn-portfolio/SKILL.md) | Wallet holdings, activity, stats | [SKILL.md](skills/gmgn-portfolio/SKILL.md) |
|
|
16
24
|
| [`/gmgn-swap`](skills/gmgn-swap/SKILL.md) | Swap submission + order query | [SKILL.md](skills/gmgn-swap/SKILL.md) |
|
|
17
25
|
|
|
26
|
+
> For detailed CLI commands, parameters, and recommended values, see the [Wiki documentation](https://github.com/GMGNAI/gmgn-skills/wiki).
|
|
27
|
+
|
|
28
|
+
### Quick Start
|
|
29
|
+
|
|
30
|
+
Ready to install skills? [Jump to Installation →](#get-started)
|
|
31
|
+
|
|
18
32
|
---
|
|
19
33
|
|
|
20
|
-
##
|
|
34
|
+
## Demo Cases
|
|
21
35
|
|
|
22
|
-
|
|
36
|
+
### Trending Token Rankings
|
|
37
|
+
|
|
38
|
+
Send this prompt to your AI Agent:
|
|
23
39
|
|
|
24
40
|
```
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
41
|
+
Fetch Solana 1h trending, filter for pump.fun tokens created within 6h, sort by volume descending.
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+

|
|
45
|
+
|
|
46
|
+
### Real-Time Token Trading Analysis
|
|
47
|
+
|
|
48
|
+
Send this prompt to your AI Agent:
|
|
49
|
+
|
|
33
50
|
```
|
|
51
|
+
Check the first token's K-line, analyze entry timing, plot price + volume chart, and provide social media links and smart money/KOL trading analysis.
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+

|
|
55
|
+

|
|
34
56
|
|
|
35
57
|
---
|
|
36
58
|
|
|
37
|
-
##
|
|
59
|
+
## Get Started
|
|
38
60
|
|
|
39
|
-
|
|
61
|
+
Before installing, create your API Key at **https://gmgn.ai/ai**. The API key is used for:
|
|
40
62
|
|
|
41
|
-
|
|
63
|
+
1. Read data: tokens, trending lists, K-line, and featured on-chain metrics
|
|
64
|
+
2. Submit trades: market orders, limit orders, strategy orders, and more
|
|
42
65
|
|
|
43
|
-
|
|
66
|
+
---
|
|
44
67
|
|
|
45
|
-
|
|
68
|
+
## 1. Installation
|
|
46
69
|
|
|
47
|
-
|
|
70
|
+
Choose one of the following methods:
|
|
71
|
+
|
|
72
|
+
### 1.1 Via Agent (recommended)
|
|
73
|
+
|
|
74
|
+
Send this to your AI agent:
|
|
48
75
|
|
|
49
76
|
```bash
|
|
50
|
-
|
|
77
|
+
npx skills add GMGNAI/gmgn-skills
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 1.2 npm Global Install
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm install -g gmgn-cli@1.1.0
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 1.3 Local Development
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm install
|
|
90
|
+
npm run build
|
|
91
|
+
node dist/index.js <command> [options]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## 2. Verify Connection
|
|
95
|
+
|
|
96
|
+
### Option 1: Via AI Agent
|
|
97
|
+
|
|
98
|
+
Send this prompt to your AI Agent:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
Run this CLI command: GMGN_API_KEY=gmgn_solbscbaseethmonadtron npx gmgn-cli market trending --chain sol --interval 1h --limit 3
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Option 2: Via CLI
|
|
105
|
+
|
|
106
|
+
Test with the public API key — no registration required:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
GMGN_API_KEY=gmgn_solbscbaseethmonadtron gmgn-cli market trending --chain sol --interval 1h --limit 3
|
|
51
110
|
```
|
|
52
111
|
|
|
53
|
-
|
|
112
|
+
If you see JSON output, the CLI is working. The public key supports all read-only commands (token / market / portfolio). The public key is for testing only — apply for your own API key to use any feature (see step 3).
|
|
113
|
+
|
|
114
|
+
## 3. Get Your Own API Key
|
|
115
|
+
|
|
116
|
+
The public key in step 2 is for testing only. Apply for your own API key at **https://gmgn.ai/ai** — required for all actual use (read-only and swap). You will need:
|
|
117
|
+
|
|
118
|
+
### 3.1 Generate an Ed25519 Key Pair
|
|
54
119
|
|
|
55
|
-
|
|
120
|
+
**Option 1 — Ask your AI agent (recommended)**
|
|
56
121
|
|
|
57
|
-
|
|
122
|
+
Send this prompt to your agent:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
Generate an Ed25519 key pair for me using OpenSSL and show me:
|
|
126
|
+
1. The public key (I need to fill it in the GMGN API Key application form)
|
|
127
|
+
2. The private key in PEM format (I need to set it as GMGN_PRIVATE_KEY in my .env)
|
|
128
|
+
```
|
|
58
129
|
|
|
59
|
-
|
|
130
|
+
**Option 2 — Binance Key Generator**
|
|
60
131
|
|
|
61
|
-
|
|
132
|
+
Download and run the [Binance Asymmetric Key Generator](https://github.com/binance/asymmetric-key-generator/releases).
|
|
133
|
+
|
|
134
|
+
Enter the **public key** in the application form.
|
|
135
|
+
|
|
136
|
+
### 3.2 Get Your Public Egress IP
|
|
137
|
+
|
|
138
|
+
For the IP whitelist (required when enabling swap capability on your API key):
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
curl ip.me
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## 4. Configure Your API Key
|
|
145
|
+
|
|
146
|
+
### Option 1: Global config (recommended)
|
|
62
147
|
|
|
63
148
|
Create `~/.config/gmgn/.env` once — works from any directory:
|
|
64
149
|
|
|
@@ -67,12 +152,12 @@ mkdir -p ~/.config/gmgn
|
|
|
67
152
|
cat > ~/.config/gmgn/.env << 'EOF'
|
|
68
153
|
GMGN_API_KEY=your_api_key_here
|
|
69
154
|
|
|
70
|
-
# Required for swap / order
|
|
155
|
+
# Required for swap / order only:
|
|
71
156
|
GMGN_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n<base64>\n-----END PRIVATE KEY-----\n"
|
|
72
157
|
EOF
|
|
73
158
|
```
|
|
74
159
|
|
|
75
|
-
|
|
160
|
+
### Option 2: Project `.env`
|
|
76
161
|
|
|
77
162
|
```bash
|
|
78
163
|
cp .env.example .env
|
|
@@ -81,23 +166,15 @@ cp .env.example .env
|
|
|
81
166
|
|
|
82
167
|
Config lookup order: `~/.config/gmgn/.env` → project `.env` (project takes precedence).
|
|
83
168
|
|
|
84
|
-
|
|
169
|
+
## 5. Try in AI Clients
|
|
85
170
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
npm install -g gmgn-cli@1.0.1
|
|
90
|
-
```
|
|
171
|
+
#### OpenClaw
|
|
91
172
|
|
|
92
|
-
|
|
173
|
+
Send the following prompt directly to test the query capabilities:
|
|
93
174
|
|
|
94
|
-
```bash
|
|
95
|
-
npm install
|
|
96
|
-
npm run build
|
|
97
|
-
node dist/index.js <command> [options]
|
|
98
175
|
```
|
|
99
|
-
|
|
100
|
-
|
|
176
|
+
Show me the trending tokens on Solana in the last 1 hour.
|
|
177
|
+
```
|
|
101
178
|
|
|
102
179
|
#### Claude Code
|
|
103
180
|
|
|
@@ -107,19 +184,17 @@ Skills are automatically discovered when the package is installed as a plugin.
|
|
|
107
184
|
|
|
108
185
|
Skills are automatically discovered via the `.cursor-plugin/` configuration.
|
|
109
186
|
|
|
110
|
-
1. Complete steps
|
|
111
|
-
2.
|
|
112
|
-
3. Restart Cursor — skills will be available in Agent mode via `/gmgn-*` commands
|
|
187
|
+
1. Complete the installation and configuration steps above
|
|
188
|
+
2. Restart Cursor — skills will be available in Agent mode via `/gmgn-*` commands
|
|
113
189
|
|
|
114
190
|
#### Cline
|
|
115
191
|
|
|
116
|
-
1. Complete steps
|
|
192
|
+
1. Complete the installation and configuration steps above
|
|
117
193
|
2. In Cline settings → **Skills directory**: point to the installed package's `skills/` folder:
|
|
118
194
|
```bash
|
|
119
195
|
echo "$(npm root -g)/gmgn-skills/skills"
|
|
120
196
|
```
|
|
121
|
-
3.
|
|
122
|
-
4. Restart Cline — `/gmgn-token`, `/gmgn-market`, `/gmgn-portfolio`, `/gmgn-swap` will be available
|
|
197
|
+
3. Restart Cline — `/gmgn-token`, `/gmgn-market`, `/gmgn-portfolio`, `/gmgn-swap` will be available
|
|
123
198
|
|
|
124
199
|
#### Codex CLI
|
|
125
200
|
|
|
@@ -143,7 +218,24 @@ See [.opencode/INSTALL.md](.opencode/INSTALL.md) for full instructions.
|
|
|
143
218
|
|
|
144
219
|
---
|
|
145
220
|
|
|
146
|
-
##
|
|
221
|
+
## 6. Usage
|
|
222
|
+
|
|
223
|
+
### Examples
|
|
224
|
+
|
|
225
|
+
Natural language prompts you can send to any AI assistant with gmgn-cli skills installed:
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
buy 0.1 SOL of <token_address>
|
|
229
|
+
sell 50% of <token_address> on BSC
|
|
230
|
+
check order status <order_id>
|
|
231
|
+
is <token_address> safe to buy on solana?
|
|
232
|
+
show top holders of <token_address>
|
|
233
|
+
show my wallet holdings on SOL
|
|
234
|
+
query token details for 0x1234...
|
|
235
|
+
show trading stats for wallet <wallet_address> on BSC
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Typical Workflows
|
|
147
239
|
|
|
148
240
|
**Research a token:**
|
|
149
241
|
```
|
|
@@ -162,14 +254,14 @@ token info (confirm token) → portfolio token-balance (check funds) → swa
|
|
|
162
254
|
|
|
163
255
|
**Discover trading opportunities via trending:**
|
|
164
256
|
```
|
|
165
|
-
market trending (top 50
|
|
257
|
+
market trending (top 50) → AI selects top 5 by multi-factor analysis → user reviews → token info / token security → swap
|
|
166
258
|
```
|
|
167
259
|
|
|
168
260
|
---
|
|
169
261
|
|
|
170
|
-
## CLI Reference
|
|
262
|
+
## 7. CLI Reference
|
|
171
263
|
|
|
172
|
-
Full parameter reference: [docs/cli-usage.md](docs/cli-usage.md)
|
|
264
|
+
Full parameter reference: [docs/cli-usage.md](docs/cli-usage.md). All commands support `--raw` for single-line JSON output (pipe-friendly, e.g. `| jq '.price'`).
|
|
173
265
|
|
|
174
266
|
### Token
|
|
175
267
|
|
|
@@ -183,7 +275,7 @@ npx gmgn-cli token info --chain sol --address <addr>
|
|
|
183
275
|
npx gmgn-cli market trending \
|
|
184
276
|
--chain sol \
|
|
185
277
|
--interval 1h \
|
|
186
|
-
--
|
|
278
|
+
--order-by volume --limit 20 \
|
|
187
279
|
--filter not_risk --filter not_honeypot
|
|
188
280
|
```
|
|
189
281
|
|
|
@@ -209,9 +301,7 @@ npx gmgn-cli swap \
|
|
|
209
301
|
npx gmgn-cli order get --chain sol --order-id <order-id>
|
|
210
302
|
```
|
|
211
303
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
## Supported Chains
|
|
304
|
+
## 8. Supported Chains
|
|
215
305
|
|
|
216
306
|
| Commands | Chains | Chain Currencies |
|
|
217
307
|
|----------|--------|-----------------|
|
|
@@ -220,17 +310,7 @@ npx gmgn-cli order get --chain sol --order-id <order-id>
|
|
|
220
310
|
|
|
221
311
|
---
|
|
222
312
|
|
|
223
|
-
##
|
|
224
|
-
|
|
225
|
-
Default: formatted JSON. Use `--raw` for single-line JSON (pipe-friendly):
|
|
226
|
-
|
|
227
|
-
```bash
|
|
228
|
-
npx gmgn-cli token info --chain sol --address <addr> --raw | jq '.price'
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
---
|
|
232
|
-
|
|
233
|
-
## Security & Disclaimer
|
|
313
|
+
## 9. Security & Disclaimer
|
|
234
314
|
|
|
235
315
|
**About `GMGN_PRIVATE_KEY`**
|
|
236
316
|
|
|
@@ -241,7 +321,7 @@ npx gmgn-cli token info --chain sol --address <addr> --raw | jq '.price'
|
|
|
241
321
|
- Restrict config file permissions: `chmod 600 ~/.config/gmgn/.env`
|
|
242
322
|
- Never commit your `.env` file to version control — add it to `.gitignore`
|
|
243
323
|
- Do not share `GMGN_API_KEY` or `GMGN_PRIVATE_KEY` in logs, screenshots, or chat messages
|
|
244
|
-
- Use a pinned install (`npm install -g gmgn-cli@1.0
|
|
324
|
+
- Use a pinned install (`npm install -g gmgn-cli@1.1.0`) rather than `npx gmgn-cli` to avoid executing unintended package updates alongside your credentials
|
|
245
325
|
|
|
246
326
|
**Disclaimer**
|
|
247
327
|
|
package/Readme.zh.md
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<img src="static/gmgnagentskills.png" alt="GMGN Agent Skills" />
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://x.com/gmgnai) [](https://t.me/gmgnagentapi) [](https://discord.gg/gmgnai)
|
|
6
|
+
|
|
7
|
+
[English](Readme.md) | 简体中文
|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
## GMGN Agent Skills
|
|
12
|
+
|
|
13
|
+
使用 GMGN Agent Skills,你可以通过 AI Agent 实时查询多个链上热门代币排行榜,代币基础信息,社交媒体信息,实时交易动态,实时战壕新币,报持仓大户(Top Holder),交易大户(Top Trader),聪明钱持仓占比,KOL持仓占比,老鼠仓持仓,捆绑持仓占比,等代币专业数据分析数据,以及支持代币市价单交易、限价单交易、高级止盈止损策略单交易,以及钱包资产管理相关功能,例如查询钱包实时持仓、钱包最近盈亏、钱包交易动态等,全部通过自然语言与 AI Agent 交互即可完成。
|
|
6
14
|
|
|
7
15
|
---
|
|
8
16
|
|
|
@@ -15,50 +23,127 @@ GMGN 链上操作 AI 技能套件 — Token 研究、行情数据、钱包分析
|
|
|
15
23
|
| [`/gmgn-portfolio`](skills/gmgn-portfolio/SKILL.md) | 钱包持仓、活动、统计 | [SKILL.md](skills/gmgn-portfolio/SKILL.md) |
|
|
16
24
|
| [`/gmgn-swap`](skills/gmgn-swap/SKILL.md) | 兑换提交 + 订单查询 | [SKILL.md](skills/gmgn-swap/SKILL.md) |
|
|
17
25
|
|
|
26
|
+
> 如需查看详细的 CLI 接口说明、传参格式和推荐值,请参阅 [Wiki 文档](https://github.com/GMGNAI/gmgn-skills/wiki/Home-Chinese)。
|
|
27
|
+
|
|
28
|
+
### 快速开始安装
|
|
29
|
+
|
|
30
|
+
已准备好?[点击这里开始安装 Skills →](#开始安装-skills)
|
|
31
|
+
|
|
18
32
|
---
|
|
19
33
|
|
|
20
|
-
##
|
|
34
|
+
## 使用案例
|
|
21
35
|
|
|
22
|
-
|
|
36
|
+
### 查询热门代币榜
|
|
37
|
+
|
|
38
|
+
发送下面提示词给 AI Agent:
|
|
23
39
|
|
|
24
40
|
```
|
|
25
|
-
|
|
26
|
-
sell 50% of <token_address> on BSC
|
|
27
|
-
check order status <order_id>
|
|
28
|
-
is <token_address> safe to buy on solana?
|
|
29
|
-
show top holders of <token_address>
|
|
30
|
-
show my wallet holdings on SOL
|
|
31
|
-
query token details for 0x1234...
|
|
32
|
-
show trading stats for wallet <wallet_address> on BSC
|
|
41
|
+
查 Solana 1h 热门榜,筛出 6 小时内创建的新币,并且platforms是pump.fun的代币,然后按交易量从高到低排列。
|
|
33
42
|
```
|
|
34
43
|
|
|
44
|
+

|
|
45
|
+
|
|
46
|
+
### 实时分析代币交易走势
|
|
47
|
+
|
|
48
|
+
发送下面提示词给 AI Agent:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
查看第一个代币的 K 线,分析入场时机,并提供社交媒体链接以及聪明资金 / KOL 的交易分析。
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+

|
|
55
|
+

|
|
56
|
+
|
|
35
57
|
---
|
|
36
58
|
|
|
37
|
-
##
|
|
59
|
+
## 开始安装 Skills
|
|
38
60
|
|
|
39
|
-
|
|
61
|
+
安装前,请先在 **https://gmgn.ai/ai** 创建 API Key,用于:
|
|
40
62
|
|
|
41
|
-
|
|
63
|
+
1. 读取数据:代币、榜单、K 线、特色数据指标
|
|
64
|
+
2. 提交交易:市价立即交易、创建限价单、策略单等
|
|
42
65
|
|
|
43
|
-
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 1. 安装
|
|
69
|
+
|
|
70
|
+
选择以下任意一种方式:
|
|
44
71
|
|
|
45
|
-
|
|
72
|
+
### 1.1 通过 Agent 安装(推荐)
|
|
46
73
|
|
|
47
|
-
|
|
74
|
+
发送给你的 AI Agent:
|
|
48
75
|
|
|
49
76
|
```bash
|
|
50
|
-
|
|
77
|
+
npx skills add GMGNAI/gmgn-skills
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 1.2 npm 全局安装
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm install -g gmgn-cli@1.1.0
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 1.3 本地开发
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm install
|
|
90
|
+
npm run build
|
|
91
|
+
node dist/index.js <command> [options]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## 2. 验证连通性
|
|
95
|
+
|
|
96
|
+
### 方式一:通过 AI Agent 验证
|
|
97
|
+
|
|
98
|
+
发送以下提示词给你的 AI Agent:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
执行这个cli命令:GMGN_API_KEY=gmgn_solbscbaseethmonadtron npx gmgn-cli market trending --chain sol --interval 1h --limit 3
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 方式二:通过 CLI 验证
|
|
105
|
+
|
|
106
|
+
使用公共 API Key 测试,无需注册:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
GMGN_API_KEY=gmgn_solbscbaseethmonadtron npx gmgn-cli market trending --chain sol --interval 1h --limit 3
|
|
51
110
|
```
|
|
52
111
|
|
|
53
|
-
|
|
112
|
+
看到 JSON 输出即表示 CLI 正常工作。公共 Key 支持所有只读接口(token / market / portfolio),公共 Key 仅用于测试,正式使用任何接口均需申请个人 API Key(见第 3 步)。
|
|
113
|
+
|
|
114
|
+
## 3. 申请个人 API Key
|
|
115
|
+
|
|
116
|
+
第 2 步的公共 Key 仅用于测试。正式使用(只读接口和 swap)均需在 https://gmgn.ai/ai 申请个人 API Key,需要准备:
|
|
54
117
|
|
|
55
|
-
### 1
|
|
118
|
+
### 3.1 生成 Ed25519 密钥对
|
|
56
119
|
|
|
57
|
-
|
|
120
|
+
**方式一:输入提示词(推荐)**
|
|
58
121
|
|
|
59
|
-
|
|
122
|
+
将以下提示词发送给你的 AI Agent:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
帮我用 OpenSSL 生成一个 Ed25519 密钥对,并分别显示给我:
|
|
126
|
+
1. 公钥(我需要填写到GMGN网站上的 API Key 创建表单中)
|
|
127
|
+
2. PEM 格式的私钥(我需要将它设置为 .env 中的 GMGN_PRIVATE_KEY)
|
|
128
|
+
```
|
|
60
129
|
|
|
61
|
-
|
|
130
|
+
**方式二:Binance Key Generator**
|
|
131
|
+
|
|
132
|
+
下载并运行 [Binance Asymmetric Key Generator](https://github.com/binance/asymmetric-key-generator/releases)。
|
|
133
|
+
|
|
134
|
+
申请时填入**公钥**。
|
|
135
|
+
|
|
136
|
+
### 3.2 获取本机出口 IP
|
|
137
|
+
|
|
138
|
+
用于填写 IP 白名单(开通 API Key 的交易能力时需要):
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
curl ip.me
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## 4. 配置个人 API Key
|
|
145
|
+
|
|
146
|
+
### 方式一:全局配置(推荐)
|
|
62
147
|
|
|
63
148
|
创建 `~/.config/gmgn/.env`,配置一次,所有目录均生效:
|
|
64
149
|
|
|
@@ -67,12 +152,12 @@ mkdir -p ~/.config/gmgn
|
|
|
67
152
|
cat > ~/.config/gmgn/.env << 'EOF'
|
|
68
153
|
GMGN_API_KEY=your_api_key_here
|
|
69
154
|
|
|
70
|
-
# swap / order
|
|
155
|
+
# 仅 swap / order 接口需要:
|
|
71
156
|
GMGN_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n<base64>\n-----END PRIVATE KEY-----\n"
|
|
72
157
|
EOF
|
|
73
158
|
```
|
|
74
159
|
|
|
75
|
-
|
|
160
|
+
### 方式二:项目 `.env`
|
|
76
161
|
|
|
77
162
|
```bash
|
|
78
163
|
cp .env.example .env
|
|
@@ -81,23 +166,15 @@ cp .env.example .env
|
|
|
81
166
|
|
|
82
167
|
配置加载顺序:`~/.config/gmgn/.env` → 项目 `.env`(项目级优先)。
|
|
83
168
|
|
|
84
|
-
|
|
169
|
+
## 5. 在 AI 客户端中使用
|
|
85
170
|
|
|
86
|
-
|
|
171
|
+
#### OpenClaw
|
|
87
172
|
|
|
88
|
-
|
|
89
|
-
npm install -g gmgn-cli@1.0.1
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
本地开发:
|
|
173
|
+
直接发送以下提示词,测试查询能力:
|
|
93
174
|
|
|
94
|
-
```bash
|
|
95
|
-
npm install
|
|
96
|
-
npm run build
|
|
97
|
-
node dist/index.js <command> [options]
|
|
98
175
|
```
|
|
99
|
-
|
|
100
|
-
|
|
176
|
+
查询 Solana 链 1 小时热门代币
|
|
177
|
+
```
|
|
101
178
|
|
|
102
179
|
#### Claude Code
|
|
103
180
|
|
|
@@ -107,19 +184,17 @@ node dist/index.js <command> [options]
|
|
|
107
184
|
|
|
108
185
|
技能通过 `.cursor-plugin/` 配置自动发现。
|
|
109
186
|
|
|
110
|
-
1.
|
|
111
|
-
2.
|
|
112
|
-
3. 重启 Cursor — Agent 模式下可通过 `/gmgn-*` 命令使用技能
|
|
187
|
+
1. 完成上方安装和配置步骤
|
|
188
|
+
2. 重启 Cursor — Agent 模式下可通过 `/gmgn-*` 命令使用技能
|
|
113
189
|
|
|
114
190
|
#### Cline
|
|
115
191
|
|
|
116
|
-
1.
|
|
192
|
+
1. 完成上方安装和配置步骤
|
|
117
193
|
2. 在 Cline 设置 → **Skills directory**:填入已安装包的 `skills/` 目录路径:
|
|
118
194
|
```bash
|
|
119
195
|
echo "$(npm root -g)/gmgn-skills/skills"
|
|
120
196
|
```
|
|
121
|
-
3.
|
|
122
|
-
4. 重启 Cline — `/gmgn-token`、`/gmgn-market`、`/gmgn-portfolio`、`/gmgn-swap` 即可使用
|
|
197
|
+
3. 重启 Cline — `/gmgn-token`、`/gmgn-market`、`/gmgn-portfolio`、`/gmgn-swap` 即可使用
|
|
123
198
|
|
|
124
199
|
#### Codex CLI
|
|
125
200
|
|
|
@@ -143,33 +218,50 @@ ln -s ~/.opencode/gmgn-cli/skills ~/.agents/skills/gmgn-cli
|
|
|
143
218
|
|
|
144
219
|
---
|
|
145
220
|
|
|
146
|
-
##
|
|
221
|
+
## 6. 使用示例
|
|
222
|
+
|
|
223
|
+
### 常用指令
|
|
224
|
+
|
|
225
|
+
安装技能后,向 AI 助手直接发送自然语言指令:
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
用 0.1 SOL 买入 <token_address>
|
|
229
|
+
卖出 BSC 上 <token_address> 的 50%
|
|
230
|
+
查询订单状态 <order_id>
|
|
231
|
+
solana 上的 <token_address> 安全吗,值得买入吗?
|
|
232
|
+
查看 <token_address> 的前十大持有者
|
|
233
|
+
查看我在 SOL 上的钱包持仓
|
|
234
|
+
查询 0x1234... 的代币详情
|
|
235
|
+
查看 BSC 上钱包 <wallet_address> 的交易统计
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### 典型使用场景
|
|
147
239
|
|
|
148
240
|
**研究 Token:**
|
|
149
241
|
```
|
|
150
|
-
|
|
242
|
+
查询代币信息 → 查询安全指标 → 查询流动池 → 查询持有者
|
|
151
243
|
```
|
|
152
244
|
|
|
153
245
|
**分析钱包:**
|
|
154
246
|
```
|
|
155
|
-
|
|
247
|
+
查询钱包持仓 → 查询交易统计 → 查询交易记录
|
|
156
248
|
```
|
|
157
249
|
|
|
158
250
|
**执行交易:**
|
|
159
251
|
```
|
|
160
|
-
|
|
252
|
+
确认代币信息 → 检查余额 → 提交兑换 → 轮询订单状态
|
|
161
253
|
```
|
|
162
254
|
|
|
163
|
-
|
|
255
|
+
**通过热门榜单发现交易机会:**
|
|
164
256
|
```
|
|
165
|
-
|
|
257
|
+
获取热门代币(50 条) → AI 多维度分析选出 top 5 → 用户确认 → 查询代币信息 / 安全指标 → 提交兑换
|
|
166
258
|
```
|
|
167
259
|
|
|
168
260
|
---
|
|
169
261
|
|
|
170
|
-
## CLI 参考
|
|
262
|
+
## 7. CLI 参考
|
|
171
263
|
|
|
172
|
-
完整参数说明:[docs/cli-usage.md](docs/cli-usage.md)
|
|
264
|
+
完整参数说明:[docs/cli-usage.md](docs/cli-usage.md)。所有命令均支持 `--raw` 输出单行 JSON(方便 `jq` 等工具处理)。
|
|
173
265
|
|
|
174
266
|
### Token
|
|
175
267
|
|
|
@@ -183,7 +275,7 @@ npx gmgn-cli token info --chain sol --address <addr>
|
|
|
183
275
|
npx gmgn-cli market trending \
|
|
184
276
|
--chain sol \
|
|
185
277
|
--interval 1h \
|
|
186
|
-
--
|
|
278
|
+
--order-by volume --limit 20 \
|
|
187
279
|
--filter not_risk --filter not_honeypot
|
|
188
280
|
```
|
|
189
281
|
|
|
@@ -209,9 +301,7 @@ npx gmgn-cli swap \
|
|
|
209
301
|
npx gmgn-cli order get --chain sol --order-id <order-id>
|
|
210
302
|
```
|
|
211
303
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
## 支持的链
|
|
304
|
+
## 8. 支持的链
|
|
215
305
|
|
|
216
306
|
| 接口类型 | 支持的链 | 链原生货币 |
|
|
217
307
|
|----------|----------|-----------|
|
|
@@ -220,17 +310,7 @@ npx gmgn-cli order get --chain sol --order-id <order-id>
|
|
|
220
310
|
|
|
221
311
|
---
|
|
222
312
|
|
|
223
|
-
##
|
|
224
|
-
|
|
225
|
-
默认输出格式化 JSON。使用 `--raw` 输出单行 JSON(方便 jq 等工具处理):
|
|
226
|
-
|
|
227
|
-
```bash
|
|
228
|
-
npx gmgn-cli token info --chain sol --address <addr> --raw | jq '.price'
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
---
|
|
232
|
-
|
|
233
|
-
## 安全与免责
|
|
313
|
+
## 9. 安全与免责
|
|
234
314
|
|
|
235
315
|
**关于 `GMGN_PRIVATE_KEY`**
|
|
236
316
|
|
|
@@ -241,7 +321,7 @@ npx gmgn-cli token info --chain sol --address <addr> --raw | jq '.price'
|
|
|
241
321
|
- 限制配置文件权限:`chmod 600 ~/.config/gmgn/.env`
|
|
242
322
|
- 不要将 `.env` 文件提交到版本控制系统,请将其加入 `.gitignore`
|
|
243
323
|
- 不要在日志、截图或聊天中泄露 `GMGN_API_KEY` 或 `GMGN_PRIVATE_KEY`
|
|
244
|
-
- 使用固定版本安装(`npm install -g gmgn-cli@1.0
|
|
324
|
+
- 使用固定版本安装(`npm install -g gmgn-cli@1.1.0`),而非 `npx gmgn-cli`,以避免在持有凭证的环境中执行未预期的包更新
|
|
245
325
|
|
|
246
326
|
**免责声明**
|
|
247
327
|
|