gmgn-cli 1.1.6 → 1.1.8
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 +187 -51
- package/Readme.zh.md +208 -29
- package/dist/client/OpenApiClient.d.ts.map +1 -1
- package/dist/client/OpenApiClient.js +14 -1
- package/dist/client/OpenApiClient.js.map +1 -1
- package/dist/commands/portfolio.d.ts.map +1 -1
- package/dist/commands/portfolio.js +6 -15
- package/dist/commands/portfolio.js.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/gmgn-market/SKILL.md +146 -40
- package/skills/gmgn-portfolio/SKILL.md +133 -6
- package/skills/gmgn-swap/SKILL.md +89 -21
- package/skills/gmgn-token/SKILL.md +213 -53
- package/skills/gmgn-track/SKILL.md +121 -14
|
@@ -2,14 +2,34 @@
|
|
|
2
2
|
name: gmgn-portfolio
|
|
3
3
|
description: Query GMGN wallet portfolio — API Key wallet info, holdings, transaction activity, trading stats, and token balance. Supports sol / bsc / base.
|
|
4
4
|
argument-hint: "<info|holdings|activity|stats|token-balance> [--chain <sol|bsc|base>] [--wallet <wallet_address>]"
|
|
5
|
+
metadata:
|
|
6
|
+
cliHelp: "gmgn-cli portfolio --help"
|
|
5
7
|
---
|
|
6
8
|
|
|
7
9
|
**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.**
|
|
8
10
|
|
|
9
|
-
**⚠️ IPv6 NOT SUPPORTED:
|
|
11
|
+
**⚠️ 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."**
|
|
10
12
|
|
|
11
13
|
Use the `gmgn-cli` tool to query wallet portfolio data based on the user's request.
|
|
12
14
|
|
|
15
|
+
**For full wallet analysis (holdings + stats + activity + verdict), follow [`docs/workflow-wallet-analysis.md`](../../docs/workflow-wallet-analysis.md)**
|
|
16
|
+
|
|
17
|
+
## Core Concepts
|
|
18
|
+
|
|
19
|
+
- **`realized_profit` vs `unrealized_profit`** — `realized_profit` = profit locked in from completed sells (cash in hand). `unrealized_profit` = paper gains on positions still held, calculated at current price. These are separate numbers — do not add them unless answering "total P&L including open positions."
|
|
20
|
+
|
|
21
|
+
- **`profit_change`** — A multiplier ratio, not a dollar amount. `1.5` = +150% return. `0` = break-even. `-0.5` = -50% loss. Computed as `total_profit / cost`. Do not display this as a raw decimal — convert to percentage for user-facing output.
|
|
22
|
+
|
|
23
|
+
- **`pnl`** — Profit/loss ratio from `portfolio stats`: `realized_profit / total_cost`. Same multiplier format as `profit_change`. A `pnl` of `2.0` means the wallet doubled its money on completed trades over the period.
|
|
24
|
+
|
|
25
|
+
- **`winrate`** — Ratio of profitable trades over the period (0–1). `0.6` = 60% of trades were profitable. Does not reflect the size of wins vs losses — a wallet can have high winrate but net negative if losses are large.
|
|
26
|
+
|
|
27
|
+
- **`cost` vs `usd_value`** — In holdings: `cost` is the historical amount spent buying this token (your cost basis); `usd_value` is the current market value of the position. The difference is unrealized P&L.
|
|
28
|
+
|
|
29
|
+
- **`history_bought_cost` vs `cost`** — `history_bought_cost` is the all-time cumulative spend on this token (including positions already sold). `cost` is the cost basis of the current open position only.
|
|
30
|
+
|
|
31
|
+
- **Pagination (`cursor`)** — Activity results are paginated. The response includes a `next` field; pass it as `--cursor` to fetch the next page. An empty or missing `next` means you are on the last page.
|
|
32
|
+
|
|
13
33
|
## Sub-commands
|
|
14
34
|
|
|
15
35
|
| Sub-command | Description |
|
|
@@ -81,11 +101,9 @@ gmgn-cli portfolio token-balance \
|
|
|
81
101
|
| `--cursor <cursor>` | Pagination cursor |
|
|
82
102
|
| `--order-by <field>` | Sort field: `usd_value` / `last_active_timestamp` / `realized_profit` / `unrealized_profit` / `total_profit` / `history_bought_cost` / `history_sold_income` (default `usd_value`) |
|
|
83
103
|
| `--direction <asc\|desc>` | Sort direction (default `desc`) |
|
|
84
|
-
| `--
|
|
85
|
-
| `--
|
|
86
|
-
| `--hide-
|
|
87
|
-
| `--hide-airdrop` | Hide airdrop positions |
|
|
88
|
-
| `--hide-closed` | Hide closed positions |
|
|
104
|
+
| `--hide-abnormal <bool>` | Hide abnormal positions: `true` / `false` (default: `false`) |
|
|
105
|
+
| `--hide-airdrop <bool>` | Hide airdrop positions: `true` / `false` (default: `true`) |
|
|
106
|
+
| `--hide-closed <bool>` | Hide closed positions: `true` / `false` (default: `true`) |
|
|
89
107
|
| `--hide-open` | Hide open positions |
|
|
90
108
|
|
|
91
109
|
## `portfolio activity` Options
|
|
@@ -105,6 +123,104 @@ The activity response includes a `next` field. Pass it to `--cursor` to fetch th
|
|
|
105
123
|
|--------|-------------|
|
|
106
124
|
| `--period <period>` | Stats period: `7d` / `30d` (default `7d`) |
|
|
107
125
|
|
|
126
|
+
## Response Field Reference
|
|
127
|
+
|
|
128
|
+
### `portfolio holdings` — Key Fields
|
|
129
|
+
|
|
130
|
+
The response has a `holdings` array. Each item is one token position.
|
|
131
|
+
|
|
132
|
+
| Field | Description |
|
|
133
|
+
|-------|-------------|
|
|
134
|
+
| `token.address` | Token contract address |
|
|
135
|
+
| `token.symbol` / `token.name` | Token ticker and full name |
|
|
136
|
+
| `token.price` | Current token price in USD |
|
|
137
|
+
| `balance` | Current token balance (human-readable units) |
|
|
138
|
+
| `usd_value` | Current USD value of this position |
|
|
139
|
+
| `cost` | Total amount spent buying this token (USD) |
|
|
140
|
+
| `realized_profit` | Profit from completed sells (USD) |
|
|
141
|
+
| `unrealized_profit` | Profit on current unsold holdings at current price (USD) |
|
|
142
|
+
| `total_profit` | `realized_profit + unrealized_profit` (USD) |
|
|
143
|
+
| `profit_change` | Total profit ratio = `total_profit / cost` (e.g. `1.5` = +150%) |
|
|
144
|
+
| `avg_cost` | Average buy price per token (USD) |
|
|
145
|
+
| `buy_tx_count` | Number of buy transactions |
|
|
146
|
+
| `sell_tx_count` | Number of sell transactions |
|
|
147
|
+
| `last_active_timestamp` | Unix timestamp of the most recent transaction |
|
|
148
|
+
| `history_bought_cost` | Total USD spent buying (all-time) |
|
|
149
|
+
| `history_sold_income` | Total USD received from selling (all-time) |
|
|
150
|
+
|
|
151
|
+
### `portfolio activity` — Key Fields
|
|
152
|
+
|
|
153
|
+
The response has a `activities` array and a `next` cursor field for pagination.
|
|
154
|
+
|
|
155
|
+
| Field | Description |
|
|
156
|
+
|-------|-------------|
|
|
157
|
+
| `transaction_hash` | On-chain transaction hash |
|
|
158
|
+
| `type` | Transaction type: `buy` / `sell` / `add` / `remove` / `transfer` |
|
|
159
|
+
| `token.address` | Token contract address |
|
|
160
|
+
| `token.symbol` | Token ticker |
|
|
161
|
+
| `token_amount` | Token quantity in this transaction |
|
|
162
|
+
| `cost_usd` | USD value of this transaction |
|
|
163
|
+
| `price` | Token price in USD at time of transaction |
|
|
164
|
+
| `timestamp` | Unix timestamp of the transaction |
|
|
165
|
+
| `next` | Pagination cursor — pass to `--cursor` to fetch the next page |
|
|
166
|
+
|
|
167
|
+
### `portfolio stats` — Key Fields
|
|
168
|
+
|
|
169
|
+
The response is an object (or array for batch). Key fields:
|
|
170
|
+
|
|
171
|
+
| Field | Description |
|
|
172
|
+
|-------|-------------|
|
|
173
|
+
| `realized_profit` | Total realized profit over the period (USD) |
|
|
174
|
+
| `unrealized_profit` | Total unrealized profit on open positions (USD) |
|
|
175
|
+
| `winrate` | Win rate — ratio of profitable trades (0–1) |
|
|
176
|
+
| `total_cost` | Total amount spent buying in the period (USD) |
|
|
177
|
+
| `buy_count` | Number of buy transactions |
|
|
178
|
+
| `sell_count` | Number of sell transactions |
|
|
179
|
+
| `pnl` | Profit/loss ratio = `realized_profit / total_cost` |
|
|
180
|
+
|
|
181
|
+
**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.
|
|
182
|
+
|
|
183
|
+
## Output Format
|
|
184
|
+
|
|
185
|
+
**Do NOT dump raw JSON.** Always parse and present data in the structured formats below. Use `--raw` only when piping to `jq` or further processing.
|
|
186
|
+
|
|
187
|
+
### `portfolio holdings` — Holdings Table
|
|
188
|
+
|
|
189
|
+
Present a table sorted by `usd_value` (descending). Show total portfolio value at the top.
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
Wallet: {wallet} | Chain: {chain}
|
|
193
|
+
Total value: ~${sum of usd_value across all positions}
|
|
194
|
+
|
|
195
|
+
# | Token | Balance | USD Value | Total P&L | P&L% | Avg Cost | Buys / Sells
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Flag positions where `profit_change` is strongly negative (e.g. < -50%) or positive (e.g. > 200%) with a brief note.
|
|
199
|
+
|
|
200
|
+
### `portfolio activity` — Activity Feed
|
|
201
|
+
|
|
202
|
+
Present as a chronological list (newest first). Use human-readable timestamps.
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
{type} {token.symbol} | {token_amount} tokens | ${cost_usd} | {timestamp} | tx: {short hash}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Group by token if the user asks about a specific token.
|
|
209
|
+
|
|
210
|
+
### `portfolio stats` — Stats Summary
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
Wallet: {wallet} | Period: {period}
|
|
214
|
+
Realized P&L: ${realized_profit}
|
|
215
|
+
Unrealized P&L: ${unrealized_profit}
|
|
216
|
+
Win Rate: {winrate × 100}%
|
|
217
|
+
Total Spent: ${total_cost}
|
|
218
|
+
Buys / Sells: {buy_count} / {sell_count}
|
|
219
|
+
PnL Ratio: {pnl}x
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
For batch queries (multiple wallets), present one summary block per wallet.
|
|
223
|
+
|
|
108
224
|
## Notes
|
|
109
225
|
|
|
110
226
|
- All portfolio commands use normal auth (API Key only, no signature required)
|
|
@@ -112,3 +228,14 @@ The activity response includes a `next` field. Pass it to `--cursor` to fetch th
|
|
|
112
228
|
- Use `--raw` to get single-line JSON for further processing
|
|
113
229
|
- **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.
|
|
114
230
|
- For follow-wallet, KOL, and Smart Money trade records, use the `gmgn-track` skill (`track follow-wallet` / `track kol` / `track smartmoney`)
|
|
231
|
+
|
|
232
|
+
## Workflow
|
|
233
|
+
|
|
234
|
+
For full wallet analysis including trade history and follow-through on top holdings, see [`docs/workflow-wallet-analysis.md`](../../docs/workflow-wallet-analysis.md)
|
|
235
|
+
|
|
236
|
+
For in-depth trading style analysis, copy-trade ROI estimation, and smart money leaderboard comparison, see [`docs/workflow-smart-money-profile.md`](../../docs/workflow-smart-money-profile.md)
|
|
237
|
+
|
|
238
|
+
**When to use which:**
|
|
239
|
+
- User asks "is this wallet worth following" → [`docs/workflow-wallet-analysis.md`](../../docs/workflow-wallet-analysis.md)
|
|
240
|
+
- 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)
|
|
241
|
+
- 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)
|
|
@@ -2,26 +2,35 @@
|
|
|
2
2
|
name: gmgn-swap
|
|
3
3
|
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."
|
|
4
4
|
argument-hint: "[--chain <chain> --from <wallet> --input-token <addr> --output-token <addr> --amount <n>] | [order get --chain <chain> --order-id <id>]"
|
|
5
|
+
metadata:
|
|
6
|
+
cliHelp: "gmgn-cli swap --help"
|
|
5
7
|
---
|
|
6
8
|
|
|
7
9
|
**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.**
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
**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.**
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
**⚠️ 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."**
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
Use the `gmgn-cli` tool to submit a token swap or query an existing order. **Requires private key** (`GMGN_PRIVATE_KEY` in `.env`).
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
## Core Concepts
|
|
16
18
|
|
|
17
|
-
**
|
|
18
|
-
```bash
|
|
19
|
-
curl -s https://api64.ipify.org # shows your outbound IP — if it's an IPv6 address, that's the problem
|
|
20
|
-
```
|
|
19
|
+
- **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.
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
- **`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.
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
- **`--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.
|
|
24
|
+
|
|
25
|
+
- **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.
|
|
26
|
+
|
|
27
|
+
- **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. Enabled by default.
|
|
28
|
+
|
|
29
|
+
- **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.
|
|
30
|
+
|
|
31
|
+
- **`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`.
|
|
32
|
+
|
|
33
|
+
- **`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.
|
|
25
34
|
|
|
26
35
|
## Financial Risk Notice
|
|
27
36
|
|
|
@@ -158,10 +167,10 @@ gmgn-cli order get --chain sol --order-id <order_id>
|
|
|
158
167
|
| `--from` | Yes | Wallet address (must match API Key binding) |
|
|
159
168
|
| `--input-token` | Yes | Input token contract address |
|
|
160
169
|
| `--output-token` | Yes | Output token contract address |
|
|
161
|
-
| `--amount` | No* | Input amount in smallest unit. Required unless `--percent` is used. |
|
|
162
|
-
| `--percent <pct>` | No* | Sell percentage of `input_token`, e.g. `50` = 50%, `1` = 1%. Sets `input_amount` to `0` automatically. **Only valid when `input_token` is NOT a currency (SOL/BNB/ETH/USDC).** |
|
|
163
|
-
| `--slippage <n>` | No | Slippage tolerance, e.g. `0.01` = 1
|
|
164
|
-
| `--auto-slippage` | No | Enable automatic slippage |
|
|
170
|
+
| `--amount` | No* | Input amount in smallest unit. **Mutually exclusive with `--percent`** — provide one or the other, never both. Required unless `--percent` is used. |
|
|
171
|
+
| `--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).** |
|
|
172
|
+
| `--slippage <n>` | No | Slippage tolerance, e.g. `0.01` = 1%. **Mutually exclusive with `--auto-slippage`** — use one or the other. |
|
|
173
|
+
| `--auto-slippage` | No | Enable automatic slippage. **Mutually exclusive with `--slippage`.** |
|
|
165
174
|
| `--min-output <n>` | No | Minimum output amount |
|
|
166
175
|
| `--anti-mev` | No | Enable anti-MEV protection (default true) |
|
|
167
176
|
| `--priority-fee <sol>` | No | Priority fee in SOL (≥ 0.00001, SOL only) |
|
|
@@ -185,6 +194,60 @@ gmgn-cli order get --chain sol --order-id <order_id>
|
|
|
185
194
|
| `filled_input_amount` | string | Actual input consumed (smallest unit); empty if not filled |
|
|
186
195
|
| `filled_output_amount` | string | Actual output received (smallest unit); empty if not filled |
|
|
187
196
|
|
|
197
|
+
## Output Format
|
|
198
|
+
|
|
199
|
+
### Pre-swap Confirmation
|
|
200
|
+
|
|
201
|
+
Before displaying the confirmation, run `order quote` to get the estimated output (uses normal auth — no private key required):
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
gmgn-cli order quote \
|
|
205
|
+
--chain <chain> \
|
|
206
|
+
--from <wallet> \
|
|
207
|
+
--input-token <input_token> \
|
|
208
|
+
--output-token <output_token> \
|
|
209
|
+
--amount <amount> \
|
|
210
|
+
--slippage <slippage>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Then display the confirmation summary using `output_amount` from the quote response:
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
⚠️ Swap Confirmation Required
|
|
217
|
+
|
|
218
|
+
Chain: {chain}
|
|
219
|
+
Wallet: {--from}
|
|
220
|
+
Sell: {input amount in human units} {input token symbol}
|
|
221
|
+
Buy: {output token symbol}
|
|
222
|
+
Slippage: {slippage}% (or "auto")
|
|
223
|
+
Est. output: ~{output_amount from quote} {output token symbol}
|
|
224
|
+
Risk Level: 🟢 Low / 🟡 Medium / 🔴 High (based on rug_ratio from security check)
|
|
225
|
+
|
|
226
|
+
Reply "confirm" to proceed.
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**Note**: `Risk Level` is derived from the required security check:
|
|
230
|
+
- 🟢 Low: `rug_ratio < 0.1`
|
|
231
|
+
- 🟡 Medium: `rug_ratio 0.1–0.3`
|
|
232
|
+
- 🔴 High: `rug_ratio > 0.3` (requires re-confirmation)
|
|
233
|
+
|
|
234
|
+
If the user explicitly skipped the security check, omit the Risk Level line and add a note: "(Security check skipped by user)"
|
|
235
|
+
|
|
236
|
+
### Post-swap Receipt
|
|
237
|
+
|
|
238
|
+
After a confirmed swap, display:
|
|
239
|
+
|
|
240
|
+
```
|
|
241
|
+
✅ Swap Confirmed
|
|
242
|
+
|
|
243
|
+
Spent: {filled_input_amount in human units} {input symbol}
|
|
244
|
+
Received: {filled_output_amount in human units} {output symbol}
|
|
245
|
+
Tx: {explorer link for hash}
|
|
246
|
+
Order ID: {order_id}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Convert `filled_input_amount` and `filled_output_amount` from smallest unit using token decimals before displaying.
|
|
250
|
+
|
|
188
251
|
## Notes
|
|
189
252
|
|
|
190
253
|
- Swap uses **critical auth** (API Key + signature) — CLI handles signing automatically, no manual processing needed
|
|
@@ -209,22 +272,27 @@ Before passing any address or amount to a command:
|
|
|
209
272
|
|
|
210
273
|
4. **User confirmation** — See "Execution Guidelines" below — always present resolved parameters to the user before executing a swap. This creates a human review checkpoint for any unexpected values.
|
|
211
274
|
|
|
212
|
-
## Pre-Swap Safety Check (
|
|
275
|
+
## Pre-Swap Safety Check (REQUIRED)
|
|
213
276
|
|
|
214
|
-
Before swapping into
|
|
277
|
+
Before swapping into any token, run a mandatory security check using `gmgn-cli`:
|
|
215
278
|
|
|
216
279
|
```bash
|
|
217
|
-
|
|
280
|
+
gmgn-cli token security --chain <chain> --address <output_token>
|
|
218
281
|
```
|
|
219
282
|
|
|
220
|
-
|
|
221
|
-
- If `
|
|
222
|
-
- If `
|
|
283
|
+
Check the two critical fields:
|
|
284
|
+
- **`is_honeypot`**: If `"yes"` → **abort immediately**. Display: "🚫 HONEYPOT DETECTED — swap aborted." Do NOT proceed.
|
|
285
|
+
- **`rug_ratio`**: If `> 0.3` → display 🔴 High Risk warning and require explicit re-confirmation from the user before proceeding.
|
|
286
|
+
|
|
287
|
+
**User override**: The user may explicitly skip this check by saying "I already checked" or "skip security check". In that case, document that the check was skipped in the confirmation summary. This is the only valid override — do NOT skip the check silently.
|
|
288
|
+
|
|
289
|
+
For a quick pre-swap due diligence checklist (info + security + pool + smart money, 4 steps), see [`docs/workflow-token-due-diligence.md`](../../docs/workflow-token-due-diligence.md)
|
|
223
290
|
|
|
224
|
-
|
|
291
|
+
For full token research before swapping, see [`docs/workflow-token-research.md`](../../docs/workflow-token-research.md)
|
|
225
292
|
|
|
226
293
|
## Execution Guidelines
|
|
227
294
|
|
|
295
|
+
- **[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).
|
|
228
296
|
- **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.
|
|
229
297
|
- Buy ("buy X SOL of TOKEN", "spend 0.5 USDC on TOKEN") → resolve currency to `--input-token`
|
|
230
298
|
- Sell ("sell TOKEN for SOL", "sell 50% of TOKEN to USDC") → resolve currency to `--output-token`
|