# API Documentation

Use this API to integrate Hypertrade R1 on HyperEVM.

Base URL: <https://api.ht.xyz/api/v1>

Router Contract Address: 0xe4609ab5f4c268c42ba470fbcbb9b9abf895f1a5

### Find route

```
POST /simulation
```

Finds the optimal routing path for swap execution and simulates the complete route. Returns the full routing path, expected output amount for the user, and the raw transaction data.

#### Request Body

```
{
  "inputAmount": "1",
  "slippage": 0.3,
  "userAddress": "0x...",
  "inputTokenAddress": "0x...",
  "outputTokenAddress": "0x...",
  "feeAddress": "0x...",
  "recipientAddress": "0x...",
  "feeBps": 100
}
```

#### Parameters:

| inputAmount        | string  | Raw input token amount in atomic units (value × 10^decimals). | yes      |
| ------------------ | ------- | ------------------------------------------------------------- | -------- |
| slippage           | number  | Maximum slippage tolerance.                                   | yes      |
| userAddress        | address | User's wallet address for the swap.                           | optional |
| inputTokenAddress  | address | Contract address of the input token.                          | yes      |
| outputTokenAddress | address | Contract address of the output token.                         | yes      |
| feeAddress         | address | Your address for receiving commissions from swaps.            | optional |
| recipientAddress   | address | Address for sending output tokens post-swap.                  | optional |
| feeBps             | number  | Your commission in basis points (100 = 1%). Max: 100.         | optional |

#### Successful Response (200 OK)

```
{
  "transaction": "0x...", // Raw-transaction for swap execution.
  "route": [
    {
      "inputTokenAddress": "0x...",
      "outputTokenAddress": "0x...",
      "splits": [
        {
          "dex": "hyperswap",
          "portion": 0.5,
          "fee": 3000,
          "poolAddress": "0x..."
        }
      ]
    }
  ],
  "outputAmount": "100000", // amount*10^decimals
  "economy": "123.45"
}
```
