Skip to main content

Crate strata_sdk

Crate strata_sdk 

Source
Expand description

Official Rust client for Strata markets and Sonar quotes.

It provides typed requests and responses and validates compatibility, quote binding, and economic fields before returning data to the application.

Re-exports§

pub use transaction_verifier::decode_transaction;
pub use transaction_verifier::verify_execution_transaction;
pub use transaction_verifier::verify_order_transaction;
pub use transaction_verifier::verify_twap_transaction;
pub use transaction_verifier::DecodedInstruction;
pub use transaction_verifier::DecodedTransaction;
pub use transaction_verifier::DefaultTransactionVerifier;
pub use transaction_verifier::TransactionVersion;

Modules§

transaction_verifier
Built-in transaction verification for one-signature order control.

Structs§

AccountStream
One externally authenticated private account stream. The SDK retains no signer and fails closed on any identity or sequence mismatch.
ActionAuthorityModel
ActionEdge
ActionGraph
ActionNode
ActionOperation
CapabilityCatalog
CapabilityDescriptor
DeadManGuard
Keeps the durable dead-man deadline alive. Drop is deliberately fail-closed: it stops heartbeats and leaves the pre-signed cancel-all armed.
ExecutionAuthorization
A parsed two-step execution authorization: the exact bytes to sign and the blockhash lease they bind.
ExecutionChallengeRequest
Ask Strata for a one-time payload authorizing preparation of an existing Sonar quote. The session key signs locally; no private signing material is accepted by this contract.
ExecutionChallengeResponse
ExecutionPrepareAuthorization
A prepared execution challenge, signed: the two-step path.
ExecutionPrepareResponse
ExecutionStream
Sequenced state for the executions an agent prepared in one market. The stream opens with a watch frame for the requested handles and begins with a snapshot; later watch calls add handles on the same stream. Any market or sequence mismatch fails closed so the caller reconnects.
ExecutionSubmitRequest
ExecutionSubmitResponse
ExecutionVerificationContext
Everything a verifier needs to decide whether the session may sign one prepared immediate execution.
LivePlatformCapability
One operation currently callable through the live v2 gateway.
MakerStream
One externally authenticated owner-only maker stream. The SDK retains no signer and fails closed on any identity or sequence mismatch.
Market
MarketDataStream
One sequenced connection to Strata’s product-level market stream.
MarketsResponse
NoSigner
Type-level placeholder for “no signer” (public reads).
OrderAuthorization
A parsed two-step order authorization: the exact bytes to sign and the blockhash lease they bind.
OrderChallengeResult
OrderCommandStream
Cloneable handle to one authenticated persistent order-command socket. Commands from clones are sequenced by a single writer task, so concurrent strategies cannot produce sequence gaps on the wire.
OrderVerificationContext
Everything a verifier needs to decide whether the session may sign one prepared resting-order transaction.
PageInfo
PageRequest
PlatformAccountFill
PlatformAccountMarketRequest
PlatformAccountOrder
PlatformAccountRequest
PlatformAccountSnapshot
PlatformAccountSnapshotResponse
PlatformActionGraphResponse
Complete customer-safe product graph. Static package support is projected against live capability discovery before this response is served.
PlatformAsset
Asset identity used by ordinary SDK operations.
PlatformAssetsResponse
PlatformAuthority
PlatformBestBidAskResponse
PlatformBookChange
PlatformBookLevel
PlatformBookRequest
PlatformBookSnapshotResponse
PlatformBugReport
PlatformBugSubmitRequest
PlatformBugSubmitResponse
PlatformBugsResponse
PlatformCandle
Decimal prices are strings so no SDK boundary silently rounds money.
PlatformCandlesRequest
PlatformCandlesResponse
PlatformDeadManState
PlatformDiscoveryResponse
Operations currently available to the client.
PlatformExecutionRow
One watched immediate execution as the stream sees it: the same fields as the recoverable HTTP receipt without the envelope.
PlatformExecutionStatusResponse
Recoverable immediate-execution receipt. Confirmed rows are journalled and survive a market-service restart.
PlatformFeeScheduleResponse
PlatformGraphModule
PlatformGraphRelation
PlatformMakerControlPrepareResponse
PlatformMakerControlSubmitRequest
PlatformMakerControlSubmitResponse
PlatformMakerFill
One maker-side fill: the same sanitized settlement view as an account fill plus the maker product that produced it. No counterparty or venue.
PlatformMakerReputationAuthorizedRequest
PlatformMakerReputationResponse
Authenticated, privacy-preserving reliability and participation record for the requesting maker. All potentially large counters and atomic quantities are decimal strings so JavaScript agents never lose integer precision.
PlatformMakerStatusResponse
Authenticated, owner-scoped view of the maker’s Strata products in one market: firm orders, intent, Strands, Currents, the signed-quote lane, live exposure, health, and kill state. Nothing about other makers, takers, or liquidity sources crosses this boundary.
PlatformMakerTierProgress
PlatformMarkResponse
PlatformMarket
Stable market metadata for public SDK operations.
PlatformMarketStatusResponse
PlatformMarketsResponse
PlatformOperation
PlatformOperationTransport
PlatformOrderChallengeResponse
PlatformOrderPrepareAuthorization
A prepared challenge, signed: the two-step path.
PlatformOrderPrepareResponse
PlatformOrderStatusRequest
PlatformOrderStatusResponse
PlatformOrderSubmitRequest
PlatformOrderSubmitResponse
PlatformOwnerRewards
PlatformPortfolioHistoryPoint
PlatformPortfolioHistoryResponse
Stored account-equity history. It never fabricates data before collection began and keeps all currency values in exact USD micros.
PlatformPortfolioResponse
The owner’s whole account in one public read, by wallet address: balances, per-market positions, open orders, and recent fills across every live market, plus USD totals. No signature and no market selection is needed. Amounts are exact atomic strings; USD totals are null whenever any held asset lacks a fresh public mark, so a partial valuation is never presented as complete.
PlatformReferralClaimRequest
PlatformReferralClaimResponse
PlatformReferralLinkRequest
PlatformReferralLinkResponse
PlatformReferralsResponse
PlatformRewardStanding
PlatformRewardsRequest
PlatformRewardsResponse
PlatformServiceStatusResponse
Product-level readiness without leaking private implementation details.
PlatformSwapQuoteRequest
Exact-input asset swap request. Asset identifiers come from PlatformAssetsResponse; implementation-specific identifiers are not part of this contract.
PlatformSwapQuoteResponse
Short-lived customer economics for an exact-input asset swap.
PlatformTrade
PlatformTradesRequest
PlatformTradesResponse
PlatformTwap
PlatformTwapChallengeResponse
PlatformTwapFill
PlatformTwapPrepareAuthorization
A prepared TWAP challenge, signed: the two-step path.
PlatformTwapPrepareResponse
PlatformTwapSubmitRequest
PlatformTwapSubmitResponse
PlatformTwapsResponse
PlatformVaultDelegatePrepareRequest
PlatformVaultDelegatePrepareResponse
Unsigned session-lifecycle control. The owner verifies both identities and the destructive action before signing and broadcasting it externally.
PlatformVaultDepositPrepareRequest
PlatformVaultDepositPrepareResponse
Exact owner-funded deposit transaction. Asset construction and custody identities remain internal; the public intent is echoed for verification.
PlatformVaultPausePrepareRequest
PlatformVaultPausePrepareResponse
An unsigned owner transaction. The external owner must verify its wallet and requested state before signing and broadcasting it.
PlatformVaultPolicyPrepareRequest
PlatformVaultPolicyPrepareResponse
An owner-bound withdrawal-access change. Unrestricted access is a status state rather than a preparable action in this contract.
PlatformVaultSessionStatus
Sanitized state for the requested external session key. It intentionally omits all construction accounts and price-source identities.
PlatformVaultSetupPrepareRequest
One-signature onboarding: only the wallet and the external session key are required. One session then trades every market. Everything else is an optional policy on top; absent values take the product defaults.
PlatformVaultSetupPrepareResponse
Owner-bound onboarding or session-replacement transaction. Product inputs are echoed exactly so an external verifier can reject changed intent.
PlatformVaultSpendingLimit
One asset-specific execution limit. A null maximum means that the session is permitted to use the asset without a per-execution amount ceiling.
PlatformVaultStatusRequest
PlatformVaultStatusResponse
Product-level Vault state for an owner and, when requested, one external session key. Chain construction identities never cross this boundary.
PlatformVaultSubmitRequest
Submit an owner-signed prepared Vault transaction. Strata verifies it is exactly the prepared transaction, adds its own fee-payer signature when the preparation was sponsored, and broadcasts it. Idempotent per idempotency_key.
PlatformVaultSubmitResponse
Durable outcome of a Vault submission, also returned by the status read.
PlatformVaultWithdrawPrepareRequest
PlatformVaultWithdrawPrepareResponse
Exact owner-authorized withdrawal transaction. The destination is a wallet identity; account construction and private balance routing remain internal.
PlatformVaultWithdrawalAccess
PlatformWorkflow
PlatformWorkflowEdge
PlatformWorkflowNode
QuoteRequest
QuoteResponse
StrataClient
TwapAuthorization
A parsed two-step TWAP authorization: the exact bytes to sign and the blockhash lease they bind.
TwapStream
One sequenced wallet-scoped TWAP progress stream for one market. The first event is the snapshot; later events are twap_update, heartbeat, or recovery snapshots on the same stream identity. Any identity or sequence mismatch fails closed so the caller reconnects and recovers from a fresh snapshot.
TwapVerificationContext
Everything a verifier needs to decide whether the session may sign one prepared TWAP-control transaction.

Enums§

ActionNodeKind
CapabilityRisk
CapabilityStability
ExecutionPrepareRequest
Prepare a quote-bound execution transaction: a signed challenge (Authorized) or the quote binding itself (Direct, one signature — the session’s transaction signature is the authorization). The response is identical.
ExecutionStatus
McpExposure
OrderExecuteOperation
PermissionSource
PlatformAccountEvent
PlatformBookSide
PlatformBugStatus
PlatformDeadManStatus
PlatformExecutionCommand
Client frame for the execution stream: watch one or more opaque execution handles issued by execution.prepare in this market.
PlatformExecutionEvent
Sequenced execution stream (execution.stream) for one market. The client opens the socket and sends a watch frame; the server answers with one executions_snapshot for the watched handles, then execution_update whenever a watched execution is prepared, confirmed on chain, or expires unconfirmed, execution_unknown for handles this market never issued or no longer remembers, and heartbeats. Later watch frames add handles and produce update/unknown events for them.
PlatformExecutionState
PlatformMakerControlAction
PlatformMakerControlProduct
PlatformMakerControlSubmissionStatus
PlatformMakerCurrentPrepareRequest
One maker-owned Current mutation. Current is parameterized around the market’s configured on-chain reference and therefore has no recenter action.
PlatformMakerEvent
Authenticated, sequenced owner-only maker stream (mm.fills.stream). After the signed challenge the server sends one maker_snapshot, then sequenced maker_fill, maker_status (exposure/product change), and heartbeat events; a recovery snapshot advances the sequence on the same stream identity.
PlatformMakerProduct
Which Strata maker product produced a maker-side fill.
PlatformMakerReputationTier
PlatformMakerStrandPrepareRequest
One maker-owned Strand mutation. Amounts that may exceed JavaScript’s safe integer range remain canonical unsigned decimal strings on the wire.
PlatformMarketAction
PlatformMarketDataEvent
PlatformMarketState
PlatformOrderAction
Externally authorized resting-order operation. The public contract exposes product intent only; private construction details never cross the SDK boundary.
PlatformOrderBatchOperation
One operation inside an atomic order-control batch. Owner and session identity live on the enclosing challenge so no item can widen authority.
PlatformOrderChallengeRequest
Request canonical bytes for one externally signed order-control operation. Variant-specific fields are sealed so an authorization cannot be widened between challenge and transaction preparation.
PlatformOrderCommand
One command on the persistent order-control connection. Challenge results may contain an effective request that differs from the requested one only by the explicitly selected self-trade prevention transformation.
PlatformOrderCommandBatchEvent
One result inside a compact event batch. Shared stream identity, time and sequence metadata live on the enclosing frame; request correlation and command-specific results remain independent.
PlatformOrderCommandBatchFormat
PlatformOrderCommandClientFrame
Frames sent by an external agent. Authentication proves possession of the declared session key; individual order authorizations and transactions keep their existing exact external-signing boundaries. Authentication is a singleton frame. After authentication, the transport accepts either one command or a bounded array of commands; every command retains its own request ID and contiguous sequence.
PlatformOrderCommandEvent
One sequenced event emitted by the persistent order-control connection. After authentication, the transport carries bounded arrays of these events so concurrent results share frame overhead without weakening per-event sequence or request correlation. Terminal chain status may arrive later without blocking command submission.
PlatformOrderCommandServerFrame
PlatformOrderControlStatus
PlatformOrderPrepareRequest
Prepare an order-control transaction. Either hand back a signed challenge (Authorized, two signatures per action) or send the operation itself (Direct, one signature per action): Strata builds the transaction from the operation immediately and the session’s signature over that transaction is the whole authorization. The response is identical.
PlatformOrderState
PlatformOrderSubmissionStatus
PlatformOrderType
PlatformPortfolioHistoryRange
PlatformSelfTradePrevention
Collision policy for an incoming order that would cross the owner’s own resting liquidity. Every mode still preserves Strata’s matcher and on-chain self-fill prohibition; this only controls which order is cancelled first.
PlatformServiceState
PlatformSettlementState
PlatformTradeSide
PlatformTransport
PlatformTwapChallengeRequest
Request exact authorization bytes for one Vault-owned TWAP action. The external owner chooses the session signer; Strata never receives its key.
PlatformTwapControlAction
PlatformTwapEvent
Sequenced wallet-scoped TWAP progress stream (algos.twap.stream) for one market. It starts with a twaps_snapshot, then sends one twap_update carrying the complete sanitized TWAP row whenever a schedule is created, executes a slice, or reaches a terminal state, plus heartbeats. Every event carries the stream identity and previous sequence; a recovery snapshot advances the sequence on the same identity.
PlatformTwapPrepareRequest
Prepare a TWAP-control transaction: a signed challenge (Authorized) or the action itself (Direct, one signature — the transaction signature is the authorization). The response is identical.
PlatformTwapState
PlatformVaultAction
Which prepared Vault action a submission carries.
PlatformVaultDelegateAction
PlatformVaultSessionState
PlatformVaultSetupMode
PlatformVaultState
PlatformVaultSubmissionStatus
PlatformVaultWithdrawalMode
QuoteSide
QuoteTarget
Which amount a quote request fixes.
SdkError
SigningLocation
TwapExecuteOperation

Constants§

ACCOUNT_STREAM_AUTH_DOMAIN
DEFAULT_API_BASE
DEFAULT_MAXIMUM_TOLERANCE_BPS
Default maximum tolerance: zero, so a quote is exact unless the caller opts into a lower floor. Tolerance is the caller’s choice; it is not price impact.
DEFAULT_SLIPPAGE_BPS
Legacy name for DEFAULT_MAXIMUM_TOLERANCE_BPS.
MAKER_STREAM_AUTH_DOMAIN
MAX_WATCHED_EXECUTIONS
ORDER_STREAM_AUTH_DOMAIN
PLATFORM_SESSION_DEFAULT_MAXIMUM_TOLERANCE_BPS
PLATFORM_SESSION_DEFAULT_MINIMUM_INTERVAL_SECONDS
Session policy applied when onboarding does not state one: at most one execution per second per session, and a 1% maximum tolerance.
PLATFORM_SESSION_MAX_SPENDING_LIMITS
A session carries at most this many spending limits.

Traits§

AccountSigner
ExecutionVerifier
OrderVerifier
SessionSigner
TwapVerifier

Functions§

account_http_auth_message
account_stream_auth_message
bug_authorization_payload
exact_output_floor
The output floor an exact-output quote must carry: the requested amount lowered by maximum_tolerance_bps (truncating), zero tolerance meaning the requested amount itself.
maker_reputation_auth_message
maker_status_auth_message
maker_stream_auth_message
quote_target
Exactly one of amount_in_atoms / amount_out_atoms, canonical and > 0.
referral_claim_authorization_payload
referral_link_authorization_payload
validate_execution_authorization
Two-step path helper: check a challenge’s authorization payload binds exactly this quote, owner, and session before signing it. The one-call StrataClient::execute_quote no longer needs it (one signature over the transaction).
validate_execution_challenge
Two-step path helper: check an execution challenge is bound to this quote and still inside its lifetime.
validate_execution_prepare
Two-step path helper: check a prepared execution preserved the signed challenge bindings.
validate_order_authorization
Two-step path helper: check an order challenge’s authorization payload binds exactly this operation (every field, opaque order identity, and replay value) before signing it. The one-call StrataClient::execute_order no longer needs it (one signature over the transaction); the order command channel still uses it to bind the challenge without a message signature.
validate_order_prepare_binding
Two-step path helper: check a prepared order control preserved the signed challenge bindings.
validate_twap_authorization
Two-step path helper: check a TWAP challenge’s authorization payload binds exactly this request before signing it. The one-call StrataClient::execute_twap no longer needs it (one signature over the transaction).
validate_twap_prepare_binding
Two-step path helper: check a prepared TWAP control preserved the signed challenge bindings.

Type Aliases§

PlatformMakerStatusAuthorizedRequest
Detached external authorization for the owner-scoped maker status read.