diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 443a6f15..3cc59ee6 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -8,6 +8,7 @@ on: - update-mcp-server - ai-bankofai-patch-1 - x402-sdk-1.0.0-update + - Refactor tags: - 'test' pull_request: @@ -17,6 +18,7 @@ on: - update-mcp-server - ai-bankofai-patch-1 - x402-sdk-1.0.0-update + - Refactor workflow_dispatch: # Intentionally unrestricted — allows manual builds from any branch for flexibility env: diff --git a/changelog/8004.md b/changelog/8004.md new file mode 100644 index 00000000..1e84124f --- /dev/null +++ b/changelog/8004.md @@ -0,0 +1,49 @@ +--- +title: '8004 Protocol' +description: 'Release notes for the 8004 Protocol.' +--- + +# 8004 Protocol + +Release notes for the 8004 Protocol. + +
+
Mar 2, 2026
+
+ +### GitHub organization moved + +
Update
+ +- Repository links moved from `bankofai` to **`BofAI`**. Old URLs redirect, but update any pinned clone or dependency reference. + +
+
+ +
+
Feb 12, 2026
+
+ +### v1.1.0 + +
New Release
+ +- Added **Supported Networks** and **Contract Addresses** pages so you can confirm where the registry is deployed before you register. +- Published the Usage set: **Install**, **Configure Agents**, and **HTTP Registration**. +- Rewrote the **Quick Start** around registering your first agent end to end. + +
+
+ +
+
Feb 11, 2026
+
+ +### First documentation + +
New
+ +- Initial 8004 Protocol docs — what on-chain agent identity is for, and how to get started. + +
+
diff --git a/changelog/agent-wallet.md b/changelog/agent-wallet.md new file mode 100644 index 00000000..cadb15ee --- /dev/null +++ b/changelog/agent-wallet.md @@ -0,0 +1,35 @@ +--- +title: 'Agent Wallet' +description: 'Release notes for Agent Wallet.' +--- + +# Agent Wallet + +Release notes for Agent Wallet. + +
+
Apr 15, 2026
+
+ +### Introduction and quick install + +
Docs
+ +- Added an **Introduction** covering how keys are stored and how signing works, plus a **Quick Start** for creating your first wallet. + +
+
+ +
+
Mar 22, 2026
+
+ +### Developer docs — and a password-handling fix + +
NewSecurity
+ +- Published the developer set: **CLI Reference**, **SDK Guide**, and **SDK Cookbook**. +- **Security fix**: the setup docs previously used `echo $AGENT_WALLET_PASSWORD`, which prints your wallet password to the terminal and leaves it in shell history. Those examples have been removed. If you followed the old instructions, clear your shell history and consider rotating the password. + +
+
diff --git a/changelog/index.md b/changelog/index.md new file mode 100644 index 00000000..9b2d440c --- /dev/null +++ b/changelog/index.md @@ -0,0 +1,255 @@ +--- +title: 'Changelogs' +description: 'Product updates and announcements for BANK OF AI — all products, newest first.' +--- + +# Changelogs + +Product updates and announcements for BANK OF AI. + +
+
Jul 21, 2026
+
+ +### Docs + +
Product UpdatesDocsx402
+ +- **TRON network IDs now use CAIP-2 format** across the x402 docs — `tron:0x2b6653dc` (Mainnet), `tron:0xcd8690dc` (Nile), `tron:0x94a9059e` (Shasta). In application code, prefer the SDK constants `TRON_MAINNET` / `TRON_NILE` / `TRON_SHASTA` over hard-coded hex strings. [Network & Token Support](../x402/core-concepts/network-and-token-support/) +- **`auth-capture` scheme removed** — x402 now documents four payment schemes: `exact`, `upto`, `batch-settlement`, and `exact_gasfree` (TRON). [SDK Features](../x402/sdk-features/) +- **x402 quickstarts simplified** for both buyers and sellers. +- **New model**: Kimi K3 pricing docs added to LLM Service. +- **Rewritten BANK OF AI introduction** — restructured around what your AI actually gains, with a capability overview and an end-to-end execution example. +- **New section — Best Practices**: hands-on walkthroughs and habits worth keeping, alongside the product docs. [Read the first one](../devnotes/first-onchain-swap/) + +
+
+ +
+
Jul 17, 2026
+
+ +### Docs + +
Product UpdatesDocs
+ +- **New x402 CLI documentation set**: overview, quick start, full command reference, and FAQ — in English and 中文. [Read the docs](../x402/cli/) +- **Docs site refresh**: offline full-text search (⌘K), a Changelogs tab, section icons, and a cleaner sidebar layout. + +
+
+ +
+
Jul 15, 2026
+
+ +### x402 CLI + +
New Releasex402CLI
+ +- **`v1.0.0` — first stable release** of `@bankofai/x402-cli`, a TypeScript command-line client for x402 payments: `pay` any x402-protected URL, `serve` a local paywall endpoint, `roundtrip` for end-to-end smoke tests, plus `gateway` and `catalog` for provider files and the service catalog. +- Built on the published `@bankofai/x402-core` / `x402-evm` / `x402-tron` SDK 1.0 packages; `scheme=exact` with Permit2. +- Networks: TRON (`tron:mainnet` / `tron:nile` / `tron:shasta`) and BSC (`eip155:56` / `eip155:97`). [Quick Start](../x402/cli/quickstart/) + +
+
+
+
Jul 10, 2026
+
+ +### SKILLS · LLM Service + +
UpdateNew Modelx402
+ +- **SKILLS** — added guidance for the **`exact_gasfree` scheme** on TRON, and moved the API catalog to a new endpoint. Re-install if you pinned an older version. [Details](./skills/) +- **LLM Service** — added the **GPT-5.6** family: `sol`, `terra`, and `luna`. [Details](./llm-service/) + +
+
+ +
+
Jul 2, 2026
+
+ +### LLM Service + +
New Model
+ +- **Claude Fable 5** and **Claude Sonnet 5** added with full pricing. [Details](./llm-service/) + +
+
+ +
+
Jun 19, 2026
+
+ +### LLM Service + +
New ModelPricing
+ +- Added **GLM-5.2**. +- Corrected the **Qwen cache-read price** — re-check any cost estimates based on the old figure. [Details](./llm-service/) + +
+
+ +
+
Jun 13, 2026
+
+ +### LLM Service + +
Removed
+ +- Deprecated models removed from the model list and pricing page. Requests naming them will now fail. [Details](./llm-service/) + +
+
+ +
+
Jun 1, 2026
+
+ +### LLM Service + +
New Model
+ +- Added **MiniMax M3** and **Claude Opus 4.8**, and regrouped the model sidebar by family. [Details](./llm-service/) + +
+
+ +
+
Apr 15, 2026
+
+ +### SKILLS · Agent Wallet + +
Docs
+ +- **SKILLS** — new Introduction and a Quick Start that installs in one command. [Details](./skills/) +- **Agent Wallet** — new Introduction covering key storage and signing, plus a Quick Start for your first wallet. [Details](./agent-wallet/) + +
+
+ +
+
Apr 1, 2026
+
+ +### Openclaw Extension + +
Privacy
+ +- Wallet addresses now display **masked** in the extension UI — safer for screen-sharing and recordings. [Details](./openclaw-extension/) + +
+
+ +
+
Mar 31, 2026
+
+ +### Openclaw Extension + +
New
+ +- Added a **Windows installation guide** alongside macOS and Linux. [Details](./openclaw-extension/) + +
+
+ +
+
Mar 22, 2026
+
+ +### Agent Wallet + +
NewSecurity
+ +- Published the developer set: **CLI Reference**, **SDK Guide**, and **SDK Cookbook**. +- **Security fix** — setup docs no longer use `echo $AGENT_WALLET_PASSWORD`, which printed your wallet password to the terminal and left it in shell history. If you followed the old instructions, clear your shell history and consider rotating the password. [Details](./agent-wallet/) + +
+
+ +
+
Mar 17, 2026
+
+ +### MCP Server · Openclaw Extension + +
NewDocs
+ +- **MCP Server** — added a full **Tool List** for the TRON MCP Server, with parameters. [Details](./mcp-server/) +- **Openclaw Extension** — first release: Introduction and Quick Start for connecting the browser extension to your Agent Wallet. [Details](./openclaw-extension/) + +
+
+ +
+
Mar 13, 2026
+
+ +### SKILLS + +
New
+ +- Published the **BANK OF AI Skill** reference — the bundle that teaches your AI client to read balances, quote swaps, and execute transactions through Agent Wallet. [Details](./skills/) + +
+
+ +
+
Mar 10, 2026
+
+ +### MCP Server + +
NewTRON
+ +- Two ways to connect: **Official Server Access** for the hosted endpoint, and **Local Private Deployment** when keys and traffic must stay in your own environment. [Details](./mcp-server/) + +
+
+ +
+
Mar 2, 2026
+
+ +### 8004 Protocol + +
Update
+ +- Repository links moved from `bankofai` to **`BofAI`**. Old URLs redirect, but update any pinned clone or dependency reference. [Details](./8004/) + +
+
+ +
+
Feb 12, 2026
+
+ +### 8004 Protocol + +
New Release
+ +- **v1.1.0** — added Supported Networks and Contract Addresses, published the Usage set (Install, Configure Agents, HTTP Registration), and rewrote the Quick Start around registering your first agent end to end. [Details](./8004/) + +
+
+ +
+
Feb 11, 2026
+
+ +### MCP Server · 8004 Protocol + +
New
+ +- **MCP Server** — first documentation for the **TRON MCP Server** and **BSC MCP Server**: installation, features, and API surface. [Details](./mcp-server/) +- **8004 Protocol** — initial docs on what on-chain agent identity is for and how to get started. [Details](./8004/) + +
+
diff --git a/changelog/llm-service.md b/changelog/llm-service.md new file mode 100644 index 00000000..1aab28bc --- /dev/null +++ b/changelog/llm-service.md @@ -0,0 +1,87 @@ +--- +title: 'LLM Service' +description: 'Release notes for LLM Service.' +--- + +# LLM Service + +Release notes for LLM Service. + +
+
Jul 21, 2026
+
+ +### Kimi K3 + +
New Model
+ +- **Kimi K3** is now available, with pricing documented. [Models](../llmservice/models/kimi-k3/) + +
+
+ +
+
Jul 10, 2026
+
+ +### GPT-5.6 + +
New Model
+ +- Added the **GPT-5.6** family — `sol`, `terra`, and `luna` — with pricing for each. + +
+
+ +
+
Jul 2, 2026
+
+ +### Claude Fable 5 and Claude Sonnet 5 + +
New Model
+ +- **Claude Fable 5** and **Claude Sonnet 5** added with full pricing. + +
+
+ +
+
Jun 19, 2026
+
+ +### GLM-5.2 and a Qwen pricing correction + +
New ModelPricing
+ +- Added **GLM-5.2**. +- Corrected the **Qwen cache-read price** — if you were estimating costs from the old figure, re-check your numbers. + +
+
+ +
+
Jun 13, 2026
+
+ +### Deprecated models removed + +
Removed
+ +- Retired models have been removed from the model list and pricing page. Requests naming them will fail — switch to a current model. + +
+
+ +
+
Jun 1, 2026
+
+ +### MiniMax M3 and Claude Opus 4.8 + +
New Model
+ +- Added **MiniMax M3** and **Claude Opus 4.8**, and reorganized the model sidebar so families group together. + +
+
diff --git a/changelog/mcp-server.md b/changelog/mcp-server.md new file mode 100644 index 00000000..f455bc23 --- /dev/null +++ b/changelog/mcp-server.md @@ -0,0 +1,48 @@ +--- +title: 'MCP Server' +description: 'Release notes for MCP Server.' +--- + +# MCP Server + +Release notes for MCP Server. + +
+
Mar 17, 2026
+
+ +### Full tool list for TRON MCP Server + +
DocsTRON
+ +- Added a **Tool List** page — every tool the TRON MCP Server exposes, with parameters, so you can see up front what your AI client will be able to call. + +
+
+ +
+
Mar 10, 2026
+
+ +### Two ways to connect + +
NewTRON
+ +- **Official Server Access** — point your client at the hosted endpoint, no infrastructure required. +- **Local Private Deployment** — run the server yourself when keys and traffic need to stay in your own environment. + +
+
+ +
+
Feb 11, 2026
+
+ +### TRON and BSC MCP Servers + +
New
+ +- First documentation for the **TRON MCP Server** and the **BSC MCP Server**, covering installation, features, and the API surface. + +
+
diff --git a/changelog/openclaw-extension.md b/changelog/openclaw-extension.md new file mode 100644 index 00000000..bd9117ae --- /dev/null +++ b/changelog/openclaw-extension.md @@ -0,0 +1,47 @@ +--- +title: 'Openclaw Extension' +description: 'Release notes for the Openclaw Extension.' +--- + +# Openclaw Extension + +Release notes for the Openclaw Extension. + +
+
Apr 1, 2026
+
+ +### TRON addresses are masked by default + +
Privacy
+ +- Wallet addresses now display masked in the extension UI — useful when you're screen-sharing or recording. + +
+
+ +
+
Mar 31, 2026
+
+ +### Windows setup + +
New
+ +- Added a **Windows installation guide** alongside the existing macOS and Linux steps, and expanded the general setup walkthrough. + +
+
+ +
+
Mar 17, 2026
+
+ +### First release + +
New
+ +- Published the **Introduction** and **Quick Start** for the Openclaw Extension — connect the browser extension to your Agent Wallet and start acting on-chain from the page you're already on. + +
+
diff --git a/changelog/skills.md b/changelog/skills.md new file mode 100644 index 00000000..a97e5f5f --- /dev/null +++ b/changelog/skills.md @@ -0,0 +1,48 @@ +--- +title: 'SKILLS' +description: 'Release notes for SKILLS.' +--- + +# SKILLS + +Release notes for SKILLS. + +
+
Jul 10, 2026
+
+ +### GasFree guidance and a new catalog URL + +
Updatex402
+ +- Skills now document the **`exact_gasfree` payment scheme** on TRON — pay for an x402 service without keeping TRX around for energy. +- The **API catalog endpoint moved to a new URL**. Skills and the facilitator config were updated together; re-install if you pinned an older version. + +
+
+ +
+
Apr 15, 2026
+
+ +### Introduction and one-line install + +
Docs
+ +- Added an **Introduction** page explaining what Skills give your AI, plus a **Quick Start** that gets you installed in a single command. + +
+
+ +
+
Mar 13, 2026
+
+ +### BANK OF AI Skill + +
New
+ +- Published the **BANK OF AI Skill** reference — the bundle that teaches your AI client to read balances, quote swaps, and execute on-chain transactions through Agent Wallet. + +
+
diff --git a/changelog/x402.md b/changelog/x402.md new file mode 100644 index 00000000..b5538e79 --- /dev/null +++ b/changelog/x402.md @@ -0,0 +1,30 @@ +--- +title: 'x402 Payment Protocol' +description: 'Release notes for the x402 payment protocol, SDK, and CLI.' +--- + +# x402 Payment Protocol + +Release notes for the x402 protocol, SDK, and [CLI](../x402/cli/). + +
+
Jul 15, 2026
+
+ +### x402 CLI v1.0.0 + +
New ReleaseCLI
+ +First stable release of `@bankofai/x402-cli` — a TypeScript command-line client for x402 payments. + +- **`pay`** — pay any x402-protected URL: probe, read the `402` challenge, sign, and retry +- **`serve`** — run a local x402 paywall endpoint that verifies and settles through a facilitator +- **`roundtrip`** — start a temporary server, pay it, exit: the fastest end-to-end smoke test +- **`gateway`** / **`catalog`** — validate and scaffold provider files; search, cache, and export the provider catalog +- Built on the published `@bankofai/x402-core` / `x402-evm` / `x402-tron` SDK 1.0 packages; `scheme=exact` with Permit2 +- Networks: TRON (`tron:mainnet` / `tron:nile` / `tron:shasta`) and BSC (`eip155:56` / `eip155:97`) + +👉 Get started: [x402 CLI Quick Start](../x402/cli/quickstart/) + +
+
diff --git a/devnotes/first-onchain-swap.md b/devnotes/first-onchain-swap.md new file mode 100644 index 00000000..d46bb0b3 --- /dev/null +++ b/devnotes/first-onchain-swap.md @@ -0,0 +1,116 @@ +--- +title: 'Your First On-Chain Swap, Step by Step' +description: 'A practical walkthrough: from installing Skills to completing a real swap on the Nile testnet — including what to check at each step and what to do when it fails.' +--- + +# Your First On-Chain Swap, Step by Step + +The [Quick Start](/BANK-OF-AI/QuickStart/) gets you installed in a minute. This note picks up where it ends: a complete, realistic walkthrough of one on-chain task — with the checks worth making at each step, and what to do when something breaks. + +We'll swap **TRX for USDT on the Nile testnet**. Testnet tokens are free, so nothing here costs real money. + +--- + +## Before you start + +You need three things: + +1. Skills installed and a wallet created — see [Quick Start](/BANK-OF-AI/QuickStart/) +2. A TRON **Nile testnet** address with some test TRX +3. Your AI client open (OpenClaw, Claude Code, Cursor, Codex — whichever you use) + +Get test TRX from the [Nile faucet](https://nileex.io/join/getJoinPage). You'll need TRX both as the asset to swap and to pay for energy. + +--- + +## Step 1: Confirm what you're working with + +Before any transaction, check the state you're starting from: + +> Show my wallet address and my TRX balance on the Nile testnet. + +The AI returns your address and balance. Two things to verify: + +- **The address is the one you funded.** If you created multiple wallets, the AI uses the active one — easy to mix up. +- **The balance is non-zero.** A brand-new TRON address stays "inactive" until it receives its first transfer, and an inactive account can't sign contract calls. + +If the balance is zero or the account shows as inactive, fund it from the faucet and check again before continuing. + +--- + +## Step 2: Get a quote before you commit + +Never let the first on-chain action be the transaction itself. Ask for a quote: + +> On the Nile testnet, how much USDT would I get for 100 TRX on SunSwap? + +The AI queries SunSwap and returns the expected output. This is a read-only call — nothing is signed and nothing is spent. + +Take a moment on the number it gives you. If the rate looks far off from what you expect, stop and investigate rather than proceeding. A quote that seems wrong usually means low liquidity in the pool, or the wrong token being resolved — both are much cheaper to catch now than after signing. + +--- + +## Step 3: Run the swap + +Now the real thing: + +> Swap 100 TRX for USDT on the Nile testnet, with 1% max slippage. + +Two details in that sentence matter: + +- **State the network explicitly.** Otherwise the AI may default to mainnet, where the same command spends real money. +- **State the slippage.** It caps how much worse than the quote you'll accept. Without it you're agreeing to whatever the pool gives you at execution time. + +The AI now works through a standard sequence: check balance → check token approval → fetch a fresh quote → calculate slippage → **show you the bill** → wait. + +It stops there. Nothing is signed until you confirm. + +Read the bill before you approve it — the amount out, the recipient, and the network. This is the last point where a mistake is free. + +--- + +## Step 4: Verify on-chain + +After you confirm, the AI signs locally, broadcasts, and returns a transaction hash. That hash is the proof, not the AI's summary — check it: + +> Look up that transaction on TronScan and show me the result. + +Or paste the hash into [Nile TronScan](https://nile.tronscan.org) yourself. Confirm the status is success and the token amount matches what you approved. + +--- + +## When it doesn't work + +Four failures cover almost everything you'll hit early on: + +**"Account not activated"** — the address has never received anything on-chain. Send it a small amount of TRX first; activation is a one-time thing per address. + +**"Insufficient energy" / the transaction fails at broadcast** — TRON charges energy for contract calls. Keep some TRX beyond the amount you're swapping, or stake TRX for energy. + +**"Insufficient allowance" or an approval error** — spending a TRC-20 token requires a one-time approval of the DEX contract. The AI normally handles this automatically; if it errors here, ask it directly: *"Approve SunSwap to spend my USDT, then retry the swap."* + +**The quote and the result differ noticeably** — this is slippage doing its job. On thin testnet pools it's common. Lower the amount, or state a tighter slippage and let the transaction revert rather than fill badly. + +--- + +## What to do next + +Once the swap works, the same pattern extends to everything else — check state, preview, execute, verify: + +> Check the holder distribution of this token: `
` + +> Transfer 10 USDT to `
` on the Nile testnet. + +> Stake 100 TRX and show me my current TRON Power. + +Two habits worth keeping past the testnet stage: **always run a read-only query before a write**, and **always state the network explicitly**. Both take a second and both prevent the expensive kind of mistake. + +When you move to mainnet, run the same task once with a small amount before doing it at full size. + +--- + +## Related + +- [Quick Start](/BANK-OF-AI/QuickStart/) — install and create your wallet +- [Skills](/McpServer-Skills/SKILLS/Intro/) — the full list of what your AI can do +- [Agent Wallet](/Agent-Wallet/Intro/) — how keys are stored and signing works diff --git a/devnotes/index.md b/devnotes/index.md new file mode 100644 index 00000000..6d1bc88e --- /dev/null +++ b/devnotes/index.md @@ -0,0 +1,12 @@ +--- +title: 'Best Practices' +description: 'Practical, battle-tested guidance from the BANK OF AI team — hands-on walkthroughs and the habits worth keeping.' +--- + +# Best Practices + +Practical, battle-tested guidance from the BANK OF AI team — hands-on walkthroughs and the habits worth keeping when you put your AI to work on-chain. + +## Practices + +- [**Your First On-Chain Swap, Step by Step**](./first-onchain-swap/) — a complete walkthrough of one real task on the Nile testnet, including what to check at each step and what to do when it fails. diff --git a/docs/BANK-OF-AI/Intro.md b/docs/BANK-OF-AI/Intro.md index 9d57cc46..d9c42165 100644 --- a/docs/BANK-OF-AI/Intro.md +++ b/docs/BANK-OF-AI/Intro.md @@ -1,249 +1,192 @@ -# Introduction - -## BANK OF AI in One Sentence - -**BANK OF AI — Your Web3 Gateway to AI.** - -One entry point gives your AI four core capabilities at once: - -- 💸 **Payment** — pay in crypto (x402) -- 🪪 **Identity** — a verifiable on-chain identity and reputation (8004) -- ⚙️ **Action** — call the full set of on-chain atomic capabilities, plus orchestration (Skills + MCP Server + Agent Wallet) -- 🧠 **Cognition** — every top-tier LLM in one account (LLM Service) - -You don't need to write code, switch wallets, or hop between multiple dApps — just hand the task to your AI, and BANK OF AI lines up payment, identity, action, and brain for it. - --- - -## The BANK OF AI Product Matrix - -BANK OF AI is made up of **4 layers**: - -- **🧠 Model Layer | Top AI in One Account** — LLM Service (BANKOFAI APP + API Gateway), a single entry point to every leading LLM -- **🛤️ Protocol Layer | Payment. Verify. Build.** — x402 Payment · 8004 Protocol, two open protocols connecting AI and Web3 -- **🔧 Tool Layer | Everything Your Agent Needs** — Agent Wallet · Skills · MCP Server, the full toolkit giving your AI on-chain signing, operational SOPs, and protocol wrappers -- **🌐 Ecosystem Layer | AI Agent Ecosystem** — Third-party MCP Servers and Skills across TRON / Ethereum / BNB Chain, all plugged into the same protocols - -Each layer is usable on its own, or composable with the others — pick what you need. - +title: 'Introduction' +description: >- + BANK OF AI is the infrastructure connecting AI and Web3. Install it, and your AI can pay, prove its identity, and execute on-chain — you describe the goal, the AI gets it done. --- -## 🧠 Model Layer | Top AI in One Account - -### LLM Service — A Unified Entry Point to Every Leading LLM +# Introduction -**LLM Service is BANK OF AI's model-access layer.** It aggregates GPT, Claude, Gemini, DeepSeek, Kimi, GLM, MiniMax, and other leading models under a single account, exposed two ways: +Today's AI can write code, analyze data, build presentations — it can even deliver an entire software project on its own. -- **BANKOFAI APP** (the official app, corresponding to the `BANKOFAI APP →` button in the top-right of the website): an AI Chat app for end users — open [chat.bankofai.io/chat](https://chat.bankofai.io/chat) and use it directly, switch models on demand -- **API Gateway** (one API key for every model): a unified API for developers, billed by usage, OpenAI-compatible, usable from any OpenAI-compatible third-party AI client +But tell it this: -**Key points**: fund with crypto (supports TRON, BNB Chain, Ethereum, Base, Arbitrum, Optimism, Polygon), pay-as-you-go, no card linking, no subscription. +> Swap 100 USDT for TRX. -👉 Learn more: [LLM Service Introduction](../llmservice/introduction.md) +and it can't do a thing. The problem isn't that it doesn't know how. The problem is that — **it has no way into Web3**. --- -## 🛤️ Protocol Layer | Payment. Verify. Build. - -With the model layer in place, AI is still just a "brain." To let it spend on-chain and be verified, you first need two open protocols: **x402 defines how payments get made**, and **8004 defines who each Agent is.** - -### 01 · x402 Payment — One Line of Code for On-chain Payments - -**An open payment protocol built on an extension of HTTP `402 Payment Required`.** When AI calls a paid service, it automatically signs a small on-chain payment and instantly receives the content — no account, no credit card, no pre-funding. +## What's missing? -- **Currently supports**: TRON, BNB Chain (more chains rolling out) -- **SDK components**: Client SDK · Server SDK · Facilitator +To operate in Web3, AI is missing four essential capabilities: -**Typical scenarios**: +- 💸 **Payment** — no way to pay when a service charges for access +- 🪪 **Identity** — no way to prove who it is on-chain +- ⚙️ **Execution** — no connection to the blockchain, so nothing actually lands +- 🔐 **Wallet** — can't hold assets, can't sign -- MCP Server calls a paid off-chain API -- The `x402-payment` Skill triggers payment explicitly -- An AI Agent autonomously decides to buy paid content -- **Agent-to-Agent auto-settlement** — pay-per-call between two AIs - -> ⚙️ **Dependency**: The x402 SDK uses [Agent-Wallet](#03--agent-wallet--ais-local-signing-layer) to parse and manage wallet credentials — installing x402 pulls in agent-wallet automatically. - -👉 Learn more: [x402 Protocol Introduction](../x402/index.md) +A model solves "figuring it out." These four solve "getting it done." Supplying them is exactly why BANK OF AI exists. --- -### 02 · 8004 Protocol — On-chain Identity and Reputation for AI Agents - -**A Web3-native "Agent Registry + Reputation System."** Any Agent can mint an identity NFT on-chain, bind its service endpoints (Web / MCP / DID), and openly accept feedback from other Agents and users. - -It solves one core question: **as AI Agents proliferate, how do you know which ones you can trust?** - -- **Standard metadata**: name, capability claims, service endpoints -- **Verifiable credentials**: signatures + rotation policy -- **Chain support**: TRON · BNB Chain +## What is BANK OF AI? -**Typical uses**: +> **BANK OF AI is the infrastructure connecting AI and Web3.** -- An AI Agent checks a stranger's on-chain reputation before calling its service -- Skills orchestration runs a pre-flight risk check -- MCP Servers verify each other's identity -- Check a counterparty's reputation before paying or granting authorization +It isn't a new model, a wallet app, or an exchange. It installs into the AI client you already use — OpenClaw, Claude Code, Cursor, Codex — and gives your AI what it needs to enter Web3, without changing how you work. -8004 is a **horizontal protocol** — any step that needs "identity verification" or "reputation lookup" can call it; it isn't tied to a specific layer. - -👉 Learn more: [8004 Protocol Introduction](../8004/general.md) +Once installed, your AI goes from "offering advice" to "getting things done." Here's what it gains. --- -## 🔧 Tool Layer | Everything Your Agent Needs - -The protocol layer is in place — now AI needs tools to actually use those protocols. For any on-chain operation, AI needs three things: **on-chain signing (Agent Wallet), on-chain operation SOPs (Skills), and protocol wrappers (MCP Server)**. +## What your AI gains -### 03 · Agent Wallet — AI's Local Signing Layer +
-**Agent Wallet is the AI Agent's local encrypted wallet**, providing unified signing for every Skill, MCP Server, and the x402 SDK. +
-Your private key is encrypted and locked in a hidden local directory; the AI only ever holds an unlock password. **Even if the password leaks, the encrypted file alone is useless. Even if the file is stolen, without the password it's just gibberish.** +
💸 Payment
-- 🔒 **Encrypted storage**: Keystore encryption + `local_secure` mode, 100% local and offline -- 🔑 **Flexible import**: create new, or import from private key / mnemonic -- 🔄 **Multi-wallet switching**: manage multiple wallets and switch the active account any time -- ⛓️ **Multi-chain signing**: TRON + every EVM-compatible chain (Ethereum / BSC / Polygon / Base / Arbitrum…) +Your AI can pay for APIs and Agent services automatically — always confirming with you before spending. -> 💡 **Who depends on Agent-Wallet**: -> - **x402 SDK** — parses payment credentials, signs x402 micropayments (pulled in automatically when x402 is installed) -> - **Skills** — whenever an on-chain operation needs a signature -> - **MCP Servers** (when self-hosted) — write-type tools read the local wallet before executing +
-**What users see**: when you first follow the [Quick Start](./QuickStart.md), Agent-Wallet is created and configured for you automatically — most users never touch it directly. +[x402](../x402/index.md) -👉 Learn more: [Agent-Wallet Introduction](../Agent-Wallet/Intro.md) +
---- +
-### 04 · Skills — The SOP Playbook for AI On-chain Operations +
-**Skills are pre-written standard operating procedures for AI on-chain actions.** The AI Agent follows the Skill's SOP step by step — **check balance → check approval → fetch quote → apply slippage protection → wait for your confirmation → call MCP Server to execute** — nothing skipped, common pitfalls avoided. +
⚙️ Execution
-Example: a user says "use 50 USDT to buy some TRX." A vanilla AI might generate a transaction that fails because USDT was never approved on SunSwap. An AI loaded with the `sunswap-dex-trading` Skill walks the full SOP automatically. +Your AI can run transfers, swaps, and staking through standard, checked workflows. -**Key properties**: one sentence installs every Skill; invoked in natural language; automatically calls the underlying MCP Server to execute atomic on-chain operations. The BANK OF AI Skills suite covers wallet management, SunSwap swaps, SunPerp perpetuals, the TRC20 toolkit, TronScan lookups, TRX staking + SR voting, USDD/JUST, multi-sig permissions, x402 payments, and more — and keeps growing alongside the ecosystem. +
-👉 Learn more: [Skills Introduction](../McpServer-Skills/SKILLS/Intro.md) · [Quick Start](./QuickStart.md) +[Skills](../McpServer-Skills/SKILLS/Intro.md) · [MCP Server](../McpServer-Skills/MCP/Intro.md) ---- +
-### 05 · MCP Server — The On-chain Atomic Capability Interface +
-**MCP Server (Model Context Protocol Server)** is built on Anthropic's MCP standard. It wraps on-chain and off-chain capabilities into standardized, AI-callable tools. +
-**Relationship between Skills and MCP Server:** +
🔐 Wallet
-| Layer | Role | Responsibility | -| :-- | :-- | :-- | -| **Skills** | Business Orchestration Layer | Stringing multi-step operations into SOPs, handling pre-checks and risk control | -| **MCP Server** | Capability Provider Layer | Exposing atomic capability tools for upper layers to call | +Your AI can sign securely — your private key never leaves your device. -BANK OF AI ships two **MCP Servers**, pointed at BANK OF AI cloud endpoints by default — ready to use out of the box: +
-- **TRON MCP Server** — atomic TRON on-chain operations (query, transfer, contracts, staking, governance), 60+ tools. Supports local private deployment -- **SUN MCP Server** — SunSwap V2/V3/V4 swap and liquidity capabilities, 20+ tools. Supports local private deployment. Also ships **[SUN CLI](../McpServer-Skills/Tools/SUNCli/Intro.md)** — a command-line implementation fully equivalent to SUN MCP Server's capabilities, for scripting / automation / CI-CD scenarios +[Agent Wallet](../Agent-Wallet/Intro.md) -> 💡 **Private deployment**: Skills call MCP Server via the official cloud endpoints by default — no separate install needed. For local deployment, see each MCP Server's deployment guide. +
-> ⚙️ **Dependency**: A self-hosted MCP Server needs Agent-Wallet configured first — the wallet determines which identity the AI uses for on-chain actions. Without a wallet, write-type tools return an error. +
-Beyond BANK OF AI's first-party MCP Servers, the ecosystem has more third-party MCP Servers and Skills — see [🌐 Ecosystem Layer](#-ecosystem-layer--ai-agent-ecosystem) below. +
-👉 Learn more: [MCP Server Introduction](../McpServer-Skills/MCP/Intro.md) +
🪪 Identity
---- +Your AI has a verifiable on-chain identity, so Agents can trust and work with each other. -## 🌐 Ecosystem Layer | AI Agent Ecosystem +
-Beyond BANK OF AI's first-party products, the ecosystem already includes several leading DeFi / data protocols across 3 chains — each shipping a **production-grade MCP Server or Skills** that AI can install and use immediately. +[8004](../8004/general.md) -### 🔴 TRON +
-| Product | Provider | Capabilities | Install | -| :-- | :-- | :-- | :-- | -| **TRON MCP Server** | BANK OF AI | Transfer / Contract / Staking / Governance, 60+ tools | `npx -y @bankofai/mcp-server-tron` | -| **SUN MCP Server** | BANK OF AI | Swap / Liquidity / Farming, V2/V3/V4, 20+ tools | `npx -y @bankofai/sun-mcp-server` | -| **JustLend MCP Server** | JustLend DAO | Lend / Borrow / Staking / Governance, 50 tools | `npx -y @justlend/mcp-server-justlend` | -| **TronScan MCP Server** | TronScan | Query / Analytics / Security, 119 tools | `https://mcp.tronscan.org/mcp` | +
-### 🔵 Ethereum +
-| Product | Provider | Capabilities | Install | -| :-- | :-- | :-- | :-- | -| **Etherscan** | Etherscan Official | Query / Tracking / Analytics, 60+ chains | `npx skills add https://docs.etherscan.io` | -| **Uniswap AI** | Uniswap Labs | Swap / Liquidity / V4 Hooks / 5 Plugins | `npx skills add Uniswap/uniswap-ai` | +Reasoning, of course, your AI already has. BANK OF AI doesn't replace your model — it lets you switch freely between GPT, Claude, Gemini and others, and combine that reasoning with real Web3 capability ([LLM Service](../llmservice/introduction.md)). -### 🟡 BNB Chain +You don't need to memorize these product names, and there are no new commands or tools to learn. Just tell your AI what you want, the same way you'd chat with it: -| Product | Provider | Capabilities | Install | -| :-- | :-- | :-- | :-- | -| **BNB Chain** | BNB Chain Official | Transfer / Contract / Query / 8004 identity registry | `npx skills add bnb-chain/bnbchain-skills` | -| **PancakeSwap AI** | PancakeSwap Official | Swap / Liquidity / Farming, 3 Skills · 8 chains | `npx skills add pancakeswap/pancakeswap-ai` | -| **ListaDAO** | ListaDAO Official | Lending / Staking / CDP, 3 Skills · 9 MCP tools | `npx skills add lista-dao/lista-skills` | +> **You describe the goal. The AI gets it done.** -> 💡 The ecosystem is expanding — refer to the official **[AI Agent Ecosystem](https://bankofai.io)** page for the latest list. +Here's a real example of how these capabilities work together. --- -## How BANK OF AI Layers Work Together - -The sections above covered what each of the 4 layers does. Below is what happens when they collaborate on a real operation — a **TRC20 transfer**, the most common case. - -
+## A real execution -![AI Agent completes a TRC20 transfer through natural conversation](./image/bankofai-architecture.svg) +Once installed, you say: -
+> Swap 100 USDT for TRX, keep slippage under 1%. -**① Model Layer · Understanding Intent** +The whole path, at a glance: -In any AI client (OpenClaw / Cursor / Claude Code / Codex / …), you type a sentence: +```text +User + ↓ +AI interprets the request + ↓ +Selects a Skill or calls an MCP Server + ↓ +Agent Wallet signs + ↓ +Transaction broadcast + ↓ +Blockchain + ↓ +Result +``` -> Transfer 100 TRX to address `T....XXXXX` +If anything goes wrong along the way — insufficient balance, a malformed address — the AI stops immediately and tells you why. And anything that spends money always needs your confirmation first. -The AI client is powered by **LLM Service**, recognizes this as a TRC20 / TRX transfer, and decides to call the `trc20-token-toolkit` Skill. +--- -**② Tool Layer · Skills Orchestration** +## Architecture -`trc20-token-toolkit` walks its SOP step by step: **check balance → validate the recipient address → build the transaction → wait for your confirmation.** If any step fails (insufficient balance, malformed address, etc.), it stops immediately and returns the reason. +Abstract that path into a diagram, and you have all of BANK OF AI: -**③ Tool Layer · MCP + Wallet · Build · Sign · Submit** +```text + AI + │ +BANK OF AI + │ + Web3 +``` -The Skill calls **TRON MCP Server** to assemble the TRC20 transfer, hands it to **Agent-Wallet** for local signing on your machine (**private keys never leave your computer**), and submits it to TRON Mainnet. +Internally it's four layers, each with a single job: -**④ Return · The result travels back to the AI Agent** +| Layer | What it does | +| :-- | :-- | +| 🧠 Model | Provides reasoning — pick whichever model fits | +| 🛤️ Protocol | Sets the rules: how to pay, how to prove identity | +| 🔧 Tool | Handles execution: workflows, tools, signing | +| 🌐 Ecosystem | Connects third-party services across chains through one standard | -Once on-chain execution completes, the tx hash, status, and event logs travel back along the same path — MCP Server parses them into structured data, and the AI Agent turns that into a natural-language summary: +Each layer works on its own, or combines into the full platform. Later chapters cover the design and usage of each one — for now, a general picture is all you need. -> ✅ Transferred 100 TRX to `T....XXXXX`. Fee: 1.1 TRX. -> Tx hash: `0xabc123...def456` ([view on TronScan](https://tronscan.org)) +--- -:::tip When do the other two layers engage? -This example only involves the **Model Layer** and **Tool Layer**. The other two kick in by scenario: +## Want to go deeper? -- **🛤️ Protocol Layer**: **x402** activates when a payment is involved (calling a paid API, subscribing to an Agent service, etc.); **8004** activates when verifying an unfamiliar Agent's identity or looking up its reputation -- **🌐 Ecosystem Layer**: when you need to call a third-party protocol (e.g. swapping on Ethereum via **Uniswap AI**, staking on BNB Chain via **ListaDAO**), the AI Agent calls the corresponding third-party MCP Server / Skills — the flow is identical to this example, just with a different MCP Server at the target chain -::: +| If you want to understand | Go here | +| :-- | :-- | +| How AI uses multiple models | [LLM Service](../llmservice/introduction.md) | +| How AI pays automatically | [x402 Payment Protocol](../x402/index.md) | +| On-chain identity and reputation | [8004 Protocol](../8004/general.md) | +| How keys are stored and signing works | [Agent Wallet](../Agent-Wallet/Intro.md) | +| The workflows AI follows | [Skills](../McpServer-Skills/SKILLS/Intro.md) | +| How AI calls on-chain tools | [MCP Server](../McpServer-Skills/MCP/Intro.md) | --- -## Is BANK OF AI for Me? +## Your turn -- **Web3 beginner:** Absolutely. Paste one install command into your AI client, and everything else is configured automatically; from there, plain-language conversation is all you need — no underlying knowledge required. -- **Web3 veteran:** Skip the "switch wallet → copy address → calculate slippage → wait for blocks" grind. Let AI handle the repetitive work; you focus on strategy. -- **AI Agent developer:** Full SDKs, CLIs, APIs, and MCP-standard interfaces — build your own AI Agents on top of BANK OF AI, giving them on-chain capability and autonomous payment. -- **API service provider:** With x402, your paid APIs can be called by AI and billed per call automatically — no traditional account registration, no credit-card binding required. Especially well-suited for micropayments and agent-to-agent settlement. - ---- +You now know what BANK OF AI is, why it exists, and how it works. One step left: try it yourself. -## Ready? +Setup takes about a minute — paste an install command, then confirm wallet creation. After that, you can give your AI its first on-chain instruction: -Want your AI client to gain BANK OF AI's on-chain capabilities? Just **two steps**, under **1 minute**: +> Check my wallet balance. -1. **Paste the install command** → AI installs Skills, checks wallet status, and asks whether to create a wallet -2. **Confirm wallet creation** → AI automatically creates your local encrypted wallet +From that moment on, your AI has Web3 capability, and everything that follows happens in plain language. -For standalone integration of **LLM Service / x402 / 8004**, or **local private deployment of MCP Server / using SUN CLI**, refer to each product's own docs. +Whether you're checking assets, executing trades, or calling on-chain services — describe the goal, and leave the rest to your AI. 👉 **[Go to Quick Start](./QuickStart.md)** diff --git a/docs/BANK-OF-AI/QuickStart.md b/docs/BANK-OF-AI/QuickStart.md index 306e3793..80475ec8 100644 --- a/docs/BANK-OF-AI/QuickStart.md +++ b/docs/BANK-OF-AI/QuickStart.md @@ -5,6 +5,13 @@ Want your AI client to gain BANK OF AI's on-chain capabilities? Just **two steps 1. **Paste the install command** → AI installs every Skill, checks wallet status, and asks whether to create a wallet 2. **Confirm wallet creation** → AI automatically creates your local encrypted wallet +**No coding, no pre-existing wallet needed** — all you'll actually do is copy one message and reply with one letter. + +**Before you start, you need:** + +- An AI client that supports Skills: **OpenClaw / Claude Code / Cursor / Codex** — whichever you already use +- **Node.js** on your machine (the AI runs `npx` during install). Not sure if you have it? Just start Step 1 — if the AI reports `npx` is unavailable, install it from [nodejs.org](https://nodejs.org/) and retry + --- ## Step 1: Paste the Install Command @@ -84,7 +91,9 @@ The AI will install the Skills and then ask whether to create a wallet. ## Step 2: Confirm Wallet Creation -Confirm wallet creation however the AI prompts you (e.g. reply "create", "go ahead", or whichever option the AI offers). The AI will create your local encrypted wallet and, in one message, show your wallet info, addresses, master password, and suggested next steps. +Confirm wallet creation however the AI prompts you (e.g. reply "A", "create", or whichever option the AI offers). The AI will create your local encrypted wallet and, in one message, show your wallet info, addresses, master password, and suggested next steps. + +⚠️ **When the master password appears, pause:** it is shown **only this once** — it's the one and only key to your safe. Copy it into a password manager (1Password / Bitwarden / etc.) right now, then continue. See [Safety First](#a-few-reminders) below.
Show example AI output @@ -156,7 +165,7 @@ Open your AI chat and send: Check the TRX and USDT balances of the wallet address you just created. ``` -If the AI returns the balance — **congrats, the full stack is live and ready to use.** +If the AI returns the balance — **congrats, you now have an AI butler that can work on-chain!** Everything is in place; from here on, just tell it what you want. :::note What a brand-new wallet may show A TRON address that has never received any transfer is considered **not activated**, so the query may report **balance 0 / account not activated**. This is completely normal for a fresh wallet and doesn't prevent you from using BANK OF AI. @@ -196,31 +205,28 @@ Just describe what you want in plain language: ## A Few Reminders -:::warning Three Rules for Beginners · On-chain transactions are irreversible +:::warning Safety First · On-chain transactions are irreversible + +**Three rules for beginners:** + 1. **Always practice on testnet first.** Run 1–2 transactions on Nile testnet, confirm the AI behaves exactly as expected, *then* switch to mainnet. 2. **Review the AI's bill before every spending action.** 3. **Start small.** Even for operations you've tested, use a small amount the first time you run them on mainnet. -::: -:::caution The master password is critical — back it up immediately -The master password is shown **exactly once in Step 2**. It's auto-saved to `~/.agent-wallet/runtime_secrets.json` locally, but we strongly recommend **also saving it manually in a password manager** (1Password / Bitwarden / etc.). If the local file is ever lost or corrupted *and* you have no external backup, your wallet becomes **permanently unrecoverable** (no recovery mechanism, no support, no backdoors). +**Back up the master password immediately:** it is shown **exactly once in Step 2**. It's auto-saved to `~/.agent-wallet/runtime_secrets.json` locally, but we strongly recommend **also saving it manually in a password manager** (1Password / Bitwarden / etc.). If the local file is ever lost or corrupted *and* you have no external backup, your wallet becomes **permanently unrecoverable** (no recovery mechanism, no support, no backdoors). **Never** paste this password into chat tools, emails, screenshots, or public repos. -⚠️ **Never** paste this password into chat tools, emails, screenshots, or public repos. ::: -:::info If you skip wallet creation in Step 2 -The AI skips wallet creation. When you're ready, you can trigger **conversational wallet creation** right in the AI chat at any time — no need to re-run the install command. See [Agent-Wallet Quick Start · Option 1: Conversational Creation](../Agent-Wallet/QuickStart.md). -::: +**If you skip wallet creation in Step 2** — the AI skips wallet creation. When you're ready, you can trigger **conversational wallet creation** right in the AI chat at any time, no need to re-run the install command. See [Agent-Wallet Quick Start · Option 1: Conversational Creation](../Agent-Wallet/QuickStart.md). -:::tip Want to use the other products independently, or self-host? -**The full BANK OF AI product matrix is more than Skills.** To use the other products independently or to self-host the lower layers, see: +### Want to use the other products independently, or self-host? + +The full BANK OF AI product matrix is more than Skills. To use the other products independently or to self-host the lower layers, see: - **LLM Service** (model-access layer): use BANKOFAI APP directly, or connect to the unified API Gateway → [LLM Service Introduction](../llmservice/introduction.md) - **x402 Payment** (payment protocol): let AI auto-settle micropayments on-chain → [x402 Protocol Introduction](../x402/index.md) - **8004 Protocol** (identity + reputation): on-chain reputation lookup for Agents → [8004 Protocol Introduction](../8004/general.md) -- **MCP Server local private deployment**: Skills call MCP Server through BANK OF AI's official cloud endpoints by default — no separate install needed. For local deployment, see [TRON MCP — Local Private Deployment](../McpServer-Skills/MCP/TRONMCPServer/LocalPrivatizedDeployment.md) · [SUN MCP — Local Private Deployment](../McpServer-Skills/MCP/SUNMCPServer/LocalPrivatizedDeployment.md) · [BSC MCP — Installation](../McpServer-Skills/MCP/BSCMCPServer/Installation.md) -- **SUN CLI**: a command-line tool with capabilities equivalent to SUN MCP Server, for scripting / automation / CI-CD → [SUN CLI Quick Start](../McpServer-Skills/Tools/SUNCli/QuickStart.md) -::: +- **MCP Server local private deployment**: Skills call MCP Server through BANK OF AI's official cloud endpoints by default — no separate install needed. For local deployment, see [TRON MCP — Local Private Deployment](../McpServer-Skills/MCP/TRONMCPServer/LocalPrivatizedDeployment.md) · [BSC MCP — Installation](../McpServer-Skills/MCP/BSCMCPServer/Installation.md) --- diff --git a/docs/McpServer-Skills/Intro.md b/docs/McpServer-Skills/Intro.md deleted file mode 100644 index 1ed5acb0..00000000 --- a/docs/McpServer-Skills/Intro.md +++ /dev/null @@ -1,12 +0,0 @@ -# Introduction - -BANK OF AI provides a comprehensive AI Agent capability framework through **MCP Server** and **Skills**: the former delivers standardized blockchain interaction capabilities, while the latter organizes these capabilities into executable workflows, enabling AI Agents to perform complex operations in on-chain environments. - -* **MCP Server** is designed to provide a standardized framework for interactions between Large Language Models (LLMs) and external tools and data sources. Its core lies in a well-defined client-server architecture and layered communication mechanism, ensuring that AI applications can securely and efficiently access and utilize external information. - -* **Skills** are capability abstractions that orchestrate multiple tools into structured workflows, enabling AI Agents to complete complex, multi-step tasks. - -## Quick Navigation - -- **Learn about MCP Server**: Go to [MCP Server Introduction](./MCP/Intro.md) to understand the protocol architecture and communication mechanisms. -- **Learn about Skills**: Go to [Skills Introduction](./SKILLS/Intro.md) to understand the design philosophy and usage of skill packages. diff --git a/docs/McpServer-Skills/MCP/Intro.md b/docs/McpServer-Skills/MCP/Intro.md index 76da6657..074c3d6f 100644 --- a/docs/McpServer-Skills/MCP/Intro.md +++ b/docs/McpServer-Skills/MCP/Intro.md @@ -8,7 +8,7 @@ MCP follows a **client-server** architecture, primarily comprising the following * **MCP Host**: Typically the AI application itself. It is responsible for coordinating and managing one or more MCP Clients. * **MCP Client**: Instantiated by the MCP Host for each MCP Server. Each client maintains a dedicated connection with its corresponding MCP Server and obtains context information from the MCP Server for the host to use. -* **MCP Server**: A program responsible for providing context data to MCP Clients. Servers can run locally (e.g., a filesystem server) or remotely (e.g., a TRON MCP/SUN MCP server). +* **MCP Server**: A program responsible for providing context data to MCP Clients. Servers can run locally (e.g., a filesystem server) or remotely (e.g., a TRON MCP server). This architecture allows AI applications to connect to different MCP Servers simultaneously through multiple clients, thereby expanding their capabilities. diff --git a/docs/McpServer-Skills/MCP/SUNMCPServer/FAQ.md b/docs/McpServer-Skills/MCP/SUNMCPServer/FAQ.md deleted file mode 100644 index 6494e046..00000000 --- a/docs/McpServer-Skills/MCP/SUNMCPServer/FAQ.md +++ /dev/null @@ -1,481 +0,0 @@ ---- -title: FAQ & Troubleshooting -description: SUN MCP Server FAQ covering connection, authentication, DeFi operations and troubleshooting. ---- - -# FAQ & Troubleshooting - -This page collects frequently asked questions when using SUN MCP Server and their solutions. - -## Connection Issues - -### MCP client "Cannot Connect to MCP Server" - -**Symptom:** MCP client shows server unresponsive or connection refused. - -**Resolution Steps:** - -1. **Check Node.js Installation** - ```bash - node --version # Should return v18+ - npm --version - ``` - -2. **Verify Server Running** - ```bash - # If using official server - npx -y @bankofai/sun-mcp-server - - # If using local deployment - npm start - ``` - -3. **Check JSON Format** - - Verify JSON format of `stdio.json` in MCP client configuration - - Common errors: trailing commas, unmatched brackets - -4. **Restart MCP client** - - Completely close application - - Clear client cache (method depends on your specific MCP client) - - Restart application - -5. **Check Server Logs** - ```bash - # If using official server, enable verbose logging - DEBUG=* npx -y @bankofai/sun-mcp-server - ``` - -**If issue persists:** See [Official Server Access Guide](OfficialServerAccess.md) for latest configuration examples. - -### "Connection Refused" in HTTP Mode - -**Symptom:** Getting connection refused error when trying to connect via HTTP. - -**Common Causes and Solutions:** - -1. **Server Not Running** - ```bash - # Start server in HTTP mode - sun-mcp-server --http --port 8080 - ``` - -2. **Port 8080 Already in Use** - ```bash - # Check port usage - lsof -i :8080 - - # Use different port - sun-mcp-server --http --port 8081 - ``` - -3. **Firewall Blocking Connection** - - Check local firewall rules - - Ensure localhost:8080 connection is allowed - - On macOS: System Settings > Security & Privacy > Firewall - -4. **Confirm Server Address** - - Use `http://localhost:8080` rather than `127.0.0.1:8080` - - Ensure no typos - -### Only Read Tools in Tool List - -**Symptom:** Cannot see `sunswap_swap`, `sunswap_add_liquidity` and other write tools. - -**Cause:** No wallet configured. - -**Solution:** - -1. **Configure [Agent Wallet](../../../Agent-Wallet/Intro.md)** — set `AGENT_WALLET_PASSWORD` - ```bash - export AGENT_WALLET_PASSWORD='your_password' - ``` - -2. **Restart server** and reconnect MCP client - -Verify successful configuration by checking [Full Capability List](ToolList.md) for Full Capability List. - -## Authentication and Key Issues - -### "Invalid Private Key" Error - -**Symptom:** Server rejects provided private key. - -**Private Key Format Requirements:** -- Must be 64 hexadecimal characters (excluding `0x` prefix) -- Valid range: `0x0000000000000000000000000000000000000000000000000000000000000001` to `0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140` - -**Verification Steps:** -```bash -# Check private key length -echo -n "your_private_key" | wc -c -# Should output 64 - -# Check if valid hexadecimal -echo "your_private_key" | grep -E '^[0-9a-fA-F]{64}$' -# If output exists, format is correct -``` - -**Common Errors:** -- Contains `0x` prefix (remove it) -- Length less than 64 characters (get complete key from export tool) -- Contains spaces or special characters - -### "Agent Wallet Password Incorrect" - -**Symptom:** Server cannot decrypt Agent Wallet. - -**Resolution Steps:** - -1. **Verify password is set**: Run `[[ -n "$AGENT_WALLET_PASSWORD" ]] && echo "Password is set" || echo "Password NOT set"` to confirm the variable is set without revealing the value. -2. **Check wallet directory**: Verify `~/.agent-wallet/` exists and contains wallet files. If you used a custom directory, ensure `AGENT_WALLET_DIR` points to the correct path. -3. **If password is lost**: You'll need to re-initialize the wallet. **Warning: this wipes all wallets and keys — ensure funds are moved or mnemonics backed up before proceeding.** Run `agent-wallet reset` to wipe and start over — see [CLI Reference → Reset](../../../Agent-Wallet/Developer/CLI-Reference.md#agent-wallet-reset-reset-all-data) and [Agent-Wallet FAQ](../../../Agent-Wallet/FAQ.md) for details. Passwords with special characters are supported — use single quotes when setting the environment variable. - - -### "Wallet Not Found" or Initialization Error - -**Symptom:** Server cannot find or initialize wallet. - -**Cause:** Agent Wallet not properly configured. - -**Solution:** Ensure Agent Wallet is installed and configured: - -```bash -# Set Agent Wallet password -export AGENT_WALLET_PASSWORD='your_password' - -# Optional: specify custom wallet directory -export AGENT_WALLET_DIR="$HOME/.agent-wallet" - -# Restart server -sun-mcp-server -``` - -If you haven't initialized Agent Wallet yet, see the [Agent-Wallet documentation](../../../Agent-Wallet/Intro.md) for setup instructions. - -## DeFi Operation Errors - -### "Swap Failed" - -**Symptom:** `sunswap_swap` call returns error. - -**Common Causes and Solutions:** - -1. **Insufficient Balance** - ```bash - # Check source token balance - sunswap_get_balances # List all balances - ``` - - Confirm sufficient source tokens - - Account amount should include Gas fees - -2. **Slippage Tolerance Too Low** - ``` - # Example: 2% slippage tolerance may not be enough - Increase to 3-5% - ``` - - May need higher tolerance in volatile markets - - But higher tolerance increases frontrunning risk - -3. **Token Not Tradeable** - - Check if token listed on SunSwap - - Some new tokens may not support trading - - Verify token contract address is correct - -4. **Insufficient Liquidity** - ``` - Use sunswap_quote_exact_input to check available liquidity - ``` - - Small trades may fail - - Try smaller amount or use multi-hop routes - -**Diagnostic Steps:** -``` -1. Check balance -2. Use sunswap_quote_exact_input to estimate output -3. Try higher slippage tolerance -4. Check network status -``` - -### "Add Liquidity Failed" - -**Symptom:** `sunswap_add_liquidity` returns error. - -**Common Causes and Solutions:** - -1. **Tokens Not Authorized** - ``` - Need to authorize both tokens for SunSwap contract - ``` - - Call `sunswap_approve_token` or `permit2_approve` - - Grant sufficient amount - - Both tokens need authorization - -2. **Amount Ratio Not Reasonable** - ``` - Current price may have changed - Reduce slippage tolerance to allow wider ratio range - ``` - - Check current pool price - - Adjust token amounts to match pool ratio - - Or increase tolerance percentage - -3. **Amount Too Small** - ``` - Minimum liquidity requirement may not be met - ``` - - Try increasing amount - - Check SunSwap's minimum position requirement - -4. **Pool Doesn't Exist** - - Verify trading pair exists on SunSwap - - Check fee tier is correct (V2: 0.3%, V3: 0.01%-1%) - -**Diagnostic Tip:** Always verify balance and authorization first, before calling add liquidity. - -### "Permit2 Signature Failed" - -**Symptom:** Permit2 authorization returns signature error. - -**Resolution Steps:** - -1. **Check Wallet Support** - ```bash - # Agent Wallet must support signTypedData - [[ -n "$AGENT_WALLET_PASSWORD" ]] && echo "Password is set" || echo "Password NOT set" - ``` - -2. **Verify Signature Data** - - Check Permit2 request structured data - - Confirm chain ID, token address, deadline correct - -3. **Reinitialize Wallet** — run `agent-wallet reset` to wipe and start over. See [CLI Reference → Reset](../../../Agent-Wallet/Developer/CLI-Reference.md#agent-wallet-reset-reset-all-data) for details. - -4. **Use Alternate Authorization Method** - ``` - If Permit2 continues to fail, use sunswap_approve_token instead - ``` - -### Transaction Shows "REVERT" Status - -**Symptom:** Transaction submitted but reverted on-chain. - -**Common Causes:** - -1. **Balance Decreased After Transaction Signed** - - Wallet may be participating in other transactions simultaneously - - Space sufficient time between submissions - -2. **Slippage Price Changed** - - Price changed while transaction queued - - Increase slippage tolerance and retry - -3. **Contract State Changed** - - Pool or token contract updated - - Retry after one block - -4. **Insufficient Authorization** - - Permit2 authorization expired or used up - - Re-authorize and retry - -5. **Insufficient Gas** - - Uncommon on TRON, but check account balance - - Ensure account has sufficient TRX as Gas - -**Debug Tip:** -``` -Check transaction hash details on https://tronscan.org for error message -``` - -## AI Behavior Issues - -### AI Constructed Invalid Token Address - -**Symptom:** AI used non-existent token address, causing operation failure. - -**Solution:** - -1. **Provide Accurate Address in Prompt** - ``` - Please use USDT (TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t) - ``` - -2. **Use Official Token List** - - Get address from SunSwap or TronScan - - Always verify address format (case and length) - -3. **Have AI Verify Address** - ``` - Before executing any operation, use sunswap_get_token_price - to verify token exists - ``` - -### AI Tried to Call Non-existent Tool - -**Symptom:** AI called `invalid_tool_name` or other non-existent tool. - -**Solution:** - -1. **Reference Official Tool List** - - Check [SUN MCP Server Tool List](ToolList.md) - - Provide correct tool names to AI - -2. **Explicitly List Tools in Prompt** - ``` - Available swap tools include: - - sunswap_swap - - sunswap_quote_exact_input - - sunswap_quote_exact_output - ``` - -3. **Simplify Request** - - Request single operation rather than complex multi-step workflow - - AI will call correct tool more reliably - -### Slow Response Speed - -**Symptom:** Querying data or executing operations takes long time. - -**Optimization Steps:** - -1. **Simplify Workflow** - - Reduce multi-tool coordination steps - - Avoid large number of consecutive queries - -2. **Use Local Server** - - See [Local Privatized Deployment](LocalPrivatizedDeployment.md) - - May be faster than official server (depends on network) - -3. **Batch Operations** - ``` - Merge related queries to reduce round trips - ``` - -## General Questions - -### What's the Difference Between Mainnet, Nile and Shasta? - -| Feature | Mainnet | Nile Testnet | Shasta Testnet | -|------|---|---|---| -| **Purpose** | Production | Official testing | Community testing | -| **Network Parameter** | `mainnet` | `nile` | `shasta` | -| **Real Value** | Yes | No (test TRX) | No (test TRX) | -| **Transaction Finality** | Immediate | Immediate | Immediate | -| **Recommended Use** | Production DeFi | Development and testing | Experimentation | -| **Stability** | Highest | High | Medium | -| **Get Test TRX** | N/A | [Nile Faucet](https://nile.trongrid.io/join/getjoined) | [Shasta Faucet](https://shasta.trongrid.io/join/getjoined) | - -**Best Practice:** -- Always use Nile during development -- Final testing on Shasta -- Only migrate to mainnet after sufficient verification - -### Can I Use Multiple MCP Server Instances Simultaneously? - -**Yes.** For example, can run official mainnet server and local Nile instance simultaneously. - -**Configuration Example (MCP client):** - -```json -{ - "mcpServers": { - "sun-mainnet": { - "command": "npx", - "args": ["-y", "@bankofai/sun-mcp-server"], - "env": { - "TRON_NETWORK": "mainnet", - "AGENT_WALLET_PASSWORD": "your_mainnet_password" - } - }, - "sun-nile": { - "command": "sun-mcp-server", - "args": ["--port", "8081"], - "env": { - "TRON_NETWORK": "nile", - "AGENT_WALLET_PASSWORD": "your_testnet_password" - } - } - } -} -``` - -**Note:** Use different wallet credentials for each instance to avoid confusion. - -### How to Update to Latest Version? - -**Using npx (Recommended):** -```bash -# npx automatically gets latest version -npx -y @bankofai/sun-mcp-server - -# Force clear cache and get latest version -npx --clear-cache -y @bankofai/sun-mcp-server -``` - -**Using Local Installation:** -```bash -# Update global installation -npm install -g @bankofai/sun-mcp-server - -# Or update in project -npm update @bankofai/sun-mcp-server -``` - -**Using Git Repository:** -```bash -# Clone or update repository -git clone https://github.com/BofAI/sun-mcp-server.git -cd sun-mcp-server - -# Pull latest code -git pull - -# Install dependencies and start -npm install -npm start -``` - -### Too Many Tools Cause LLM Context Overflow? - -**Symptom:** Claude reports token limit exceeded or tool list too long. - -**Solution: Use Tool Filtering:** - -```bash -# Enable only specific tools (whitelist) -sun-mcp-server --whitelist sunswap_swap,sunswap_get_balances,sunswap_quote_exact_input - -# Exclude certain tools (blacklist) -sun-mcp-server --blacklist getUserPositions,getPoolVolHistory -``` - -**Optimization Tips:** -- Create multiple server instances for different tasks -- Use whitelist to load only necessary tools -- Regularly clean up unused tool configurations - -### Which MCP Protocol Version is Supported? - -**SUN MCP Server supports MCP 1.10.2 and higher.** - -**Verify Version:** -```bash -# Check version in dependencies -npm list @modelcontextprotocol/sdk - -# Should output similar to: -# @modelcontextprotocol/sdk@1.10.2 -``` - -**Upgrade MCP SDK:** -```bash -npm update @modelcontextprotocol/sdk -``` - ---- - -## Get More Help - -- **GitHub Issues:** https://github.com/BofAI/sun-mcp-server/issues -- **Full Capability List:** Check [Full Capability List](ToolList.md) -- **Local Deployment:** See [Local Privatized Deployment](LocalPrivatizedDeployment.md) -- **Official Server:** See [Official Server Access](OfficialServerAccess.md) diff --git a/docs/McpServer-Skills/MCP/SUNMCPServer/Intro.md b/docs/McpServer-Skills/MCP/SUNMCPServer/Intro.md deleted file mode 100644 index cb3635f5..00000000 --- a/docs/McpServer-Skills/MCP/SUNMCPServer/Intro.md +++ /dev/null @@ -1,107 +0,0 @@ -# Introduction - -## What is SUN MCP Server? - -SUN MCP Server is the bridge connecting AI assistants to [SUN.IO (SunSwap)](https://sun.io), the largest decentralized exchange on the TRON blockchain. Built on the [Model Context Protocol (MCP)](../Intro.md) standard, it lets you query DeFi data, execute token swaps, and manage liquidity positions using natural language—without directly interacting with contracts or handling complex on-chain parameters. - -For example: just tell Claude "swap 100 USDT to TRX using SunSwap's best route," and the AI will automatically find the optimal path, estimate slippage, ask you to confirm, then execute the trade. No need to open a frontend, manually approve contracts, or understand the routing contract internals. - -What this means for different people: - -- If you're a **DeFi user**, it lets you operate SunSwap conversationally—swapping, adding liquidity, collecting fees, as naturally as sending a message. -- If you're a **Web3 developer**, it's your tool for quickly querying SunSwap on-chain state and protocol metrics, saving significant API integration work. -- If you're an **AI Agent builder**, it provides a standardized DeFi toolkit you can directly orchestrate into automated trading or market-making strategies. -- If you're a **data analyst**, SunSwap's trading volume, pool APYs, and position data are all within reach—no API documentation required. - ---- - -## What can it do? - -SUN MCP Server covers the full range of SunSwap DEX interactions, from on-chain data queries to token swaps and liquidity management, providing **41 tools**. - -Here's a capability overview—each item can be triggered through natural language: - -**Data Queries (read-only, no private key needed):** - -| Capability | Description | Try saying | -| :--- | :--- | :--- | -| **Token Prices** | Query real-time prices for any token on SunSwap | "What's the current USDT/TRX price?" | -| **Swap Quotes** | Get the optimal route and expected output for a given input | "How much TRX can I get for 100 USDT?" | -| **Pool Data** | Query pool lists, APY, trading volume, liquidity history | "What's the current APY for the USDT-TRX pool?" | -| **Position Query** | View liquidity positions for any address on SunSwap | "Check my SunSwap positions" | -| **Protocol Stats** | Overall SunSwap trading volume, user counts, pool count history | "What was SunSwap's trading volume in the past 7 days?" | -| **Farm Info** | Query farm lists and user mining positions | "What yield farms are available on SunSwap?" | - -**DeFi Operations (write, requires private key):** - -| Capability | Description | Try saying | -| :--- | :--- | :--- | -| **Token Swap** | Execute optimal-route swaps via the Universal Router | "Swap 100 USDT to TRX for me" | -| **V2 Liquidity** | Add/remove V2 pool liquidity, auto-handles TRX/WTRX conversion | "Add 100 USDT of liquidity to the USDT-TRX V2 pool" | -| **V3 Liquidity** | Mint and manage concentrated liquidity positions, collect fees | "Collect the accrued fees from my V3 position" | -| **V4 Liquidity** | V4 concentrated liquidity operations with Permit2 authorization | "Mint a V4 USDT-TRX position" | -| **Contract Interaction** | Directly read or call any TRON smart contract function | "Query the current slot0 state of this contract" | - -For the Full Capability List and parameter details, see [Full Capability List](./ToolList.md). - ---- - -## Two Access Modes - -Now that you understand SUN MCP Server's capabilities, you need to choose an access mode. There are two paths depending on your use case: - -**[Official Cloud Service](./OfficialServerAccess.md)** — Best for quick exploration and data queries. No installation required—just add a service address to your AI client config and you're ready. The cloud service is **read-only**: it supports querying token prices, pool data, protocol stats, but does not support executing swaps or adding liquidity. - -**[Local Private Deployment](./LocalPrivatizedDeployment.md)** — For users who need full DeFi functionality. Run SUN MCP Server on your own machine, configure a wallet, and unlock swaps, liquidity management, and all other operations. Private keys stay entirely local and are never uploaded to any remote service. - -The core difference comes down to one thing: **whether you need to sign transactions**. - -| Comparison | Official Cloud Service | Local Private Deployment | -| :--- | :--- | :--- | -| **Feature scope** | Read-only (data queries) | Full (queries + swaps + liquidity) | -| **Setup difficulty** | Add one line of config | Requires local install and build | -| **Private key required** | No | Yes (required for write operations) | -| **Token swaps / liquidity** | Not supported | Supported | -| **Best for** | Data queries, getting started | DeFi operations, automated strategies | -| **Security** | High (no private key exposure risk) | Depends on your key management | - -:::tip Not sure which to choose? -If you just want to check SunSwap prices and pool data, start with the [Official Cloud Service](./OfficialServerAccess.md)—it takes 1 minute to connect. When you need to execute swaps or manage liquidity, switch to [Local Private Deployment](./LocalPrivatizedDeployment.md). -::: - ---- - -## Supported Networks - -Both access modes support the following three networks (mainnet by default): - -| Network | Identifier | Purpose | Block Explorer | -| :--- | :--- | :--- | :--- | -| **Mainnet** | `mainnet` | Production, real assets | [tronscan.org](https://tronscan.org) | -| **Nile Testnet** | `nile` | Development and testing (recommended) | [nile.tronscan.org](https://nile.tronscan.org) | -| **Shasta Testnet** | `shasta` | Development and testing | [shasta.tronscan.org](https://shasta.tronscan.org) | - -Specify the target network via the `network` parameter when calling tools. **We strongly recommend validating any new operation on the Nile testnet first**—mainnet operations involve real assets and cannot be undone. - ---- - -## Security Notes - -:::warning -Before you start, keep these security principles in mind—DeFi operations directly involve on-chain assets and mistakes cannot be reversed: - -- **Never hardcode private keys**: Do not write private keys or mnemonics directly into config files. Use system environment variables or encrypted wallet management. -- **Test on testnet first**: Before executing any swap or liquidity operation on mainnet, verify it on the Nile testnet. -- **Minimum funds principle**: Only keep the funds needed for the current task in the AI Agent's wallet. -- **Watch authorization risk**: Token `approve` operations require extra care—avoid granting unlimited allowances. -- **Confirm every transaction**: Before executing any on-chain write operation, the AI will present transaction details and ask for confirmation. Don't skip this step. -::: - ---- - -## Next Steps - -- Want the fastest way to try it out? → [Quick Start](./QuickStart.md) -- Only need to query on-chain data? → [Official Cloud Service](./OfficialServerAccess.md) -- Need token swaps or liquidity management? → [Local Private Deployment](./LocalPrivatizedDeployment.md) -- Want to explore all 41 tools? → [Full Capability List](./ToolList.md) diff --git a/docs/McpServer-Skills/MCP/SUNMCPServer/LocalPrivatizedDeployment.md b/docs/McpServer-Skills/MCP/SUNMCPServer/LocalPrivatizedDeployment.md deleted file mode 100644 index fef556dc..00000000 --- a/docs/McpServer-Skills/MCP/SUNMCPServer/LocalPrivatizedDeployment.md +++ /dev/null @@ -1,298 +0,0 @@ -# Local Privatized Deployment - -## What is Local Privatized Deployment? - -Local privatized deployment refers to running a complete instance of SUN MCP Server on your own computer. Unlike relying on third-party services, local deployment gives you full control over your wallet, network connection, and data privacy. - -This mode is particularly suitable for scenarios that require executing DeFi operations. By configuring wallet private keys or mnemonics, you can unlock the following write operations: - -- **Swap**: Automatic routing swaps using Universal Router -- **Liquidity Management**: Add and remove liquidity for SunSwap V2/V3/V4 -- **Position Management**: Mint, increase, decrease positions and collect fees for SunSwap V3/V4 -- **Contract Interaction**: Call arbitrary contracts via `sunswap_send_contract` - -:::info -Without wallet configuration, SUN MCP Server will run in **read-only mode**, allowing querying on-chain data but unable to execute write operations. -::: - ---- - -## Before You Start - -### Environment Requirements - -| Item | Requirement | Description | -|------|------|------| -| Node.js | >= 20.0.0 | v20.0.0 or higher ([download](https://nodejs.org/)) | -| npm | >= 10.0 | Usually installed with Node.js | -| Operating System | Linux / macOS / Windows | Cross-platform support | -| Disk Space | >= 100 MB | For dependency installation | -| Network | Internet Connection | Communication with TRON network | - -### Security Principles - -:::danger Important Security Tips -1. **Private Key Protection**: Never commit private keys to version control. Use `.env` files and add them to `.gitignore`. -2. **Permission Management**: Ensure `.env` file permissions are `600` (owner read-only). -3. **Multiple Wallet Mode Prohibited**: Configuring multiple wallet methods simultaneously will trigger an error. Only one method can be used at a time. -4. **Mnemonic Terminology**: In this document, "mnemonic" refers to BIP-39 standard 12-word or 24-word recovery phrases. -5. **Mainnet Caution**: Before using real funds on mainnet, thoroughly test on testnets (Nile, Shasta). -::: - ---- - -## Installation Steps -### Step 1: Configure Wallet - -The wallet determines which identity the AI assistant uses to perform on-chain operations. SUN MCP Server uses [Agent Wallet](../../../Agent-Wallet/Intro.md) for secure wallet management. If no wallet is configured, the server automatically runs in read-only mode. - -#### Agent Wallet - -SUN MCP Server uses [Agent Wallet](../../../Agent-Wallet/Intro.md) for wallet management. Private keys are encrypted and stored on local disk, never exposed as plaintext in environment variables. Even if environment variables are leaked, the attacker still needs the encrypted keystore file to access funds. Agent Wallet also supports **multi-wallet management** and runtime wallet switching via the `select_wallet` tool. - -| Feature | Description | -| :--- | :--- | -| Security Level | High (encrypted storage) | -| Multi-Wallet Support | Yes | -| Runtime Wallet Switching | Yes | -| Recommended For | All use cases | - -> For installation, initialization, and detailed usage of Agent Wallet, see the [Agent-Wallet documentation](../../../Agent-Wallet/Intro.md). - -First, install Agent Wallet: - -```bash -npm install -g @bankofai/agent-wallet -``` - -Then, choose one of the following two options depending on your situation: - -#### Option A: Generate a New Wallet (Recommended for New Users) - -If you don't have an existing private key, use `agent-wallet start` to generate a new wallet with an encrypted keystore and master password: - -```bash -agent-wallet start -``` - -Follow the interactive prompts to set your master password and generate a wallet. Once complete, the wallet is ready to use — **no additional environment variables are needed**. Agent Wallet will automatically manage the encrypted keystore. - -#### Option B: Import an Existing Private Key - -If you already have a private key you want to use, set it via the `AGENT_WALLET_PRIVATE_KEY` environment variable: - -```bash -export AGENT_WALLET_PRIVATE_KEY=your_private_key_here -``` - -:::tip -To make this persist across terminal sessions, add it to your shell configuration file: - -```bash -echo 'export AGENT_WALLET_PRIVATE_KEY=your_private_key' >> ~/.zshrc # zsh (macOS default) -echo 'export AGENT_WALLET_PRIVATE_KEY=your_private_key' >> ~/.bashrc # bash (Linux default) -source ~/.zshrc # or source ~/.bashrc — takes effect immediately without restarting the terminal -``` - -Verify the environment variable is set: - -```bash -echo $AGENT_WALLET_PRIVATE_KEY -``` -::: - - ---- - - -### Step 2: Local Private Deployment - -#### Option A: Run directly with npx (Recommended) - -The simplest and quickest method, no installation or cloning needed. - -**Command:** - -```bash -npx -y @bankofai/sun-mcp-server -``` - -**Description:** -- `npx` automatically downloads the latest version of `@bankofai/sun-mcp-server` -- `-y` flag automatically confirms prompts -- First run may take a few seconds to download - -**Run with environment variables:** - -```bash -TRON_NETWORK=nile npx -y @bankofai/sun-mcp-server -``` - -#### Option B: Clone from Source - -Suitable for development and custom modifications. - -**Steps:** - -```bash -# 1. Clone repository -git clone https://github.com/BofAI/sun-mcp-server.git -cd sun-mcp-server - -# 2. Install dependencies -npm install - -# 3. Build project -npm run build - -# 4. Run server -npx tsx src/index.ts -``` - -**Or install globally:** - -```bash -npm install -g @bankofai/sun-mcp-server -sun-mcp-server -``` - ---- - -### Step 3: Server Running Methods - -After wallet configuration is complete, you can run the server using one of the following methods: - -### Option A: Run directly with npx (Recommended) - -The simplest and quickest method, no installation or cloning needed. - -**Command:** - -```bash -npx -y @bankofai/sun-mcp-server -``` - -**Description:** -- `npx` automatically downloads the latest version of `@bankofai/sun-mcp-server` -- `-y` flag automatically confirms prompts -- First run may take a few seconds to download - -**Run with environment variables:** - -```bash -TRON_NETWORK=nile npx -y @bankofai/sun-mcp-server -``` - -### Option B: Clone from Source - -Suitable for development and custom modifications. - -**Steps:** - -```bash -# 1. Clone repository -git clone https://github.com/BofAI/sun-mcp-server.git -cd sun-mcp-server - -# 2. Install dependencies -npm install - -# 3. Build project -npm run build - -# 4. Run server -npx tsx src/index.ts -``` - -**Or install globally:** - -```bash -npm install -g @bankofai/sun-mcp-server -sun-mcp-server -``` - -### Option C: HTTP Mode - -Run SUN MCP Server in HTTP server mode, allowing remote connections. - -**Start HTTP Server:** - -```bash -sun-mcp-server --transport streamable-http --host 127.0.0.1 --port 8080 --mcpPath /mcp -``` - -:::warning -HTTP mode is suitable for local development and testing. For remote deployment, use HTTPS and appropriate authentication. -::: - -:::tip About Environment Variables -- **npx Run**: Export environment variables directly in the terminal before running the command. -- **HTTP Mode**: When starting the HTTP server, environment variables should be exported before the startup command: - -```bash -export TRON_NETWORK=nile -sun-mcp-server --transport streamable-http --host 127.0.0.1 --port 8080 --mcpPath /mcp -``` - -- **Server Configuration**: Once the server is running, configure your MCP client to connect to it. -::: - ---- - -### Step 4: Client Configuration - -After the server is running, you need to configure your MCP client to connect to it. Refer to your MCP client's documentation for configuration instructions. The server will be accessible at one of the following: - -- **npx/Local Build**: Typically runs as a subprocess managed by your client -- **HTTP Mode**: `http://127.0.0.1:8080/mcp` (or the host/port you specified) - ---- - -### Step 5: Verify Connection - -After starting the AI client, you should be able to see the tool list of SUN MCP Server. Perform the following tests to confirm the configuration is correct: - -#### Query Test - -Try the following command in chat: - -``` -Check the current prices of USDT and TRX on SunSwap -``` - -Expect to receive the current block number. - -#### If Testing on Testnet - -If you configured to use Nile testnet: - -```bash -TRON_NETWORK=nile -``` - -You can get test TRX from [TRON Nile Faucet](https://nile.trongrid.io/join), then try the following operations: - -- Query test account balance -- Execute a test swap (if wallet is configured) -- Check transaction history - -:::info Diagnostic Steps -If you encounter connection issues: - -1. **Check Network Connection**: Ensure you can access TRON network endpoints -2. **View Logs**: When running the server, check console output for error messages -3. **Test Network**: Try switching to testnet (Nile) to rule out network issues -::: - ---- - -## Next Steps - -Now that you've successfully deployed SUN MCP Server! Next you can: - -1. **View Full Capability List**: Browse [Full Capability List](./ToolList.md) to understand all available operations -2. **Resolve Common Issues**: Consult [Frequently Asked Questions](./FAQ.md) for help - -:::success -Congratulations! You can now interact with the TRON blockchain through your AI client. Start exploring the unlimited possibilities of DeFi! -::: diff --git a/docs/McpServer-Skills/MCP/SUNMCPServer/OfficialServerAccess.md b/docs/McpServer-Skills/MCP/SUNMCPServer/OfficialServerAccess.md deleted file mode 100644 index 434ca786..00000000 --- a/docs/McpServer-Skills/MCP/SUNMCPServer/OfficialServerAccess.md +++ /dev/null @@ -1,186 +0,0 @@ -# Official Cloud Service Access - -## What is the Official Cloud Service? - -The official cloud service is a SUN MCP Server instance hosted by **BANK OF AI**, providing AI clients with **read-only query capabilities for SunSwap on-chain data**. - -If you want your AI assistant to query token prices, pool APYs, or protocol trading volume on SunSwap, or analyze a specific address's liquidity positions — these are all read-only operations that can be completed via the official cloud service, with no wallet credentials needed. - -**The core purpose of the official cloud service is to handle all infrastructure for you.** You only need to add a single service URL to your AI client's configuration to start interacting with SunSwap. - -### Key Advantages - -**1. No private key exposure risk** — Since the cloud service is read-only, you never need to provide a wallet private key or mnemonic. This eliminates key leakage risks and makes team sharing straightforward. - -**2. Official maintenance and continuous updates** — The service always runs the latest stable version, including SunSwap protocol updates and SUN.IO API synchronization. No manual rebuilds needed. - -**3. Covers a large number of practical use cases** — Querying token prices and swap quotes, analyzing pool data and APYs, getting protocol statistics and historical metrics, viewing user liquidity positions — all the most commonly used DeFi data queries are fully supported. Only when you need to actually execute swaps or manage liquidity do you need to switch to [Local Private Deployment](./LocalPrivatizedDeployment.md). - -> In short: **The official cloud service acts as a "read-only data gateway" for SunSwap** — AI clients only need the service URL to query all public data on SunSwap. - -:::warning Important -The official cloud service only provides **read-only access**. It does **not support** token swaps, adding/removing liquidity, or any other on-chain write operations. For full functionality, please use [Local Private Deployment](./LocalPrivatizedDeployment.md). -::: - ---- - -## How to Connect - -We provide three installation methods. **Pick the one that matches your level of comfort** — the conversational install is the easiest; the interactive install gives you the most control. - -### Method 1: Conversational Install (Easiest) - -If you're already using an AI Agent that can run shell commands (OpenClaw, a Telegram bot, web chat, Claude Code, Cursor, etc.), you can install everything by **simply chatting with the AI** — no need to open a terminal yourself, no manual file copying. - -:::tip Prerequisite -**Node.js is required** on the machine where the AI Agent runs (the Agent uses `npx` under the hood). If Node.js isn't installed yet, grab the LTS installer from [nodejs.org](https://nodejs.org) — install once, double-click and follow the prompts. -::: - -**How it works:** - -1. Open your AI Agent chat -2. Copy and paste the following prompt: - - ``` - Run npx add-mcp https://sun-mcp-server.bankofai.io/mcp -y to install the SUN MCP Server. - Note: Please install to the MCP config of the current Agent. - ``` - -3. The AI handles the entire flow automatically: - - Detects the remote MCP service URL - - Auto-detects which AI client is currently running - - Writes the `sun-mcp-server` entry into the right MCP config file (no manual JSON editing) - - Reports back with a ✅ confirmation when done - -Once the AI confirms the install, the SUN MCP Server is ready — you can start asking questions right away. - -:::tip Why this is the recommended path for beginners -You don't need to know what `npx`, `npm`, or "MCP config file" means. The AI handles every step including selecting the right config path for your client. -::: - -### Method 2: Quick Auto-Install (Command Line) - -If you have Node.js installed and prefer the command line, run the following directly in your terminal: - -```bash -npx add-mcp https://sun-mcp-server.bankofai.io/mcp -y -``` - -The `-y` flag skips all interactive prompts and automatically installs to every AI tool detected on your computer. Once complete, it will show ✅ Installation complete! along with the list of agents it was installed to. - -Once installation is complete, you can start interacting with SunSwap via SUN MCP Server. - -### Method 3: Interactive Install (Most Control) - -If you want to choose which AI tools to install to, remove the `-y` flag: - -```bash -npx add-mcp https://sun-mcp-server.bankofai.io/mcp -``` - -:::tip -This guide demonstrates the installation process using terminal commands as an example. -::: - -#### Installation Walkthrough - -The installer will guide you through a few steps — just follow along: - -**1️⃣ Identify the service source** - -The installer automatically detects the remote MCP service URL and generates a server name: - -``` -◇ Source: https://sun-mcp-server.bankofai.io/mcp (remote) -│ -● Server name: sun-mcp-server -``` - -**2️⃣ Choose which AI tools to install to** - -The installer auto-detects AI tools on your computer (e.g., Claude Code, Cursor, Cline, etc.). Use Space to select the ones you want: - -``` -◇ Detected 1 agent -│ -◇ Select agents to install to -│ Claude Code -``` - -**3️⃣ Confirm installation details** - -The installer displays an installation summary. Review it and select `Yes` to proceed: - -``` -◇ Installation Summary ───╮ -│ │ -│ Server: sun-mcp-server │ -│ Type: remote │ -│ Scope: Project │ -│ Agents: Claude Code │ -│ │ -├──────────────────────────╯ -│ -◇ Proceed with installation? -│ Yes -``` - -**4️⃣ Installation complete!** - -When you see output like this, SUN MCP Server has been successfully installed to your selected AI tools: - -``` -◇ Installation complete -│ -◇ Installed to 1 agent ───────╮ -│ │ -│ ✓ Claude Code: ~/.mcp.json │ -│ │ -├──────────────────────────────╯ -│ -└ Done! -``` - -Once installation is complete, you can start interacting with SunSwap via SUN MCP Server. - ---- - -## Verify Connection - -Once connected, you can test by asking your AI Agent the following question: - -``` -Check the current prices of USDT and TRX on SunSwap -``` - -If you receive a normal response, the connection is working. - -If you encounter issues, first confirm: -1. Node.js version >= 20.0.0 (run `node --version` to check) -2. Network can reach `sun-mcp-server.bankofai.io` - ---- - -## Available Capabilities Overview - -When connected via the official cloud service, you can use all **read-only** tools, including: - -| Category | Example Capabilities | -| :--- | :--- | -| **Token Prices** | Query real-time token prices by address or symbol | -| **Swap Quotes** | Get the optimal swap quote for an exact input via smart routing | -| **Token Info** | Search token information by address, protocol, or keyword | -| **Pool Data** | Pool lists, APY rankings, trading volume history, liquidity history | -| **Position Queries** | User liquidity positions, tick-level position details | -| **Protocol Stats** | Trading volume, user counts, transaction counts, pool count history | -| **Farm Info** | Farm lists, farm transactions, user farm positions | -| **Contract Reading** | Call view/pure functions on any TRON contract | - -For the Full Capability List, see [Full Capability List](./ToolList.md). - ---- - -## Next Steps - -- Need token swaps or liquidity management? → [Local Private Deployment](./LocalPrivatizedDeployment.md) -- Want the detailed description of all available tools? → [Full Capability List](./ToolList.md) diff --git a/docs/McpServer-Skills/MCP/SUNMCPServer/QuickStart.md b/docs/McpServer-Skills/MCP/SUNMCPServer/QuickStart.md deleted file mode 100644 index 6f1a689a..00000000 --- a/docs/McpServer-Skills/MCP/SUNMCPServer/QuickStart.md +++ /dev/null @@ -1,82 +0,0 @@ -# Quick Start - -The goal of this page is simple: **get you integrated and make your first DeFi query in just 1 minute.** - -We'll use the [official cloud service](./OfficialServerAccess.md) for this quick experience. The cloud service is read-only, requires no wallet, and is ready to use immediately. - ---- - -## Preparation - -Before you get started, make sure you have: - -1. **Node.js** >= 20.0.0 ([download link](https://nodejs.org/)) -2. **MCP Client**: Any AI client that supports MCP. - ---- - -## Install - -The easiest way to install is by **simply chatting with your AI Agent** — no need to open a terminal yourself, no manual file copying. If you're already using an AI Agent that can run shell commands (OpenClaw, a Telegram bot, web chat, Claude Code, Cursor, etc.), you're set. - -**How it works:** - -1. Open your AI Agent chat -2. Copy and paste the following prompt: - - ``` - Run npx add-mcp https://sun-mcp-server.bankofai.io/mcp -y to install the SUN MCP Server. - Note: Please install to the MCP config of the current Agent. - ``` - -3. The AI handles the entire flow automatically: - - Detects the remote MCP service URL - - Auto-detects which AI client is currently running - - Writes the `sun-mcp-server` entry into the right MCP config file (no manual JSON editing) - - Reports back with a ✅ confirmation when done - -Once the AI confirms the install, the SUN MCP Server is ready — you can start asking questions right away. - -:::tip Prefer the command line? -If you'd rather run the install yourself or need finer control (e.g. selecting which AI tools to install to), see [Official Cloud Service Access](./OfficialServerAccess.md) for the command-line and interactive options. -::: - ---- - -## Test It Out - -Try the following query in a conversation: - -``` -Check the current prices of USDT and TRX on SunSwap -``` - -:::info About Cloud Service -The official cloud service we provide is **read-only**, suitable for querying data and analysis. If you need to execute on-chain transactions, deploy contracts, or other write operations, please see [Local Privatized Deployment](./LocalPrivatizedDeployment.md). -::: - ---- - -## Continue Exploring - -Here are some common DeFi query examples: - -| Operation | Example Prompt | -|------|--------| -| **Price Query** | Query the real-time price of USDT/TRX | -| **Liquidity Pool Data** | Get pool information for the TRX-USDC trading pair on SunSwap | -| **Position Query** | View all liquidity positions of address TR... on SunSwap | -| **Trade Quote** | Get a quote for swapping 1000 USDT for TRX | -| **Protocol Stats** | Get SunSwap statistics including TVL and 24-hour trading volume | - ---- - -## Next Steps - -- **[Local Privatized Deployment](./LocalPrivatizedDeployment.md)** - Learn how to run SUN MCP Server locally and perform write operations -- **[Official Server Access](./OfficialServerAccess.md)** - Learn more about the official cloud service -- **[Full Capability List](./ToolList.md)** - View all available tools and features - ---- - -Happy coding! If you have any questions, feel free to provide feedback. diff --git a/docs/McpServer-Skills/MCP/SUNMCPServer/ToolList.md b/docs/McpServer-Skills/MCP/SUNMCPServer/ToolList.md deleted file mode 100644 index 09625201..00000000 --- a/docs/McpServer-Skills/MCP/SUNMCPServer/ToolList.md +++ /dev/null @@ -1,349 +0,0 @@ -# Full Capability List - -SUN MCP Server provides **41 tools**. - -## Understand Two Key Concepts First - -Before browsing the tool list, there are two things you should know: - -:::info Read vs Write -Each tool is labeled with a **mode** — "read" or "write": - -- **Read tools**: Only query on-chain data and do not affect any state. They can be used in both cloud services and local deployments. -- **Write tools**: Modify blockchain state (e.g., transfers, staking, contract interactions). These are only available in local deployments with a configured wallet. - -If you have not configured a wallet, write tools will not appear in the AI’s available tool list — they are automatically hidden, so there’s no risk of triggering them by mistake. -::: - -:::tip `network` parameter -Most tools include an optional `network` parameter used to specify the target network environment. By default, the mainnet is used, but it can be switched to a testnet if needed. -::: - ---- - -## Custom Tools (18 total) - -### Wallet and Balance - -| Tool Name | Function Description | Tool Type | Required Parameters | Optional Parameters | -|--------|---------|---------|---------|---------| -| `sunswap_get_wallet_address` | Get current active TRON wallet address | Read | - | `network` | -| `sunswap_get_balances` | Query TRX and TRC20 token balances | Read | `tokens` | `network`, `ownerAddress` | - -**Try saying this:** -- "Query my TRON wallet address" -- "Show my balance for USDT and SUNFLARE" -- "Get my TRX balance on testnet" - ---- - -### Price and Quotes - -| Tool Name | Function Description | Tool Type | Required Parameters | Optional Parameters | -|--------|---------|---------|---------|---------| -| `sunswap_get_token_price` | Get token price (via SUN.IO API) | Read | `tokenAddress` or `symbol` | `network` | -| `sunswap_quote_exact_input` | Swap quote for exact input amount (smart routing) | Read | `routerAddress`, `args` | `network`, `functionName`, `abi` | - -**Try saying this:** -- "What is the current price of SUNFLARE?" -- "If I swap 1000 USDT for SUNFLARE, how much will I get?" -- "Query the current price of USDC on testnet" - ---- - -### Swaps - -| Tool Name | Function Description | Tool Type | Required Parameters | Optional Parameters | -|--------|---------|---------|---------|---------| -| `sunswap_swap` | Execute generic router swap (supports auto-routing + Permit2) | Write | `tokenIn`, `tokenOut`, `amountIn` | `network`, `slippage` | -| `sunswap_swap_exact_input` | Exact input swap (smart router) | Write | `routerAddress`, `args` | `network`, `functionName`, `value`, `abi` | - -**Try saying this:** -- "I want to swap 500 USDT for SUNFLARE with 1% slippage" -- "Execute a swap of 1000 USDC for TRX" -- "Help me swap SUNFLARE to USDT, completed in less than 2 seconds" - -:::caution Wallet Required -Swap tools require local deployment of SUN MCP Server with configured wallet private key. -::: - ---- - -### V2 Liquidity - -| Tool Name | Function Description | Tool Type | Required Parameters | Optional Parameters | -|--------|---------|---------|---------|---------| -| `sunswap_v2_add_liquidity` | Add V2 liquidity (automatic TRX/WTRX handling) | Write | `routerAddress`, `tokenA`, `tokenB`, `amountADesired`, `amountBDesired` | `network`, `amountAMin`, `amountBMin`, `to`, `deadline`, `abi` | -| `sunswap_v2_remove_liquidity` | Remove V2 liquidity | Write | `routerAddress`, `tokenA`, `tokenB`, `liquidity` | `network`, `amountAMin`, `amountBMin`, `to`, `deadline`, `abi` | - -**Try saying this:** -- "I want to add 1000 USDT and equivalent SUNFLARE to V2 liquidity pool" -- "Remove 50% of my liquidity from the USDC-TRX pool" -- "Add V2 liquidity with minimum 950 USDT and 9500 SUNFLARE" - -:::info Auto-handling -When the pair involves TRX, the tool automatically converts to WTRX. -::: - ---- - -### V3 Liquidity - -| Tool Name | Function Description | Tool Type | Required Parameters | Optional Parameters | -|--------|---------|---------|---------|---------| -| `sunswap_v3_mint_position` | Create V3 concentrated liquidity position | Write | `positionManagerAddress`, `token0`, `token1` | `network`, `fee`, `tickLower`, `tickUpper`, `amount0Desired`, `amount1Desired`, `amount0Min`, `amount1Min`, `recipient`, `deadline`, `abi` | -| `sunswap_v3_increase_liquidity` | Increase V3 liquidity | Write | `positionManagerAddress`, `tokenId` | `network`, `token0`, `token1`, `fee`, `amount0Desired`, `amount1Desired`, `amount0Min`, `amount1Min`, `deadline` | -| `sunswap_v3_decrease_liquidity` | Decrease V3 liquidity | Write | `positionManagerAddress`, `tokenId`, `liquidity` | `network`, `token0`, `token1`, `fee`, `amount0Min`, `amount1Min`, `deadline` | -| `sunswap_v3_collect` | Collect V3 fees | Write | `positionManagerAddress`, `tokenId` | `network`, `recipient`, `abi` | - -**Try saying this:** -- "Help me create liquidity in the USDT-SUNFLARE V3 0.3% fee pool with range ±50 ticks" -- "Increase my V3 position #12345 by adding 1000 USDT" -- "Collect fees from my V3 position" -- "Decrease V3 liquidity to 50%" - -:::tip Auto-calculation -When creating a new position, the system automatically calculates tick range (±50×tickSpacing) and optimal single-sided input amounts. -::: - ---- - -### V4 Liquidity - -| Tool Name | Function Description | Tool Type | Required Parameters | Optional Parameters | -|--------|---------|---------|---------|---------| -| `sunswap_v4_mint_position` | Create V4 position (Permit2 supported) | Write | `token0`, `token1` | `network`, `fee`, `tickLower`, `tickUpper`, `amount0Desired`, `amount1Desired`, `slippage`, `recipient`, `deadline`, `sqrtPriceX96`, `createPoolIfNeeded` | -| `sunswap_v4_increase_liquidity` | Increase V4 liquidity (Permit2 supported) | Write | `tokenId`, `token0`, `token1` | `network`, `fee`, `amount0Desired`, `amount1Desired`, `slippage`, `deadline` | -| `sunswap_v4_decrease_liquidity` | Decrease V4 liquidity | Write | `tokenId`, `liquidity`, `token0`, `token1` | `network`, `fee`, `amount0Min`, `amount1Min`, `slippage`, `deadline` | -| `sunswap_v4_collect` | Collect V4 fees | Write | `tokenId` | `network`, `token0`, `token1`, `fee`, `deadline` | - -**Try saying this:** -- "Create a USDC-SUNFLARE liquidity position in V4 with 5% slippage" -- "Increase my V4 position #67890 by injecting 5000 USDC" -- "Collect all accumulated fees from V4 position" -- "Decrease V4 liquidity ensuring slippage stays within 3%" - -:::info Permit2 Support -V4 tools natively support Permit2 signature authorization, improving user experience. -::: - ---- - -### Contract Interaction - -| Tool Name | Function Description | Tool Type | Required Parameters | Optional Parameters | -|--------|---------|---------|---------|---------| -| `sunswap_read_contract` | Read data from TRON smart contract (view/pure) | Read | `address`, `functionName` | `network`, `args`, `abi` | -| `sunswap_send_contract` | Send state-changing contract transaction | Write | `address`, `functionName` | `network`, `args`, `value`, `abi` | - -**Try saying this:** -- "Query the total supply of SUNFLARE contract" -- "Read my balance in the liquidity contract" -- "Call contract function to update pool parameters" -- "Send 0.1 TRX to contract and execute specific function" - -:::caution ABI Requirement -If ABI is not provided, the system will attempt to retrieve contract ABI from TronScan. -::: - ---- - -## SUN.IO OpenAPI Derived Tools (23 total) - -### Transactions - -| Tool Name | Function Description | Required Parameters | Optional Parameters | -|--------|---------|---------|---------| -| `scanTransactions` | Scan DEX transactions | - | `protocol`, `token`, `pool`, `type`, `timeRange` | -| `getFarmTransactions` | Scan farm pool transactions | `farmAddress` | - | - -**Try saying this:** -- "View SUN protocol transactions from the past 24 hours" -- "Query all transactions in the SUNFLARE-USDT pool" -- "Get transaction data from the last 7 days" - ---- - -### Tokens - -| Tool Name | Function Description | Required Parameters | Optional Parameters | -|--------|---------|---------|---------| -| `getTokens` | Get tokens by address or protocol | - | `address`, `protocol` | -| `searchTokens` | Fuzzy search tokens | `keyword` | - | -| `getPrice` | Get token price by address | `tokenAddress` | - | - -**Try saying this:** -- "Search for 'SUNFLARE' token" -- "Get token information for address `TR7NHqjeKQxGTCi8q282JHJC8YXQFg...`" -- "Query USDT price in SUN protocol" - ---- - -### Protocol - -| Tool Name | Function Description | Required Parameters | Optional Parameters | -|--------|---------|---------|---------| -| `getProtocol` | Protocol snapshot data | - | - | -| `getVolHistory` | Protocol volume history | - | - | -| `getLiqHistory` | Protocol liquidity history | - | - | -| `getUsersCountHistory` | Protocol user count history | - | - | -| `getTransactionsHistory` | Protocol transaction count history | - | - | -| `getPoolsCountHistory` | Protocol pool count history | - | - | - -**Try saying this:** -- "Get the latest snapshot of SUN protocol" -- "View volume trends over the past 30 days" -- "Get protocol user growth information" - ---- - -### Price - -| Tool Name | Function Description | Required Parameters | Optional Parameters | -|--------|---------|---------|---------| -| `getPrice` | Token price query | `tokenAddress` | - | - -**Try saying this:** -- "Get the real-time price of SUNFLARE token" - ---- - -### Positions - -| Tool Name | Function Description | Required Parameters | Optional Parameters | -|--------|---------|---------|---------| -| `getUserPositions` | User liquidity positions | `userAddress` | - | -| `getPoolUserPositionTick` | Pool user tick-level position details | `poolAddress`, `userAddress` | - | -| `getFarmPositions` | User farm positions | `userAddress` | - | - -**Try saying this:** -- "View all my liquidity positions" -- "Get my tick-level details in the USDT-SUNFLARE pool" -- "Query my farm yield positions" - ---- - -### Pools - -| Tool Name | Function Description | Required Parameters | Optional Parameters | -|--------|---------|---------|---------| -| `getPools` | Get pools | - | `address`, `token`, `protocol` | -| `searchPools` | Search pools | `keyword` | - | -| `searchCountPools` | Pool search count | `keyword` | - | -| `getTopApyPoolList` | Get top APY pool list | - | `limit`, `offset` | -| `getPoolHooks` | Pool hooks | `poolAddress` | - | -| `getPoolVolHistory` | Pool volume history | `poolAddress` | - | -| `getPoolLiqHistory` | Pool liquidity history | `poolAddress` | - | - -**Try saying this:** -- "Get detailed information about the SUNFLARE-USDT pool" -- "Find the top 10 pools with highest APY" -- "Get volume history of the USDC-TRX pool" -- "Query all hooks used by the pool" - ---- - -### Trading Pairs - -| Tool Name | Function Description | Required Parameters | Optional Parameters | -|--------|---------|---------|---------| -| `getPairsFromEntity` | Token pair query | - | `token0`, `token1` | - -**Try saying this:** -- "Get trading pair information between SUNFLARE and USDT" -- "Query all trading pairs containing USDC" - ---- - -### Farm - -| Tool Name | Function Description | Required Parameters | Optional Parameters | -|--------|---------|---------|---------| -| `getFarms` | Farm pool list | - | - | - -**Try saying this:** -- "List all available farm pools" -- "Query current farm reward situation" - ---- - -## Auto-Calculation Features - -SUN MCP Server has multiple tools with built-in intelligent auto-calculation features designed to simplify user interaction: - -### V3 Liquidity Auto-Calculation - -**`sunswap_v3_mint_position` Auto Features:** - -| Feature | Description | Use Case | -|------|------|---------| -| **Default Fee** | If `fee` not specified, system automatically uses `3000` (0.3%) | Quickly create standard liquidity position | -| **Tick Range Calculation** | Automatically set `tickLower` and `tickUpper` to `±50 × tickSpacing` | No need to manually calculate complex math, get reasonable range directly | -| **Single-Sided Input Handling** | Can specify only one token amount, system automatically calculates required amount of other token | Simplify multi-token liquidity deployment | - -**Example:** -``` -Request: Create V3 position in USDT-SUNFLARE pool, inject 1000 USDT -System automatically: - - Set fee to 3000 (0.3%) - - Calculate ±50 tick range - - Based on current price, calculate required SUNFLARE amount - - Submit multi-token authorization and transaction in one go -``` - -### V4 Liquidity Auto-Calculation - -**`sunswap_v4_mint_position` Auto Features:** - -| Feature | Description | Use Case | -|------|------|---------| -| **Tick Range Calculation** | Automatically set `tickLower` and `tickUpper` to `±100 × tickSpacing` | V4's more flexible range configuration | -| **Default Slippage** | If `slippage` not specified, system automatically uses `5%` | Protect users from price volatility | -| **Permit2 Authorization** | Native support for Permit2 signature process, no need for multiple approvals | Improve user experience, complete all authorizations with one signature | -| **Dynamic Pool Creation** | If pool doesn't exist, `createPoolIfNeeded` can automatically create new pool | Quickly establish liquidity for new trading pairs | - -**Example:** -``` -Request: Create USDC-SUNFLARE position in V4 with 3% slippage -System automatically: - - Calculate ±100 tick range - - Use Permit2 signature authorization - - Create new pool if it doesn't exist - - Based on current price, calculate optimal input ratio -``` - -### Smart Swap Routing - -**`sunswap_swap` Auto Features:** - -| Feature | Description | Use Case | -|------|------|---------| -| **Multi-Route Optimization** | Automatically find optimal swap path, support direct trading pairs and multi-hop routes | Get best price | -| **Permit2 Integration** | No need to pre-approve tokens, complete authorization and swap with one signature | Improve user flow | - -**Example:** -``` -Request: Swap 1000 USDT for SUNFLARE with 1% slippage -System automatically: - - Evaluate direct USDT-SUNFLARE pool - - Evaluate USDT → intermediate → SUNFLARE routes - - Choose optimal path - - Use Permit2 one-time signature to complete authorization and trade - - Ensure slippage doesn't exceed 1% -``` - -### Key Parameter Reference - -| Parameter | Default Value | When Auto-Calculated | -|------|--------|-----------| -| `fee` (V3) | 3000 | When not provided | -| `tickLower`, `tickUpper` (V3) | ±50×tickSpacing | When not provided | -| `tickLower`, `tickUpper` (V4) | ±100×tickSpacing | When not provided | -| `slippage` (V4) | 5% | When not provided | -| Counterparty token amount | Calculated by current price | When only one token amount specified | - -:::tip Best Practice -Although most parameters are auto-calculated, for critical operations (such as adding large amounts of liquidity), it's recommended to actively specify parameters to get higher control precision. -::: - - diff --git a/docs/McpServer-Skills/SKILLS/Intro.md b/docs/McpServer-Skills/SKILLS/Intro.md index 5eefda6f..b82c192a 100644 --- a/docs/McpServer-Skills/SKILLS/Intro.md +++ b/docs/McpServer-Skills/SKILLS/Intro.md @@ -57,111 +57,23 @@ No. Skills use an **on-demand, lightweight architecture** — the AI only loads ## What Can Skills Do for You? -Fourteen skills in total — covering the most common scenarios in the TRON ecosystem plus X/Twitter tooling, and a dedicated onboarding helper. Each one comes with a ready-to-use sample prompt — copy it into your AI chat and hit enter to try it out. - -### 🔑 Secure Wallet Management - -Create encrypted wallets, sign transactions and messages, manage multiple wallets — all without exposing your private key. This is the foundation that other trading and payment skills rely on. Supports both EVM (BSC, Ethereum, Polygon, etc.) and TRON networks. - -> 🗣️ "Create a new agent wallet for me" or "List all my wallets and show their addresses." - -💡 For setup and advanced usage, see: [**agent-wallet**](./BANKOFAISkill.md#agent-wallet) - -### 💱 Execute DEX Trades - -Check prices, compare rates, even swap tokens in one go. - -> 🗣️ "How much TRX can I get for 100 USDT on SunSwap right now?" - -💡 For more advanced features, see: [**sunswap**](./BANKOFAISkill.md#sunswap) - -### 🚀 Launch & Trade SunPump Meme Coins - -Create your own meme token in one sentence, buy and sell on SunPump — TRON's meme-token launchpad — and check market data. Token creation happens **server-side, no wallet needed**: just give a name, symbol, description, and logo. For trading, the AI automatically picks the right path: tokens that haven't created a SunSwap V2 pair yet ("pre-launch") trade on the bonding curve, while tokens that already have a SunSwap V2 pair ("post-launch") go through a regular swap. You can also look up token detail, rankings, holder distribution, and wallet portfolios. TRON mainnet only. - -> 🗣️ "Launch a meme token on SunPump — here are the name, symbol, description, and logo." or "Show me the top 10 SunPump meme coins by 24h gain, then check the holder concentration of the top one." - -💡 For trading and risk details, see: [**sunpump-agent-skill**](./BANKOFAISkill.md#sunpump-agent-skill) - -### 📈 Trade Perpetual Contracts - -View market data, open and close positions on SunPerp. Built-in safety locks: max 20x leverage (configurable) and a mandatory stop-loss on every position-opening order — auto-set to 5% from entry if omitted, and rejected if wider than 25%. Keeps you from blowing up your account. - -> 🗣️ "What's BTC's funding rate right now? Open a 5x long position with a 5% stop-loss." - -💡 For more parameter settings, see: [**sunperp-skill**](./BANKOFAISkill.md#sunperp-skill) - -### 🕵️ Query On-Chain Data - -Look up accounts, transactions, and check if a new token is legit. Pure read-only, completely safe, costs nothing. - -> 🗣️ "Check the holder distribution for that new token — is it controlled by a whale?" - -💡 For more query dimensions, see: [**tronscan-skill**](./BANKOFAISkill.md#tronscan-skill) - -### 💸 Transfer & Manage TRC20 Tokens - -Check balances, transfer tokens, manage approvals — supports common tokens like USDT, USDD, SUN, and can also operate any TRC20 token via its contract address. Supports batch balance checks. - -> 🗣️ "Check my USDT, USDD, and SUN balances. Then transfer 10 USDT to TRecipientAddress." - -💡 For more token operations, see: [**trc20-toolkit-skill**](./BANKOFAISkill.md#trc20-toolkit-skill) - -### 💵 USDD Stablecoin & JUST Protocol - -Swap USDT ↔ USDD at 1:1 via the Peg Stability Module (zero fee currently), check USDD/USDT/USDC/TRX/JST balances, and read vault (CDP) positions and protocol parameters. - -> 🗣️ "Sell 1000 USDT for USDD via the PSM" or "Show me all USDD vault types and their stability fees." - -💡 For PSM swaps and vault queries, see: [**usdd-skill**](./BANKOFAISkill.md#usdd-skill) - -### 🗳️ TRX Staking & SR Voting - -Stake TRX for TRON Power, vote for Super Representatives, and claim voting rewards. Stake 2.0 compatible — top 27 SRs distribute block rewards every 6 hours proportionally to their voters. - -> 🗣️ "Show my TRON Power and current votes, then list the top 10 SRs." or "Claim my pending voting rewards." - -💡 For staking, voting, and reward flows, see: [**trx-staking-skill**](./BANKOFAISkill.md#trx-staking-skill) - -### 🔐 Multi-Sig & Account Permissions - -Set up multi-signature security for your TRON account — configure keys, thresholds, and co-sign transactions. Perfect for teams or for restricting your AI agent to DeFi-only operations. - -> 🗣️ "Check my account's current permission setup. Then set up a 2-of-3 multi-sig on owner permission." - -💡 For permission templates and multi-sig workflows, see: [**multisig-permissions**](./BANKOFAISkill.md#multisig-permissions) - -### ☕ Auto-Settle On-Chain Paid Services - -When the AI needs to call a paid on-chain service or data API, it uses the x402 protocol to automatically complete "pay first, then receive" on-chain settlement — no manual QR scanning or wallet switching needed. Multi-chain support — TRON (TRC20: USDT, USDD, with GasFree) and BSC (ERC20: USDT, USDC) both work; just switch the `--network` parameter. - -> 🗣️ "Use the x402 protocol to call this paid agent endpoint: https://api.example.com" (replace with the actual paid endpoint URL you want to call) - -💡 For payment and authorization details, see: [**x402-payment**](./BANKOFAISkill.md#x402-payment) - -### 🏦 Manage BANK OF AI Account - -Check your BANK OF AI balance and top up with a single sentence. - -> 🗣️ "How much balance do I have? Go ahead and recharge 5 USDT." - -💡 For top-up and withdrawal rules, see: [**recharge-skill**](./BANKOFAISkill.md#recharge-skill) - -### 🐦 X/Twitter Daily Digest - -Turn your own X/Twitter account into a daily briefing — mentions, home timeline, and reply opportunities, summarized for you. - -> 🗣️ "Generate today's X/Twitter digest for my account." - -💡 Two ways to run it: API-only via [**twitter-digest**](./BANKOFAISkill.md#twitter-digest), or from the local `xurl` CLI via [**twitter-mcp**](./BANKOFAISkill.md#twitter-mcp). - -### 🧭 Onboarding Guide (bankofai-guide) - -A lightweight companion skill that runs the post-install setup flow, helps you create your first AgentWallet, and acts as a "wallet guard" before any on-chain operation — reminding you to set up a wallet if none exists. You don't usually call it directly; it gets invoked automatically by the installer and by other skills when needed. - -> 🗣️ "Walk me through BANK OF AI onboarding." or "Run bankofai-guide so I can set up my first wallet." - -💡 For the full onboarding flow, see: [**bankofai-guide**](./BANKOFAISkill.md#bankofai-guide) +Fourteen skills covering the most common TRON scenarios plus X/Twitter tooling — the table below shows everything at a glance. Each comes with a sample prompt you can paste straight into your AI chat; click a skill name for its full docs. + +| Skill | What it does | Try saying | +| :-- | :-- | :-- | +| 🔑 [agent-wallet](./BANKOFAISkill.md#agent-wallet) | Create/manage encrypted wallets and sign transactions without exposing your key; the foundation other skills rely on (EVM + TRON) | "Create a new agent wallet for me" | +| 💱 [sunswap](./BANKOFAISkill.md#sunswap) | Check prices, compare rates, swap tokens in one go | "How much TRX can I get for 100 USDT?" | +| 🚀 [sunpump-agent-skill](./BANKOFAISkill.md#sunpump-agent-skill) | Launch a meme token in one sentence, trade and track SunPump (TRON mainnet only; creation needs no wallet) | "Launch a meme token on SunPump" | +| 📈 [sunperp-skill](./BANKOFAISkill.md#sunperp-skill) | SunPerp perpetuals — market data, open/close positions; built-in guardrails: ≤20x leverage, mandatory stop-loss | "Open a 5x long with a 5% stop-loss" | +| 🕵️ [tronscan-skill](./BANKOFAISkill.md#tronscan-skill) | Look up accounts, transactions, token safety; read-only, free, zero risk | "Is that new token whale-controlled?" | +| 💸 [trc20-toolkit-skill](./BANKOFAISkill.md#trc20-toolkit-skill) | TRC20 balances, transfers, approvals — batch checks and any contract address | "Transfer 10 USDT to TRecipientAddress" | +| 💵 [usdd-skill](./BANKOFAISkill.md#usdd-skill) | 1:1 USDT ↔ USDD via the PSM (currently zero fee), read vault (CDP) positions | "Sell 1000 USDT for USDD via the PSM" | +| 🗳️ [trx-staking-skill](./BANKOFAISkill.md#trx-staking-skill) | Stake TRX, vote for SRs, claim rewards (Stake 2.0) | "Claim my pending voting rewards" | +| 🔐 [multisig-permissions](./BANKOFAISkill.md#multisig-permissions) | Multi-sig and permission management — great for teams or limiting your AI | "Set up a 2-of-3 multi-sig on owner" | +| ☕ [x402-payment](./BANKOFAISkill.md#x402-payment) | Auto "pay first, then receive" settlement via x402 when calling paid APIs (TRON / BSC) | "Use x402 to call this paid endpoint: https://…" | +| 🏦 [recharge-skill](./BANKOFAISkill.md#recharge-skill) | Check your BANK OF AI balance and top up in one sentence | "Check my balance, then recharge 5 USDT" | +| 🐦 [twitter-digest](./BANKOFAISkill.md#twitter-digest) / [twitter-mcp](./BANKOFAISkill.md#twitter-mcp) | Your X/Twitter daily briefing: mentions, timeline, reply opportunities | "Generate today's X digest for my account" | +| 🧭 [bankofai-guide](./BANKOFAISkill.md#bankofai-guide) | Onboarding + "wallet guard"; usually invoked automatically by the installer | "Walk me through BANK OF AI onboarding" | --- diff --git a/docs/McpServer-Skills/Tools/SUNCli/CommandGuide.md b/docs/McpServer-Skills/Tools/SUNCli/CommandGuide.md deleted file mode 100644 index 441640da..00000000 --- a/docs/McpServer-Skills/Tools/SUNCli/CommandGuide.md +++ /dev/null @@ -1,1189 +0,0 @@ -# Complete Capabilities - -This page is the complete reference for all SUN CLI commands. Commands are organized by category: wallet management, price, token, swap, pool, liquidity, position, pair, farm, protocol, transaction, contract, and SunPump. - -> Legend: `` = required argument, `[arg]` = optional argument. -> Options marked with **(required)** must be provided. All others are optional. - ---- - -## Global Flags - -All commands inherit these root-level flags. **Root flags must be placed before the subcommand.** - -| Flag | Description | -| :--- | :--- | -| `--output ` | Output format: `table`, `json`, `tsv` | -| `--json` | Shortcut for JSON output | -| `--fields ` | Comma-separated output field filter | -| `--network ` | Override `TRON_NETWORK` (e.g., `mainnet`, `nile`, `shasta`) | -| `-k, --private-key ` | Provide a private key for this invocation only | -| `-m, --mnemonic ` | Provide a mnemonic for this invocation only | -| `-i, --mnemonic-account-index ` | Provide a mnemonic account index for this invocation only | -| `-p, --agent-wallet-password ` | Override `AGENT_WALLET_PASSWORD` for this invocation | -| `-d, --agent-wallet-dir ` | Override `AGENT_WALLET_DIR` for this invocation | -| `-y, --yes` | Skip confirmation prompts | -| `--dry-run` | Print intent without sending the write action | - -:::caution Private Key Security -The `-k` / `--private-key` and `-m` / `--mnemonic` flags pass sensitive -material as command-line arguments, which may be recorded in shell history -and process listings. Prefer environment variables (`AGENT_WALLET_PRIVATE_KEY`, -`AGENT_WALLET_MNEMONIC`) or [agent-wallet](https://github.com/BofAI/agent-wallet) -encrypted storage for all non-throwaway keys. -::: - -**Examples:** - -```bash -sun --json price TRX -``` - -```bash -sun --output tsv pool top-apy --page-size 10 -``` - -```bash -sun --fields address,network wallet address -``` - -```bash -sun -p your_agent_wallet_password wallet address -``` - -```bash -sun -k your_private_key --network nile --yes swap TRX USDT 1000000 -``` - -```bash -sun --dry-run contract send TContract transfer --args '["TRecipient","1000000"]' -``` - ---- - -## Wallet & Portfolio - -### `wallet address` (read) - -Print the active wallet address. - -```bash -sun wallet address -``` - -### `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` | - ---- - -## Price - -### `price [token]` (read) - -Get token prices from SUN.IO. Accepts a built-in symbol or address. - -```bash -sun price [token] [options] -``` - -| Option | Description | Default | -| :--- | :--- | :--- | -| `--address ` | Comma-separated token contract addresses | — | - -```bash -sun price TRX -``` - -```bash -sun price USDT -``` - -```bash -sun price --address TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t -``` - ---- - -## Token - -### `token list` (read) - -Fetch tokens by address or protocol. - -```bash -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 - -:::caution Amount precision — `` is an integer scaled by the token's `decimals` -Every `` (and every `--amount*` option in the Liquidity section below) is the human-readable amount × `10^decimals`. **No decimal point, no automatic conversion.** - -- TRX, USDT (TRC20), WTRX, USDCOLD, WIN — **6 decimals** → `1` token = `1000000` -- USDD, SUN, JST, BTT, USDDOLD — **18 decimals** → `1` token = `1000000000000000000` - -So `sun swap TRX USDT 1000000` swaps **1 TRX** (not 1,000,000 TRX) for USDT. -::: - -### `swap ` (write) - -Execute a token swap via SunSwap Universal Router. - -```bash -sun swap [options] -``` - -| Option | Description | Default | -| :--- | :--- | :--- | -| `--slippage ` | Slippage tolerance as decimal (e.g. 0.005 = 0.5%) | `0.005` | - -```bash -# Swap 1 TRX for USDT -sun swap TRX USDT 1000000 -``` - -```bash -# Same swap, with 1% slippage tolerance -sun swap TRX USDT 1000000 --slippage 0.01 -``` - -### `swap:quote ` (read) - -Get a swap quote without executing. - -```bash -sun swap:quote [options] -``` - -| Option | Description | Default | -| :--- | :--- | :--- | -| `--all` | Show all available routes | `false` | - -```bash -# Quote: swap 1 TRX for USDT -sun swap:quote TRX USDT 1000000 -``` - -```bash -sun swap:quote TRX USDT 1000000 --all -``` - -### `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 -``` - -### `pool vol-history ` (read) - -Pool volume history over a date range. - -```bash -sun pool vol-history [options] -``` - -| Option | Description | Default | -| :--- | :--- | :--- | -| `--start ` | Start date (YYYY-MM-DD) | — | -| `--end ` | End date (YYYY-MM-DD) | — | - -### `pool liq-history ` (read) - -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 - -### `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. - -Create a new liquidity pool (both token amounts required): - -```bash -sun liquidity v2:add --token-a TRX --token-b USDT --amount-a 1000000 --amount-b 290000 -``` - -Add liquidity to an existing pool (the other token amount is calculated automatically): - -```bash -sun liquidity v2:add --token-a TRX --token-b USDT --amount-a 1000000 -``` - -### `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 | — | - -```bash -sun liquidity v2:remove --token-a TRX --token-b USDT --liquidity 500000 -``` - -### `liquidity v3:mint` (write) - -Mint a new V3 concentrated liquidity position. Position Manager is auto-detected by network. - -```bash -sun liquidity v3:mint [options] -``` - -| 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 | -| `--tick-upper ` | Upper tick boundary | Auto | -| `--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. - -```bash -sun liquidity v3:mint --token0 TRX --token1 USDT --amount0 1000000 -``` - -### `liquidity v3:increase` (write) - -Increase liquidity on an existing V3 position. - -```bash -sun liquidity v3:increase [options] -``` - -| 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. - -```bash -sun liquidity v3:increase --token-id 123 --amount0 500000 -``` - -### `liquidity v3:decrease` (write) - -Decrease liquidity on an existing V3 position. - -```bash -sun liquidity v3:decrease [options] -``` - -| 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 | — | - -```bash -sun liquidity v3:decrease --token-id 123 --liquidity 1000 -``` - -### `liquidity v3:collect` (write) - -Collect accumulated fees from a V3 position. - -```bash -sun liquidity v3:collect [options] -``` - -| 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 | — | - -```bash -sun liquidity v3:collect --token-id 123 -``` - -### `liquidity v4:mint` (write) - -Mint a new V4 concentrated liquidity position. - -```bash -sun liquidity v4:mint [options] -``` - -| Option | Description | Default | -| :--- | :--- | :--- | -| `--token0 ` | **(required)** Token 0 | — | -| `--token1 ` | **(required)** Token 1 | — | -| `--fee ` | Pool fee tier | — | -| `--tick-lower ` | Lower tick boundary | Auto | -| `--tick-upper ` | Upper tick boundary | Auto | -| `--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 | — | - -In an existing pool: - -```bash -sun liquidity v4:mint --token0 TRX --token1 USDT --amount0 1000000 -``` - -Create pool if it does not exist: - -```bash -sun liquidity v4:mint --token0 TRX --token1 USDT --amount0 1000000 --create-pool -``` - -### `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 | — | - -```bash -sun liquidity v4:increase --token-id 123 --token0 TRX --token1 USDT --amount0 500000 -``` - -### `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 | — | - -```bash -sun liquidity v4:decrease --token-id 123 --liquidity 1000 --token0 TRX --token1 USDT -``` - -### `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 | — | - -```bash -sun liquidity v4:collect --token-id 123 -``` - -### `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 | — | - -```bash -sun liquidity v4:info --pm --token-id 123 -``` - ---- - -## Position - -### `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 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