# Solana DeFi Swap Builder with Risk Gate

> Solana DeFi Swap Builder with Risk Gate is a paid API for AI agents from soldefi.thomenz.me, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Builds a risk-gated, unsigned Solana swap transaction with rug/honeypot safety check and protocol fee embedded, ready to sign and submit.

## Facts

- Endpoint: POST https://soldefi.thomenz.me/v1/solana/swap/build
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/solana-defi-swap-builder-with-risk-gate-b159de77
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_vuA6ajX0wyf1sBRDsdqCK

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability solana-defi-swap-builder-with-risk-gate-b159de77 -d '<json body>'
```

Example prompt: Check if BONK token (DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263) is safe to sell, and if it passes the risk gate, build me an unsigned sell swap transaction for $50 worth into USDC with 0.5% slippage for my wallet.

## When to prefer this

Choose this endpoint when you need to both build a Solana swap transaction AND gate it behind a real-time rug/honeypot risk scan in a single call — especially for sell-side exits where token sellability is uncertain. Prefer it over building a raw swap if you want an integrated risk verdict (mint/freeze authority check, wash-trade detection, sellability simulation) before committing to the transaction. Ideal for trading bots, portfolio managers, or user-facing apps that need to protect users from scam tokens without chaining multiple API calls.

## Known failure modes

- Token flagged as high-risk: gate.allowed=false, transaction not built, verdict explains specific risk flags
- Simulation error: transaction built but simulationError is non-null, indicating on-chain execution would fail
- Invalid mint address: 400 error or empty response if token mint is malformed or not found
- Insufficient liquidity: swap cannot be routed, simulation fails
- Payment failure: x402 micropayment of $0.001 USDC not processed, 402 response returned
- Expired transaction: lastValidBlockHeight passed before user signs and submits

## How this service works

Build a ready-to-sign Solana swap that refuses to route you into a rug. Runs the full honeypot/rug scan first: buying a token whose verdict is critical (or that cannot be sold) returns the verdict and NO transaction. Returns Jupiter's unsigned versioned transaction — we never custody funds, your wallet signs. A 0.5% platform fee applies ONLY when selling into USDC/SOL; buying is fee-free. Fee is disclosed in the response and rides inside the transaction you sign.

## Output

Returns a JSON object containing: a base64-encoded unsigned versioned Solana swap transaction ready for wallet signing, a risk gate verdict (allowed true/false, riskLevel low/medium/high, riskScore 0-100, flags array), embedded protocol fee details (bps, mint, account, amountAtomic), simulation error status, last valid block height, prioritization fee in lamports, swap direction, and a human-readable rationale and disclaimer.

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "fee": {
   "bps": 50,
   "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
   "note": "Charged only on sells. Rides inside the transaction you sign; we never custody funds.",
   "account": "Ca6VehbTacWoeqxDVK7qKZeDha7JvEGHoQLNjnrKoUzN",
   "percent": "0.5%",
   "amountAtomic": "13"
  },
  "gate": {
   "flags": [],
   "allowed": true,
   "verdict": "LOW RISK — mint & freeze authority renounced, sellable at scan time",
   "riskLevel": "low",
   "riskScore": 12
  },
  "built": true,
  "direction": "sell",
  "rationale": "Selling into a quote asset — the risk is whether the token you hold can actually be sold.",
  "disclaimer": "The risk gate is an informational signal from public on-chain + market data at build time, not a guarantee. Inspect the transaction before signing — you sign it, we cannot.",
  "subjectMint": "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
  "transaction": {
   "simulationError": null,
   "swapTransaction": "AQAAAAAAAAAAAAAA…base64 versioned transaction, UNSIGNED",
   "lastValidBlockHeight": 415263441,
   "prioritizationFeeLamports": 12345
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/solana-defi-swap-builder-with-risk-gate-b159de77/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from soldefi.thomenz.me](https://www.zero.xyz/host/soldefi.thomenz.me/llms.txt)
