agentleFS
BofAIBofAI/skills/sunswap/SKILL.md

SunSwap DEX Trading

Skill154 starsChanged 3 months agoMITView on GitHub

Execute token swaps, manage liquidity, and query market data on SunSwap DEX via the sun-cli.

  • Reads credentials
  • Installs packages

The file

Show its rules and text

We split this skill into the rules it gives an agent

28 rules. About 0 are common, 17 are distinctive, and 11 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈17

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read-only commands (price, quote, pool list, etc.) and --dry-run previews work without wallet credentials.

    line 52
  2. Very specific:

    Always use these flags when calling sun from an AI agent:

    line 58
  3. Very specific:

    Write operations add --yes to skip prompts:

    line 74
  4. Very specific:

    Before executing any write operation (swap, liquidity, contract send), the AI agent must perform the following checks.

    line 93
  5. Distinctive:

    Check wallet address and token balances.

    line 151
  6. Distinctive:

    Check balances for a specific owner address:

    line 161
  7. Distinctive:

    Use contract addresses instead of symbols:

    line 249
  8. Distinctive:

    Add or remove liquidity on SunSwap V2 AMM pools.

    line 265
  9. Distinctive:

    Create pool if it does not exist:

    line 396
  10. Distinctive:

    Search and inspect liquidity pools.

    line 442
  11. Distinctive:

    Search and list token metadata.

    line 484
  12. Distinctive:

    Read or send arbitrary TRON contract calls when higher-level commands are insufficient.

    line 626
  13. Distinctive:

    Read a contract (no wallet needed):

    line 628
  14. Distinctive:

    Verify balance ≥ amountIn.

    line 666
  15. Distinctive:

    Verify balance is sufficient for both amount0 and amount1.

    line 722
  16. Distinctive:

    After a successful transaction, mark it as done

    line 813
  17. Distinctive:

    Never retry a successful transaction

    line 814
  18. Distinctive:

    Verify tokenIn ≠ tokenOut before swap

    line 819
  19. Very specific:

    Verify --fee is one of: 100, 500, 3000, 10000 before V3 mint

    line 820
  20. Distinctive:

    Verify tick values are aligned to tick spacing before V3 mint

    line 821
  21. Very specific:

    Verify --network is one of: mainnet, nile, shasta

    line 822
  22. Very specific:

    Check wallet balances to confirm sufficient funds before any write operation

    line 823
  23. Very specific:

    Always check balance and get a quote before executing.

    line 835
  24. Very specific:

    For high-value operations (large amounts): Always use --dry-run first in addition to the quote:

    line 861
  25. Distinctive:

    When executing trades or liquidity operations, communicate clearly:

    line 873
  26. Distinctive:

    Ensure sufficient TRX for gas (100+ TRX recommended)

    line 940
  27. Very specific:

    Verify token balance with sun --json wallet balances

    line 942
  28. Very specific:

    Use --dry-run to verify transaction structure even when resources are insufficient

    line 948

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

SunSwap DEX Trading Skill

Quick Start

This skill enables AI agents to interact with SunSwap DEX on the TRON blockchain through sun-cli — a unified CLI for quoting swaps, executing trades, managing liquidity (V2/V3/V4), querying pools, prices, positions, and more.

Prerequisites

Wallet required for real writes only: Configure a supported sun-cli wallet source before swaps, liquidity changes, or contract send, then verify the public address with sun wallet address. Read-only queries and --dry-run previews do not need a wallet. The retired wallet and onboarding Skills are not prerequisites; wallet-cli accounts are not automatically available to sun-cli. Never request or display secret values in chat.

  1. Verify sun-cli:
    sun --version
    The required version is exactly 1.2.2. If it is missing or another version is installed, obtain approval before changing the global package:
    npm install -g @sun-protocol/sun-cli@1.2.2
  2. Configure wallet (required for write operations only):
    export TRON_PRIVATE_KEY="your_private_key_here"
    Alternative wallet sources: TRON_MNEMONIC or AGENT_WALLET_PASSWORD.
  3. Optional environment variables:
    export TRON_NETWORK=mainnet
    export TRONGRID_API_KEY=your_key

Read-only commands (price, quote, pool list, etc.) and --dry-run previews work without wallet credentials.


AI Agent Flags

Always use these flags when calling sun from an AI agent:

FlagPurpose
--jsonMachine-readable JSON output to stdout
--yesSkip interactive confirmation prompts
--dry-runSimulate write operations without sending transactions
--fieldsLimit output to specific comma-separated fields
--networkOverride network: mainnet, nile, shasta

Standard agent invocation pattern:

sun --json price TRX

Write operations add --yes to skip prompts:

sun --json --yes swap TRX USDT 100000000

WARNING: --network only accepts mainnet, nile, or shasta. Invalid network names silently fall back to mainnet without error. The AI agent must validate the network value before passing it.

WARNING: --dry-run only builds a transaction preview. It does NOT check balances, validate fee tiers, verify tick alignment, or reject same-token swaps. The agent must perform these validations before executing. See Agent Pre-Validation Checklist below.


Agent Pre-Validation Checklist

Before executing any write operation (swap, liquidity, contract send), the AI agent must perform the following checks. The CLI's --dry-run does not validate these — it only builds a transaction preview.

Before Swap

  1. Check balance is sufficient:
    sun --json wallet balances
    Compare the token balance against the amountIn. Abort if insufficient.
  2. Verify tokenIn ≠ tokenOut: Same-token swaps (e.g. TRX → TRX) are not rejected by --dry-run. The agent must check that the two tokens are different before executing.
  3. Validate slippage is reasonable: Recommended range: 0.001 (0.1%) to 0.05 (5%). Warn the user if outside this range.

Before V3 Liquidity (Mint)

  1. Use only valid fee tiers: 100, 500, 3000, or 10000. Invalid fee values (e.g. 9999) are not rejected by --dry-run.
  2. Ensure ticks are aligned to tick spacing:

    Fee ValueTick SpacingValid tick examples
    1001any integer
    50010-10, 0, 10, 20
    300060-120, -60, 0, 60
    10000200-400, -200, 0, 200

    Both --tick-lower and --tick-upper must be exact multiples of the tick spacing. Misaligned ticks are not rejected by --dry-run but will fail on-chain.

  3. Check balance is sufficient for both token0 and token1 amounts.

Before V3/V4 Position Operations (Increase/Decrease/Collect)

  1. Verify token-id exists: Query the user's positions first:
    sun --json position list --owner TMgYX7m37cyyTSgVbtCoDUAQcFZ9RoYxJW --protocol V3
    Confirm the target --token-id appears in the result. Passing a non-existent token-id may produce misleading errors (e.g. "amount required" instead of "position not found").

Before V2 Liquidity (Add)

  1. Check balance is sufficient for both token-a and token-b amounts.

General

  • Validate --network is one of: mainnet, nile, shasta. Invalid values silently fall back to mainnet.
  • Validate --type for tx scan is one of: swap, add, withdraw. Invalid values return empty results instead of errors.

Command Reference

1. Wallet

Check wallet address and token balances.

sun --json wallet address
sun --json wallet balances

Check balances for a specific owner address:

sun --json wallet balances --owner TDqSquXBgUCLYvYC4XZgrprLK589dkhSCf

Filter by specific tokens (contract addresses only, symbols like TRX/USDT are NOT supported):

sun --json wallet balances --tokens TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t,TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR

WARNING: --tokens only accepts contract addresses. Passing symbols (e.g. TRX,USDT) will return Invalid contract address provided. Use the address table in Supported Token Symbols to resolve symbols to addresses first.


2. Token Price

Fetch token prices from SUN.IO.

sun --json price TRX
sun --json price USDT

Query by contract address:

sun --json price --address TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t

3. Swap Quote (Read-Only)

Get a price quote without executing. No wallet required.

Parameters: tokenIn and tokenOut accept token symbols (TRX, USDT) or TRC20 addresses. amountIn is in sun (smallest unit, e.g. 1000000 = 1 TRX).

sun --json swap:quote TRX USDT 100000000

Quote with all route details:

sun --json swap:quote TRX USDT 100000000 --all

Quote on a specific network:

sun --json swap:quote TRX USDT 100000000 --network nile

Reverse direction:

sun --json swap:quote USDT TRX 1000000

4. Execute Swap

Execute a token swap through the SunSwap Universal Router.

Parameters: tokenIn and tokenOut accept symbols or addresses. amountIn is in sun. --slippage is a decimal (default: 0.005 = 0.5%).

sun --json --yes swap TRX USDT 100000000

Swap with custom slippage (1%):

sun --json --yes swap TRX USDT 100000000 --slippage 0.01

Dry-run (simulate without sending):

sun --json --yes --dry-run swap TRX USDT 100000000

Use contract addresses instead of symbols:

sun --json --yes swap T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t 100000000

Swap on nile testnet:

sun --json --yes swap TRX USDT 1000000 --network nile

5. V2 Liquidity

Add or remove liquidity on SunSwap V2 AMM pools.

Parameters for add: --token-a and --token-b accept symbols or addresses. --amount-a and --amount-b are in sun. Optional: --min-a, --min-b, --to, --deadline.

Parameters for remove: --token-a, --token-b, --liquidity (raw LP amount). Optional: --min-a, --min-b, --to, --deadline.

Add Liquidity

Single-side (auto-calculate other):

sun --json --yes liquidity v2:add --token-a TRX --token-b USDT --amount-a 1000000

Both sides:

sun --json --yes liquidity v2:add --token-a TRX --token-b USDT --amount-a 1000000 --amount-b 290000

Dry-run:

sun --json --yes --dry-run liquidity v2:add --token-a TRX --token-b USDT --amount-a 1000000

With minimum amounts and recipient:

sun --json --yes liquidity v2:add --token-a TRX --token-b USDT --amount-a 1000000 --amount-b 290000 --min-a 950000 --min-b 275000

Remove Liquidity

sun --json --yes liquidity v2:remove --token-a TRX --token-b USDT --liquidity 500000

Dry-run:

sun --json --yes --dry-run liquidity v2:remove --token-a TRX --token-b USDT --liquidity 500000

6. V3 Liquidity (Concentrated)

Manage concentrated liquidity positions on SunSwap V3.

Fee tiers (only these values are valid):

Fee RateFee ValueTick SpacingFull Range Ticks
0.01%1001-887272 / 887272
0.05%50010-887270 / 887270
0.3%300060-887220 / 887220
1%10000200-887200 / 887200

IMPORTANT: --fee must be exactly one of: 100, 500, 3000, 10000. Other values are NOT rejected by --dry-run but will fail on-chain.

--tick-lower and --tick-upper must be exact multiples of the tick spacing. Misaligned ticks are NOT rejected by --dry-run but will fail on-chain.

Parameters for mint: --token0, --token1 (symbol or address), --fee, --tick-lower, --tick-upper, --amount0, --amount1. Optional: --recipient, --deadline.

Mint New Position

Full-range with defaults:

sun --json --yes liquidity v3:mint --token0 TRX --token1 USDT --amount0 1000000

With specific fee and tick range (fee=3000, tick spacing=60):

sun --json --yes liquidity v3:mint --token0 TRX --token1 USDT --fee 3000 --tick-lower -887220 --tick-upper 887220 --amount0 1000000

Dry-run:

sun --json --yes --dry-run liquidity v3:mint --token0 TRX --token1 USDT --amount0 1000000

With specific fee tier (fee=500, tick spacing=10):

sun --json --yes liquidity v3:mint --token0 TRX --token1 USDT --fee 500 --tick-lower -887270 --tick-upper 887270 --amount0 1000000

With recipient:

sun --json --yes liquidity v3:mint --token0 TRX --token1 USDT --fee 3000 --tick-lower -60 --tick-upper 60 --amount0 1000000 --recipient TMgYX7m37cyyTSgVbtCoDUAQcFZ9RoYxJW

Increase Position

sun --json --yes liquidity v3:increase --token-id 123 --amount0 500000

Decrease Position

sun --json --yes liquidity v3:decrease --token-id 123 --liquidity 1000

Collect Fees

sun --json --yes liquidity v3:collect --token-id 123

7. V4 Liquidity

Manage liquidity on SunSwap V4 pools (with hooks support).

Parameters for mint: --token0, --token1, --fee, --tick-lower, --tick-upper, --amount0, --amount1. Optional: --slippage, --recipient, --create-pool.

Mint New Position

sun --json --yes liquidity v4:mint --token0 TRX --token1 USDT --amount0 1000000

Create pool if it does not exist:

sun --json --yes liquidity v4:mint --token0 TRX --token1 USDT --amount0 1000000 --create-pool

With slippage:

sun --json --yes liquidity v4:mint --token0 TRX --token1 USDT --amount0 1000000 --slippage 0.01

Dry-run:

sun --json --yes --dry-run liquidity v4:mint --token0 TRX --token1 USDT --amount0 1000000

Increase Position

sun --json --yes liquidity v4:increase --token-id 123 --token0 TRX --token1 USDT --amount0 500000

Decrease Position

sun --json --yes liquidity v4:decrease --token-id 123 --liquidity 1000 --token0 TRX --token1 USDT

Collect Fees

sun --json --yes liquidity v4:collect --token-id 123

Query Position Info

sun --json liquidity v4:info --pm TLSWrv7eC1AZCXkRjpqMZUmvgd99cj7pPF --token-id 123

8. Pool Discovery

Search and inspect liquidity pools.

List pools by token address:

sun --json pool list --token TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t

Search by keyword:

sun --json pool search "TRX USDT"

Top APY pools:

sun --json pool top-apy --page-size 10

Pool volume history (requires a pool address):

sun --json pool vol-history TSUUVjysXV8YqHytSNjfkNXnnB49QDvZpx --start 2026-01-01 --end 2026-03-15

Pool liquidity history:

sun --json pool liq-history TSUUVjysXV8YqHytSNjfkNXnnB49QDvZpx --start 2026-01-01 --end 2026-03-15

Pool hooks (V4):

sun --json pool hooks

9. Token Discovery

Search and list token metadata.

sun --json token list

Filter by protocol:

sun --json token list --protocol V3

Search by keyword:

sun --json token search USDT

10. Position Management

Query user liquidity positions.

List all positions for an owner:

sun --json position list --owner TMgYX7m37cyyTSgVbtCoDUAQcFZ9RoYxJW

Filter by protocol:

sun --json position list --owner TMgYX7m37cyyTSgVbtCoDUAQcFZ9RoYxJW --protocol V3

Pool tick info:

sun --json position tick TSUUVjysXV8YqHytSNjfkNXnnB49QDvZpx

11. Pair Info

Resolve trading pair information.

WARNING: pair info --token only accepts contract addresses. Passing a symbol (e.g. USDT) will fail with an API error or return unexpected results. Always resolve the symbol to a contract address first using the Supported Token Symbols table or token search.

Query by USDT contract address:

sun --json pair info --token TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t

Query by WTRX contract address:

sun --json pair info --token T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb

12. Protocol Analytics

Fetch protocol-level metrics.

sun --json protocol info
sun --json protocol vol-history --start 2026-01-01 --end 2026-03-15
sun --json protocol users-history --start 2026-01-01 --end 2026-03-15
sun --json protocol tx-history --start 2026-01-01 --end 2026-03-15
sun --json protocol pools-history --start 2026-01-01 --end 2026-03-15
sun --json protocol liq-history --start 2026-01-01 --end 2026-03-15

13. Farm

Inspect SUN.IO farms.

sun --json farm list

Farm transactions for a specific owner:

sun --json farm tx --owner TMgYX7m37cyyTSgVbtCoDUAQcFZ9RoYxJW --type stake

User farm positions:

sun --json farm positions --owner TMgYX7m37cyyTSgVbtCoDUAQcFZ9RoYxJW

14. Transaction Scan

Scan DEX transaction activity.

IMPORTANT: --type must be exactly one of: swap, add, withdraw. Invalid types return empty results instead of an error.

sun --json tx scan --type swap --token TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t --start 2026-01-01 --end 2026-03-15
sun --json tx scan --type add --start 2026-01-01 --end 2026-03-15
sun --json tx scan --type withdraw --start 2026-01-01 --end 2026-03-15

15. Generic Contract Calls

Read or send arbitrary TRON contract calls when higher-level commands are insufficient.

Read a contract (no wallet needed):

sun --json contract read TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t name
sun --json contract read TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t balanceOf --args '["TMgYX7m37cyyTSgVbtCoDUAQcFZ9RoYxJW"]'

Send a contract call (requires wallet, use --dry-run to simulate):

sun --json --yes --dry-run contract send TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t approve --args '["TKzxdSv2FZKQrEqkKVgp5DcwEXBEKMg2Ax","1000000"]' --value 0

Recommended Workflow for AI Agents

Pattern 1: Quick Swap (Three-Step with Validation)

Best for: User-facing swap operations.

Step 1 — Validate inputs (agent-side, no CLI call):

  • Confirm tokenIn ≠ tokenOut (same-token swaps like TRX→TRX are not rejected by CLI)
  • Confirm --network is valid (mainnet, nile, or shasta)

Step 2 — Check balance and get quote:

sun --json wallet balances
sun --json swap:quote TRX USDT 100000000

Verify balance ≥ amountIn. Show the user: expected output amount, price impact, route.

Step 3 — Execute after user confirms:

sun --json --yes swap TRX USDT 100000000 --slippage 0.005

Pattern 2: Safe Execution (Dry-Run First)

Best for: Large amounts or cautious operations.

NOTE: --dry-run only previews the transaction structure. It does NOT check balances, validate fee tiers, or reject invalid parameters.

Check balance first:

sun --json wallet balances

Simulate (preview transaction structure):

sun --json --yes --dry-run swap TRX USDT 100000000

Execute after reviewing dry-run result and confirming balance:

sun --json --yes swap TRX USDT 100000000

Pattern 3: Liquidity Management (V3 Example)

Best for: Adding concentrated liquidity.

Step 1 — Validate parameters (agent-side):

  • Confirm --fee is one of: 100, 500, 3000, 10000
  • Confirm --tick-lower and --tick-upper are multiples of tick spacing (e.g. 60 for fee=3000)
  • Confirm token0 ≠ token1

Step 2 — Check balances and pool info:

sun --json wallet balances
sun --json pool search "TRX USDT"

Verify balance is sufficient for both amount0 and amount1.

Step 3 — Dry-run mint (preview only, does not validate balances or parameters):

sun --json --yes --dry-run liquidity v3:mint --token0 TRX --token1 USDT --fee 3000 --tick-lower -887220 --tick-upper 887220 --amount0 1000000

Step 4 — Execute after user confirms:

sun --json --yes liquidity v3:mint --token0 TRX --token1 USDT --fee 3000 --tick-lower -887220 --tick-upper 887220 --amount0 1000000

Pattern 4: Information Gathering

Best for: Answering user questions about tokens, pools, prices.

Query token price:

sun --json price TRX

Top APY pools:

sun --json pool top-apy --page-size 10

User positions:

sun --json position list --owner TMgYX7m37cyyTSgVbtCoDUAQcFZ9RoYxJW

Pair info (requires contract address, not symbol):

sun --json pair info --token TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t

Limit output fields to reduce response size:

sun --json --fields address,network wallet address

Supported Token Symbols

sun-cli has built-in symbol resolution. Common symbols:

SymbolMainnet AddressDecimals
TRXT9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb6
WTRXTNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR6
USDTTR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t6
USDCTEkxiTehnzSmSe2XqrBj4w32RUN966rdz86
USDDTPYmHEhy5n8TCEfYGqW2rPxsghSfzghPDn18
SUNTSSMHYeV2uE9qYH95DqyoCuNCzEL1NvU3S18
JSTTCFLL5dx5ZJdKnWuesXxi1VPwjLVmWZZy918
BTTTAFjULxiVgT4qWk6UZwjqwZXTSaGaqnVp418
WINTLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU76

Any TRC20 token can also be referenced by its contract address directly.


Security Rules

CRITICAL: Never Display Private Keys

FORBIDDEN: private keys, seed phrases, mnemonics, environment variable values containing secrets, agent wallet passwords.

ALLOWED: public wallet addresses, transaction hashes, token balances and prices.

To verify no secrets leak in output:

sun --json wallet address

The output must not contain private key material.

CRITICAL: Prevent Duplicate Transactions

  • One user command = one transaction
  • After a successful transaction, mark it as done
  • Never retry a successful transaction

CRITICAL: Validate Inputs Before Execution

The CLI does not validate all inputs in --dry-run mode. The agent must:

  • Verify tokenIn ≠ tokenOut before swap
  • Verify --fee is one of: 100, 500, 3000, 10000 before V3 mint
  • Verify tick values are aligned to tick spacing before V3 mint
  • Verify --network is one of: mainnet, nile, shasta
  • Check wallet balances to confirm sufficient funds before any write operation

CRITICAL: Use Quote + Balance Check for High-Value Operations

sun --json wallet balances
sun --json swap:quote TRX USDT 1000000000

Always check balance and get a quote before executing. --dry-run only shows transaction structure and does NOT validate balances or parameters.

CRITICAL: Always Preview Before Write Operations

The AI agent must never execute a write operation (swap, liquidity add/remove/mint, contract send) without first showing the user a preview. The correct sequence is:

  1. Get a quote or dry-run to show what will happen
  2. Display the preview to the user (amounts, route, price impact, fees)
  3. Ask for explicit confirmation from the user
  4. Only then execute with --yes

WARNING: Do not pass --yes on the first call. Use --yes only after the user has reviewed a preview and confirmed. Skipping the preview violates the security protocol.

Correct pattern:

sun --json swap:quote TRX USDT 100000000

Show results to user. After user confirms:

sun --json --yes swap TRX USDT 100000000

For high-value operations (large amounts): Always use --dry-run first in addition to the quote:

sun --json --yes --dry-run swap TRX USDT 1000000000

Then execute only after user reviews both the quote and the dry-run result.


User Communication Protocol

When executing trades or liquidity operations, communicate clearly:

Before execution:

Getting quote for 100 TRX → USDT...

Quote received:
  100 TRX → 15.234 USDT
  Price Impact: 0.12%
  Route: TRX → WTRX → USDT

Proceed with swap?

After success:

Swap completed!
  Transaction: abc123def456...
  Explorer: https://tronscan.org/#/transaction/abc123def456...
  Swapped: 100 TRX → 15.234 USDT

Known Limitations

These are CLI-level behaviors that the AI agent must work around:

IssueAffected CommandsBehaviorAgent Workaround
--dry-run doesn't check balancesswap, liquidity v2:add, all V3/V4 opsReturns preview even if balance is insufficientCheck wallet balances before executing
--dry-run doesn't validate V3 fee tiersliquidity v3:mintAccepts invalid fees like 9999Only pass 100, 500, 3000, or 10000
--dry-run doesn't validate tick alignmentliquidity v3:mintAccepts misaligned ticksEnsure ticks are multiples of tick spacing
Same-token swap not rejectedswapAccepts TRX→TRX in dry-runVerify tokenIn ≠ tokenOut before calling
Invalid --network silently falls backAll commandsUnknown network names use mainnetOnly pass mainnet, nile, or shasta
Invalid --type returns empty resultstx scanUnknown types return empty list, no errorOnly pass swap, add, or withdraw
pair info --token needs addresspair infoSymbols cause API error or bad resultsUse contract addresses, not symbols
--tokens filter needs addresseswallet balancesSymbols like TRX,USDT cause Invalid contract address providedResolve symbols to addresses before calling
BigInt serialization in JSON outputcontract readFunctions returning large integers (e.g. totalSupply) may crash with Do not know how to serialize a BigIntWrap result with .toString() client-side, or avoid --json for these calls
V3 invalid --token-id error misleadingv3:increase, v3:decrease, v3:collectNon-existent token-id may report "amount required" instead of "position not found"Verify the token-id exists via position list before operating
AGENT_WALLET_PASSWORD needs wallet storewallet addressFails if ~/.agent-wallet directory is not initializedUse TRON_PRIVATE_KEY or TRON_MNEMONIC instead, or initialize wallet store first
Testnet transactions need bandwidth/energyAll write commands on nile/shastaReal execution may fail with resource errors even if dry-run succeedsEnsure test wallet has sufficient TRX staked for bandwidth and energy

Troubleshooting

"sun: command not found"

npm install -g @sun-protocol/sun-cli@1.2.2

"Wallet not configured" on real writes

Set one of: TRON_PRIVATE_KEY, TRON_MNEMONIC, or AGENT_WALLET_PASSWORD. --dry-run should return a preview without wallet credentials on @sun-protocol/sun-cli@1.2.2.

NOTE on AGENT_WALLET_PASSWORD: This mode requires an initialized wallet store at ~/.agent-wallet. If the directory does not exist, the CLI will fail with Secrets directory not found. Use TRON_PRIVATE_KEY or TRON_MNEMONIC for simpler setup. Only set one wallet source at a time.

"Network error" or "Timeout"

  • Check internet connectivity
  • For mainnet, set TRONGRID_API_KEY
  • Retry (network may be congested)

Transaction fails

  • Ensure sufficient TRX for gas (100+ TRX recommended)
  • Increase slippage: --slippage 0.01
  • Verify token balance with sun --json wallet balances

Testnet transaction fails with bandwidth/energy error

  • Nile and Shasta testnets require staked TRX for bandwidth and energy
  • Dry-run may succeed but real execution fails if the wallet lacks resources
  • Fund the test wallet with testnet TRX and stake for resources before testing
  • Use --dry-run to verify transaction structure even when resources are insufficient

  • Skill version: 2.0.0
  • Runtime dependency: @sun-protocol/sun-cli@1.2.2 Last Updated: 2026-07-09 Maintainer: Bank of AI Team

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.