Skip to content

Rust SDK

Async, tonic-based Rust client for every service in sweetspot.api.v1. Quoting layer (OracleOffset, OrderList, LinearDistribution) behind the default quoting feature; turn it off for read-only consumers to drop the on-chain Solana SDK from your build.

Install

toml
[dependencies]
superis = { git = "https://github.com/superis/sweetspot-maker-client", branch = "main" }
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }

When the SDK is published to crates.io:

toml
superis = "0.1"

Read-only (no quoting):

toml
superis = { version = "0.1", default-features = false, features = ["tls"] }

Quickstart

rust
use std::sync::Arc;
use superis::auth::AuthFlow;
use superis::proto::{
    market_data_service_client::MarketDataServiceClient, ListPairsRequest,
};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let channel = tonic::transport::Channel::from_static("https://api.superis.exchange:443")
        .connect()
        .await?;

    // Public RPC — no auth required.
    let mut market = MarketDataServiceClient::new(channel.clone());
    let pairs = market.list_pairs(ListPairsRequest {}).await?.into_inner();
    for pair in &pairs.pairs {
        println!("{:?} / {:?}", pair.base, pair.quote);
    }

    // Authenticated path: AuthService.Challenge → sign → Authenticate.
    let auth = AuthFlow::new(channel.clone(), Arc::new(my_signer));
    let session = auth.token().await?;
    println!("authenticated as maker_id={}", session.maker_id);

    Ok(())
}

Where to go from here

You wantPage
Boot a maker botQuoting
Stream books and fillsMarket data
Survive transient disconnectsResilience
Pull historical trades / candlesHistorical queries
Sign-in flow detailAuth flow

Decimal handling

price, size, and OHLCV fields are wrapped as Decimal { value: String } on the wire. Parse with rust_decimal:

rust
use rust_decimal::Decimal;
use std::str::FromStr;

let price = Decimal::from_str(&trade.price.as_ref().unwrap().value)?;
let size = Decimal::from_str(&trade.size.as_ref().unwrap().value)?;
let notional = price * size;

Errors

The SDK surfaces gRPC tonic::Status directly. Branch on status.code() for retry decisions — see Errors.

Cargo features

FeatureDefaultWhat it adds
tlsyesHTTPS via rustls + native roots.
quotingyesQuoting layer (OracleOffsetQuotingClient, OrderListQuotingClient, LinearDistributionQuotingClient, Receipt, sequence trackers). Pulls in the on-chain Solana SDK.

Source

Apache 2.0