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

# EVM Transactions

> Build EVM swap transactions across Ethereum, Base, and BNB Chain.

Build unsigned transactions for token swaps.

***

## Get Buy Transaction

Build an unsigned transaction for buying tokens.

**Endpoint:** `/evm/buy/transaction`

| Parameter      | Type   | Required | Description                                            |
| -------------- | ------ | -------- | ------------------------------------------------------ |
| `chain`        | string | Yes      | Chain identifier                                       |
| `token`        | string | Yes      | Token contract address                                 |
| `swapMode`     | string | Yes      | `ExactIn` or `ExactOut`                                |
| `amountIn`     | string | Yes      | Amount of native currency in wei                       |
| `wallet`       | string | Yes      | Wallet address                                         |
| `slippageBps`  | number | No       | Slippage tolerance in basis points (default: 100 = 1%) |
| `feeBps`       | number | No       | Fee in basis points (0-175)                            |
| `feeRecipient` | string | No       | Wallet to receive fees                                 |
| `sendRoute`    | string | No       | `Public`, `Private`, or `Both` for MEV protection      |

**Example:**

<Tabs>
  <Tab title="Socket.IO">
    ```typescript theme={null}
    socket.emit("/evm/buy/transaction", {
      chain: "eth",
      token: "0x6982508145454Ce325dDbE47a25d4ec3d2311933",
      swapMode: "ExactIn",
      amountIn: "1000000000000000000",
      wallet: "0x10a64c6d7f12c47b7c66c5b4e20e72bc1fcd5d9e",
      slippageBps: 100,
      sendRoute: "Private",
    });
    ```
  </Tab>

  <Tab title="HTTP">
    ```typescript theme={null}
    await fetch("https://api.chainworks.co/evm/buy/transaction", {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        Authorization: CHAINWORKS_API_AUTH_TOKEN,
      },
      body: JSON.stringify({
        chain: "eth",
        token: "0x6982508145454Ce325dDbE47a25d4ec3d2311933",
        swapMode: "ExactIn",
        amountIn: "1000000000000000000",
        wallet: "0x10a64c6d7f12c47b7c66c5b4e20e72bc1fcd5d9e",
        slippageBps: 100,
        sendRoute: "Private",
      }),
    });
    ```
  </Tab>
</Tabs>

***

## Get Sell Transaction

**Endpoint:** `/evm/sell/transaction`

Same parameters as buy transaction.

***

## Get Approve Transaction

Build a transaction to approve token spending.

**Endpoint:** `/evm/approve/transaction`

| Parameter | Type   | Required | Description                 |
| --------- | ------ | -------- | --------------------------- |
| `chain`   | string | Yes      | Chain identifier            |
| `token`   | string | Yes      | Token contract address      |
| `wallet`  | string | Yes      | Wallet granting approval    |
| `spender` | string | Yes      | Contract address to approve |
