mirror of
https://github.com/GMGNAI/gmgn-skills.git
synced 2026-07-28 01:07:44 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e6dfca48d8 | |||
| 362d180910 | |||
| d5c43eed51 | |||
| 968013ebce | |||
| 3d11f8c6d6 | |||
| f15e8271f9 | |||
| eda0ac9f52 | |||
| b940c66c00 | |||
| 1964e927cd | |||
| 0f3d550736 | |||
| dd41e38755 |
@@ -505,6 +505,9 @@ gmgn-cli portfolio created-tokens --chain sol --wallet <addr>
|
||||
### Track
|
||||
|
||||
```bash
|
||||
# Followed token map for a wallet
|
||||
gmgn-cli track follow-tokens --chain sol --wallet <wallet_address>
|
||||
|
||||
# Follow-wallet trade records
|
||||
gmgn-cli track follow-wallet --chain sol
|
||||
gmgn-cli track follow-wallet --chain sol --limit 20 --min-amount-usd 1000
|
||||
|
||||
@@ -529,6 +529,9 @@ gmgn-cli portfolio created-tokens --chain sol --wallet <addr>
|
||||
### Track
|
||||
|
||||
```bash
|
||||
# 查询钱包收藏的代币列表
|
||||
gmgn-cli track follow-tokens --chain sol --wallet <wallet_address>
|
||||
|
||||
# 追踪关注钱包的交易动态
|
||||
gmgn-cli track follow-wallet --chain sol
|
||||
gmgn-cli track follow-wallet --chain sol --limit 20 --min-amount-usd 1000
|
||||
|
||||
+49
-2
@@ -349,6 +349,54 @@ gmgn-cli market signal --chain sol --groups '<json_array>' [--raw]
|
||||
|
||||
---
|
||||
|
||||
## track follow-tokens
|
||||
|
||||
Query the followed token list for a wallet. Returns a paginated list of tokens the wallet has bookmarked on GMGN, with full market data. API Key auth only.
|
||||
|
||||
```bash
|
||||
gmgn-cli track follow-tokens \
|
||||
--chain <chain> \
|
||||
--wallet <wallet_address> \
|
||||
[--group-id <id>] \
|
||||
[--order-by <field>] \
|
||||
[--direction <asc|desc>] \
|
||||
[--limit <n>] \
|
||||
[--cursor <cursor>] \
|
||||
[--raw]
|
||||
```
|
||||
|
||||
| Option | Required | Description |
|
||||
|--------|----------|-------------|
|
||||
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
|
||||
| `--wallet` | Yes | Wallet address |
|
||||
| `--group-id` | No | `all_group` (all tokens), `default`, or a user-defined group ID |
|
||||
| `--interval` | No | Time interval for price change stats: `1m` / `5m` / `1h` / `6h` / `24h` |
|
||||
| `--order-by` | No | `created_at` / `swaps` / `volume` / `market_cap` / `liquidity` / `price` / `open_timestamp` |
|
||||
| `--direction` | No | Sort direction: `asc` / `desc` |
|
||||
| `--limit` | No | Page size |
|
||||
| `--cursor` | No | Pagination cursor from previous response |
|
||||
| `--search` | No | Search by token name or address |
|
||||
|
||||
---
|
||||
|
||||
## track follow-token-groups
|
||||
|
||||
Query the follow token group names for a wallet. Returns the groups a wallet uses to organise its followed tokens on GMGN. API Key auth only.
|
||||
|
||||
```bash
|
||||
gmgn-cli track follow-token-groups \
|
||||
--chain <chain> \
|
||||
--wallet <wallet_address> \
|
||||
[--raw]
|
||||
```
|
||||
|
||||
| Option | Required | Description |
|
||||
|--------|----------|-------------|
|
||||
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
|
||||
| `--wallet` | Yes | Wallet address |
|
||||
|
||||
---
|
||||
|
||||
## portfolio follow-wallet
|
||||
|
||||
Query follow-wallet trade records. Returns trades from wallets you personally follow on the GMGN platform. The follow list is resolved automatically from the GMGN user account bound to the API Key — `--wallet` is optional. Signed auth (API Key + private key signature).
|
||||
@@ -749,7 +797,7 @@ gmgn-cli cooking create \
|
||||
[--fourmeme-rate-conf <json>] \
|
||||
[--bags-fee-share-list <json>] \
|
||||
[--bonk-model <model>] \
|
||||
[--buy-wallets <json>] [--snip-buy-wallets <json>] [--interval-seconds <n>] \
|
||||
[--buy-wallets <json>] [--snip-buy-wallets <json>] \
|
||||
[--buy-trade-config <json>] [--sell-trade-config <json>] [--sell-configs <json>] \
|
||||
[--raw]
|
||||
```
|
||||
@@ -795,7 +843,6 @@ gmgn-cli cooking create \
|
||||
| `--bonk-model` | No | Bonk model identifier (**bonk DEX only**) |
|
||||
| `--buy-wallets` | No | Multi-wallet buy config as JSON array: `[{"from_address":"<addr>","buy_amt":"<n>"}]` |
|
||||
| `--snip-buy-wallets` | No | Snipe-buy wallet config as JSON array: `[{"from_address":"<addr>","buy_amt":"<n>"}]` |
|
||||
| `--interval-seconds` | No | Interval between multi-wallet buys in seconds |
|
||||
| `--buy-trade-config` | No | Buy-side trade config for CondMarket orders as JSON (TradeParam) |
|
||||
| `--sell-trade-config` | No | Sell-side trade config for auto-sell / pending_sell as JSON (TradeParam) |
|
||||
| `--sell-configs` | No | Auto-sell strategy list as JSON array (CookingSellConfig[]): `[{"sell_type":"delay_sell","delay_sec":<n>,"sell_ratio":"0.5","wallet_addresses":["<addr>"]}]` |
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "gmgn-cli",
|
||||
"version": "1.4.3",
|
||||
"version": "1.4.5",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "gmgn-cli",
|
||||
"version": "1.4.3",
|
||||
"version": "1.4.5",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"commander": "^12.1.0",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gmgn-cli",
|
||||
"version": "1.4.3",
|
||||
"version": "1.4.5",
|
||||
"description": "GMGN OpenAPI CLI — call GMGN market, token, portfolio and swap APIs from the command line",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
@@ -180,7 +180,6 @@ gmgn-cli cooking stats [--raw]
|
||||
| `--bonk-model` | No | Bonk model identifier (**bonk DEX only**) |
|
||||
| `--buy-wallets` | No | Multi-wallet buy config as JSON array: `[{"from_address":"<addr>","buy_amt":"<n>"}]` |
|
||||
| `--snip-buy-wallets` | No | Snipe-buy wallet config as JSON array: `[{"from_address":"<addr>","buy_amt":"<n>"}]` |
|
||||
| `--interval-seconds` | No | Interval between multi-wallet buys in seconds |
|
||||
| `--buy-trade-config` | No | Buy-side trade config for CondMarket orders as JSON (TradeParam) — see Advanced API Fields |
|
||||
| `--sell-trade-config` | No | Sell-side trade config for auto-sell / pending_sell as JSON (TradeParam) — see Advanced API Fields |
|
||||
| `--sell-configs` | No | Auto-sell strategy list as JSON array (CookingSellConfig[]) — see Auto-Sell Configuration |
|
||||
@@ -263,23 +262,25 @@ Example: `--pump-fee-share-list '[{"provider":"twitter","username":"handle","bas
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|---|---|---|---|
|
||||
| `beneficiary` | string | Yes | Fee recipient address |
|
||||
| `tax_rate` | int | Conditional | V5 unified tax rate in bps, e.g. 5% → `500` |
|
||||
| `buy_tax_rate` | int | Conditional | V6 separate buy tax rate in bps |
|
||||
| `buy_tax_rate` | int | Conditional | V6 separate buy tax rate in bps, e.g. 1% → `100`. Use together with `sell_tax_rate`. |
|
||||
| `sell_tax_rate` | int | Conditional | V6 separate sell tax rate in bps |
|
||||
| `mkt_bps` | int | Yes | Marketing / donation fund share |
|
||||
| `tax_rate` | int | Conditional | V5 unified tax rate in bps, e.g. 5% → `500`. Use instead of `buy_tax_rate` + `sell_tax_rate`. |
|
||||
| `mkt_bps` | int | Yes | **Tax recipient share** — the slice of the collected tax routed to the recipient(s): the X handle when `recipient_type = gift`, or the `split_conf` addresses when `recipient_type = split`. This is NOT a generic "marketing" fund. |
|
||||
| `deflation_bps` | int | Yes | Burn (supply-reduction) share |
|
||||
| `dividend_bps` | int | Yes | Dividend (holder-reward) share |
|
||||
| `lp_bps` | int | Yes | Liquidity share |
|
||||
| `recipient_type` | string | Yes | `gift` (route the recipient share to an X handle) / `split` (route it to specific addresses) |
|
||||
| `twitter_account` | string | Conditional | X / Twitter handle that receives the recipient share — **required when `recipient_type = gift`**; leave `""` when `split`. |
|
||||
| `split_conf` | array | Conditional | Recipient address split list — **required when `recipient_type = split`**; leave `[]` when `gift`. |
|
||||
| `minimum_share_balance` | int | Yes | Min holding to qualify for dividends — minimum **10000** tokens |
|
||||
| `recipient_type` | string | Yes | `split` (proportional) / `gift` |
|
||||
| `twitter_account` | string | Yes | Twitter username |
|
||||
| `split_conf` | array | Yes | Split list — see below |
|
||||
| `beneficiary` | string | No | Legacy single fee-recipient address. Omit when using `recipient_type` + `twitter_account` / `split_conf`. |
|
||||
|
||||
`split_conf` entries: `{ "recipient": "<address>", "bps": <n> }` — all `bps` must sum to **10000**.
|
||||
|
||||
> - **Tax distribution:** whenever the tax rate > 0, `mkt_bps + deflation_bps + dividend_bps + lp_bps` must sum to **10000**. `mkt_bps` is the recipient's cut; the other three are burn / dividend / liquidity.
|
||||
> - **Recipient routing:** set `recipient_type = gift` + `twitter_account` to send the recipient cut to an X handle, OR `recipient_type = split` + `split_conf` to send it to one or more addresses. Fill only the field that matches the chosen mode; leave the other empty (`""` / `[]`).
|
||||
> - Use `tax_rate` for V5 (unified rate); use `buy_tax_rate` + `sell_tax_rate` for V6 (separate rates).
|
||||
> - When the tax rate > 0: `mkt_bps + deflation_bps + dividend_bps + lp_bps` must sum to **10000**. When `lp_bps > 0`: `minimum_share_balance` must be > 0.
|
||||
> - When `lp_bps > 0`: `minimum_share_balance` must be > 0.
|
||||
|
||||
### FourMeme (`--dex fourmeme`)
|
||||
|
||||
@@ -373,6 +374,8 @@ Token creation is **asynchronous**. If the initial `cooking create` response sho
|
||||
|
||||
## Usage Examples
|
||||
|
||||
Examples run shortest-first: basic single-launch commands, then full end-to-end configurations. Every JSON flag below is a valid payload shape — copy and adapt.
|
||||
|
||||
```bash
|
||||
# Get token creation statistics per launchpad
|
||||
gmgn-cli cooking stats
|
||||
@@ -426,9 +429,7 @@ gmgn-cli cooking create \
|
||||
--sell-configs '[{"sell_type":"delay_sell","delay_sec":60,"sell_ratio":"0.5","wallet_addresses":["<wallet_address>"]}]'
|
||||
```
|
||||
|
||||
### Full worked examples
|
||||
|
||||
These mirror real launch configurations end-to-end. Copy and adapt — every JSON flag below is a valid payload shape.
|
||||
These mirror real launch configurations end-to-end.
|
||||
|
||||
**Pump.fun (SOL) — Bundle + Sniper + Auto-Sell + Agent Auto Buyback**
|
||||
|
||||
@@ -477,6 +478,50 @@ gmgn-cli cooking create \
|
||||
- `--gas-price 1000000000` is wei (1 Gwei).
|
||||
- In `--fourmeme-rate-conf`, `recipient_rate + burn_rate + divide_rate + liquidity_rate` must sum to **100**.
|
||||
|
||||
**Flap (BSC) — `split` mode: route the recipient cut to a BSC address**
|
||||
|
||||
```bash
|
||||
gmgn-cli cooking create \
|
||||
--chain bsc \
|
||||
--dex flap \
|
||||
--from 0x1f8d977b6843e1bbcb306c4a3664c9fb0277979d \
|
||||
--name "refer" \
|
||||
--symbol refer \
|
||||
--buy-amt 2 \
|
||||
--image-url https://gmgn.ai/external-res-va/11ad7747dcefcfaae87d3f53a4d7330d_v2l.webp \
|
||||
--website https://www.refercoins.bond/ \
|
||||
--twitter https://x.com/referdotfun \
|
||||
--dev-gas 50000000 \
|
||||
--auto-slippage \
|
||||
--flap-rate-conf '{"buy_tax_rate":100,"sell_tax_rate":100,"mkt_bps":10000,"deflation_bps":0,"dividend_bps":0,"lp_bps":0,"minimum_share_balance":10000,"recipient_type":"split","twitter_account":"","split_conf":[{"recipient":"0x1f8d977b6843e1bbcb306c4a3664c9fb0277979d","bps":10000}]}'
|
||||
```
|
||||
|
||||
- `recipient_type: split` → the recipient cut goes to `split_conf` addresses; `twitter_account` is left `""`.
|
||||
- `mkt_bps:10000` means the **entire** tax (1% buy / 1% sell) goes to the recipient — `deflation_bps + dividend_bps + lp_bps` are all `0`, and the four still sum to **10000**.
|
||||
- `split_conf` has one address taking all `10000` bps (100%). Multiple addresses are allowed as long as their `bps` sum to `10000`.
|
||||
|
||||
**Flap (BSC) — `gift` mode: route the recipient cut to an X handle, split the rest across burn / dividend / LP**
|
||||
|
||||
```bash
|
||||
gmgn-cli cooking create \
|
||||
--chain bsc \
|
||||
--dex flap \
|
||||
--from 0x1f8d977b6843e1bbcb306c4a3664c9fb0277979d \
|
||||
--name "refer" \
|
||||
--symbol refer \
|
||||
--buy-amt 2 \
|
||||
--image-url https://gmgn.ai/external-res-va/11ad7747dcefcfaae87d3f53a4d7330d_v2l.webp \
|
||||
--website https://www.refercoins.bond/ \
|
||||
--twitter https://x.com/referdotfun \
|
||||
--dev-gas 50000000 \
|
||||
--auto-slippage \
|
||||
--flap-rate-conf '{"buy_tax_rate":100,"sell_tax_rate":100,"mkt_bps":5000,"deflation_bps":2700,"dividend_bps":1800,"lp_bps":500,"minimum_share_balance":10000,"recipient_type":"gift","twitter_account":"handleName","split_conf":[]}'
|
||||
```
|
||||
|
||||
- `recipient_type: gift` → the recipient cut goes to the `twitter_account` X handle; `split_conf` is left `[]`.
|
||||
- Tax distribution: `mkt_bps:5000` (50% to the handle) + `deflation_bps:2700` (27% burn) + `dividend_bps:1800` (18% dividend) + `lp_bps:500` (5% LP) = **10000**.
|
||||
- `lp_bps > 0`, so `minimum_share_balance` must be > 0 (`10000` here).
|
||||
|
||||
## Output Format
|
||||
|
||||
### Pre-create Confirmation
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: gmgn-track
|
||||
description: Get real-time crypto buy/sell activity from Smart Money wallets, KOL influencer wallets, and personally followed wallets via GMGN API — alpha signals, whale tracking, meme token copy-trading ideas on Solana, BSC, Base, or Ethereum. Use when user asks what smart money or KOLs are buying, wants whale alerts, on-chain alpha, or copy-trade signals. (For a specific wallet address, use gmgn-portfolio.)
|
||||
argument-hint: "<follow-wallet|kol|smartmoney> --chain <sol|bsc|base|eth> [--wallet <wallet_address>]"
|
||||
description: Get real-time crypto buy/sell activity from Smart Money wallets, KOL influencer wallets, and personally followed wallets via GMGN API — alpha signals, whale tracking, meme token copy-trading ideas on Solana, BSC, Base, or Ethereum. Also query which tokens a wallet has followed (bookmarked) on GMGN. Use when user asks what smart money or KOLs are buying, wants whale alerts, on-chain alpha, copy-trade signals, or wants to check a wallet's followed tokens. (For a specific wallet address's portfolio, use gmgn-portfolio.)
|
||||
argument-hint: "<follow-tokens|follow-wallet|kol|smartmoney> --chain <sol|bsc|base|eth> [--wallet <wallet_address>]"
|
||||
metadata:
|
||||
cliHelp: "gmgn-cli track --help"
|
||||
---
|
||||
@@ -49,6 +49,8 @@ Use the `gmgn-cli` tool to query on-chain tracking data based on the user's requ
|
||||
|
||||
| Sub-command | Description |
|
||||
|-------------|-------------|
|
||||
| `track follow-tokens` | Followed token list for a wallet — which tokens a wallet has bookmarked on GMGN, with full market data |
|
||||
| `track follow-token-groups` | Follow token group names for a wallet — the group names and IDs the wallet uses to organise followed tokens |
|
||||
| `track follow-wallet` | Trade records from wallets the user personally follows on GMGN |
|
||||
| `track kol` | Real-time trades from KOL / influencer wallets tagged by GMGN |
|
||||
| `track smartmoney` | Real-time trades from smart money / whale wallets tagged by GMGN |
|
||||
@@ -61,7 +63,7 @@ Use the `gmgn-cli` tool to query on-chain tracking data based on the user's requ
|
||||
|
||||
- `gmgn-cli` installed globally — if missing, run: `npm install -g gmgn-cli`
|
||||
- `GMGN_API_KEY` configured in `~/.config/gmgn/.env` — required for all sub-commands
|
||||
- `GMGN_PRIVATE_KEY` — required for `track follow-wallet` only (signed auth); not needed for `kol` or `smartmoney`
|
||||
- `GMGN_PRIVATE_KEY` — required for `track follow-wallet` only (signed auth); not needed for `follow-tokens`, `kol`, or `smartmoney`
|
||||
|
||||
## Rate Limit Handling
|
||||
|
||||
@@ -69,6 +71,8 @@ All tracking routes used by this skill go through GMGN's leaky-bucket limiter wi
|
||||
|
||||
| Command | Route | Weight |
|
||||
|---------|-------|--------|
|
||||
| `track follow-tokens` | `GET /v1/user/follow_tokens` | 3 |
|
||||
| `track follow-token-groups` | `GET /v1/user/follow_token_groups` | 1 |
|
||||
| `track follow-wallet` | `GET /v1/trade/follow_wallet` | 3 |
|
||||
| `track kol` | `GET /v1/user/kol` | 1 |
|
||||
| `track smartmoney` | `GET /v1/user/smartmoney` | 1 |
|
||||
@@ -101,6 +105,18 @@ When a request returns `429`:
|
||||
## Usage Examples
|
||||
|
||||
```bash
|
||||
# Followed token list for a wallet on SOL
|
||||
gmgn-cli track follow-tokens --chain sol --wallet <wallet_address>
|
||||
|
||||
# Followed token list on BSC, raw JSON output
|
||||
gmgn-cli track follow-tokens --chain bsc --wallet <wallet_address> --raw
|
||||
|
||||
# Follow token group names for a wallet on SOL
|
||||
gmgn-cli track follow-token-groups --chain sol --wallet <wallet_address>
|
||||
|
||||
# Follow token group names, raw JSON output
|
||||
gmgn-cli track follow-token-groups --chain sol --wallet <wallet_address> --raw
|
||||
|
||||
# Follow-wallet trades (all wallets you follow)
|
||||
gmgn-cli track follow-wallet --chain sol
|
||||
|
||||
@@ -126,6 +142,66 @@ gmgn-cli track smartmoney --limit 10 --raw
|
||||
gmgn-cli track smartmoney --chain sol --side sell --limit 10 --raw
|
||||
```
|
||||
|
||||
## `track follow-tokens` Options
|
||||
|
||||
| Option | Description |
|
||||
|--------|-------------|
|
||||
| `--chain` | Required. `sol` / `bsc` / `base` / `eth` |
|
||||
| `--wallet <address>` | Required. Wallet address to query |
|
||||
| `--group-id <id>` | Filter by group: `all_group` (all tokens across groups), `default` (default group), or a user-defined group ID |
|
||||
| `--interval <interval>` | Time interval for price change stats (e.g. `1m`, `5m`, `1h`, `6h`, `24h`) |
|
||||
| `--order-by <field>` | Sort field: `created_at` / `swaps` / `volume` / `market_cap` / `liquidity` / `price` / `open_timestamp` |
|
||||
| `--direction <dir>` | Required when `--order-by` is set. `asc` / `desc` |
|
||||
| `--limit <n>` | Page size |
|
||||
| `--cursor <cursor>` | Pagination cursor from previous response |
|
||||
| `--search <text>` | Search by token name or address |
|
||||
|
||||
## `track follow-tokens` Response Fields
|
||||
|
||||
Top-level fields:
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| `cursor` | Opaque cursor for fetching the next page |
|
||||
| `all_following` | Total number of followed tokens |
|
||||
| `is_recommend` | Whether results include recommended tokens |
|
||||
| `followings` | Array of followed token objects |
|
||||
|
||||
Each item in `followings` contains:
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| `address` | Token contract address |
|
||||
| `symbol` | Token ticker symbol |
|
||||
| `name` | Token name |
|
||||
| `chain` | Chain the token is on |
|
||||
| `price` | Current token price |
|
||||
| `price_change_percent` | Price change percentage |
|
||||
| `volume` | Trading volume |
|
||||
| `liquidity` | Pool liquidity |
|
||||
| `market_cap` | Market cap |
|
||||
| `swaps` | Total swaps |
|
||||
| `group_ids` | Follow groups this token belongs to |
|
||||
| `open_timestamp` | Unix timestamp when trading opened |
|
||||
|
||||
## `track follow-token-groups` Options
|
||||
|
||||
| Option | Description |
|
||||
|--------|-------------|
|
||||
| `--chain` | Required. `sol` / `bsc` / `base` / `eth` |
|
||||
| `--wallet <address>` | Required. Wallet address to query |
|
||||
|
||||
## `track follow-token-groups` Response Fields
|
||||
|
||||
`data` is an array. Each item contains:
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| `chain` | Chain the group is on |
|
||||
| `group_id` | Group identifier (e.g. `default`, or a user-defined ID) |
|
||||
| `group_name` | Human-readable group name |
|
||||
| `rank` | Display order / sort rank |
|
||||
|
||||
## `track follow-wallet` Options
|
||||
|
||||
| Option | Description |
|
||||
@@ -311,6 +387,7 @@ To research any token surfaced by smart money activity, follow [`docs/workflow-t
|
||||
|
||||
## Notes
|
||||
|
||||
- `track follow-tokens` uses exist auth (API Key only); `--wallet` is required
|
||||
- `track follow-wallet` uses signed auth (API Key + private key signature); `track kol` and `track smartmoney` use exist auth (API Key only)
|
||||
- `track follow-wallet` returns trades from wallets followed on the GMGN platform; the follow list is resolved automatically from the GMGN user account bound to the API Key — `--wallet` is optional
|
||||
- Use `--raw` to get single-line JSON for further processing
|
||||
|
||||
@@ -6,11 +6,16 @@
|
||||
* Signed (swap and order routes): X-APIKEY + timestamp + client_id + X-Signature (private key signature)
|
||||
*/
|
||||
|
||||
import { createRequire } from "node:module";
|
||||
|
||||
import { buildAuthQuery, buildMessage, detectAlgorithm, sign } from "./signer.js";
|
||||
|
||||
const RATE_LIMIT_RETRY_BUFFER_MS = 1000;
|
||||
const DEFAULT_RATE_LIMIT_AUTO_RETRY_MAX_WAIT_MS = 5000;
|
||||
|
||||
const { version: CLI_VERSION } = createRequire(import.meta.url)("../../package.json") as { version: string };
|
||||
const USER_AGENT = `gmgn-cli/${CLI_VERSION}`;
|
||||
|
||||
interface PreparedRequest {
|
||||
method: string;
|
||||
subPath: string;
|
||||
@@ -314,7 +319,6 @@ export interface CreateTokenParams {
|
||||
// Multi-wallet buy
|
||||
buy_wallets?: BuyWalletInfo[];
|
||||
snip_buy_wallets?: BuyWalletInfo[];
|
||||
interval_seconds?: number;
|
||||
}
|
||||
|
||||
export class OpenApiClient {
|
||||
@@ -436,6 +440,14 @@ export class OpenApiClient {
|
||||
return this.authSignedRequest("GET", "/v1/trade/follow_wallet", { chain, ...extra }, null);
|
||||
}
|
||||
|
||||
async getFollowTokens(chain: string, walletAddress: string, extra: Record<string, string | number> = {}): Promise<unknown> {
|
||||
return this.authExistRequest("GET", "/v1/user/follow_tokens", { chain, wallet_address: walletAddress, ...extra });
|
||||
}
|
||||
|
||||
async getFollowGroupNames(chain: string, walletAddress: string): Promise<unknown> {
|
||||
return this.authExistRequest("GET", "/v1/user/follow_token_groups", { chain, wallet_address: walletAddress });
|
||||
}
|
||||
|
||||
async getKol(chain?: string, limit?: number): Promise<unknown> {
|
||||
const query: Record<string, string | number> = {};
|
||||
if (chain) query["chain"] = chain;
|
||||
@@ -523,6 +535,7 @@ export class OpenApiClient {
|
||||
const headers: Record<string, string> = {
|
||||
"X-APIKEY": this.apiKey,
|
||||
"Content-Type": "application/json",
|
||||
"User-Agent": USER_AGENT,
|
||||
};
|
||||
const bodyStr = body !== null ? JSON.stringify(body) : null;
|
||||
return {
|
||||
@@ -558,6 +571,7 @@ export class OpenApiClient {
|
||||
"X-APIKEY": this.apiKey,
|
||||
"X-Signature": signature,
|
||||
"Content-Type": "application/json",
|
||||
"User-Agent": USER_AGENT,
|
||||
};
|
||||
return {
|
||||
method,
|
||||
|
||||
@@ -66,7 +66,6 @@ export function registerCookingCommands(program: Command): void {
|
||||
// Multi-wallet buy
|
||||
.option("--buy-wallets <json>", "Multi-wallet buy config as JSON array [{from_address, buy_amt}]")
|
||||
.option("--snip-buy-wallets <json>", "Snipe-buy wallet config as JSON array [{from_address, buy_amt}]")
|
||||
.option("--interval-seconds <n>", "Interval between multi-wallet buys in seconds", parseInt)
|
||||
// CondMarket execution config + auto-sell (JSON)
|
||||
.option("--buy-trade-config <json>", "Buy-side trade config for CondMarket orders as JSON (TradeParam)")
|
||||
.option("--sell-trade-config <json>", "Sell-side trade config for auto-sell / pending_sell as JSON (TradeParam)")
|
||||
@@ -124,7 +123,6 @@ export function registerCookingCommands(program: Command): void {
|
||||
if (opts.bonkModel) params.bonk_model = opts.bonkModel;
|
||||
if (opts.buyWallets) params.buy_wallets = JSON.parse(opts.buyWallets);
|
||||
if (opts.snipBuyWallets) params.snip_buy_wallets = JSON.parse(opts.snipBuyWallets);
|
||||
if (opts.intervalSeconds != null) params.interval_seconds = opts.intervalSeconds;
|
||||
if (opts.buyTradeConfig) params.buy_trade_config = JSON.parse(opts.buyTradeConfig);
|
||||
if (opts.sellTradeConfig) params.sell_trade_config = JSON.parse(opts.sellTradeConfig);
|
||||
if (opts.sellConfigs) params.sell_configs = JSON.parse(opts.sellConfigs);
|
||||
|
||||
@@ -7,6 +7,47 @@ import { validateChain } from "../validate.js";
|
||||
export function registerTrackCommands(program: Command): void {
|
||||
const track = program.command("track").description("On-chain tracking commands: follow-wallet trades, KOL trades, Smart Money trades");
|
||||
|
||||
track
|
||||
.command("follow-tokens")
|
||||
.description("Get the followed token list for a wallet on a given chain")
|
||||
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
|
||||
.requiredOption("--wallet <address>", "Wallet address")
|
||||
.option("--group-id <id>", "Filter by group: all_group (all), default, or a user-defined group ID")
|
||||
.option("--interval <interval>", "Time interval for price change stats (e.g. 1m, 5m, 1h, 6h, 24h)")
|
||||
.option("--order-by <field>", "Sort field: created_at / swaps / volume / market_cap / liquidity / price / open_timestamp")
|
||||
.option("--direction <dir>", "Sort direction: asc / desc")
|
||||
.option("--limit <n>", "Page size", parseInt)
|
||||
.option("--cursor <cursor>", "Pagination cursor")
|
||||
.option("--search <text>", "Search by token name or address")
|
||||
.option("--raw", "Output raw JSON")
|
||||
.action(async (opts) => {
|
||||
validateChain(opts.chain);
|
||||
const extra: Record<string, string | number> = {};
|
||||
if (opts.groupId) extra["group_id"] = opts.groupId;
|
||||
if (opts.interval) extra["interval"] = opts.interval;
|
||||
if (opts.orderBy) extra["order_by"] = opts.orderBy;
|
||||
if (opts.direction) extra["direction"] = opts.direction;
|
||||
if (opts.limit != null) extra["limit"] = opts.limit;
|
||||
if (opts.cursor) extra["cursor"] = opts.cursor;
|
||||
if (opts.search) extra["search_text"] = opts.search;
|
||||
const client = new OpenApiClient(getConfig());
|
||||
const data = await client.getFollowTokens(opts.chain, opts.wallet, extra).catch(exitOnError);
|
||||
printResult(data, opts.raw);
|
||||
});
|
||||
|
||||
track
|
||||
.command("follow-token-groups")
|
||||
.description("Get the follow token group names for a wallet on a given chain")
|
||||
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
|
||||
.requiredOption("--wallet <address>", "Wallet address")
|
||||
.option("--raw", "Output raw JSON")
|
||||
.action(async (opts) => {
|
||||
validateChain(opts.chain);
|
||||
const client = new OpenApiClient(getConfig());
|
||||
const data = await client.getFollowGroupNames(opts.chain, opts.wallet).catch(exitOnError);
|
||||
printResult(data, opts.raw);
|
||||
});
|
||||
|
||||
track
|
||||
.command("follow-wallet")
|
||||
.description("Get follow-wallet trade records")
|
||||
|
||||
Reference in New Issue
Block a user