Skip to content

Jupiter-DevRel/jup-rust-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jup-Rust-SDK

A Rust SDK to interact with the Jupiter Aggregator APIs.
Easily fetch token quotes and execute swaps programmatically from your Rust applications.

Installation 🛠️

cargo add jup-ag-sdk

or Add this to your Cargo.toml:

[dependencies]
jup-ag-sdk = "0.1.5"

Features

  • Complete API Coverage - All Jupiter APIs included Ultra, Swap, Trigger, Recurring, Token and Price
  • Strongly typed – Full Rust structs for all request/response types
  • Composable builders – Chainable methods to customize request payloads (e.g. taker, referral, fee, excluded routers)

Usage

Below is a simple example that shows how to fetch and execute an Ultra order with the SDK. For detailed example checkout examples/

use jup_ag_sdk::{
    JupiterClient,
    types::{UltraExecuteOrderRequest, UltraOrderRequest},
};

#[tokio::main]
async fn main() {
    // initalize the client
    let client = JupiterClient::new("https://lite-api.jup.ag");

    // Create an ultra order request to swap 10 USDC to SOL
    let ultra = UltraOrderRequest::new(
        "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "So11111111111111111111111111111111111111112",
        10_000_000, // 6 decimals (USDC)
    ).add_taker("your wallet address");

    // fetch the quote
    let quote = client.get_ultra_order(&ultra).await
        .expect("Failed to get ultra order");

    // sign the transaction. Checkout examples/src/ultra.rs on how to sign the transaction

    // execute the signed transaction
    let execute = UltraExecuteOrderRequest {
        signed_transaction: base64_signed_tx,
        request_id: quote.request_id,
    };

    // Execute the transaction
    let response = client.ultra_execute_order(&execute).await
        .expect("Failed to execute transaction");

    println!("Transaction: {}", response.signature);
}

Support

Local

git clone https://github.com/Jupiter-DevRel/jup-rust-sdk
cd jup-rust-sdk
cargo build

open to contributions and suggestions.

License

MIT License

About

Rust SDK for Jupiter Exchange APIs.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages