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

Guide

Native Relay connects you with Native Core liquidity on public networks in two same-chain modes:

Mode
How you quote
When to use it

RFQ

Offchain firm-quote API, then submit signed calldata to Native Router

Existing DEX aggregators, wallets, and solvers. Supports RFQ fallback and a higher swap success rate.

pAMM

Fully onchain getQuote + tradePAMM. No API key, no RFQ signature.

Integrators that want an AMM-style onchain path with no offchain quoting.

pAMM is single-hop only and has no RFQ fallback on the direct path. Use RFQ if you need hybrid fallback. Full pAMM reference: pAMM Swap APIs

Set up a Swap using Native Relay RFQ APIs

1. Get an API key

To start testing, please fill out the form and our team will get back to you with the API key.

2. Get orderbook

The latest prices for each pair Native quotes on a specified chain are published in an orderbook.

Our RFQ orderbook is refreshed several times per second from Native Core. Books that are no longer valid are dropped from the response, so always quote against the latest /orderbook result.

Here's how to retrieve the orderbook:

var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://v2.api.native.org/swap-api-v2/v1/orderbook?chain=ethereum',
  'headers': {
    'apikey': 'your-api-key'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Refer to GET Orderbook for the full reference.

Sample response

Each level is [base_quantity, price] and is not cumulative. Prices already include your API key's fee. minimum_in_base is expressed in wei of the base token; requests below it fail with error 171055.

3. Get a firm quote

Next, obtain a quote with a price that Native is committed to. If the quote is favorable, you can execute it by submitting the associated call data to the Native Router on-chain.

Sample response

4. Submit call data to Native Router

To execute a firm quote, submit a transaction on-chain to call the Native Router with the returned call data.

You can find all the deployed addresses with their ABIs here: Addresses

Here’s an example of how to submit call data to the NativeRouter:

Set up a Swap using Native Relay pAMM

pAMM does not use the Swap API. Quote and execution are both onchain on Native Router V6. No API key and no RFQ signature.

Refer to pAMM Swap APIs for addresses, events, and reverts. Deployed V6 contracts: Addresses

1. Confirm the pair and engine

directSwapEnabled is the live flag. Quotes can still work when it is false, provided the pair has an engine; swaps revert with DirectSwapDisabled. Always read the flag onchain before sending a swap.

On BNB Chain, QQQB–USDT is enabled for test. Other listed pairs may quote while direct swap is still disabled. Confirm yourself:

Also require router.isNativePools(pool) == true.

2. Get an onchain quote

Call PropAMMEngine.getQuote. Amounts are raw token units. For native gas token (ETH/BNB), pass the wrapped address — never address(0) on the engine.

Refresh the quote close to send. Engine price is short-TTL.

3. Approve, then call tradePAMM

Do not call Engine.swap(); only the bound pool may call it. Users always go through the router.

Sell ERC-20: approve the router, then msg.value = 0. Sell native: sellerToken = address(0) and msg.value = sellerTokenAmount.

tradePAMM returns nothing. Read actual out from the pool PAMMTrade event. See Events.

Staging UI (BNB Chain): https://native-pamm-staging.vercel.app/

Last updated