Rust SDK (API wrapper) for SplitNOW, the multi-wallet instant crypto exchange. 🪼
4 Dependencies :
reqwestserdetokiothiserror
cargo add splitnowOr add splitnow as a dependency to your Cargo.toml file:
[dependencies]
splitnow = "1.0"You'll need to create a SplitNOW API key if you don't have one already:
- Create a SplitNOW account at https://splitnow.io/auth/register
- Head to the API keys page on your account dashboard at https://splitnow.io/account/api-keys
- Copy your account's API key and store it in a safe place.
This example demonstrates splitting 10 SOL evenly across 2 wallets through Binance & Bybit:
use splitnow::{AssetId, ExchangerId, NetworkId, SplitNow, WalletDistribution};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Get a free API key at: https://splitnow.io/auth/register
const API_KEY: &str = "replace_me";
let splitnow = SplitNow::new(API_KEY.to_string())?;
// Step 1: Create and fetch a quote
let quote = splitnow
.create_and_fetch_quote(
10.0,
AssetId::Sol,
NetworkId::Solana,
AssetId::Sol,
NetworkId::Solana,
)
.await?;
println!("Quote ID: {}", quote.quote_id);
println!("Available rates:");
for rate in "e.rates {
println!(" {}: {}", rate.exchange_id, rate.exchange_rate);
}
// Step 2: Create and fetch an order
let wallet_distributions = vec![
WalletDistribution {
to_address: "7ingPqZUYmuso5HakTLgoXjMpETpbZYzxeQBJChGrQn5".to_string(),
to_pct_bips: 5000,
to_asset_id: AssetId::Sol,
to_network_id: NetworkId::Solana,
to_exchanger_id: ExchangerId::Binance,
},
WalletDistribution {
to_address: "92CzWZt7fD5ffhwkRNBKHxqHahVTPeWedd5UYmdmHjMw".to_string(),
to_pct_bips: 5000,
to_asset_id: AssetId::Sol,
to_network_id: NetworkId::Solana,
to_exchanger_id: ExchangerId::Bybit,
},
];
let order = splitnow
.create_and_fetch_order(
quote.quote_id,
10.0,
AssetId::Sol,
NetworkId::Solana,
wallet_distributions,
)
.await?;
println!("\nOrder ID: {}", order.order_id);
println!("Deposit Address: {}", order.deposit_address);
println!("Deposit Amount: {}", order.deposit_amount);
// Step 3: Get order status
let order_status = splitnow.get_order_status(&order.order_id).await?;
println!("\nOrder Status: {:?}", order_status.order_status);
println!("Status Short: {:?}", order_status.order_status_short);
println!("Status Text: {}", order_status.order_status_text);
Ok(())
}To ensure a seamless SplitNOW API integration for your use case, you must first understand the 3-step flow when using the SplitNOW API.
Below is a short explainer of each step so that you can best fit each step into your own software & workflows.
let quote = splitnow
.create_and_fetch_quote(
10.0,
AssetId::Sol,
NetworkId::Solana,
AssetId::Sol,
NetworkId::Solana,
)
.await?;- Save
quote.quote_idbecause you need this value to create your order in the next step. - You'll also probably want to do something such as filter through
quote.ratesto see which exchanges are available and at what rate. - If the
exchange_ratefield of a rate object in thequote.ratesvector is0, the pair might not be supported on that exchange. - You can pick any exchange no matter what, though. Our systems fall back to the next best rate if your selection is unavailable!
let order = splitnow
.create_and_fetch_order(
quote.quote_id,
10.0,
AssetId::Sol,
NetworkId::Solana,
wallet_distributions,
)
.await?;- Remember to pass in the
quote_idfrom the previous step! - The
orderstruct contains important information you'll need for initiating the order:order.deposit_address&order.deposit_amount. - Once you've sent the deposit, we take care of everything else automatically!
- Save
order.order_idso you can check the status of your order anytime.
let order_status = splitnow.get_order_status(&order.order_id).await?;- Remember to pass in the
order_idfrom the previous step! - Your 6-digit order ID is returned as
order_status.order_id. - You'll probably want to do something with
order_status.order_statussuch as update your app's client or trigger a notification once the order status changes. - If you want a human-readable order status such as for your UI, use
order_status.order_status_text. - Once
order_status.order_statusisOrderStatus::Completed, it's all done and the wallets are funded as requested! Enjoy!
This Rust SDK includes 10 functions that wrap around the SplitNOW API to help you get up and running with creating quotes & orders quickly, no matter your use case:
pub async fn get_health(&self) -> Result<bool, SplitNowError>- Checks whether the SplitNOW API is healthy.
- Returns: A
Result<bool, SplitNowError>indicating API health status.
API Reference: GET /health/
pub async fn get_assets(&self) -> Result<Vec<Asset>, SplitNowError>- Gets a list of available asset IDs and network IDs.
- Returns: A
Result<Vec<Asset>, SplitNowError>.
💡 Pro Tip: When creating quotes & orders, the asset_id field of each Asset can be used for from_asset_id & to_asset_id.
💡 Pro Tip: When creating quotes & orders, the network_id field of a corresponding Asset can be used for from_network_id & to_network_id.
API Reference: GET /assets/
pub async fn get_asset_prices(&self) -> Result<HashMap<String, Option<f64>>, SplitNowError>- Gets the current USD price of each available asset by ID.
- Returns: A
Result<HashMap<String, Option<f64>>, SplitNowError>where each key is an asset ID and each value is its price.
API Reference: GET /assets/prices/
pub async fn get_asset_deposit_limits(&self) -> Result<Vec<AssetLimit>, SplitNowError>- Gets the minimum and maximum deposit (if any) for each available asset.
- Returns: A
Result<Vec<AssetLimit>, SplitNowError>.
API Reference: GET /assets/limits/
pub async fn get_exchangers(&self) -> Result<Vec<Exchanger>, SplitNowError>- Get a list of available exchanger IDs.
- Returns: A
Result<Vec<Exchanger>, SplitNowError>.
💡 Pro Tip: When creating quotes & orders, the id field of each Exchanger can be used for to_exchanger_id.
API Reference: GET /exchangers/
pub async fn create_and_fetch_quote(
&self,
from_amount: f64,
from_asset_id: impl Into<String>,
from_network_id: impl Into<String>,
to_asset_id: impl Into<String>,
to_network_id: impl Into<String>,
) -> Result<QuoteData, SplitNowError>- Creates and fetches a quote.
- Parameters:
from_amount: A numerical amount of tokens to split.from_asset_id: The input asset ID returned fromget_assets. AcceptsAssetIdenum orString.from_network_id: A corresponding input network ID returned fromget_assets. AcceptsNetworkIdenum orString.to_asset_id: The output asset ID returned fromget_assets. AcceptsAssetIdenum orString.to_network_id: A corresponding output network ID returned fromget_assets. AcceptsNetworkIdenum orString.
- Returns: A
Result<QuoteData, SplitNowError>.
API Reference: POST /quotes/, GET /quotes/{id}
pub async fn create_and_fetch_order(
&self,
quote_id: impl Into<String>,
from_amount: f64,
from_asset_id: impl Into<String>,
from_network_id: impl Into<String>,
wallet_distributions: Vec<WalletDistribution>,
) -> Result<OrderData, SplitNowError>- Creates and fetches an order.
- Parameters:
quote_id: A quote ID returned fromcreate_and_fetch_quote.from_amount: A numerical amount of tokens to split.from_asset_id: The input asset ID returned fromget_assets. AcceptsAssetIdenum orString.from_network_id: A corresponding input network ID returned fromget_assets. AcceptsNetworkIdenum orString.wallet_distributions: AVec<WalletDistribution>containing recipient wallets and distribution preferences.
- Returns: A
Result<OrderData, SplitNowError>.
API Reference: POST /orders/, GET /orders/{id}
pub async fn get_quote(&self, quote_id: &str) -> Result<Quote, SplitNowError>- Fetches a quote by its ID.
- Parameters:
quote_id: The quote ID to fetch.
- Returns: A
Result<Quote, SplitNowError>.
API Reference: GET /quotes/{id}
pub async fn get_order(&self, order_id: &str) -> Result<Order, SplitNowError>- Fetches an order by its ID.
- Parameters:
order_id: The order ID to fetch.
- Returns: A
Result<Order, SplitNowError>.
API Reference: GET /orders/{id}
pub async fn get_order_status(&self, order_id: &str) -> Result<OrderStatusData, SplitNowError>- Fetches the status of an order by its ID.
- Parameters:
order_id: The order ID to fetch.
- Returns: A
Result<OrderStatusData, SplitNowError>.
API Reference: GET /orders/{id}
The default rate-limit of each API key is 60 requests per minute.
Don't hesitate to contact SplitNOW if you need more. We scale to meet any demand instantly!
Never expose your SplitNOW API key to clients! If you think your API key may have been accidentally leaked, please contact support right away so that we can get you set up with a fresh one.
Our API services are not available to users in the Restricted Regions, directly or indirectly, in accordance with our Terms of Service.
- Official API docs: https://splitnow.io/api/docs
- Free 24/7 email support: [email protected]
- Free community support: SplitNOW API Developers Chat
Unlicensed (Whitelabelled)
More information: https://unlicense.org
© 2025 SplitOTC, Ltd.