Guides
Jupiter V6 integration
Integrate Jupiter v6 API in your game
Was this page helpful?
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Integrate Jupiter v6 API in your game
IDexAggregator dex = new JupiterDexAg(Web3.Account);
TokenData tokenA = await dex.GetTokenBySymbol("SOL");
TokenData tokenB = await dex.GetTokenBySymbol("USDC");
SwapQuoteAg swapQuote = await dex.GetSwapQuote(
tokenA.MintAddress,
tokenB.MintAddress,
DecimalUtil.ToUlong(1, tokenA.Decimals)
);
var quote = DecimalUtil.FromBigInteger(swapQuote.OutputAmount, tokenB.Decimals);
Debug.Log(quote); // Amount of espected USDC token to receive
Debug.Log(string.Join(" -> ", swapQuote.RoutePlan.Select(p => p.SwapInfo.Label)));
// Lifinity V2 -> Whirlpool
Transaction tx = await dex.Swap(swapQuote);
await Web3.Wallet.SignAndSendTransaction(tx);
IDexAggregator dex = new JupiterDexAg(Web3.Account);
TokenData tokenA = await dex.GetTokenBySymbol("SOL");
TokenData tokenB = await dex.GetTokenBySymbol("USDC");
SwapQuoteAg swapQuote = await dex.GetSwapQuote(
tokenA.MintAddress,
tokenB.MintAddress,
DecimalUtil.ToUlong(5, tokenB.Decimals),
SwapMode.ExactOut
);
var quote = DecimalUtil.FromBigInteger(swapQuote.InputAmount, tokenA.Decimals);
Debug.Log(quote); // Amount of espected SOL token to pay
Transaction tx = await dex.Swap(swapQuote);
await Web3.Wallet.SignAndSendTransaction(tx);
Was this page helpful?
