↔️Swap API
The FluxBeam Swap API allows developers and users to retrieve swap quotes and pre-built transactions to speed up integration.
Quote
The quote API will return the expected output amount and slippage amount based on the provided input amount & token mints.
Currently, the API only returns pools on FluxBeam DEX.
Source token
Destination token
Source token input amount
Slippage in BPS
Returns a swap quote
GET /v1/quote?inputMint=text&outputMint=text&amount=1 HTTP/1.1
Host: api.fluxbeam.xyz
Accept: */*
Returns a swap quote
{
"quote": {
"amountIn": 1000000,
"inputMint": "So11111111111111111111111111111111111111112",
"minimumOut": 9820,
"outAmount": 10000,
"outputMint": "FLUXBmPhT3Fd1EDVFdg46YREqHBeNypn1h4EbnTzWERX",
"pool": "GeNc51GBjhXiYruWrx6VPh6xMNeTjYb5hUBpFJi9cW27",
"program": "FLUXubRmkEi2q6K3Y9kBPg9248ggaZVsoSFhtJHSrm1X"
}
}Example
Swap Transaction
The Transaction endpoint returns a pre-built transaction that is ready to be signed by the payer wallet based on the quote provided.
The swap transaction includes the following instructions:
Priority Fee Price & Units
Input & Output associated token account creation
Wrap & Unwrap of SOL accounts
100{PAYER_WALLET_ADDRESS}trueReturns a swap quote
POST /v1/swap/transaction HTTP/1.1
Host: api.fluxbeam.xyz
Content-Type: application/json
Accept: */*
Content-Length: 386
{
"priorityFeeLamports": 100,
"quote": {
"amountIn": 1000000,
"inputMint": "So11111111111111111111111111111111111111112",
"minimumOut": 9820,
"outAmount": 10000,
"outputMint": "FLUXBmPhT3Fd1EDVFdg46YREqHBeNypn1h4EbnTzWERX",
"pool": "GeNc51GBjhXiYruWrx6VPh6xMNeTjYb5hUBpFJi9cW27",
"program": "FLUXubRmkEi2q6K3Y9kBPg9248ggaZVsoSFhtJHSrm1X"
},
"userPublicKey": "{PAYER_WALLET_ADDRESS}",
"wrapAndUnwrapSol": true
}Returns a swap quote
{
"transaction": "text"
}Example
Swap Instruction
The instruction endpoint will return the FluxBeam swap instruction for a given quote. The instruction should be included within a transaction that handles the priority fee & associated token account calls.
If no pool is provided a quote will be generated.
100{PAYER_WALLET_ADDRESS}trueReturns a swap instruction to be added to transaction
POST /v1/swap/instruction HTTP/1.1
Host: api.fluxbeam.xyz
Content-Type: application/json
Accept: */*
Content-Length: 386
{
"priorityFeeLamports": 100,
"quote": {
"amountIn": 1000000,
"inputMint": "So11111111111111111111111111111111111111112",
"minimumOut": 9820,
"outAmount": 10000,
"outputMint": "FLUXBmPhT3Fd1EDVFdg46YREqHBeNypn1h4EbnTzWERX",
"pool": "GeNc51GBjhXiYruWrx6VPh6xMNeTjYb5hUBpFJi9cW27",
"program": "FLUXubRmkEi2q6K3Y9kBPg9248ggaZVsoSFhtJHSrm1X"
},
"userPublicKey": "{PAYER_WALLET_ADDRESS}",
"wrapAndUnwrapSol": true
}Returns a swap instruction to be added to transaction
{
"instruction": {
"accounts": "text",
"data": [
1
],
"programId": "text"
}
}Example
Last updated