From ebf12e42f6e44e7b342fdeec3ccef1c61769a201 Mon Sep 17 00:00:00 2001 From: "Leon.Zhang" Date: Tue, 7 Apr 2026 16:40:48 +0800 Subject: [PATCH 1/2] add options infomation --- README.md | 756 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 668 insertions(+), 88 deletions(-) diff --git a/README.md b/README.md index 4cdc300..d873859 100644 --- a/README.md +++ b/README.md @@ -16,13 +16,19 @@ A CLI for AI-driven and human-operated DeFi workflows on the TRON network throug - [Configuration](#configuration) - [Wallet Configuration](#wallet-configuration) - [Network Configuration](#network-configuration) -- [Command Guide](#command-guide) +- [Command Reference](#command-reference) - [Wallet & Portfolio](#wallet--portfolio) - - [Price & Discovery](#price--discovery) + - [Price](#price) + - [Token](#token) - [Swap](#swap) + - [Pool](#pool) - [Liquidity](#liquidity) - - [Protocol & History](#protocol--history) - - [Generic Contract](#generic-contract) + - [Position](#position) + - [Pair](#pair) + - [Farm](#farm) + - [Protocol](#protocol) + - [Transaction](#transaction) + - [Contract](#contract) - [Global Flags](#global-flags) - [Output Modes](#output-modes) - [Built-In Token Symbols](#built-in-token-symbols) @@ -176,29 +182,78 @@ export TRONGRID_API_KEY="" export TRON_RPC_URL=https://your-tron-rpc.example ``` -## Command Guide +## Command Reference + +> Legend: `` = required argument, `[arg]` = optional argument. +> Options marked with **(required)** must be provided. All others are optional. ### Wallet & Portfolio -Inspect the active wallet and balances: +#### `wallet address` (read) + +Print the active wallet address. ```bash sun wallet address -sun wallet balances -sun wallet balances --owner TYourAddress --tokens TRX,TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t ``` -Related read-only portfolio commands: +No additional options. + +#### `wallet balances` (read) + +Fetch wallet token balances. + +```bash +sun wallet balances [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--owner
` | Wallet address to query | Active wallet | +| `--tokens ` | Comma-separated token list: `TRX,,...` | `TRX` | + +#### `position list` (read) + +List liquidity positions. + +```bash +sun position list [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--owner
` | Owner wallet address | — | +| `--pool ` | Filter by pool | — | +| `--protocol ` | Protocol filter (V2, V3, V4) | — | +| `--page ` | Page number | `1` | +| `--page-size ` | Page size | `20` | + +#### `position tick ` (read) + +Get tick data for a pool. ```bash -sun position list --owner TYourAddress -sun position tick -sun farm positions --owner TYourAddress +sun position tick [options] ``` -### Price & Discovery +| Option | Description | Default | +|--------|-------------|---------| +| `--page ` | Page number | `1` | +| `--page-size ` | Page size | `20` | + +### Price + +#### `price [token]` (read) + +Get token prices from SUN.IO. Accepts a built-in symbol or address. + +```bash +sun price [token] [options] +``` -Token prices: +| Option | Description | Default | +|--------|-------------|---------| +| `--address ` | Comma-separated token contract addresses | — | ```bash sun price TRX @@ -206,126 +261,651 @@ sun price USDT sun price --address TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t ``` -Token, pool, pair, and farm discovery: +### Token + +#### `token list` (read) + +Fetch tokens by address or protocol. ```bash -sun token list --protocol V3 -sun token search USDT -sun pool list --token TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t -sun pool search "TRX USDT" -sun pool top-apy --page-size 10 -sun pool hooks -sun pair info --token TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t -sun farm list +sun token list [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--address ` | Filter by token contract address | — | +| `--protocol ` | Protocol filter (V2, V3, V4) | — | +| `--page ` | Page number | `1` | +| `--page-size ` | Page size | `20` | +| `--sort ` | Sort field | — | +| `--no-blacklist` | Include blacklisted tokens | `false` | + +#### `token search ` (read) + +Fuzzy search for tokens by name or symbol. + +```bash +sun token search [options] ``` +| Option | Description | Default | +|--------|-------------|---------| +| `--protocol ` | Protocol filter | — | +| `--page ` | Page number | `1` | +| `--page-size ` | Page size | `20` | + ### Swap -High-level swap execution: +#### `swap ` (write) + +Execute a token swap via SunSwap Universal Router. ```bash -sun swap TRX USDT 1000000 --slippage 0.005 -sun -k your_private_key --network nile --yes swap TRX USDT 1000000 +sun swap [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--slippage ` | Slippage tolerance as decimal (e.g. 0.005 = 0.5%) | `0.005` | + +```bash +sun swap TRX USDT 1000000 +sun swap TRX USDT 1000000 --slippage 0.01 +``` + +#### `swap:quote ` (read) + +Get a swap quote without executing. + +```bash +sun swap:quote [options] ``` -Read-only quote: +| Option | Description | Default | +|--------|-------------|---------| +| `--all` | Show all available routes | `false` | ```bash sun swap:quote TRX USDT 1000000 sun swap:quote TRX USDT 1000000 --all ``` -Low-level router interaction: +#### `swap:quote-raw` (read) + +Low-level router quote call. + +```bash +sun swap:quote-raw [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--router
` | **(required)** Smart router contract address | — | +| `--fn ` | Quote function name | `quoteExactInput` | +| `--args ` | **(required)** Arguments as JSON array | — | +| `--abi ` | Router ABI as JSON array | — | + +#### `swap:exact-input` (write) + +Low-level router swap execution. + +```bash +sun swap:exact-input [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--router
` | **(required)** Smart router contract address | — | +| `--fn ` | Swap function name | `swapExactInput` | +| `--args ` | **(required)** Arguments as JSON array | — | +| `--value ` | TRX call value in Sun | — | +| `--abi ` | Router ABI as JSON array | — | + +### Pool + +#### `pool list` (read) + +List pools with filters. + +```bash +sun pool list [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--address ` | Filter by pool address | — | +| `--token ` | Filter by token (symbol or address) | — | +| `--protocol ` | Protocol filter (V2, V3, V4) | — | +| `--page ` | Page number | `1` | +| `--page-size ` | Page size | `20` | +| `--sort ` | Sort field | — | +| `--no-blacklist` | Include blacklisted pools | `false` | + +#### `pool search ` (read) + +Search pools by keyword. + +```bash +sun pool search [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--protocol ` | Protocol filter | — | +| `--page ` | Page number | `1` | +| `--page-size ` | Page size | `20` | + +#### `pool top-apy` (read) + +List top APY pools. + +```bash +sun pool top-apy [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--protocol ` | Protocol filter | — | +| `--page ` | Page number | `1` | +| `--page-size ` | Page size | `20` | + +#### `pool hooks` (read) + +List registered pool hooks. + +```bash +sun pool hooks +``` + +No additional options. + +#### `pool vol-history ` (read) + +Pool volume history over a date range. ```bash -sun swap:quote-raw --router --args '[...]' -sun swap:exact-input --router --args '[...]' --value 1000000 +sun pool vol-history [options] ``` -Successful broadcast responses include: +| Option | Description | Default | +|--------|-------------|---------| +| `--start ` | Start date (YYYY-MM-DD) | — | +| `--end ` | End date (YYYY-MM-DD) | — | + +#### `pool liq-history ` (read) -- `txid` -- route details when available -- `tronscanUrl` based on the selected network +Pool liquidity history over a date range. + +```bash +sun pool liq-history [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--start ` | Start date (YYYY-MM-DD) | — | +| `--end ` | End date (YYYY-MM-DD) | — | ### Liquidity -V2: +#### `liquidity v2:add` (write) + +Add V2 liquidity. Router address is auto-detected by network. + +```bash +sun liquidity v2:add [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--token-a ` | **(required)** Token A (symbol or address) | — | +| `--token-b ` | **(required)** Token B (symbol or address) | — | +| `--amount-a ` | Amount of token A (raw units) | — | +| `--amount-b ` | Amount of token B (raw units) | — | +| `--min-a ` | Minimum amount A | — | +| `--min-b ` | Minimum amount B | — | +| `--router
` | V2 router address | Auto by network | +| `--to
` | LP token recipient | Active wallet | +| `--deadline ` | Transaction deadline | — | +| `--abi ` | Custom router ABI | — | + +> Provide at least one of `--amount-a` or `--amount-b`. When only one is given, the other is auto-calculated from pool reserves. + +#### `liquidity v2:remove` (write) + +Remove V2 liquidity. + +```bash +sun liquidity v2:remove [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--token-a ` | **(required)** Token A | — | +| `--token-b ` | **(required)** Token B | — | +| `--liquidity ` | **(required)** LP token amount to remove | — | +| `--min-a ` | Minimum amount A | — | +| `--min-b ` | Minimum amount B | — | +| `--router
` | V2 router address | Auto by network | +| `--to
` | Token recipient | Active wallet | +| `--deadline ` | Transaction deadline | — | +| `--abi ` | Custom router ABI | — | + +#### `liquidity v3:mint` (write) + +Mint a new V3 concentrated liquidity position. Position Manager is auto-detected by network. ```bash -sun liquidity v2:add --token-a TRX --token-b USDT --amount-a 1000000 --amount-b 290000 -sun liquidity v2:remove --token-a TRX --token-b USDT --liquidity 500000 +sun liquidity v3:mint [options] ``` -V3: +| Option | Description | Default | +|--------|-------------|---------| +| `--token0 ` | **(required)** Token 0 (symbol or address) | — | +| `--token1 ` | **(required)** Token 1 (symbol or address) | — | +| `--fee ` | Pool fee tier | `3000` | +| `--tick-lower ` | Lower tick boundary | Auto by `sun-kit` | +| `--tick-upper ` | Upper tick boundary | Auto by `sun-kit` | +| `--amount0 ` | Amount of token 0 | — | +| `--amount1 ` | Amount of token 1 | — | +| `--min0 ` | Minimum amount 0 | — | +| `--min1 ` | Minimum amount 1 | — | +| `--pm
` | Position Manager address | Auto by network | +| `--recipient
` | NFT recipient | Active wallet | +| `--deadline ` | Transaction deadline | — | +| `--abi ` | Custom ABI | — | + +> Provide at least one of `--amount0` or `--amount1`. When only one is given, the other is auto-calculated. TRX is automatically converted to WTRX for V3 pool lookup. + +#### `liquidity v3:increase` (write) + +Increase liquidity on an existing V3 position. ```bash -sun liquidity v3:mint --token0 TRX --token1 USDT --amount0 1000000 -sun liquidity v3:increase --token-id 123 --amount0 500000 -sun liquidity v3:decrease --token-id 123 --liquidity 1000 -sun liquidity v3:collect --token-id 123 +sun liquidity v3:increase [options] ``` -V4: +| Option | Description | Default | +|--------|-------------|---------| +| `--token-id ` | **(required)** Position NFT token ID | — | +| `--amount0 ` | Amount of token 0 | — | +| `--amount1 ` | Amount of token 1 | — | +| `--min0 ` | Minimum amount 0 | — | +| `--min1 ` | Minimum amount 1 | — | +| `--token0 ` | Token 0 (needed for single-sided auto-compute) | — | +| `--token1 ` | Token 1 (needed for single-sided auto-compute) | — | +| `--fee ` | Pool fee (needed for single-sided auto-compute) | `3000` | +| `--pm
` | Position Manager address | Auto by network | +| `--deadline ` | Transaction deadline | — | +| `--abi ` | Custom ABI | — | + +> When providing only one amount, `--token0`, `--token1`, and `--fee` are required for auto-calculation. + +#### `liquidity v3:decrease` (write) + +Decrease liquidity on an existing V3 position. ```bash -sun liquidity v4:mint --token0 TRX --token1 USDT --amount0 1000000 -sun liquidity v4:mint --token0 TRX --token1 USDT --amount0 1000000 --create-pool -sun liquidity v4:increase --token-id 123 --token0 TRX --token1 USDT --amount0 500000 -sun liquidity v4:decrease --token-id 123 --liquidity 1000 --token0 TRX --token1 USDT -sun liquidity v4:collect --token-id 123 -sun liquidity v4:info --pm --token-id 123 +sun liquidity v3:decrease [options] ``` -### Protocol & History +| Option | Description | Default | +|--------|-------------|---------| +| `--token-id ` | **(required)** Position NFT token ID | — | +| `--liquidity ` | **(required)** Liquidity amount to remove | — | +| `--min0 ` | Minimum amount 0 | — | +| `--min1 ` | Minimum amount 1 | — | +| `--pm
` | Position Manager address | Auto by network | +| `--deadline ` | Transaction deadline | — | +| `--abi ` | Custom ABI | — | + +#### `liquidity v3:collect` (write) -Protocol analytics: +Collect accumulated fees from a V3 position. ```bash -sun protocol info -sun protocol vol-history --start 2026-01-01 --end 2026-03-01 -sun protocol users-history --start 2026-01-01 --end 2026-03-01 -sun protocol tx-history --start 2026-01-01 --end 2026-03-01 -sun protocol pools-history --start 2026-01-01 --end 2026-03-01 -sun protocol liq-history --start 2026-01-01 --end 2026-03-01 +sun liquidity v3:collect [options] ``` -Pool and transaction history: +| Option | Description | Default | +|--------|-------------|---------| +| `--token-id ` | **(required)** Position NFT token ID | — | +| `--recipient
` | Fee recipient | Active wallet | +| `--pm
` | Position Manager address | Auto by network | +| `--abi ` | Custom ABI | — | + +#### `liquidity v4:mint` (write) + +Mint a new V4 concentrated liquidity position. ```bash -sun pool vol-history --start 2026-01-01 --end 2026-03-01 -sun pool liq-history --start 2026-01-01 --end 2026-03-01 -sun tx scan --type swap --token TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t --start 2026-01-01 +sun liquidity v4:mint [options] ``` -### Generic Contract +| Option | Description | Default | +|--------|-------------|---------| +| `--token0 ` | **(required)** Token 0 | — | +| `--token1 ` | **(required)** Token 1 | — | +| `--fee ` | Pool fee tier | — | +| `--tick-lower ` | Lower tick boundary | Auto by `sun-kit` | +| `--tick-upper ` | Upper tick boundary | Auto by `sun-kit` | +| `--amount0 ` | Amount of token 0 | — | +| `--amount1 ` | Amount of token 1 | — | +| `--slippage ` | Slippage tolerance | — | +| `--sqrt-price ` | Initial sqrtPriceX96 (for pool creation) | — | +| `--create-pool` | Create the pool if it doesn't exist | `false` | +| `--recipient
` | NFT recipient | Active wallet | +| `--deadline ` | Transaction deadline | — | + +#### `liquidity v4:increase` (write) + +Increase liquidity on an existing V4 position. + +```bash +sun liquidity v4:increase [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--token-id ` | **(required)** Position NFT token ID | — | +| `--token0 ` | **(required)** Token 0 | — | +| `--token1 ` | **(required)** Token 1 | — | +| `--fee ` | Pool fee tier | — | +| `--amount0 ` | Amount of token 0 | — | +| `--amount1 ` | Amount of token 1 | — | +| `--slippage ` | Slippage tolerance | — | +| `--deadline ` | Transaction deadline | — | + +#### `liquidity v4:decrease` (write) + +Decrease liquidity on an existing V4 position. + +```bash +sun liquidity v4:decrease [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--token-id ` | **(required)** Position NFT token ID | — | +| `--liquidity ` | **(required)** Liquidity amount to remove | — | +| `--token0 ` | **(required)** Token 0 | — | +| `--token1 ` | **(required)** Token 1 | — | +| `--fee ` | Pool fee tier | — | +| `--min0 ` | Minimum amount 0 | — | +| `--min1 ` | Minimum amount 1 | — | +| `--slippage ` | Slippage tolerance | — | +| `--deadline ` | Transaction deadline | — | + +#### `liquidity v4:collect` (write) + +Collect accumulated fees from a V4 position. + +```bash +sun liquidity v4:collect [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--token-id ` | **(required)** Position NFT token ID | — | +| `--token0 ` | Token 0 | — | +| `--token1 ` | Token 1 | — | +| `--fee ` | Pool fee tier | — | +| `--deadline ` | Transaction deadline | — | + +#### `liquidity v4:info` (read) + +Get details about a V4 position. + +```bash +sun liquidity v4:info [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--pm
` | **(required)** Position Manager address | — | +| `--token-id ` | **(required)** Position NFT token ID | — | + +### Position + +#### `position list` (read) + +```bash +sun position list [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--owner
` | Owner address | — | +| `--pool ` | Filter by pool | — | +| `--protocol ` | Protocol filter | — | +| `--page ` | Page number | `1` | +| `--page-size ` | Page size | `20` | + +#### `position tick ` (read) + +```bash +sun position tick [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--page ` | Page number | `1` | +| `--page-size ` | Page size | `20` | + +### Pair + +#### `pair info` (read) + +Get token pair information. + +```bash +sun pair info [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--token ` | Token contract address | — | +| `--protocol ` | Protocol filter | — | +| `--page ` | Page number | `1` | +| `--page-size ` | Page size | `20` | + +### Farm + +#### `farm list` (read) + +List farming pools. + +```bash +sun farm list [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--farm ` | Filter by farm address | — | +| `--page ` | Page number | `1` | +| `--page-size ` | Page size | `20` | + +#### `farm tx` (read) + +List farming transaction history. + +```bash +sun farm tx [options] +``` + +| Option | Description | Default | +|--------|-------------|---------| +| `--owner
` | Owner address | — | +| `--farm ` | Filter by farm | — | +| `--type ` | Transaction type | — | +| `--start