Skip to main content
Try Cobo WaaS Skill in your AI coding assistant (Claude Code, Cursor, etc.). Describe your needs in natural language to auto-generate production-ready SDK code and debug faster 🚀
This guide uses a complete Python example to demonstrate how to combine Cobo WaaS SDK with Jupiter on Solana, from getting swap routes to submitting an on-chain token swap transaction, so that you can quickly integrate token swap capabilities.
This document is intended for developers who already understand Solana programming and Jupiter routing. Basic blockchain concepts and Jupiter mechanics will not be introduced here.

Prerequisites

Before you begin, ensure the following:
  • You have followed the steps in Send your first API request and successfully sent an API request.
  • You understand and can use the Call smart contract API.
  • You are familiar with Solana smart contract calls and understand the basic concepts and usage of Jupiter.
  • Your Solana address has sufficient balance, including:
    • Enough balance of the token you plan to swap;
    • Enough SOL to pay for transaction fees.
  • Since this guide provides a Python-based example, please ensure your local environment has:
    • Python 3.9 or above
    • Required packages: cobo_waas2, requests, and solders
  • This example uses an MPC Wallet (Organization-Controlled Wallet). If you are using a Custodial Wallet (Web3 wallet), make sure to update the source parameter in the Call Smart Contract API request to use the Custodial Wallets (Web3 wallets) structure instead.

Python example

This example walks through:
  1. Getting the best swap route from Jupiter
  2. Generating swap instructions with Jupiter
  3. Parsing Address Lookup Tables (ALT)
  4. Call smart contract
  5. Executing a swap from SOL to USDT
The following code highlights the parameters you must customize (such as API key, wallet ID, address, token pair, and amount). All other code can be used without modification.