For the complete documentation index, see llms.txt. This page is also available as Markdown.

⚑Execution

Execute swaps by sending the ready-to-use calldata from the route finding API to the RouterV2 contract. That calldata encodes a call to executeSwaps or executeSwapsWithData.

Always use the execution.to address from the route response.

Chain
RouterV2

HyperEVM (999)

0x744489ee3d540777a66f2cf297479745e0852f7a

Robinhood Chain (4663)

0xfc020bBCe0365f56bbBb78Ce504cE2a2b24E0ae6

Using Calldata from the Route API

const response = await fetch(
  'https://api.liqd.ag/v2/route?tokenIn=0x5555...&tokenOut=0xB8CE...&amountIn=100&chainId=999'
);
const routeData = await response.json();

if (routeData.success && routeData.execution) {
  const transaction = {
    to: routeData.execution.to,
    data: routeData.execution.calldata,
    value: 0, // set if swapping from the chain's native token
  };

  const result = await signer.sendTransaction(transaction);
}

Fees and positive slippage are already encoded in the calldata when you pass feeBps / feeRecipient on the route request. See Revenue Sharing.

executeSwaps

Primary execution function. Provides positive slippage capture (50% capture rate) and custom fee collection:

Name
Type
Description

tokens

address[]

Token addresses representing the swap path

amountIn

uint256

Amount of input tokens to swap

minAmountOut

uint256

Minimum output (slippage protection)

expectedAmountOut

uint256

Expected output (used for positive slippage)

hopSwaps

Swap[][]

Swap configurations for each hop

feeBps

uint256

Fee in basis points (capped at 100 = 1%)

feeRecipient

address

Receives 97.5% of the fee (2.5% to protocol)

executeSwapsWithData

Same fee and slippage model as executeSwaps, but each hop can carry an opaque per-pool data blob for sources that need more than (fee, stable) to identify a pool. Legs with empty data behave like legacy Swap legs.

You do not need to call these functions manually β€” use the returned execution.calldata instead.

Native Token Unwrapping

Set unwrapNative=true on the route request to receive the chain's native token instead of its wrapped form β€” HYPE on HyperEVM, ETH on Robinhood Chain. The returned calldata handles unwrapping automatically in the same transaction.

When unwrapping is enabled, the final output token in the path is the dead address 0x000000000000000000000000000000000000dEaD, which RouterV2 treats as the native token.

Last updated