feat: Add missing API methods

This commit is contained in:
floor-licker
2025-11-04 18:55:20 -05:00
parent bd1c3f27f1
commit 1d2234c896
2 changed files with 21 additions and 0 deletions
+17
View File
@@ -92,6 +92,23 @@ impl ClobClient {
}
}
/// Create a client with L2 headers (for API key authentication)
pub fn with_l2_headers(host: &str, private_key: &str, chain_id: u64, api_creds: ApiCreds) -> Self {
let signer = private_key.parse::<PrivateKeySigner>()
.expect("Invalid private key");
let order_builder = crate::orders::OrderBuilder::new(signer.clone(), None, None);
Self {
http_client: Client::new(),
base_url: host.to_string(),
chain_id,
signer: Some(signer),
api_creds: Some(api_creds),
order_builder: Some(order_builder),
}
}
/// Set API credentials
pub fn set_api_creds(&mut self, api_creds: ApiCreds) {
self.api_creds = Some(api_creds);
+4
View File
@@ -98,6 +98,10 @@ pub use crate::types::{
NotificationParams, OpenOrder, OpenOrderParams, Order, OrderBook, OrderDelta,
OrderRequest, OrderStatus, OrderType, Side, StreamMessage, TokenPrice, TradeParams,
WssAuth, WssSubscription, WssChannelType,
// Additional compatibility types
ApiKeysResponse, MidpointResponse, PriceResponse, SpreadResponse, TickSizeResponse,
NegRiskResponse, BookParams, MarketsResponse, SimplifiedMarketsResponse, Market,
SimplifiedMarket, Token, Rewards, ClientResult,
};
// Re-export client