FortiSwap · TX Build

by FortiSwap

POSTBaseSolana

$0.005

per call · USD Coin on Base

Build an unsigned, simulated X1 swap transaction (base64 v0) for the given payer through the on-chain FortiBlox Router — routed, impact-capped, simulated before return; the 25 bps protocol fee is enforced in-program. Sign it with the payer key and broadcast via POST /api/tx/send (free). Amounts are raw base units. Requires a prior quote.

Endpoint

POST https://app.fortiblox.com/api/tx/build

3

Calls / 30d

2

Unique payers / 30d

Aug 22

Last called

exact

Payment scheme

Call this service

TypeScript · @x402/fetch
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const fetchWithPay = wrapFetchWithPayment(fetch, account);

const res = await fetchWithPay("https://app.fortiblox.com/api/tx/build", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "amountIn": "1000000",
    "inputMint": "B69chRzqzDCmdB5WYB8NRu5Yv5ZA95ABiZcdzCgGm9Tq",
    "mode": "exactIn",
    "outputMint": "So11111111111111111111111111111111111111112",
    "payer": "4YksiSRD3VenFSXHGbaTAa9EEjN1Sxayqy3epMKhHBWB",
    "slippageBps": 100
  }),
});
const data = await res.json();
cURL
curl -X POST \
  "https://app.fortiblox.com/api/tx/build" \
  -H "Content-Type: application/json" \
  -d '{"amountIn":"1000000","inputMint":"B69chRzqzDCmdB5WYB8NRu5Yv5ZA95ABiZcdzCgGm9Tq","mode":"exactIn","outputMint":"So11111111111111111111111111111111111111112","payer":"4YksiSRD3VenFSXHGbaTAa9EEjN1Sxayqy3epMKhHBWB","slippageBps":100}' \
  -H "X-PAYMENT: <signed x402 payment>"

Example response

{
  "blockhash": "5iMvGtFseNWxJw248AanzxGjb8Weo9eSyUfwjpQ3e1BK",
  "computeUnitLimit": 135000,
  "expectedOut": "2049354266",
  "feeAmount": "5123386",
  "feeApplied": true,
  "feeEnforcedOnChain": true,
  "guardUsed": false,
  "hopFallbackApplied": false,
  "hopsUsed": 4,
  "lastValidBlockHeight": 72986069,
  "maxAmountIn": null,
  "minOut": "2023788571",
  "mode": "exactIn",
  "platformFee": {
    "amountToken": "5123386",
    "bps": 25,
    "percent": "0.25"
  },
  "route": {
    "amountIn": "1000000",
    "amountOut": "2049354266",
    "parts": [
      {
        "amountIn": "1000000",
        "amountOut": "2049354266",
        "guard": {
          "hardExcluded": false,
          "maxPriceDeviationPct": 0,
          "minPoolTvlXnt": 65884.29,
          "penaltyBps": 0,
          "thin": false,
          "worstTradeReservePct": 0.00623893
        },
        "legs": [
          {
            "address": "CAJeVEoSm1QQZccnCqYu9cnNF7TTD2fcUA3E5HQoxRvR",
            "amountIn": "1000000",
            "amountOut": "2049354266",
            "feePpm": 2800,
            "inMint": "B69chRzqzDCmdB5WYB8NRu5Yv5ZA95ABiZcdzCgGm9Tq",
            "outMint": "So11111111111111111111111111111111111111112",
            "priceImpactPct": 0.00623892,
            "venue": "xdex"
          }
        ],
        "priceImpactPct": 0.00623892,
        "requiresGuard": false
      }
    ],
    "priceImpactPct": 0.00623892,
    "split": false
  },
  "routerVersion": "v2",
  "safety": {
    "level": "safe",
    "reasons": []
  },
  "simulation": {
    "unitsConsumed": 94432
  },
  "slippageBps": 100,
  "slippageDynamic": false,
  "splitApplied": false,
  "transaction": "AQAAAAAAAAAAAAAAAAAAAAAA…base64 unsigned v0 transaction…",
  "txSize": 498,
  "usedAlt": true,
  "usedRouter": true
}

Payment details

Pay to0x581ab190df2b2932175d987e787acd28a85eaa1c
AssetUSD Coin · 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
NetworksBase, Solana
Schemesexact

Is this your API?

Pin it to the top of DeFi and the homepage with a featured placement.

Get featured →

More from FortiSwap & similar services