Client Configuration

Creating a Client

Use StrikeClient::new() with a config, then chain builder methods:

use strike_sdk::prelude::*;

// Testnet with defaults
let client = StrikeClient::new(StrikeConfig::bsc_testnet()).build()?;

// With a wallet for trading
let client = StrikeClient::new(StrikeConfig::bsc_testnet())
    .with_private_key("0x...")
    .build()?;

Preset Configs

Method
Chain ID
Description

StrikeConfig::bsc_testnet()

97

BSC testnet with default RPC, WSS, and indexer URLs

StrikeConfig::custom(addresses, chain_id)

any

Custom deployment

Each preset includes default RPC, WSS, and indexer endpoints. Override any of them with builder methods.

Builder Methods

All builder methods are optional. A client built without with_private_key() is read-only — it can query markets, stream events, and read balances, but cannot send transactions.

Read-Only vs Trading Mode

Capability
Read-only
With wallet

Fetch markets, orderbook

Yes

Yes

Stream events

Yes

Yes

Read balances

Yes

Yes

Place/cancel orders

No

Yes

Approve USDT

No

Yes

Redeem tokens

No

Yes

Calling a write method without a wallet returns StrikeError::NoWallet.

Nonce Manager

For bots that send transactions in rapid succession, enable the nonce manager to avoid nonce-too-low errors:

The NonceSender fetches the current nonce from the chain at init, then tracks it locally. It auto-recovers on nonce errors by re-syncing with the chain and retrying. Enabled by the nonce-manager feature flag (on by default).

You generally don't need this for simple scripts — it's designed for bots that place and cancel orders in tight loops.

Accessing Internals

For advanced usage, you can access the underlying provider and config:

Sub-Clients

The StrikeClient exposes domain-specific sub-clients:

Method
Returns
Description

client.orders()

OrdersClient

client.vault()

VaultClient

client.tokens()

TokensClient

client.markets()

MarketsClient

On-chain market state reads

client.redeem()

RedeemClient

client.events()

EventStream

client.indexer()

IndexerClient

Error Handling

All SDK methods return strike_sdk::Result<T>, which is std::result::Result<T, StrikeError>.

StrikeError variants:

Variant
Cause

Rpc

Transport-level RPC failure

Contract

On-chain revert or ABI decoding error

NonceMismatch

Local nonce diverged from chain

MarketNotActive

Market ID is not active

InsufficientBalance

Not enough USDT or tokens

NoWallet

Write operation attempted without a private key

WebSocket

WSS connection error

Indexer

Indexer HTTP error

Config

Invalid configuration

Other

Catch-all via eyre::Report

Last updated