Expand description
High-level signing client for the Real Markets matching engine.
This module provides the SigningClient struct, which is a convenience wrapper
around the low-level Client that automatically handles transaction signing and
provides simplified methods for common operations like submitting and canceling orders.
The signing client manages cryptographic operations transparently, automatically generating nonces, signing transactions, and handling the submission workflow.
§Key Features
- Automatic Signing: All transactions are signed automatically using the configured signer
- Simplified API: High-level methods for common operations (submit/cancel orders)
- Network Presets: Built-in configurations for testnet and mainnet
- Batch Operations: Support for submitting multiple commands in a single transaction
- Nonce Management: Automatic nonce generation using system time
§Network Configuration
- Testnet:
SigningClient::new_testnetfor testing and development - Mainnet:
SigningClient::new_mainnetfor production trading - Custom:
SigningClient::newfor custom network configurations - Discovered:
SigningClient::builderwith nochain_id, to read it from the endpoint itself
§Examples
§Basic Usage
use sdk::{SigningClient, crypto::Signer, types::SubmitOrderRequest};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// a private key in IOTA bech32 form (`iotaprivkey1…`), not hex
let signer: Signer =
"iotaprivkey1qrsd2u9ztqr6z2y78sp2ch8kcyak9cx3ezphkpp4acqaqruajxr6qye2645".into();
// Create a testnet client
let client = SigningClient::new_testnet(signer)?;
// `market` and `account` are `0x`-prefixed on-chain object ids
let order = SubmitOrderRequest::builder()
.market("0x5efc5ad00c209baf4c5d77dfd1be18e8b50916e53adbe2142ae1b47af445303c")
.account("0xcc6ebf909253ea35314bb28d91321f6415827c01790fba84aaf570c87372850a")
.buy()
.limit_order("50000.00")
.quantity("0.1")
.good_till_cancel()
.build()?;
let report = client.submit_order(order, None).await?;
println!("Order submitted: {:?}", report);
Ok(())
}Structs§
- Signing
Client - High-level client that automatically handles transaction signing.
- Signing
Client Builder - Builds a
SigningClientwhose chain id is optional.