Skip to main content

StrataClient

Struct StrataClient 

Source
pub struct StrataClient { /* private fields */ }

Implementations§

Source§

impl StrataClient

Source

pub fn production() -> Result<Self, SdkError>

Source

pub fn new(base_url: impl AsRef<str>) -> Result<Self, SdkError>

Source

pub fn with_timeout( base_url: impl AsRef<str>, timeout: Duration, ) -> Result<Self, SdkError>

Source

pub async fn connect_order_commands<S: SessionSigner + ?Sized>( &self, market_id: &str, owner_wallet: &str, signer: &S, ) -> Result<OrderCommandStream, SdkError>

Open one authenticated, persistent order-command connection. The external session signer is used for authentication and is not retained.

Source

pub async fn connect_market_data( &self, market_id: &str, ) -> Result<MarketDataStream, SdkError>

Open the sequenced Strata market-data stream. A sequence gap fails closed so the caller can reconnect and recover from a new snapshot.

Source

pub async fn connect_executions( &self, market_id: &str, execution_ids: &[String], ) -> Result<ExecutionStream, SdkError>

Open the sequenced execution stream for one market, watching the opaque handles issued by execution.prepare. It begins with a snapshot; a gap fails closed so the caller reconnects and recovers.

Source

pub async fn connect_twaps( &self, market_id: &str, wallet_address: &str, ) -> Result<TwapStream, SdkError>

Open the sequenced TWAP progress stream for a wallet in one market. It begins with a snapshot and then delivers one complete sanitized TWAP row per change; a gap fails closed so the caller reconnects and recovers.

Source

pub async fn connect_maker_for_wallet( &self, market_id: &str, wallet_address: &str, ) -> Result<MakerStream, SdkError>

Open the maker stream for one market by wallet address — public, no signature: a maker snapshot followed by sequenced maker fills, product/exposure changes, and heartbeats.

Source

pub async fn connect_maker<S: AccountSigner + ?Sized>( &self, market_id: &str, signer: &S, ) -> Result<MakerStream, SdkError>

Same stream, addressed by a signer’s public key; the server’s compatibility challenge is answered with the signer’s signature.

Source

pub async fn connect_account<S: AccountSigner + ?Sized>( &self, market_id: &str, signer: &S, ) -> Result<AccountStream, SdkError>

Open one externally authenticated private account stream. The signer is used only for the server challenge and is not retained by the SDK.

Source

pub async fn platform_capabilities( &self, ) -> Result<PlatformDiscoveryResponse, SdkError>

Read the operations currently enabled through the public 2.0 product contract. This response contains product capabilities only.

Source

pub async fn platform_action_graph( &self, ) -> Result<PlatformActionGraphResponse, SdkError>

Read the complete customer-safe entity, operation, and workflow graph projected against the capabilities that are live now.

Source

pub async fn platform_status( &self, ) -> Result<PlatformServiceStatusResponse, SdkError>

Read product-level readiness without exposing internal services.

Source

pub async fn platform_assets( &self, request: PageRequest, ) -> Result<PlatformAssetsResponse, SdkError>

Source

pub async fn platform_swap_quote( &self, request: PlatformSwapQuoteRequest, ) -> Result<PlatformSwapQuoteResponse, SdkError>

Request a short-lived exact-input quote between two assets returned by Self::platform_assets.

Source

pub async fn platform_markets( &self, request: PageRequest, ) -> Result<PlatformMarketsResponse, SdkError>

Source

pub async fn platform_resolve_market( &self, reference: &str, ) -> Result<PlatformMarket, SdkError>

Resolve an opaque market ID or case-insensitive label across all pages.

Source

pub async fn platform_resolve_asset( &self, reference: &str, ) -> Result<PlatformAsset, SdkError>

Resolve an opaque asset ID or unambiguous symbol across all pages.

Source

pub async fn platform_book( &self, market_id: &str, request: PlatformBookRequest, ) -> Result<PlatformBookSnapshotResponse, SdkError>

Source

pub async fn platform_best_bid_ask( &self, market_id: &str, ) -> Result<PlatformBestBidAskResponse, SdkError>

Source

pub async fn platform_fees( &self, market_id: &str, ) -> Result<PlatformFeeScheduleResponse, SdkError>

Source

pub async fn platform_market_status( &self, market_id: &str, ) -> Result<PlatformMarketStatusResponse, SdkError>

Source

pub async fn platform_trades( &self, market_id: &str, request: PlatformTradesRequest, ) -> Result<PlatformTradesResponse, SdkError>

Source

pub async fn platform_candles( &self, market_id: &str, request: PlatformCandlesRequest, ) -> Result<PlatformCandlesResponse, SdkError>

Source

pub async fn platform_mark( &self, market_id: &str, ) -> Result<PlatformMarkResponse, SdkError>

Source

pub async fn platform_execution_status( &self, market_id: &str, execution_id: &str, ) -> Result<PlatformExecutionStatusResponse, SdkError>

Source

pub async fn platform_twaps( &self, market_id: &str, wallet_address: &str, ) -> Result<PlatformTwapsResponse, SdkError>

Source

pub async fn platform_portfolio( &self, wallet_address: &str, ) -> Result<PlatformPortfolioResponse, SdkError>

The whole account in one public read, by wallet address: balances (total / available / locked, exact USD), positions, open orders, and recent fills across every live market. No signature, no session key, no market selection. platform_account is the same read.

Source

pub async fn platform_account( &self, wallet_address: &str, ) -> Result<PlatformPortfolioResponse, SdkError>

Alias of platform_portfolio: the whole account in one public read.

Source

pub async fn platform_portfolio_history( &self, wallet_address: &str, range: PlatformPortfolioHistoryRange, ) -> Result<PlatformPortfolioHistoryResponse, SdkError>

Source

pub async fn platform_vault_status( &self, wallet_address: &str, request: PlatformVaultStatusRequest, ) -> Result<PlatformVaultStatusResponse, SdkError>

Read sealed Vault owner state and, optionally, one external session.

Source

pub async fn platform_vault_pause_prepare( &self, request: PlatformVaultPausePrepareRequest, ) -> Result<PlatformVaultPausePrepareResponse, SdkError>

Prepare an owner-authorized Vault pause or resume transaction. The external owner verifies, signs, and broadcasts the returned bytes.

Source

pub async fn platform_vault_setup_prepare( &self, request: PlatformVaultSetupPrepareRequest, ) -> Result<PlatformVaultSetupPrepareResponse, SdkError>

Prepare one-signature Vault onboarding (or a further session) for external owner verification, signing, and broadcast. Only the wallet and the session key are required; the policy fields are optional and take the product defaults when absent.

Source

pub async fn platform_vault_delegate_prepare( &self, request: PlatformVaultDelegatePrepareRequest, ) -> Result<PlatformVaultDelegatePrepareResponse, SdkError>

Prepare owner-authorized revocation of one external Vault session. The SDK never signs or broadcasts this destructive action.

Source

pub async fn platform_vault_policy_prepare( &self, request: PlatformVaultPolicyPrepareRequest, ) -> Result<PlatformVaultPolicyPrepareResponse, SdkError>

Prepare blocked or restricted Vault withdrawal access. The external owner verifies, signs, and broadcasts the returned transaction.

Source

pub async fn platform_vault_deposit_prepare( &self, request: PlatformVaultDepositPrepareRequest, ) -> Result<PlatformVaultDepositPrepareResponse, SdkError>

Prepare an exact owner-funded Vault deposit. With session_public_key set, a first deposit also registers that session in the same transaction (one owner signature onboards and funds the wallet). The SDK validates the echoed product intent and leaves signing and broadcast external.

Source

pub async fn platform_vault_withdraw_prepare( &self, request: PlatformVaultWithdrawPrepareRequest, ) -> Result<PlatformVaultWithdrawPrepareResponse, SdkError>

Prepare an exact owner-authorized Vault withdrawal to one destination wallet. Signing and broadcast remain external.

Source

pub async fn platform_vault_submit( &self, request: PlatformVaultSubmitRequest, ) -> Result<PlatformVaultSubmitResponse, SdkError>

Submit an owner-signed prepared Vault transaction. Strata verifies it is exactly the prepared transaction, pays the fee (and any rent) when the preparation was sponsored, and broadcasts it. Idempotent per idempotency_key; read the outcome with platform_vault_submission.

Source

pub async fn platform_vault_submission( &self, preparation_id: &str, ) -> Result<PlatformVaultSubmitResponse, SdkError>

Durable outcome of a Vault submission (submittedconfirmed | failed).

Source

pub async fn platform_rewards( &self, request: PlatformRewardsRequest, ) -> Result<PlatformRewardsResponse, SdkError>

Source

pub async fn platform_referrals( &self, wallet_address: &str, ) -> Result<PlatformReferralsResponse, SdkError>

Source

pub async fn platform_referral_claim( &self, request: PlatformReferralClaimRequest, ) -> Result<PlatformReferralClaimResponse, SdkError>

Source

pub async fn platform_bugs( &self, wallet_address: &str, ) -> Result<PlatformBugsResponse, SdkError>

Source

pub async fn platform_bug_submit( &self, request: PlatformBugSubmitRequest, ) -> Result<PlatformBugSubmitResponse, SdkError>

Source

pub async fn platform_account_market<S: AccountSigner + ?Sized>( &self, market_id: &str, signer: &S, request: PlatformAccountMarketRequest, ) -> Result<PlatformAccountSnapshotResponse, SdkError>

Read one market’s private account state after proving wallet control. The wallet signs an exact, server-time-bound read message outside Strata.

Source

pub async fn platform_account_snapshot<S: AccountSigner + ?Sized>( &self, signer: &S, request: PlatformAccountRequest, ) -> Result<PlatformAccountSnapshot, SdkError>

Read private order and fill state across selected markets, or across every currently discoverable market when market_ids is omitted.

Source

pub async fn platform_maker_status_for_wallet( &self, market_id: &str, wallet_address: &str, ) -> Result<PlatformMakerStatusResponse, SdkError>

A maker’s products, exposure, health, and kill state in one market — public by wallet address, no signature.

Source

pub async fn platform_maker_status<S: AccountSigner + ?Sized>( &self, market_id: &str, signer: &S, ) -> Result<PlatformMakerStatusResponse, SdkError>

Same read, addressed by a signer’s public key. Reads are public, so the signer is never asked to sign; kept so existing callers keep compiling.

Source

pub async fn platform_maker_status_authorized( &self, request: PlatformMakerStatusAuthorizedRequest, ) -> Result<PlatformMakerStatusResponse, SdkError>

Submit a detached external signature for the maker status read. Reads are public now; a signed request is still accepted (deprecated path).

Source

pub async fn platform_maker_reputation_for_wallet( &self, market_id: &str, wallet_address: &str, ) -> Result<PlatformMakerReputationResponse, SdkError>

A maker’s reliability record in one market — public by wallet address, no signature.

Source

pub async fn platform_maker_reputation<S: AccountSigner + ?Sized>( &self, market_id: &str, signer: &S, ) -> Result<PlatformMakerReputationResponse, SdkError>

Same read, addressed by a signer’s public key; the signer is never asked to sign (reads are public). Kept so existing callers keep compiling.

Source

pub async fn platform_maker_reputation_authorized( &self, request: PlatformMakerReputationAuthorizedRequest, ) -> Result<PlatformMakerReputationResponse, SdkError>

Submit a detached external signature. Reads are public now; a signed request is still accepted (deprecated path).

Source

pub async fn platform_maker_strand_prepare( &self, market_id: &str, request: PlatformMakerStrandPrepareRequest, ) -> Result<PlatformMakerControlPrepareResponse, SdkError>

Prepare one exact maker-signed Strand transaction. Strata never sees the maker’s private key and the returned packet has one signature slot.

Source

pub async fn platform_maker_current_prepare( &self, market_id: &str, request: PlatformMakerCurrentPrepareRequest, ) -> Result<PlatformMakerControlPrepareResponse, SdkError>

Prepare one exact maker-signed Current transaction. Upsert prices its bands from the market’s live Strata mark; cancel stays usable.

Source

pub async fn platform_maker_strand_submit( &self, market_id: &str, request: PlatformMakerControlSubmitRequest, ) -> Result<PlatformMakerControlSubmitResponse, SdkError>

Source

pub async fn platform_maker_current_submit( &self, market_id: &str, request: PlatformMakerControlSubmitRequest, ) -> Result<PlatformMakerControlSubmitResponse, SdkError>

Source

pub async fn platform_wait_for_maker_market( &self, reference: &str, timeout: Duration, ) -> Result<PlatformMarket, SdkError>

Wait through a brief restart until a market is active with a fresh Strata mark, then return its resolved public identity.

Source

pub async fn platform_maker_quickstart_prepare( &self, maker_wallet: &str, request: &PlatformMakerQuickstartRequest, ) -> Result<PlatformMakerQuickstartPrepared, SdkError>

Resolve human inputs and prepare one exact maker-owned transaction.

Source

pub async fn platform_maker_stop_prepare( &self, market: &str, product: PlatformMakerControlProduct, maker_wallet: &str, ) -> Result<PlatformMakerQuickstartPrepared, SdkError>

Prepare a label-aware Strand or Current cancellation.

Source

pub async fn platform_maker_submit_prepared( &self, prepared: &PlatformMakerQuickstartPrepared, signed_transaction_base64: &str, idempotency_key: Option<&str>, confirmation_timeout: Option<Duration>, ) -> Result<PlatformMakerQuickstartResult, SdkError>

Submit an externally signed quickstart preparation and wait until the matcher’s chain-derived maker state observes the exact start or stop.

Source

pub async fn platform_maker_start<S: MakerTransactionSigner + ?Sized>( &self, request: &PlatformMakerQuickstartRequest, signer: &S, confirmation_timeout: Option<Duration>, ) -> Result<PlatformMakerQuickstartResult, SdkError>

One-call Rust maker start: resolve, prepare, verify, externally sign, submit idempotently, and return only after chain-derived confirmation.

Source

pub async fn platform_maker_stop<S: MakerTransactionSigner + ?Sized>( &self, market: &str, product: PlatformMakerControlProduct, signer: &S, confirmation_timeout: Option<Duration>, ) -> Result<PlatformMakerStopResult, SdkError>

Idempotent one-call stop. If the product is already absent no wallet prompt or transaction is produced.

Source

pub async fn capabilities(&self) -> Result<CapabilityCatalog, SdkError>

Source

pub async fn action_graph(&self) -> Result<ActionGraph, SdkError>

Return the live operation topology, including capability-gated nodes and the points where the agent owner’s signer acts outside Strata.

Source

pub async fn markets(&self) -> Result<MarketsResponse, SdkError>

Source

pub async fn quote( &self, request: QuoteRequest, ) -> Result<QuoteResponse, SdkError>

Request a short-lived Sonar quote by human market label or market ID. Give exactly one of amount_in_atoms (spend this much) or amount_out_atoms (receive this much; Strata resolves the input). maximum_tolerance_bps is the most you accept below the quoted output (default 0); it is your choice and unrelated to the measured price_impact_pct the response reports.

Source

pub async fn execution_challenge( &self, market: &str, request: ExecutionChallengeRequest, ) -> Result<ExecutionChallengeResponse, SdkError>

Request canonical authorization bytes for an external signer. This operation accepts public identity only; signing material stays external.

Source

pub async fn execution_prepare( &self, market: &str, request: ExecutionPrepareRequest, ) -> Result<ExecutionPrepareResponse, SdkError>

Prepare a quote-bound, partially signed transaction: either exchange an external authorization signature (Authorized, two-step path) or bind the quote directly (Direct, one signature — the session’s transaction signature is the authorization).

Source

pub async fn execution_submit( &self, market: &str, request: ExecutionSubmitRequest, ) -> Result<ExecutionSubmitResponse, SdkError>

Submit an externally signed transaction. Reusing the same idempotency key cannot create a second execution.

Source

pub async fn order_challenge( &self, market_id: &str, request: PlatformOrderChallengeRequest, ) -> Result<PlatformOrderChallengeResponse, SdkError>

Request exact authorization bytes for one product-level resting-order operation. Private key material never enters this client or Strata.

Source

pub async fn order_prepare( &self, market_id: &str, request: PlatformOrderPrepareRequest, ) -> Result<PlatformOrderPrepareResponse, SdkError>

Prepare a backend-partially-signed v0 order-control transaction: either hand back a signed challenge (Authorized, two-step path) or send the operation itself (Direct, one signature — Strata builds the transaction from the operation and the session’s signature over that transaction is the whole authorization).

Source

pub async fn order_submit( &self, market_id: &str, request: PlatformOrderSubmitRequest, ) -> Result<PlatformOrderSubmitResponse, SdkError>

Submit an externally signed order-control transaction. The same control ID and idempotency key return the same receipt.

Source

pub async fn order_status( &self, market_id: &str, request: PlatformOrderStatusRequest, ) -> Result<PlatformOrderStatusResponse, SdkError>

Recover the durable result for a prior submission. The same opaque control ID and idempotency key are required, so status polling never broadens authority beyond the original external submission.

Source

pub async fn twap_challenge( &self, market_id: &str, request: PlatformTwapChallengeRequest, ) -> Result<PlatformTwapChallengeResponse, SdkError>

Request exact authorization bytes for one bounded TWAP placement or cancellation. The session private key remains outside Strata.

Source

pub async fn twap_prepare( &self, market_id: &str, request: PlatformTwapPrepareRequest, ) -> Result<PlatformTwapPrepareResponse, SdkError>

Prepare a backend-partially-signed TWAP-control transaction that the external session must verify: either the exact detached TWAP authorization (Authorized, two-step path) or the action itself (Direct, one signature — the transaction signature is the authorization).

Source

pub async fn twap_submit( &self, market_id: &str, request: PlatformTwapSubmitRequest, ) -> Result<PlatformTwapSubmitResponse, SdkError>

Submit one externally signed TWAP transaction idempotently.

Source

pub async fn execute_twap<S, V>( &self, market_id: &str, operation: &TwapExecuteOperation, signer: &S, verifier: &V, idempotency_key: Option<&str>, ) -> Result<PlatformTwapSubmitResponse, SdkError>

Complete the externally signed TWAP flow with one signature: the action is bound and built in one step (direct prepare), the prepared bindings are checked against the request, the mandatory verifier runs (see DefaultTransactionVerifier), and only then is the session’s transaction signature requested. SessionSigner::sign_message is not called on this path.

Source

pub async fn execute_order<S, V>( &self, market_id: &str, operation: &OrderExecuteOperation, signer: &S, verifier: &V, idempotency_key: Option<&str>, ) -> Result<PlatformOrderSubmitResponse, SdkError>

Execute one resting-order operation with one signature while all private keys and signing policy remain in the caller’s signer adapter. The operation is bound and built in one step (direct prepare), the prepared bindings are checked against the request, and the mandatory verifier (see DefaultTransactionVerifier, which decodes the transaction and requires it to be exactly this operation) runs before the transaction signature is requested. SessionSigner::sign_message is not called on this path.

Source

pub async fn execute_quote<S, V>( &self, quote: &QuoteResponse, owner_wallet: &str, account_sequence: Option<u64>, signer: &S, verifier: &V, idempotency_key: Option<&str>, ) -> Result<ExecutionSubmitResponse, SdkError>

Execute one short-lived Sonar quote with one signature, without giving the SDK custody of a session private key. The quote is bound and built in one step (direct prepare), the prepared bindings are checked against the quote, and the transaction verifier (see DefaultTransactionVerifier) always runs before the session adapter is allowed to sign. SessionSigner::sign_message is not called on this path.

Trait Implementations§

Source§

impl Clone for StrataClient

Source§

fn clone(&self) -> StrataClient

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StrataClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more