mirror of
https://github.com/floor-licker/polyfill-rs.git
synced 2026-08-06 17:27:45 +00:00
feat: Add missing API methods
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user