Examples

Here you will some of the examples of the API integration

circle-exclamation

1. ExactIn swap: Get Transaction Data for swap from USDC to APT when fromTokenAmount is entered

POST https://api.panora.exchange/swap

const end_point = 'https://api.panora.exchange/swap'
const query = {
    fromTokenAddress: "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b",
    toTokenAddress: "0xa",
    toWalletAddress: "0x1c3206329806286fd2223647c9f9b130e66baeb6d7224a18c1f642ffe48f3b4c",
    fromTokenAmount: 100,
};

const headers = {
    "x-api-key": "Your API key"
};

const queryString = new URLSearchParams(query).toString();
const url = `${end_point}?${queryString}`;

const response = await (
    await fetch(url, {
        method: 'POST',
        headers: headers
    })
).json();

Below is the response for the above request

This response can be sent to Aptos chain with the required signatures to execute the transaction.

2. ExactOut swap: Get transaction data for swap from USDC to APT when toTokenAmount is entered

POST https://api.panora.exchange/swap

circle-info

Note: toTokenAmount here is amount (without Token Decimals) that the user desires to receive after the swap is executed

Below is the response for the above request

This response can be sent to Aptos chain with the required signatures to execute the transaction.

3. ExactIn swap: Get Quote Data for swap from USDC to APT when fromTokenAmount is entered

GET https://api.panora.exchange/swap/quote

Below is the response for the above request

4. ExactOut swap: Get Quote data for swap from USDC to APT when toTokenAmount is entered

GET https://api.panora.exchange/swap/quote

Below is the response for the request.

Last updated