Skip to content

Runnable Example

Protected Swap Example

This example shows how an agent or trading bot routes a transaction through the Agent Transaction Firewall before execution.

The full lifecycle is three steps: protect send verify.

Step 1: Protect the swap intent

Send the swap intent to the ATF. The firewall evaluates the intent against the active policy and returns a permit or denial with reason codes.

curl - protect a swap intent

curl -sS https://api.trucore.xyz/v1/bot/protect \
  -H "Content-Type: application/json" \
  -d '{
    "chain_id": "solana",
    "intent_type": "swap",
    "intent": {
      "type": "swap",
      "in_mint": "So11111111111111111111111111111111111111112",
      "out_mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "amount_in": 1000000,
      "slippage_bps": 50,
      "agent_id": "my-bot-v1"
    }
  }'

Replace the endpoint with your local instance if running locally.

Step 2: Send the transaction (optional)

After the firewall returns a permit, your bot or agent signs and submits the transaction to the network. This step is handled entirely by your execution layer - no wallet integration is required from the ATF side.

The ATF does not sign or broadcast transactions. It validates intent and produces a receipt. Your bot retains full control of signing and submission.

Step 3: Verify the execution receipt

Every protected execution produces a deterministic receipt. You can verify the receipt independently to confirm the execution occurred under the declared policy.

Use the Verify Receipt page to paste any receipt hash and confirm its integrity.

Execution flow

Agent

   ↓

ATF protect

   ↓

Policy validation

   ↓

Execution receipt

   ↓

Verify

Prefer the shortest path? Quickstart - copy-paste a protected transaction in under 60 seconds.

Next steps