From 8a90c2e57fd585e3af352043ae25d8010bf26083 Mon Sep 17 00:00:00 2001 From: floor-licker Date: Thu, 1 Jan 2026 15:04:32 -0500 Subject: [PATCH] fix: struct decimal field annotations --- src/client.rs | 22 +++++++++++----------- src/types.rs | 20 ++++++-------------- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/src/client.rs b/src/client.rs index 2710059..daaf4b1 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1809,20 +1809,20 @@ mod tests { async fn test_get_sampling_markets_success() { let mut server = Server::new_async().await; let mock_response = r#"{ - "limit": "10", - "count": "2", + "limit": 10, + "count": 2, "next_cursor": null, "data": [ { "condition_id": "0x123", "tokens": [ - {"token_id": "0x456", "outcome": "Yes"}, - {"token_id": "0x789", "outcome": "No"} + {"token_id": "0x456", "outcome": "Yes", "price": 0.5, "winner": false}, + {"token_id": "0x789", "outcome": "No", "price": 0.5, "winner": false} ], "rewards": { "rates": null, - "min_size": "1.0", - "max_spread": "0.1", + "min_size": 1.0, + "max_spread": 0.1, "event_start_date": null, "event_end_date": null, "in_game_multiplier": null, @@ -1833,15 +1833,15 @@ mod tests { "active": true, "closed": false, "question_id": "0x123", - "minimum_order_size": "1.0", - "minimum_tick_size": "0.01", + "minimum_order_size": 1.0, + "minimum_tick_size": 0.01, "description": "Test market", "category": "test", "end_date_iso": null, "game_start_time": null, "question": "Will this test pass?", "market_slug": "test-market", - "seconds_delay": "0", + "seconds_delay": 0, "icon": "", "fpmm": "" } @@ -1871,8 +1871,8 @@ mod tests { async fn test_get_sampling_markets_with_cursor() { let mut server = Server::new_async().await; let mock_response = r#"{ - "limit": "5", - "count": "0", + "limit": 5, + "count": 0, "next_cursor": null, "data": [] }"#; diff --git a/src/types.rs b/src/types.rs index ffa5fa0..7143ac0 100644 --- a/src/types.rs +++ b/src/types.rs @@ -575,9 +575,7 @@ pub struct Market { pub active: bool, pub closed: bool, pub question_id: String, - #[serde(with = "rust_decimal::serde::str")] pub minimum_order_size: Decimal, - #[serde(with = "rust_decimal::serde::str")] pub minimum_tick_size: Decimal, pub description: String, pub category: Option, @@ -585,7 +583,6 @@ pub struct Market { pub game_start_time: Option, pub question: String, pub market_slug: String, - #[serde(with = "rust_decimal::serde::str")] pub seconds_delay: Decimal, pub icon: String, pub fpmm: String, @@ -598,9 +595,9 @@ pub struct Market { pub accepting_orders: bool, #[serde(default)] pub accepting_order_timestamp: Option, - #[serde(with = "rust_decimal::serde::str", default)] + #[serde(default)] pub maker_base_fee: Decimal, - #[serde(with = "rust_decimal::serde::str", default)] + #[serde(default)] pub taker_base_fee: Decimal, #[serde(default)] pub notifications_enabled: bool, @@ -621,7 +618,6 @@ pub struct Market { pub struct Token { pub token_id: String, pub outcome: String, - #[serde(with = "rust_decimal::serde::str", default)] pub price: Decimal, #[serde(default)] pub winner: bool, @@ -1032,20 +1028,16 @@ pub struct OrderSummary { #[derive(Debug, Serialize, Deserialize)] pub struct MarketsResponse { - #[serde(with = "rust_decimal::serde::str")] - pub limit: Decimal, - #[serde(with = "rust_decimal::serde::str")] - pub count: Decimal, + pub limit: usize, + pub count: usize, pub next_cursor: Option, pub data: Vec, } #[derive(Debug, Serialize, Deserialize)] pub struct SimplifiedMarketsResponse { - #[serde(with = "rust_decimal::serde::str")] - pub limit: Decimal, - #[serde(with = "rust_decimal::serde::str")] - pub count: Decimal, + pub limit: usize, + pub count: usize, pub next_cursor: Option, pub data: Vec, }