support trenches & kol & smartmoney

This commit is contained in:
dev
2026-03-25 22:20:56 +08:00
parent 8301bf515f
commit 45fb37d51f
14 changed files with 407 additions and 25 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ EOF
When creating or updating any file in `skills/`:
- **Language**: English only — no bilingual content. SKILL.md files are read by AI, not humans.
- **Package runner**: Always use the pre-installed `gmgn-cli` binary (e.g. `gmgn-cli token info ...`). Never use `npx gmgn-cli` or `npx gmgn-cli@<version>` — npx downloads the package at runtime alongside live credentials. The package must be installed once with `npm install -g gmgn-cli@1.0.2`.
- **Package runner**: Always use the pre-installed `gmgn-cli` binary (e.g. `gmgn-cli token info ...`). Never use `npx gmgn-cli` or `npx gmgn-cli@<version>` — npx downloads the package at runtime alongside live credentials. The package must be installed once with `npm install -g gmgn-cli@1.1.0`.
- **Section order**: Sub-commands → Supported Chains → Prerequisites → Parameters/Options (if needed) → Usage Examples → Notes
- **`--raw` flag**: All commands support `--raw` for single-line JSON output. Always document it in the Notes section.
- **YAML frontmatter**: Quote `argument-hint` values that contain `|` characters to avoid YAML parsing errors.
+2 -2
View File
@@ -80,7 +80,7 @@ npx skills add GMGNAI/gmgn-skills
### 1.2 npm Global Install
```bash
npm install -g gmgn-cli@1.0.2
npm install -g gmgn-cli@1.1.0
```
### 1.3 Local Development
@@ -321,7 +321,7 @@ npx gmgn-cli order get --chain sol --order-id <order-id>
- Restrict config file permissions: `chmod 600 ~/.config/gmgn/.env`
- Never commit your `.env` file to version control — add it to `.gitignore`
- Do not share `GMGN_API_KEY` or `GMGN_PRIVATE_KEY` in logs, screenshots, or chat messages
- 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
- 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
**Disclaimer**
+2 -2
View File
@@ -80,7 +80,7 @@ npx skills add GMGNAI/gmgn-skills
### 1.2 npm 全局安装
```bash
npm install -g gmgn-cli@1.0.2
npm install -g gmgn-cli@1.1.0
```
### 1.3 本地开发
@@ -321,7 +321,7 @@ npx gmgn-cli order get --chain sol --order-id <order-id>
- 限制配置文件权限:`chmod 600 ~/.config/gmgn/.env`
- 不要将 `.env` 文件提交到版本控制系统,请将其加入 `.gitignore`
- 不要在日志、截图或聊天中泄露 `GMGN_API_KEY` 或 `GMGN_PRIVATE_KEY`
- 使用固定版本安装(`npm install -g gmgn-cli@1.0.2`),而非 `npx gmgn-cli`,以避免在持有凭证的环境中执行未预期的包更新
- 使用固定版本安装(`npm install -g gmgn-cli@1.1.0`),而非 `npx gmgn-cli`,以避免在持有凭证的环境中执行未预期的包更新
**免责声明**
+121
View File
@@ -255,6 +255,127 @@ npx gmgn-cli portfolio token-balance \
---
## market trenches
Query Trenches token lists (new creation, near completion, completed).
```bash
npx gmgn-cli market trenches --chain <chain> [--raw]
```
| Option | Required | Description |
|--------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` |
**Response:** `data.new_creation`, `data.pump`, `data.completed` — each is an array of `RankItem` (same structure as `market trending` rank items).
---
## portfolio follow-wallet
Query follow-wallet trade records.
```bash
npx gmgn-cli portfolio follow-wallet \
--chain <chain> \
[--wallet <wallet_address>] \
[--base-token <token_address>] \
[--page-token <cursor>] \
[--limit <n>] \
[--side <side>] \
[--cost <cost>] \
[--filter <tag>] \
[--with-balance] \
[--with-security] \
[--min-amount-usd <n>] \
[--max-amount-usd <n>] \
[--is-gray] \
[--raw]
```
| Option | Required | Description |
|--------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` / `eth` |
| `--wallet` | No | Filter by wallet address |
| `--base-token` | No | Filter by base token address |
| `--page-token` | No | Pagination cursor |
| `--limit` | No | Page size (1200, default 100) |
| `--side` | No | Trade direction filter |
| `--cost` | No | Cost filter |
| `--filter` | No | Filter conditions (repeatable) |
| `--with-balance` | No | Include balance in response |
| `--with-security` | No | Include security info in response |
| `--min-amount-usd` | No | Minimum trade amount (USD) |
| `--max-amount-usd` | No | Maximum trade amount (USD) |
| `--is-gray` | No | Gray mode filter |
---
## portfolio kol
Query KOL trade records (SOL chain).
```bash
npx gmgn-cli portfolio kol [--limit <n>] [--raw]
```
| Option | Required | Description |
|--------|----------|-------------|
| `--limit` | No | Page size (1200, default 100) |
---
## portfolio smartmoney
Query Smart Money trade records (SOL chain).
```bash
npx gmgn-cli portfolio smartmoney [--limit <n>] [--raw]
```
| Option | Required | Description |
|--------|----------|-------------|
| `--limit` | No | Page size (1200, default 100) |
---
## order quote
Get a swap quote without submitting a transaction. Uses normal auth — no private key required.
```bash
npx gmgn-cli order quote \
--chain <chain> \
--from <wallet_address> \
--input-token <input_token_address> \
--output-token <output_token_address> \
--amount <input_amount> \
--slippage <n> \
[--raw]
```
| Option | Required | Description |
|--------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` |
| `--from` | Yes | Wallet address (must match API Key binding) |
| `--input-token` | Yes | Input token contract address |
| `--output-token` | Yes | Output token contract address |
| `--amount` | Yes | Input amount (smallest unit) |
| `--slippage` | Yes | Slippage tolerance, e.g. `0.01` = 1% |
**Response fields (data):**
| Field | Type | Description |
|-------|------|-------------|
| `input_token` | string | Input token contract address |
| `output_token` | string | Output token contract address |
| `input_amount` | string | Input amount (smallest unit) |
| `output_amount` | string | Expected output amount (smallest unit) |
| `min_output_amount` | string | Minimum output after slippage |
| `slippage` | number | Actual slippage percentage |
---
## swap
Submit a token swap. **Requires `GMGN_PRIVATE_KEY` configured in `.env`.**
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "gmgn-cli",
"version": "1.0.1",
"version": "1.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "gmgn-cli",
"version": "1.0.1",
"version": "1.1.0",
"license": "MIT",
"dependencies": {
"commander": "^12.1.0",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "gmgn-cli",
"version": "1.0.2",
"version": "1.1.0",
"description": "GMGN OpenAPI CLI — call GMGN market, token, portfolio and swap APIs from the command line",
"type": "module",
"bin": {
@@ -16,7 +16,7 @@
"scripts": {
"build": "tsc",
"dev": "tsx src/index.ts",
"prepublishOnly": "npm run build",
"prepublishOnly": "npm run build",
"publish:provenance": "npm publish --provenance --access public"
},
"dependencies": {
+18 -4
View File
@@ -1,10 +1,10 @@
---
name: gmgn-market
description: Query GMGN market data — token K-line (candlestick) and trending token swap data. Supports sol / bsc / base.
argument-hint: "kline --chain <sol|bsc|base> --address <token_address> --resolution <1m|5m|15m|1h|4h|1d> [--from <unix_ts>] [--to <unix_ts>] | trending --chain <sol|bsc|base> --interval <1m|5m|1h|6h|24h>"
description: Query GMGN market data — token K-line (candlestick), trending token swap data, and Trenches token lists. Supports sol / bsc / base.
argument-hint: "kline --chain <sol|bsc|base> --address <token_address> --resolution <1m|5m|15m|1h|4h|1d> [--from <unix_ts>] [--to <unix_ts>] | trending --chain <sol|bsc|base> --interval <1m|5m|1h|6h|24h> | trenches --chain <sol|bsc|base>"
---
Use the `gmgn-cli` tool to query K-line data for a token or browse trending tokens.
Use the `gmgn-cli` tool to query K-line data for a token, browse trending tokens, or view Trenches token lists.
## Sub-commands
@@ -12,6 +12,7 @@ Use the `gmgn-cli` tool to query K-line data for a token or browse trending toke
|-------------|-------------|
| `market kline` | Token candlestick data |
| `market trending` | Trending token swap data |
| `market trenches` | Trenches token lists (new creation, near completion, completed) |
## Supported Chains
@@ -21,7 +22,7 @@ Use the `gmgn-cli` tool to query K-line data for a token or browse trending toke
- `.env` file with `GMGN_API_KEY` set
- Run from the directory where your `.env` file is located, or set `GMGN_HOST` in your environment
- `gmgn-cli` installed globally: `npm install -g gmgn-cli@1.0.2`
- `gmgn-cli` installed globally: `npm install -g gmgn-cli@1.1.0`
## Kline Parameters
@@ -135,6 +136,19 @@ For each token, offer:
- **Deep dive**: `token info` + `token security` for full due diligence
- **Swap**: execute directly if the user is satisfied with the trending data alone
## Trenches Parameters
| Parameter | Required | Description |
|-----------|----------|-------------|
| `--chain` | Yes | `sol` / `bsc` / `base` |
Response fields: `data.new_creation`, `data.pump`, `data.completed` — each is an array of `RankItem` (same fields as `market trending` rank items).
```bash
# Trenches token lists on SOL
gmgn-cli market trenches --chain sol --raw
```
## Notes
- `market kline`: `--from` and `--to` are Unix timestamps in **seconds** — CLI converts to milliseconds automatically
+46 -3
View File
@@ -1,7 +1,7 @@
---
name: gmgn-portfolio
description: Query GMGN wallet portfolio — API Key wallet info, holdings, transaction activity, trading stats, and token balance. Supports sol / bsc / base.
argument-hint: "<info|holdings|activity|stats|token-balance> [--chain <sol|bsc|base>] [--wallet <wallet_address>]"
description: Query GMGN wallet portfolio — API Key wallet info, holdings, transaction activity, trading stats, token balance, follow-wallet trades, KOL trades, and Smart Money trades. Supports sol / bsc / base.
argument-hint: "<info|holdings|activity|stats|token-balance|follow-wallet|kol|smartmoney> [--chain <sol|bsc|base>] [--wallet <wallet_address>]"
---
Use the `gmgn-cli` tool to query wallet portfolio data based on the user's request.
@@ -15,6 +15,9 @@ Use the `gmgn-cli` tool to query wallet portfolio data based on the user's reque
| `portfolio activity` | Transaction history |
| `portfolio stats` | Trading statistics (supports batch) |
| `portfolio token-balance` | Token balance for a specific token |
| `portfolio follow-wallet` | Follow-wallet trade records |
| `portfolio kol` | KOL trade records (SOL chain) |
| `portfolio smartmoney` | Smart Money trade records (SOL chain) |
## Supported Chains
@@ -24,7 +27,7 @@ Use the `gmgn-cli` tool to query wallet portfolio data based on the user's reque
- `.env` file with `GMGN_API_KEY` set
- Run from the directory where your `.env` file is located, or set `GMGN_HOST` in your environment
- `gmgn-cli` installed globally: `npm install -g gmgn-cli@1.0.2`
- `gmgn-cli` installed globally: `npm install -g gmgn-cli@1.1.0`
## Usage Examples
@@ -101,6 +104,46 @@ The activity response includes a `next` field. Pass it to `--cursor` to fetch th
|--------|-------------|
| `--period <period>` | Stats period: `7d` / `30d` (default `7d`) |
## Follow-Wallet Options
| Option | Description |
|--------|-------------|
| `--chain` | Required. `sol` / `bsc` / `base` / `eth` |
| `--wallet <address>` | Filter by wallet address |
| `--base-token <address>` | Filter by base token address |
| `--page-token <cursor>` | Pagination cursor |
| `--limit <n>` | Page size (1200, default 100) |
| `--side <side>` | Trade direction filter |
| `--cost <cost>` | Cost filter |
| `--filter <tag...>` | Repeatable filter conditions |
| `--with-balance` | Include balance in response |
| `--with-security` | Include security info in response |
| `--min-amount-usd <n>` | Minimum trade amount (USD) |
| `--max-amount-usd <n>` | Maximum trade amount (USD) |
| `--is-gray` | Gray mode filter |
## KOL / Smart Money Options
| Option | Description |
|--------|-------------|
| `--limit <n>` | Page size (1200, default 100) |
Both `kol` and `smartmoney` return SOL chain data only — no `--chain` flag needed.
```bash
# Follow-wallet trades filtered by wallet
gmgn-cli portfolio follow-wallet --chain sol --wallet <wallet_address>
# Follow-wallet with balance info
gmgn-cli portfolio follow-wallet --chain sol --with-balance --limit 20
# KOL trade records
gmgn-cli portfolio kol --limit 10 --raw
# Smart Money trade records
gmgn-cli portfolio smartmoney --limit 10 --raw
```
## Notes
- All portfolio commands use normal auth (API Key only, no signature required)
+27 -1
View File
@@ -20,6 +20,7 @@ Use the `gmgn-cli` tool to submit a token swap or query an existing order. **Req
| Sub-command | Description |
|-------------|-------------|
| `swap` | Submit a token swap |
| `order quote` | Get a swap quote (no transaction submitted) |
| `order get` | Query order status |
## Supported Chains
@@ -45,7 +46,7 @@ Both `GMGN_API_KEY` and `GMGN_PRIVATE_KEY` must be set in `.env`. The private ke
`gmgn-cli` must be installed globally before use (one-time setup):
```bash
npm install -g gmgn-cli@1.0.2
npm install -g gmgn-cli@1.1.0
```
### Credential Model
@@ -92,6 +93,31 @@ gmgn-cli swap \
--percent 50
```
## Quote Usage
Get an estimated output amount before submitting a swap. Uses normal auth — no private key required.
```bash
gmgn-cli order quote \
--chain sol \
--from <wallet_address> \
--input-token <input_token_address> \
--output-token <output_token_address> \
--amount <input_amount_smallest_unit> \
--slippage 0.01
```
### Quote Response Fields
| Field | Type | Description |
|-------|------|-------------|
| `input_token` | string | Input token contract address |
| `output_token` | string | Output token contract address |
| `input_amount` | string | Input amount (smallest unit) |
| `output_amount` | string | Expected output amount (smallest unit) |
| `min_output_amount` | string | Minimum output after slippage |
| `slippage` | number | Actual slippage percentage |
## Order Query
```bash
+1 -1
View File
@@ -24,7 +24,7 @@ Use the `gmgn-cli` tool to query token information based on the user's request.
- `.env` file with `GMGN_API_KEY` set
- Run from the directory where your `.env` file is located, or set `GMGN_HOST` in your environment
- `gmgn-cli` installed globally: `npm install -g gmgn-cli@1.0.2`
- `gmgn-cli` installed globally: `npm install -g gmgn-cli@1.1.0`
## Info / Security / Pool Options
+81 -3
View File
@@ -75,10 +75,13 @@ export class OpenApiClient {
chain: string,
address: string,
resolution: string,
from: number,
to: number
from?: number,
to?: number
): Promise<unknown> {
return this.normalRequest("GET", "/v1/market/token_kline", { chain, address, resolution, from, to });
const query: Record<string, string | number> = { chain, address, resolution };
if (from != null) query["from"] = from;
if (to != null) query["to"] = to;
return this.normalRequest("GET", "/v1/market/token_kline", query);
}
// ---- Portfolio endpoints (normal auth) ----
@@ -123,6 +126,11 @@ export class OpenApiClient {
return this.normalRequest("GET", "/v1/user/wallet_token_balance", { chain, wallet_address: walletAddress, token_address: tokenAddress });
}
async getTrenches(chain: string): Promise<unknown> {
const body = buildTrenchesBody(chain);
return this.normalRequest("POST", "/v1/trenches", { chain }, body);
}
// ---- Market trending endpoints (normal auth) ----
async getTrendingSwaps(
@@ -139,6 +147,35 @@ export class OpenApiClient {
return this.normalRequest("GET", "/v1/user/info", {});
}
async getFollowWallet(chain: string, extra: Record<string, string | number | string[]> = {}): Promise<unknown> {
return this.normalRequest("GET", "/v1/trade/follow_wallet", { chain, ...extra });
}
async getKol(limit?: number): Promise<unknown> {
const query: Record<string, string | number> = {};
if (limit != null) query["limit"] = limit;
return this.normalRequest("GET", "/v1/user/kol", query);
}
async getSmartMoney(limit?: number): Promise<unknown> {
const query: Record<string, string | number> = {};
if (limit != null) query["limit"] = limit;
return this.normalRequest("GET", "/v1/user/smartmoney", query);
}
async quoteOrder(
chain: string,
from_address: string,
input_token: string,
output_token: string,
input_amount: string,
slippage: number
): Promise<unknown> {
return this.normalRequest("GET", "/v1/trade/quote", {
chain, from_address, input_token, output_token, input_amount, slippage,
});
}
// ---- Swap endpoints (critical auth) ----
async swap(params: SwapParams): Promise<unknown> {
@@ -269,6 +306,47 @@ function formatCurl(method: string, url: string, headers: Record<string, string>
return `\n[curl]\ncurl -X ${method} '${url}' \\\n${headerArgs}${bodyArg}\n`;
}
const TRENCHES_PLATFORMS: Record<string, string[]> = {
sol: [
"Pump.fun", "pump_mayhem", "pump_mayhem_agent", "pump_agent",
"letsbonk", "bonkers", "bags", "memoo", "liquid", "bankr", "zora",
"surge", "anoncoin", "moonshot_app", "wendotdev", "heaven", "sugar",
"token_mill", "believe", "trendsfun", "trends_fun", "jup_studio",
"Moonshot", "boop", "ray_launchpad", "meteora_virtual_curve", "xstocks",
],
bsc: [
"fourmeme", "fourmeme_agent", "bn_fourmeme", "four_xmode_agent",
"flap", "clanker", "lunafun",
],
base: [
"clanker", "bankr", "flaunch", "zora", "zora_creator",
"baseapp", "basememe", "virtuals_v2", "klik",
],
};
const TRENCHES_QUOTE_ADDRESS_TYPES: Record<string, number[]> = {
sol: [4, 5, 3, 1, 13, 0],
bsc: [6, 7, 1, 16, 8, 3, 9, 10, 2, 17, 18, 0],
base: [11, 3, 12, 13, 0],
};
function buildTrenchesBody(chain: string): Record<string, unknown> {
const launchpad_platform = TRENCHES_PLATFORMS[chain] ?? [];
const quote_address_type = TRENCHES_QUOTE_ADDRESS_TYPES[chain] ?? [];
const section = {
filters: ["offchain", "onchain"],
launchpad_platform,
quote_address_type,
launchpad_platform_v2: true,
};
return {
new_creation: { ...section, limit: 60 },
near_completion: { ...section, limit: 120 },
completed: { ...section, limit: 60 },
version: "v2",
};
}
function buildUrl(base: string, query: Record<string, string | number | string[]>): string {
const params = new URLSearchParams();
for (const [k, v] of Object.entries(query)) {
+21 -3
View File
@@ -13,15 +13,21 @@ export function registerMarketCommands(program: Command): void {
.requiredOption("--chain <chain>", "Chain: sol / bsc / base")
.requiredOption("--address <address>", "Token contract address")
.requiredOption("--resolution <resolution>", "Candlestick resolution: 1m / 5m / 15m / 1h / 4h / 1d")
.requiredOption("--from <timestamp>", "Start time (Unix seconds)", parseInt)
.requiredOption("--to <timestamp>", "End time (Unix seconds)", parseInt)
.option("--from <timestamp>", "Start time (Unix seconds)", parseInt)
.option("--to <timestamp>", "End time (Unix seconds)", parseInt)
.option("--raw", "Output raw JSON")
.action(async (opts) => {
validateChain(opts.chain);
validateAddress(opts.address, opts.chain, "--address");
const client = new OpenApiClient(getConfig());
const data = await client
.getTokenKline(opts.chain, opts.address, opts.resolution, opts.from * 1000, opts.to * 1000)
.getTokenKline(
opts.chain,
opts.address,
opts.resolution,
opts.from != null ? opts.from * 1000 : undefined,
opts.to != null ? opts.to * 1000 : undefined
)
.catch(exitOnError);
printResult(data, opts.raw);
});
@@ -50,5 +56,17 @@ export function registerMarketCommands(program: Command): void {
const data = await client.getTrendingSwaps(opts.chain, opts.interval, extra).catch(exitOnError);
printResult(data, opts.raw);
});
market
.command("trenches")
.description("Get Trenches token data (new creation, near completion, completed)")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base")
.option("--raw", "Output raw JSON")
.action(async (opts) => {
validateChain(opts.chain);
const client = new OpenApiClient(getConfig());
const data = await client.getTrenches(opts.chain).catch(exitOnError);
printResult(data, opts.raw);
});
}
+60 -1
View File
@@ -62,7 +62,7 @@ export function registerPortfolioCommands(program: Command): void {
validateAddress(opts.wallet, opts.chain, "--wallet");
if (opts.token) validateAddress(opts.token, opts.chain, "--token");
const extra: Record<string, string | number | string[]> = {};
if (opts.token) extra["token"] = opts.token;
if (opts.token) extra["token_address"] = opts.token;
if (opts.limit != null) extra["limit"] = opts.limit;
if (opts.cursor) extra["cursor"] = opts.cursor;
if (opts.type?.length) extra["type"] = opts.type;
@@ -112,5 +112,64 @@ export function registerPortfolioCommands(program: Command): void {
const data = await client.getWalletTokenBalance(opts.chain, opts.wallet, opts.token).catch(exitOnError);
printResult(data, opts.raw);
});
portfolio
.command("follow-wallet")
.description("Get follow-wallet trade records")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base / eth")
.option("--wallet <address>", "Filter by wallet address")
.option("--base-token <address>", "Filter by base token address")
.option("--page-token <cursor>", "Pagination cursor")
.option("--limit <n>", "Page size (1200, default 100)", parseInt)
.option("--side <side>", "Trade direction filter")
.option("--cost <cost>", "Cost filter")
.option("--filter <tag...>", "Filter conditions, repeatable")
.option("--with-balance", "Include balance in response")
.option("--with-security", "Include security info in response")
.option("--min-amount-usd <n>", "Minimum trade amount (USD)", parseFloat)
.option("--max-amount-usd <n>", "Maximum trade amount (USD)", parseFloat)
.option("--is-gray", "Gray mode filter")
.option("--raw", "Output raw JSON")
.action(async (opts) => {
validateChain(opts.chain);
const extra: Record<string, string | number | string[]> = {};
if (opts.wallet) extra["wallet_address"] = opts.wallet;
if (opts.baseToken) extra["base_token"] = opts.baseToken;
if (opts.pageToken) extra["page_token"] = opts.pageToken;
if (opts.limit != null) extra["limit"] = opts.limit;
if (opts.side) extra["side"] = opts.side;
if (opts.cost) extra["cost"] = opts.cost;
if (opts.filter?.length) extra["filters"] = opts.filter;
if (opts.withBalance) extra["with_balance"] = "true";
if (opts.withSecurity) extra["with_security"] = "true";
if (opts.minAmountUsd != null) extra["min_amount_usd"] = opts.minAmountUsd;
if (opts.maxAmountUsd != null) extra["max_amount_usd"] = opts.maxAmountUsd;
if (opts.isGray) extra["is_gray"] = "true";
const client = new OpenApiClient(getConfig());
const data = await client.getFollowWallet(opts.chain, extra).catch(exitOnError);
printResult(data, opts.raw);
});
portfolio
.command("kol")
.description("Get KOL trade records (SOL chain)")
.option("--limit <n>", "Page size (1200, default 100)", parseInt)
.option("--raw", "Output raw JSON")
.action(async (opts) => {
const client = new OpenApiClient(getConfig());
const data = await client.getKol(opts.limit).catch(exitOnError);
printResult(data, opts.raw);
});
portfolio
.command("smartmoney")
.description("Get Smart Money trade records (SOL chain)")
.option("--limit <n>", "Page size (1200, default 100)", parseInt)
.option("--raw", "Output raw JSON")
.action(async (opts) => {
const client = new OpenApiClient(getConfig());
const data = await client.getSmartMoney(opts.limit).catch(exitOnError);
printResult(data, opts.raw);
});
}
+23
View File
@@ -60,6 +60,29 @@ export function registerSwapCommands(program: Command): void {
const order = program.command("order").description("Order management commands");
order
.command("quote")
.description("Get a swap quote without submitting a transaction")
.requiredOption("--chain <chain>", "Chain: sol / bsc / base")
.requiredOption("--from <address>", "Wallet address (must match API Key binding)")
.requiredOption("--input-token <address>", "Input token contract address")
.requiredOption("--output-token <address>", "Output token contract address")
.requiredOption("--amount <amount>", "Input amount (smallest unit)")
.requiredOption("--slippage <n>", "Slippage tolerance (e.g. 0.01 = 1%)", parseFloat)
.option("--raw", "Output raw JSON")
.action(async (opts) => {
validateChain(opts.chain);
validateAddress(opts.from, opts.chain, "--from");
validateAddress(opts.inputToken, opts.chain, "--input-token");
validateAddress(opts.outputToken, opts.chain, "--output-token");
validatePositiveInt(opts.amount, "--amount");
const client = new OpenApiClient(getConfig());
const data = await client
.quoteOrder(opts.chain, opts.from, opts.inputToken, opts.outputToken, opts.amount, opts.slippage)
.catch(exitOnError);
printResult(data, opts.raw);
});
order
.command("get")
.description("Query order status (requires private key)")