POST
/
api
/
swap
/
native
curl --request POST \
  --url https://public-beam-backend-mainnet.codemelt.codes/api/swap/native \
  --header 'Content-Type: application/json' \
  --data '{
  "tokenAId": 123,
  "tokenBId": 123,
  "slippage": 50,
  "amount": 123,
  "sender": "<string>",
  "recipient": "<string>"
}'
{
  "message": "<string>",
  "data": null,
  "status": "<any>"
}

Overview

This endpoint provides native swap functionality for token exchanges. It allows for cross-chain swaps and uses the native DEX of the platform.

Using the sdk

import api, { IConnection } from "codemelt-retro-api-sdk"
const connection: IConnection = {
  host: '<enter you host url here>',
  headers: {
    'x-api-key': '<enter your api key here>'
  }
}
const result = await api.functional.api.swap.native.getSwapData(
  connection,
  {
    tokenAId: 1,
    tokenBId: 2,
    slippage: 50,
    amount: 1.5,
    //can also be BTC address or solana address
    sender: '0x0000000000000000000000000000000000000000', 
    recipient: '0x0000000000000000000000000000000000000000',
  }
)

Body

application/json
tokenAId
integer
required
tokenBId
integer
required
slippage
number
default:50
required
Required range: x >= 1
amount
number
required
sender
string
required
recipient
string
required

Response

201 - application/json
message
string
required
data
null
required
status
any
required