Migrating from Voyager to Nitro

Migrating from Voyager to Nitro is a straightforward task and won't require more than 10 minutes of effort. Follow the steps given below to migrate your existing codebase from Voyager to Nitro:

API Migrationarrow-up-right

Step 1) To fetch the quote from the pathfinder API, change the PATH_FINDER_API_URLchange the endpoint from "quote" to "v2/quote" and remove userAddress and feeTokenAddres from the params.

// Voyager
const PATH_FINDER_API_URL = "https://api.pathfinder.routerprotocol.com/api"

const fetchPathfinderData = async (params) => {
    const endpoint = "quote"
    const pathUrl = `${PATH_FINDER_API_URL}/${endpoint}`
}

const params = {
        'fromTokenAddress': '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', // USDC on Polygon
        'toTokenAddress': '0x04068DA6C83AFCFA0e13ba15A6696662335D5B75', // USDC on Fantom
        'amount': '10000000', // 10 USDC (USDC token contract on Polygon has 6 decimal places)
        'fromTokenChainId': 137, // Polygon
        'toTokenChainId': 250, // Fantom
        'userAddress': 'YOUR_WALLET_ADDRESS',
        'feeTokenAddress': '0x16ECCfDbb4eE1A85A33f3A9B21175Cd7Ae753dB4', // ROUTE on Polygon
        'slippageTolerance': 2,
        'partnerId': 0, // get your unique partner id - https://app.routernitro.com/partnerId
    }


// Nitro 
const PATH_FINDER_API_URL = "https://k8-testnet-pf.routerchain.dev/api"
const getQuote = async (params) => {
    const endpoint = "v2/quote"
    const quoteUrl = `${PATH_FINDER_API_URL}/${endpoint}`
}

const params = {
        'fromTokenAddress': '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', // USDC on Polygon
        'toTokenAddress': '0x04068DA6C83AFCFA0e13ba15A6696662335D5B75', // USDC on Fantom
        'amount': '10000000', // 10 USDC (USDC token contract on Polygon has 6 decimal places)
        'fromTokenChainId': 137, // Polygon
        'toTokenChainId': 250, // Fantom
        'slippageTolerance': 2, // optional
        'partnerId': 0, // get your unique partner id - https://app.routernitro.com/partnerId
    }

Step 2) Add another function getTransaction() to fetch the transaction data using the quote returned by the pathfinder quote endpoint. Here, you need to add the senderAddress, receiverAddress, and the refundAddress.

info

In Voyager, the pathfinder API used to return the transaction data along with the quote. However, in Nitro, the data is prepared via a separate endpoint.

SDK Migrationarrow-up-right

  1. Initialization

Earlier -

Change to -

Install new sdk with npm or yarn npm install @routerprotocol/asset-transfer-sdk-ts

  1. Quote & Transaction

Earlier -

Change to -

  1. Status

Earlier -

Change to -

Last updated