Skip to content

Commit

Permalink
Add Debug trait implementations for all structs and enums
Browse files Browse the repository at this point in the history
- Added #[derive(Debug)] to ClientModifyRequest
- Added #[derive(Debug)] to ClientLimit, ClientTrigger, MarketOrderParams, MarketCloseParams, ClientOrder, ClientOrderRequest
- Added #[derive(Debug)] to ClientCancelRequest and ClientCancelRequestCloid
- Added #[derive(Debug)] to ExchangeClient
- Added #[derive(Debug)] to HttpClient

Fixes hyperliquid-dex#52
  • Loading branch information
devin-ai-integration[bot] committed Dec 8, 2024
1 parent ffa765a commit 6545e37
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/exchange/cancel.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use serde::{Deserialize, Serialize};
use uuid::Uuid;

#[derive(Debug)]
pub struct ClientCancelRequest {
pub asset: String,
pub oid: u64,
Expand All @@ -14,6 +15,7 @@ pub struct CancelRequest {
pub oid: u64,
}

#[derive(Debug)]
pub struct ClientCancelRequestCloid {
pub asset: String,
pub cloid: Uuid,
Expand Down
1 change: 1 addition & 0 deletions src/exchange/exchange_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use super::cancel::ClientCancelRequestCloid;
use super::order::{MarketCloseParams, MarketOrderParams};
use super::{ClientLimit, ClientOrder};

#[derive(Debug)]
pub struct ExchangeClient {
pub http_client: HttpClient,
pub wallet: LocalWallet,
Expand Down
1 change: 1 addition & 0 deletions src/exchange/modify.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use super::{order::OrderRequest, ClientOrderRequest};
use serde::{Deserialize, Serialize};

#[derive(Debug)]
pub struct ClientModifyRequest {
pub oid: u64,
pub order: ClientOrderRequest,
Expand Down
7 changes: 7 additions & 0 deletions src/exchange/order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,19 @@ pub struct OrderRequest {
pub cloid: Option<String>,
}

#[derive(Debug)]
pub struct ClientLimit {
pub tif: String,
}

#[derive(Debug)]
pub struct ClientTrigger {
pub is_market: bool,
pub trigger_px: f64,
pub tpsl: String,
}

#[derive(Debug)]
pub struct MarketOrderParams<'a> {
pub asset: &'a str,
pub is_buy: bool,
Expand All @@ -67,6 +70,7 @@ pub struct MarketOrderParams<'a> {
pub wallet: Option<&'a LocalWallet>,
}

#[derive(Debug)]
pub struct MarketCloseParams<'a> {
pub asset: &'a str,
pub sz: Option<f64>,
Expand All @@ -76,10 +80,13 @@ pub struct MarketCloseParams<'a> {
pub wallet: Option<&'a LocalWallet>,
}

#[derive(Debug)]
pub enum ClientOrder {
Limit(ClientLimit),
Trigger(ClientTrigger),
}

#[derive(Debug)]
pub struct ClientOrderRequest {
pub asset: String,
pub is_buy: bool,
Expand Down
1 change: 1 addition & 0 deletions src/req.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ struct ErrorData {
msg: String,
}

#[derive(Debug)]
pub struct HttpClient {
pub client: Client,
pub base_url: String,
Expand Down

0 comments on commit 6545e37

Please sign in to comment.