> ## 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.

# Gasless Swap (Permit)

Swap tokens without paying gas. Sign off-chain and a relayer submits the transaction for you. Great for fresh wallets or moving funds without needing ETH upfront.

![Gasless Swap (Permit) logo](https://ai-icon.b3.fun/logo/ethereum)
Catalog action EVM Onchain wallet swap

Swap tokens without paying gas. Sign off-chain and a relayer submits the transaction for you. Great for fresh wallets or moving funds without needing ETH upfront.

**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 | `permit-relayer-swap` |
| Category | EVM Onchain |
| Connector | `wallet` |
| Requires gas | No |
| Funds movement | `swap` |
| Tags | `blockchain`, `evm`, `dex`, `swap`, `gasless`, `uniswap`, `token`, `trading` |

## Payload Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `sellToken` | `string` | Yes | Address of ERC-2612 permit-compatible token to sell \(e.g., USDC\) |
| `buyToken` | `string` | Yes | Address of token to buy. Use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native ETH |
| `sellAmount` | `string` | Yes | Amount of sell token in smallest unit \(e.g., USDC has 6 decimals: 1000000 = 1 USDC\) |
| `chainId` | `number` | Yes | Chain ID \(1=Ethereum, 42161=Arbitrum, 137=Polygon, 4663=Robinhood Chain\) |
| `receiver` | `string` | No | Optional recipient address for the output tokens. Defaults to the user's wallet. |
| `uniswapFeeTier` | `number` | No | Uniswap V3 pool fee tier in hundredths of a bip \(default: 500 = 0.05%\) |

## Result Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `status` | `string` | Yes | Status of the swap |
| `sellToken` | `string` | No | Sell token address |
| `buyToken` | `string` | No | Buy token address |
| `sellAmount` | `string` | No | Sell amount in smallest unit |
| `permitTxHash` | `string` | No | Transaction hash of the permit submission |
| `swapTxHash` | `string` | No | Transaction hash of the Uniswap swap |
| `buyAmount` | `string` | No | Amount of buy token received in smallest unit \(wei\) |
| `totalGasUsed` | `string` | No | Total gas used across all relayer transactions |
| `errorCode` | `string` | No | Error code if status is error |
| `errorMessage` | `string` | No | Error message if status is error |

## Examples

**Workflow node**

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

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

**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.