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

Multihop

Native Relay API and Router support multihop for pairs that have no direct market, making swapping with Native liquidity more versatile.

To enable, add allow_multihop=true when requesting /indicative-quote or /firm-quote.

Please note that /orderbook only returns base trading pairs and does not return any virtual pairs enabled by multihop. To calculate price and depth, please combine two orderbooks locally.

Example

Example orderbooks:

[
   // WBTC->USDT
  {
    "base_symbol": "WBTC",
    "quote_symbol": "USDT",
    "base_address": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599",
    "quote_address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
    "minimum_in_base": 0,
    "side": "bid",
    "levels": [
      [
        0.5,
        122739.77003987515
      ],
      [
        1,
        122728.46555507004
      ],
      [
        1,
        122713.39290866326
      ],
      [
        0.6261126319999994,
        122701.13799830334
      ]
    ]
  },
  // USDT->USDC
  {
    "base_symbol": "USDT",
    "quote_symbol": "USDC",
    "base_address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
    "quote_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
    "minimum_in_base": 0,
    "side": "bid",
    "levels": [
      [
        295958.17538750934,
        1.0003537268714557
      ]
    ]
  },
  //...

Tx: https://www.tdly.co/shared/simulation/52280a28-72a7-41fb-a741-896101281cac

Multihop routes through USDT only, with a maximum of 2 legs. A direct pair is always preferred; a USDT hop is only tried when no direct pair exists.

Related errors: 171058 (multihop cannot use multiple market makers) and 171073 (exact_type=ExactOut is not supported with multihop).

Last updated