amm/swap

Creates an unsigned transaction for the best possible swap by providing the specified tokens information through native swap.pump.fun liquidity pool.

The endpoint allows you to specify priority fees and tips to later control the transaction inclusion and propagation. Refer to the Transaction Submission & Front-Running Protection & Transaction Bundle page for additional information about these parameters.

Request

Method:

POST ./api/v2/pumpfun/amm/swap

Parameters:

Parameter
Type
Description

ownerAddress

string

Solana address which is placing swap.

inToken

string

Address of the swap-in token.

outToken

string

Address of the swap-out token.

pool

string

Specify exact which liquidity pool wants to interact with.

inAmount

double

The amount of token wants to be swapped from.

slippage

double

The maximum slippage tolerance in percentage.

computeLimit

uint64

OPTIONAL. Specifies total compute limit to be allocated for all instructions within the created tx

computePrice

uint64

OPTIONAL. Specifies compute price in Lamport (0.000001 SOL = 1,000 Lamport) to be included as a part of instruction, known as priority fee.

tip

unit64

OPTIONAL. Specifies a tip amount that will be used to pay for front-running protection or bundle submission services. What is tip?

Request example:

curl --location 'https://pump-ny.solana.dex.blxrbdn.com/api/v2/pumpfun/amm/swap' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: $AUTH_HEADER' \
--data '{
  "ownerAddress": "3RshvockaPKfPYZzsr6oxphcjQRbdhzCmQ11LSNxqkb2",
  "inToken": "So11111111111111111111111111111111111111112",
  "outToken": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "pool": "Gf7sXMoP8iRw4iiXmJ1nq4vxcRycbGXy5RL8a8LnTd3v",
  "inAmount": 0.01,
  "slippage": 1,
  "computeLimit": 130000,
  "computePrice": 100000,
  "tip": 10000
}'

Response:

Example:

{
    "transactions":[{
        "content":"AQAA...AAA==",
        "isCleanup":false
    }],
    "buyQuoteAmountIn":0.009970089,
    "buyUserQuoteAmountIn":0.01,
    "buyMaxQuoteAmountIn":0.0101,
    "buyBaseAmountOut":1.722171,
    "sellBaseAmountIn":0,
    "sellMinQuoteAmountOut":0,
    "sellQuoteAmountOut":0,
    "sellUserQuoteAmountOut":0,
    "fees":[{
        "amount":0.000029911,
        "mint":"So11111111111111111111111111111111111111112",
        "percent":0.3
    }]
}

Last updated