Create Swap Transaction AMM
Creates an unsigned transaction for the best possible swap through the specified tokens provided by Raydium.
This endpoint does not submit the transaction to the network.
Before the transaction is created, Trader API will find the best swap with the provided inToken
, outToken
, and inAmount
. outAmount
swap modes are not yet supported. For more advanced usage (e.g. specifying the minimum outAmount
), refer to Create Route Swap.
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/raydium/swap
Parameters:
ownerAddress
string
Solana address which is placing swap.
inToken
string
Symbol or token program address of the swap-in token for the current step.
outToken
string
Symbol or token program address of the swap-out token.
inAmount
double
The amount of swap-in token to be converted to the swap-out token.
slippage
double
The maximum slippage tolerance in percentage.
computeLimit
uint32
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:
Response:
Fields:
transaction
TransactionMessage
See TransactionMessage
below for details
outAmount
double
Amount of tokens expected from the swap
outAmountMin
double
Minimum amount of tokens allowed from swap given slippage
priceImpact
PriceImpactV2
Impact of swap upon the pool's liquidity
fee
Fee
Fee paid to AMM project
PriceImpactV2
percent
double
Percentage impact on price.
infinity
string
Indicates possible infinity values: INF_NOT
, INF_POSITIVE
, INF_NEGATIVE
. Usually INF_NOT
.
Fee
amount
float
Amount paid to AMM project
mint
string
Token currency the fee is paid in
percent
float
Percentage of the swap consumed by the fee
TransactionMessage
content
string
Raw bytes of signed transaction (should be in base64)
Example:
Last updated