prepare_sunswap_swap
Build an unsigned SunSwap V2 same-chain swap on TRON. SunSwap V2 is a Uniswap-V2 fork; this tool routes through the V2 router (TNJVzGqKBWkJxJB5XYSqGAwUTV15U24pPq) using the standard swapExactETHForTokens / swapExactTokensForETH / swapExactTokensForTokens selectors based on which side is native TR...
This record as markdown: /tools/io-github-szhygulin-vaultpilot-mcp/prepare-sunswap-swap.md
What prepare_sunswap_swap does on VaultPilot MCP
AI agents call prepare_sunswap_swap to permanently remove resources in VaultPilot MCP, typically in cleanup and lifecycle workflows. It does its job in a single call, and there is no undo.
| Parameter | Type | Required | Description |
|---|---|---|---|
amount | string | Yes | Human-readable amount of fromToken (e.g. "100" for 100 TRX, "10.5" for 10.5 USDT). Decimals are resolved from the canonical TRC-20 set (USDT/USDC/USDD/TUSD) or |
wallet | string | Yes | TRON base58 wallet (T-prefixed, 34 chars) — funds the swap and signs the source tx on Ledger via USB. Pair via `pair_ledger_tron` first. |
toToken | string | Yes | Destination token. Either the literal "TRX" or a T-prefixed TRC-20 contract address. Cannot equal fromToken. |
fromToken | string | Yes | Source token. Either the literal string "TRX" for native TRX, OR a T-prefixed TRC-20 contract address. TRC-20 source REQUIRES a prior approve to the SunSwap V2 |
feeLimitTrx | string | — | Override the energy fee_limit cap (default 100 TRX). Pass a human-readable TRX amount (e.g. "50"). Energy estimate is reported separately in `estimatedEnergyCos |
slippageBps | integer | — | Slippage tolerance in basis points (50 = 0.5%). Default 50. |
deadlineSeconds | integer | — | Deadline window in seconds from now. Default 1200 (20 min). The router rejects the swap if it hasn't landed by then. |
toTokenDecimals | integer | — | REQUIRED when toToken is a non-canonical TRC-20. Same reasoning as `fromTokenDecimals`. |
fromTokenDecimals | integer | — | REQUIRED when fromToken is a non-canonical TRC-20 (i.e. not USDT/USDC/USDD/TUSD or "TRX"). We refuse to guess decimals on a swap because an off-by-power-of-ten |
Parameters from the server's own tool schema.
Why prepare_sunswap_swap is rated Critical
An AI agent that decides to call prepare_sunswap_swap doesn't hesitate, doesn't double-check, and doesn't stop at one. Whatever it removes from VaultPilot MCP is gone. There is no undo for destructive operations.
Attacks that exploit this kind of access
The rule that runs prepare_sunswap_swap safely
PolicyLayer is an MCP gateway: it sits between your AI agents and VaultPilot MCP, and checks every tool call against a rule you set before the call runs. Nothing changes on the server itself. For prepare_sunswap_swap, this is the rule to start with:
prepare_sunswap_swap is removed from the agent's tool list entirely, so the agent never calls it. The rest of the server keeps working.
The button opens the PolicyLayer dashboard: create your workspace, connect VaultPilot MCP, apply this rule, and every prepare_sunswap_swap call is checked against it from then on.
Questions about prepare_sunswap_swap
Build an unsigned SunSwap V2 same-chain swap on TRON. SunSwap V2 is a Uniswap-V2 fork; this tool routes through the V2 router (TNJVzGqKBWkJxJB5XYSqGAwUTV15U24pPq) using the standard swapExactETHForTokens / swapExactTokensForETH / swapExactTokensForTokens selectors based on which side is native TRX. Path encoding: TRX→TRC20 = [WTRX, toToken]; TRC20→TRX = [fromToken, WTRX]; TRC20→TRC20 = [fromToken, WTRX, toToken]. The builder (1) calls getAmountsOut on the router via /triggerconstantcontract to compute the expected output, (2) derives minOut as quotedOut * (10000 - slippageBps) / 10000, (3) for TRC-20 sources, reads allowance(wallet, router) and refuses with a recovery hint if insufficient — the user must run prepare_tron_trc20_approve(token, spender=router, amount) first, broadcast it, wait ~3s for it to land, then retry. (4) hand-rolls ABI calldata for the swap call (no SDK), (5) hits TronGrid /triggersmartcontract to build the tx, (6) verifies the returned raw_data_hex matches exactly what we asked for (selector + parameter + call_value + fee_limit) and refuses any drift. BLIND-SIGN on Ledger TRON app — the SunSwap router is not in the device's clear-sign allowlist. Enable "Allow blind signing" in the on-device TRON app Settings; the device shows the txID, which the user matches against the txID in the prepare receipt. Pair the Ledger via pair_ledger_tron first. Smart Router (V1+V2+V3+PSM aggregator) is intentionally not used — V2 router only — because Smart Router's mainnet address has not been published officially and its multi-version path encoding is a different ABI shape. It is categorised as a Destructive tool in the VaultPilot MCP MCP Server, which means it can permanently delete or destroy data. Block by default and require explicit approval.
prepare_sunswap_swap accepts 9 parameters: amount, wallet, toToken, fromToken, feeLimitTrx, slippageBps, deadlineSeconds, toTokenDecimals, fromTokenDecimals. Required: amount, wallet, toToken, fromToken. The full parameter table on this page comes from the server's own tool schema.
Register the VaultPilot MCP server in PolicyLayer and add a rule for prepare_sunswap_swap: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches VaultPilot MCP. Nothing to install.
prepare_sunswap_swap is a Destructive tool with critical risk. Critical-risk tools should be blocked by default and only enabled with explicit human approval.
Yes. Add a rate_limit block to the prepare_sunswap_swap rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.
Set action: deny in the PolicyLayer policy for prepare_sunswap_swap. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.
prepare_sunswap_swap is provided by the VaultPilot MCP server (vaultpilot-mcp). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.
More on VaultPilot, and thousands of servers like it.
Across the catalogue