Skip to main content
POST

Endpoint

Execute a token swap using the optimal route previously found through the route endpoint. This endpoint handles the actual transaction execution and ensures the swap is performed with the best possible outcome.

Request Body Parameters

RouteResponse
required
The route object returned from the /hyperevm/route endpoint. This contains all necessary information about the swap path and expected outcomes.
number
default:"0.5"
required
Maximum acceptable slippage in percentage (0.1 to 100). Example: 0.5 for 0.5% slippage tolerance
string
required
Unix timestamp (in seconds) after which the transaction will revert. Defaults to 20 minutes from the current time if not specified.

Response

object
The executed route details.
object[]
Swap parameters for every hop in the route.

Error Responses

Route Expired

Slippage Exceeded

Insufficient Balance

Invalid Deadline

Best Practices

  1. Route Freshness
    • Always use a fresh route from the /hyperevm/route endpoint
    • Routes can become stale due to market movements
    • Implement retry logic with fresh routes if execution fails
  2. Slippage Management
    • Set appropriate slippage tolerance based on:
      • Token pair volatility
      • Trade size
      • Market conditions
    • Higher values increase success rate but may result in worse prices
    • Lower values ensure better prices but may cause more failed transactions
  3. Deadline Setting
    • Set reasonable deadlines to prevent stale transactions
    • Consider network congestion when setting deadlines
    • Default of 20 minutes is suitable for most cases
  4. Gas Optimization
    • Monitor gasUsed in responses to optimize future transactions
    • Consider using direct routes for major pairs
    • Bundle multiple swaps if possible

See Also