Rust SDK
SW4P now includes a real Rust SDK crate in the repo at sdk/rust.
Current status:
- crate name:
sw4p-sdk - source of truth: workspace crate in this repo
- packaging status: repo-local crate today, not documented here as a published crates.io package
Installation
Use it as a path or git dependency from the SW4P repository:
[dependencies]
sw4p-sdk = { path = "../sw4p/sdk/rust" }
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
Quick Start
use sw4p_sdk::{Chain, EstimateParams, Sw4pClient};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Sw4pClient::new("sk_555_live");
let estimate = client
.estimate(&EstimateParams {
from: Chain::Base,
to: Chain::Solana,
amount: "100.00".to_string(),
speed: None,
})
.await?;
println!("total fee: {}", estimate.fee.total);
Ok(())
}
Current Surface
The Rust SDK covers the same broad contract families as the TypeScript SDK:
- pilot helpers:
transfer,estimate,status,pairs,limits - Solana helpers:
solana_build_tx,solana_validate_gasless,solana_submit - shared settlement intents:
submit_intent,get_intent_status,cancel_intent - abstract transfer
- DCA and limit orders, including create/list/update/cancel helpers
- batch, portfolio, and rebalance
- filler and auction flows
- ERC-7683 order helpers
- settlement discovery
Several advanced surfaces currently return serde_json::Value rather than
fully-modeled structs. That is intentional for parity-first coverage while the
Rust type surface catches up.
Current smart-account flows are wallet-authenticated backend and app surfaces, not Rust SDK API-key methods. See the smart-account guide and API reference for that contract.
Limit orders currently execute only from pre-funded Solana/WaaS USDC balances;
omit source_chain or set it to "SOL" in the request params.
Builder Note
This page does not claim an external sw4p-bridge package, a crates.io
publication, or a separate Rust SDK repository. The current Rust SDK lives in
the SW4P repo and tracks the same single-API settlement thesis as the
TypeScript client.