Documentation Index
Fetch the complete documentation index at: https://docs.argyros.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Executing Swaps
This guide walks through the full swap lifecycle using the Argyros API on Fogo.
Flow
- Get a quote. Find the best route and estimated output.
- Build a transaction. Get an unsigned transaction from the API.
- Sign. Sign the transaction with the user’s wallet.
- Submit. Send the signed transaction to the network.
- Confirm. Wait for on-chain confirmation.
Step 1: Get a quote
curl "https://api.argyros.xyz/api/v1/quote?\
inputMint=So11111111111111111111111111111111111111112&\
outputMint=uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG&\
amount=1000000000&\
swapMode=ExactIn&\
slippageBps=50"
Step 2: Build the swap transaction
curl -X POST "https://api.argyros.xyz/api/v1/swap" \
-H "Content-Type: application/json" \
-d '{
"userWallet": "YOUR_WALLET_ADDRESS",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG",
"amount": "1000000000",
"swapMode": "ExactIn",
"slippageBps": 50
}'
Step 3: Sign and submit
import { Connection, VersionedTransaction } from "@solana/web3.js";
const connection = new Connection("https://mainnet.fogo.io");
const txBuffer = Buffer.from(swap.data.transaction, "base64");
const transaction = VersionedTransaction.deserialize(txBuffer);
transaction.sign([wallet]);
const signature = await connection.sendRawTransaction(transaction.serialize(), {
skipPreflight: false,
maxRetries: 3,
});
const confirmation = await connection.confirmTransaction({
signature,
blockhash: transaction.message.recentBlockhash,
lastValidBlockHeight: swap.data.lastValidBlockHeight,
});
if (confirmation.value.err) {
throw new Error(`Transaction failed: ${JSON.stringify(confirmation.value.err)}`);
}
console.log(`Swap confirmed: https://solscan.io/tx/${signature}`);
Using raw instructions instead
If you need to compose swap instructions with other instructions (e.g., creating token accounts, adding memos), use POST /instructions instead of POST /swap. See the Get Instructions endpoint.