Guide

About Swap API

The Swap API connects you with Native's Credit Pool liquidity and competitive quotes, powered by Native Swap Engine.

Native V2 supports two types of orders:

Each order type will have their own corresponding Swap API endpoints.

Set up a Swap using FirmQuote APIs

1. Get an API key

To start testing, please fill out the formarrow-up-right 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.

circle-info

Our orderbook is updated every second with the latest prices quoted by our partners

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

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.

circle-info

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:

Last updated