gmgn-cli 1.0.0 → 1.0.2
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 +160 -63
- package/Readme.zh.md +159 -67
- package/dist/client/OpenApiClient.d.ts +2 -2
- package/dist/client/OpenApiClient.d.ts.map +1 -1
- package/dist/client/OpenApiClient.js +4 -4
- package/dist/client/OpenApiClient.js.map +1 -1
- package/dist/commands/market.d.ts.map +1 -1
- package/dist/commands/market.js +9 -5
- package/dist/commands/market.js.map +1 -1
- package/dist/commands/portfolio.d.ts.map +1 -1
- package/dist/commands/portfolio.js +14 -1
- package/dist/commands/portfolio.js.map +1 -1
- package/dist/commands/swap.d.ts.map +1 -1
- package/dist/commands/swap.js +10 -0
- package/dist/commands/swap.js.map +1 -1
- package/dist/commands/token.d.ts.map +1 -1
- package/dist/commands/token.js +39 -2
- package/dist/commands/token.js.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/validate.d.ts +5 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +31 -0
- package/dist/validate.js.map +1 -0
- package/package.json +3 -2
- package/skills/gmgn-market/SKILL.md +23 -22
- package/skills/gmgn-portfolio/SKILL.md +17 -13
- package/skills/gmgn-swap/SKILL.md +61 -13
- package/skills/gmgn-token/SKILL.md +26 -8
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.0.2
|
|
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
|
|
51
102
|
```
|
|
52
103
|
|
|
53
|
-
|
|
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
|
|
110
|
+
```
|
|
54
111
|
|
|
55
|
-
|
|
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).
|
|
56
113
|
|
|
57
|
-
|
|
114
|
+
## 3. Get Your Own API Key
|
|
58
115
|
|
|
59
|
-
|
|
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:
|
|
60
117
|
|
|
61
|
-
|
|
118
|
+
### 3.1 Generate an Ed25519 Key Pair
|
|
119
|
+
|
|
120
|
+
**Option 1 — Ask your AI agent (recommended)**
|
|
121
|
+
|
|
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
|
+
```
|
|
129
|
+
|
|
130
|
+
**Option 2 — Binance Key Generator**
|
|
131
|
+
|
|
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,21 +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
|
-
npm install -g gmgn-cli
|
|
88
|
-
```
|
|
171
|
+
#### OpenClaw
|
|
89
172
|
|
|
90
|
-
|
|
173
|
+
Send the following prompt directly to test the query capabilities:
|
|
91
174
|
|
|
92
|
-
```bash
|
|
93
|
-
npm install
|
|
94
|
-
npm run build
|
|
95
|
-
node dist/index.js <command> [options]
|
|
96
175
|
```
|
|
97
|
-
|
|
98
|
-
|
|
176
|
+
Show me the trending tokens on Solana in the last 1 hour.
|
|
177
|
+
```
|
|
99
178
|
|
|
100
179
|
#### Claude Code
|
|
101
180
|
|
|
@@ -105,19 +184,17 @@ Skills are automatically discovered when the package is installed as a plugin.
|
|
|
105
184
|
|
|
106
185
|
Skills are automatically discovered via the `.cursor-plugin/` configuration.
|
|
107
186
|
|
|
108
|
-
1. Complete steps
|
|
109
|
-
2.
|
|
110
|
-
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
|
|
111
189
|
|
|
112
190
|
#### Cline
|
|
113
191
|
|
|
114
|
-
1. Complete steps
|
|
192
|
+
1. Complete the installation and configuration steps above
|
|
115
193
|
2. In Cline settings → **Skills directory**: point to the installed package's `skills/` folder:
|
|
116
194
|
```bash
|
|
117
195
|
echo "$(npm root -g)/gmgn-skills/skills"
|
|
118
196
|
```
|
|
119
|
-
3.
|
|
120
|
-
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
|
|
121
198
|
|
|
122
199
|
#### Codex CLI
|
|
123
200
|
|
|
@@ -141,7 +218,24 @@ See [.opencode/INSTALL.md](.opencode/INSTALL.md) for full instructions.
|
|
|
141
218
|
|
|
142
219
|
---
|
|
143
220
|
|
|
144
|
-
##
|
|
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
|
|
145
239
|
|
|
146
240
|
**Research a token:**
|
|
147
241
|
```
|
|
@@ -160,14 +254,14 @@ token info (confirm token) → portfolio token-balance (check funds) → swa
|
|
|
160
254
|
|
|
161
255
|
**Discover trading opportunities via trending:**
|
|
162
256
|
```
|
|
163
|
-
market trending (top 50
|
|
257
|
+
market trending (top 50) → AI selects top 5 by multi-factor analysis → user reviews → token info / token security → swap
|
|
164
258
|
```
|
|
165
259
|
|
|
166
260
|
---
|
|
167
261
|
|
|
168
|
-
## CLI Reference
|
|
262
|
+
## 7. CLI Reference
|
|
169
263
|
|
|
170
|
-
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'`).
|
|
171
265
|
|
|
172
266
|
### Token
|
|
173
267
|
|
|
@@ -181,7 +275,7 @@ npx gmgn-cli token info --chain sol --address <addr>
|
|
|
181
275
|
npx gmgn-cli market trending \
|
|
182
276
|
--chain sol \
|
|
183
277
|
--interval 1h \
|
|
184
|
-
--
|
|
278
|
+
--order-by volume --limit 20 \
|
|
185
279
|
--filter not_risk --filter not_honeypot
|
|
186
280
|
```
|
|
187
281
|
|
|
@@ -207,9 +301,7 @@ npx gmgn-cli swap \
|
|
|
207
301
|
npx gmgn-cli order get --chain sol --order-id <order-id>
|
|
208
302
|
```
|
|
209
303
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
## Supported Chains
|
|
304
|
+
## 8. Supported Chains
|
|
213
305
|
|
|
214
306
|
| Commands | Chains | Chain Currencies |
|
|
215
307
|
|----------|--------|-----------------|
|
|
@@ -218,19 +310,24 @@ npx gmgn-cli order get --chain sol --order-id <order-id>
|
|
|
218
310
|
|
|
219
311
|
---
|
|
220
312
|
|
|
221
|
-
##
|
|
313
|
+
## 9. Security & Disclaimer
|
|
222
314
|
|
|
223
|
-
|
|
315
|
+
**About `GMGN_PRIVATE_KEY`**
|
|
224
316
|
|
|
225
|
-
|
|
226
|
-
npx gmgn-cli token info --chain sol --address <addr> --raw | jq '.price'
|
|
227
|
-
```
|
|
317
|
+
`GMGN_PRIVATE_KEY` is a **request-signing key** used to authenticate API calls to the GMGN OpenAPI service. It is not a blockchain wallet private key and does not directly control on-chain assets. If compromised, an attacker could forge authenticated API requests on your behalf — rotate it immediately via the GMGN dashboard if you suspect exposure.
|
|
228
318
|
|
|
229
|
-
|
|
319
|
+
**Best practices**
|
|
320
|
+
|
|
321
|
+
- Restrict config file permissions: `chmod 600 ~/.config/gmgn/.env`
|
|
322
|
+
- Never commit your `.env` file to version control — add it to `.gitignore`
|
|
323
|
+
- Do not share `GMGN_API_KEY` or `GMGN_PRIVATE_KEY` in logs, screenshots, or chat messages
|
|
324
|
+
- Use a pinned install (`npm install -g gmgn-cli@1.0.2`) rather than `npx gmgn-cli` to avoid executing unintended package updates alongside your credentials
|
|
230
325
|
|
|
231
|
-
|
|
326
|
+
**Disclaimer**
|
|
232
327
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
328
|
+
Use of this tool and any financial decisions made based on its output are entirely at your own risk. GMGN is not liable for any trading losses, errors, or unauthorized access resulting from improper credential management.
|
|
329
|
+
|
|
330
|
+
The npm package is published with provenance attestation, linking each release to a specific git commit and CI pipeline run. Verify with:
|
|
331
|
+
```bash
|
|
332
|
+
npm audit signatures gmgn-cli
|
|
333
|
+
```
|
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:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
查 Solana 1h 热门榜,筛出 6 小时内创建的新币,并且platforms是pump.fun的代币,然后按交易量从高到低排列。
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+

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

|
|
55
|
+

|
|
56
|
+
|
|
35
57
|
---
|
|
36
58
|
|
|
37
|
-
##
|
|
59
|
+
## 开始安装 Skills
|
|
60
|
+
|
|
61
|
+
安装前,请先在 **https://gmgn.ai/ai** 创建 API Key,用于:
|
|
38
62
|
|
|
39
|
-
|
|
63
|
+
1. 读取数据:代币、榜单、K 线、特色数据指标
|
|
64
|
+
2. 提交交易:市价立即交易、创建限价单、策略单等
|
|
40
65
|
|
|
41
|
-
|
|
66
|
+
---
|
|
42
67
|
|
|
43
|
-
|
|
68
|
+
## 1. 安装
|
|
44
69
|
|
|
45
|
-
|
|
70
|
+
选择以下任意一种方式:
|
|
46
71
|
|
|
47
|
-
|
|
72
|
+
### 1.1 通过 Agent 安装(推荐)
|
|
73
|
+
|
|
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.0.2
|
|
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
|
|
110
|
+
```
|
|
111
|
+
|
|
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,需要准备:
|
|
117
|
+
|
|
118
|
+
### 3.1 生成 Ed25519 密钥对
|
|
119
|
+
|
|
120
|
+
**方式一:输入提示词(推荐)**
|
|
121
|
+
|
|
122
|
+
将以下提示词发送给你的 AI Agent:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
帮我用 OpenSSL 生成一个 Ed25519 密钥对,并分别显示给我:
|
|
126
|
+
1. 公钥(我需要填写到GMGN网站上的 API Key 创建表单中)
|
|
127
|
+
2. PEM 格式的私钥(我需要将它设置为 .env 中的 GMGN_PRIVATE_KEY)
|
|
51
128
|
```
|
|
52
129
|
|
|
53
|
-
|
|
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
|
|
54
137
|
|
|
55
|
-
|
|
138
|
+
用于填写 IP 白名单(开通 API Key 的交易能力时需要):
|
|
56
139
|
|
|
57
|
-
|
|
140
|
+
```bash
|
|
141
|
+
curl ip.me
|
|
142
|
+
```
|
|
58
143
|
|
|
59
|
-
|
|
144
|
+
## 4. 配置个人 API Key
|
|
60
145
|
|
|
61
|
-
|
|
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,21 +166,15 @@ cp .env.example .env
|
|
|
81
166
|
|
|
82
167
|
配置加载顺序:`~/.config/gmgn/.env` → 项目 `.env`(项目级优先)。
|
|
83
168
|
|
|
84
|
-
|
|
169
|
+
## 5. 在 AI 客户端中使用
|
|
85
170
|
|
|
86
|
-
|
|
87
|
-
npm install -g gmgn-cli
|
|
88
|
-
```
|
|
171
|
+
#### OpenClaw
|
|
89
172
|
|
|
90
|
-
|
|
173
|
+
直接发送以下提示词,测试查询能力:
|
|
91
174
|
|
|
92
|
-
```bash
|
|
93
|
-
npm install
|
|
94
|
-
npm run build
|
|
95
|
-
node dist/index.js <command> [options]
|
|
96
175
|
```
|
|
97
|
-
|
|
98
|
-
|
|
176
|
+
查询 Solana 链 1 小时热门代币
|
|
177
|
+
```
|
|
99
178
|
|
|
100
179
|
#### Claude Code
|
|
101
180
|
|
|
@@ -105,19 +184,17 @@ node dist/index.js <command> [options]
|
|
|
105
184
|
|
|
106
185
|
技能通过 `.cursor-plugin/` 配置自动发现。
|
|
107
186
|
|
|
108
|
-
1.
|
|
109
|
-
2.
|
|
110
|
-
3. 重启 Cursor — Agent 模式下可通过 `/gmgn-*` 命令使用技能
|
|
187
|
+
1. 完成上方安装和配置步骤
|
|
188
|
+
2. 重启 Cursor — Agent 模式下可通过 `/gmgn-*` 命令使用技能
|
|
111
189
|
|
|
112
190
|
#### Cline
|
|
113
191
|
|
|
114
|
-
1.
|
|
192
|
+
1. 完成上方安装和配置步骤
|
|
115
193
|
2. 在 Cline 设置 → **Skills directory**:填入已安装包的 `skills/` 目录路径:
|
|
116
194
|
```bash
|
|
117
195
|
echo "$(npm root -g)/gmgn-skills/skills"
|
|
118
196
|
```
|
|
119
|
-
3.
|
|
120
|
-
4. 重启 Cline — `/gmgn-token`、`/gmgn-market`、`/gmgn-portfolio`、`/gmgn-swap` 即可使用
|
|
197
|
+
3. 重启 Cline — `/gmgn-token`、`/gmgn-market`、`/gmgn-portfolio`、`/gmgn-swap` 即可使用
|
|
121
198
|
|
|
122
199
|
#### Codex CLI
|
|
123
200
|
|
|
@@ -141,33 +218,50 @@ ln -s ~/.opencode/gmgn-cli/skills ~/.agents/skills/gmgn-cli
|
|
|
141
218
|
|
|
142
219
|
---
|
|
143
220
|
|
|
144
|
-
##
|
|
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
|
+
### 典型使用场景
|
|
145
239
|
|
|
146
240
|
**研究 Token:**
|
|
147
241
|
```
|
|
148
|
-
|
|
242
|
+
查询代币信息 → 查询安全指标 → 查询流动池 → 查询持有者
|
|
149
243
|
```
|
|
150
244
|
|
|
151
245
|
**分析钱包:**
|
|
152
246
|
```
|
|
153
|
-
|
|
247
|
+
查询钱包持仓 → 查询交易统计 → 查询交易记录
|
|
154
248
|
```
|
|
155
249
|
|
|
156
250
|
**执行交易:**
|
|
157
251
|
```
|
|
158
|
-
|
|
252
|
+
确认代币信息 → 检查余额 → 提交兑换 → 轮询订单状态
|
|
159
253
|
```
|
|
160
254
|
|
|
161
|
-
|
|
255
|
+
**通过热门榜单发现交易机会:**
|
|
162
256
|
```
|
|
163
|
-
|
|
257
|
+
获取热门代币(50 条) → AI 多维度分析选出 top 5 → 用户确认 → 查询代币信息 / 安全指标 → 提交兑换
|
|
164
258
|
```
|
|
165
259
|
|
|
166
260
|
---
|
|
167
261
|
|
|
168
|
-
## CLI 参考
|
|
262
|
+
## 7. CLI 参考
|
|
169
263
|
|
|
170
|
-
完整参数说明:[docs/cli-usage.md](docs/cli-usage.md)
|
|
264
|
+
完整参数说明:[docs/cli-usage.md](docs/cli-usage.md)。所有命令均支持 `--raw` 输出单行 JSON(方便 `jq` 等工具处理)。
|
|
171
265
|
|
|
172
266
|
### Token
|
|
173
267
|
|
|
@@ -181,7 +275,7 @@ npx gmgn-cli token info --chain sol --address <addr>
|
|
|
181
275
|
npx gmgn-cli market trending \
|
|
182
276
|
--chain sol \
|
|
183
277
|
--interval 1h \
|
|
184
|
-
--
|
|
278
|
+
--order-by volume --limit 20 \
|
|
185
279
|
--filter not_risk --filter not_honeypot
|
|
186
280
|
```
|
|
187
281
|
|
|
@@ -207,9 +301,7 @@ npx gmgn-cli swap \
|
|
|
207
301
|
npx gmgn-cli order get --chain sol --order-id <order-id>
|
|
208
302
|
```
|
|
209
303
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
## 支持的链
|
|
304
|
+
## 8. 支持的链
|
|
213
305
|
|
|
214
306
|
| 接口类型 | 支持的链 | 链原生货币 |
|
|
215
307
|
|----------|----------|-----------|
|
|
@@ -218,19 +310,19 @@ npx gmgn-cli order get --chain sol --order-id <order-id>
|
|
|
218
310
|
|
|
219
311
|
---
|
|
220
312
|
|
|
221
|
-
##
|
|
313
|
+
## 9. 安全与免责
|
|
222
314
|
|
|
223
|
-
|
|
315
|
+
**关于 `GMGN_PRIVATE_KEY`**
|
|
224
316
|
|
|
225
|
-
|
|
226
|
-
npx gmgn-cli token info --chain sol --address <addr> --raw | jq '.price'
|
|
227
|
-
```
|
|
317
|
+
`GMGN_PRIVATE_KEY` 是用于对 GMGN OpenAPI 请求进行签名认证的**签名密钥**,不是区块链钱包私钥,不直接控制链上资产。若泄露,攻击者可以伪造经过认证的 API 请求——请立即通过 GMGN 控制台轮换密钥。
|
|
228
318
|
|
|
229
|
-
|
|
319
|
+
**最佳实践**
|
|
320
|
+
|
|
321
|
+
- 限制配置文件权限:`chmod 600 ~/.config/gmgn/.env`
|
|
322
|
+
- 不要将 `.env` 文件提交到版本控制系统,请将其加入 `.gitignore`
|
|
323
|
+
- 不要在日志、截图或聊天中泄露 `GMGN_API_KEY` 或 `GMGN_PRIVATE_KEY`
|
|
324
|
+
- 使用固定版本安装(`npm install -g gmgn-cli@1.0.2`),而非 `npx gmgn-cli`,以避免在持有凭证的环境中执行未预期的包更新
|
|
230
325
|
|
|
231
|
-
|
|
326
|
+
**免责声明**
|
|
232
327
|
|
|
233
|
-
|
|
234
|
-
- 请妥善保管 `GMGN_API_KEY` 和私钥,不要在日志、截图或聊天中泄露
|
|
235
|
-
- swap/order 使用的私钥必须与绑定该 API Key 的钱包一致
|
|
236
|
-
- **使用本工具及根据其输出做出的任何财务决策,风险由用户自行承担。GMGN 对因凭证管理不当导致的任何交易损失、错误或未授权访问不承担责任。**
|
|
328
|
+
使用本工具及根据其输出做出的任何财务决策,风险由用户自行承担。GMGN 对因凭证管理不当导致的任何交易损失、错误或未授权访问不承担责任。
|