> ## Documentation Index
> Fetch the complete documentation index at: https://docs.b3os.org/llms.txt
> Use this file to discover all available pages before exploring further.

# 0x Swap

Swap Clanker-launched tokens via 0x Protocol DEX aggregator. Specialized for sniping and trading newly launched Clanker tokens on Base via Uniswap pools. For general token swaps, prefer relay-swap.

![0x Swap logo](https://cdn.b3.fun/b3os-icons/0x.png)
Catalog action EVM Onchain wallet Gas swap

Swap Clanker-launched tokens via 0x Protocol DEX aggregator. Specialized for sniping and trading newly launched Clanker tokens on Base via Uniswap pools. For general token swaps, prefer relay-swap.

**Review wallet and value movement**

This action can require a wallet connector, gas, token movement, or an external side effect. Test with simulation or a controlled amount before using it in a live workflow.

## At a Glance

| Field | Value |
| --- | --- |
| Action ID | `0x-swap` |
| Category | EVM Onchain |
| Connector | `wallet` |
| Requires gas | Yes |
| Funds movement | `swap` |
| Tags | `blockchain`, `evm`, `dex`, `swap`, `clanker`, `uniswap`, `base` |

## Payload Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `sellToken` | `string` | Yes | Token address to sell. Use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native ETH. |
| `buyToken` | `string` | Yes | Token address to buy. Use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native ETH. |
| `sellAmount` | `string` | Yes | Amount to sell in smallest unit \(wei for ETH\). Must be a positive integer string. |
| `chainId` | `number` | Yes | Chain ID \(e.g., 1 for Ethereum, 8453 for Base, 42161 for Arbitrum\) |
| `slippageBps` | `number` | No | Slippage tolerance in basis points \(100 = 1%\). Default is 100 \(1%\). Max 5000 \(50%\). |

## Result Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `status` | `string` | Yes | Status of the swap operation |
| `transactionHash` | `string` | No | Transaction hash of the swap |
| `sellAmount` | `string` | No | Amount of tokens sold in smallest unit |
| `buyAmount` | `string` | No | Amount received on-chain in smallest unit. In simulation, this is the quoted estimate. |
| `quotedBuyAmount` | `string` | No | Pre-execution quoted buy amount in smallest unit |
| `sellToken` | `string` | No | Address of the token sold |
| `buyToken` | `string` | No | Address of the token bought |
| `estimatedGas` | `string` | No | Estimated gas for the transaction |
| `approvalTransactionHash` | `string` | No | Transaction hash of the ERC20 approval. Absent when sell token is native ETH. |
| `orderExecutionId` | `string` | No | Durable order execution identifier when invoked by the order engine. |
| `orderExecutionAnchored` | `boolean` | No | Whether the exact signed bundle was durably recorded before broadcast. |

## Examples

**Workflow node**

```json
{
  "type": "0x-swap",
  "payload": {
    "sellToken": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
    "buyToken": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
    "sellAmount": "1000000",
    "chainId": 8453
  },
  "children": [],
  "connector": {
    "type": "wallet",
    "id": "conn_wallet"
  }
}
```
  **Test with API**

```bash
curl -X POST "https://api.b3os.org/v1/actions/0x-swap/test" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "inputs": {
    "sellToken": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
    "buyToken": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
    "sellAmount": "1000000",
    "chainId": 8453
  }
}'
```

**Use expressions for dynamic values**

Payload fields can use workflow expressions such as `{{$trigger.body.amount}}`, `{{$nodes.fetch.result.price}}`, and `{{$props.asset}}` when the value should come from a trigger, prior node, or reusable workflow prop.