TypeScript & Rust
Both official SDKs validate the same versioned Strata contract. Money values cross the boundary as decimal strings in atomic units, so language-level number rounding cannot silently change an amount.
Review the source in the TypeScript SDK and Rust SDK repositories.
TypeScript
Install:
npm install @stratabook/sdk
Request a Sonar quote:
import { StrataClient } from "@stratabook/sdk";
const strata = new StrataClient();
const quote = await strata.quote({
market: "SOL/USDC",
side: "sell",
amountInAtoms: 10_000_000n,
});
console.log({
output: quote.amount_out_atoms,
minimum: quote.minimum_output_atoms,
fee: quote.output_fee_atoms,
expiresAt: quote.expires_at_ms,
});
The package supports Node 20+ and modern browsers with no runtime dependencies.
Rust
Add the SDK:
cargo add strata-sdk strata-public-contract
Request the same quote:
use strata_public_contract::{QuoteRequest, QuoteSide, DEFAULT_SLIPPAGE_BPS};
use strata_sdk::StrataClient;
let strata = StrataClient::production()?;
let quote = strata.quote(QuoteRequest {
market_id: "SOL/USDC".into(),
side: QuoteSide::Sell,
amount_in_atoms: "10000000".into(),
slippage_bps: DEFAULT_SLIPPAGE_BPS,
}).await?;
println!("{} atoms", quote.amount_out_atoms);
Execution tolerance and price impact
Read-only quotes default to zero execution tolerance, so the minimum output equals the quoted output. This is separate from price impact, which describes the depth consumed by the quote itself. Set a non-zero tolerance explicitly only when the application is willing to accept a lower minimum output.
What the clients validate
Before returning a quote, both SDKs enforce contract compatibility, market and request binding, exact atomic fields, quote lifetime, labelled fees, and internally consistent minimum output.
Unknown response fields are rejected. A public contract change therefore fails visibly instead of being interpreted loosely.