4 releases
Uses new Rust 2024
new 0.1.3 | May 9, 2025 |
---|---|
0.1.2 | May 9, 2025 |
0.1.1 | May 9, 2025 |
0.1.0 | May 8, 2025 |
#1574 in Web programming
267 downloads per month
38KB
451 lines
Jup-Ag-SDK
A Rust SDK for interacting with Jupiter Exchange APIs.
Installation 🛠️
cargo add jup-ag-sdk
or Add this to your Cargo.toml
:
[dependencies]
jup-ag-sdk = "0.1.3"
Usage 💡
use jup_ag_sdk::{
JupiterClient,
types::{QuoteRequest, SwapRequest},
};
#[tokio::main]
async fn main() {
// Initialize the client
let client = JupiterClient::new("https://lite-api.jup.ag/swap/v1");
// construct the quote request
let quote = QuoteRequest::new(
"JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN",
"oreoU2P8bN6jkk3jbaiVxYnG1dCXcYxwhwyK9jSybcp",
1000000,
)
.swap_mode(jup_ag_sdk::types::QuoteGetSwapModeEnum::ExactOut)
.slippage_bps(1000);
// get the quote
let quote_res = client.get_quote(quote).await.expect("failed to get quote");
println!("quore response: {:?}", quote_res);
// construct the swap request
let payload = SwapRequest::new("thrbabBvANwvKdV34GdrFUDXB6YMsksdfmiKj2ZUV3m", quote_res);
// get the swap transaction
let tx = client
.get_swap_transaction(payload)
.await
.expect("failed to get swap transaction");
println!("{:?}", tx);
}
Local
git clone https://github.com/thrishank/jup-ag-sdk
cd jup-ag-sdk
cargo build
MIT License
Dependencies
~5–16MB
~199K SLoC