Use StrikeClient::new() with a config, then chain builder methods:
usestrike_sdk::prelude::*;// Testnet with defaultsletclient=StrikeClient::new(StrikeConfig::bsc_testnet()).build()?;// With a wallet for tradingletclient=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:
let mut client = StrikeClient::new(StrikeConfig::bsc_testnet())
.with_private_key(&key)
.build()?;
// Initialize the shared nonce tracker
client.init_nonce_sender().await?;
let provider = client.provider(); // &DynProvider — raw alloy provider
let config = client.config(); // &StrikeConfig — addresses and URLs
let addr = client.signer_address(); // Option<Address>
let block = client.block_number().await?;
use strike_sdk::prelude::*;
match client.orders().place(market_id, ¶ms).await {
Ok(orders) => { /* success */ }
Err(StrikeError::NoWallet) => { /* no private key configured */ }
Err(StrikeError::Rpc(e)) => { /* RPC transport error */ }
Err(StrikeError::Contract(msg)) => { /* on-chain revert */ }
Err(e) => { /* other error */ }
}