mirror of
https://github.com/floor-licker/polyfill-rs.git
synced 2026-08-23 17:38:06 +00:00
fix: struct decimal field annotations
This commit is contained in:
+11
-11
@@ -1809,20 +1809,20 @@ mod tests {
|
|||||||
async fn test_get_sampling_markets_success() {
|
async fn test_get_sampling_markets_success() {
|
||||||
let mut server = Server::new_async().await;
|
let mut server = Server::new_async().await;
|
||||||
let mock_response = r#"{
|
let mock_response = r#"{
|
||||||
"limit": "10",
|
"limit": 10,
|
||||||
"count": "2",
|
"count": 2,
|
||||||
"next_cursor": null,
|
"next_cursor": null,
|
||||||
"data": [
|
"data": [
|
||||||
{
|
{
|
||||||
"condition_id": "0x123",
|
"condition_id": "0x123",
|
||||||
"tokens": [
|
"tokens": [
|
||||||
{"token_id": "0x456", "outcome": "Yes"},
|
{"token_id": "0x456", "outcome": "Yes", "price": 0.5, "winner": false},
|
||||||
{"token_id": "0x789", "outcome": "No"}
|
{"token_id": "0x789", "outcome": "No", "price": 0.5, "winner": false}
|
||||||
],
|
],
|
||||||
"rewards": {
|
"rewards": {
|
||||||
"rates": null,
|
"rates": null,
|
||||||
"min_size": "1.0",
|
"min_size": 1.0,
|
||||||
"max_spread": "0.1",
|
"max_spread": 0.1,
|
||||||
"event_start_date": null,
|
"event_start_date": null,
|
||||||
"event_end_date": null,
|
"event_end_date": null,
|
||||||
"in_game_multiplier": null,
|
"in_game_multiplier": null,
|
||||||
@@ -1833,15 +1833,15 @@ mod tests {
|
|||||||
"active": true,
|
"active": true,
|
||||||
"closed": false,
|
"closed": false,
|
||||||
"question_id": "0x123",
|
"question_id": "0x123",
|
||||||
"minimum_order_size": "1.0",
|
"minimum_order_size": 1.0,
|
||||||
"minimum_tick_size": "0.01",
|
"minimum_tick_size": 0.01,
|
||||||
"description": "Test market",
|
"description": "Test market",
|
||||||
"category": "test",
|
"category": "test",
|
||||||
"end_date_iso": null,
|
"end_date_iso": null,
|
||||||
"game_start_time": null,
|
"game_start_time": null,
|
||||||
"question": "Will this test pass?",
|
"question": "Will this test pass?",
|
||||||
"market_slug": "test-market",
|
"market_slug": "test-market",
|
||||||
"seconds_delay": "0",
|
"seconds_delay": 0,
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"fpmm": ""
|
"fpmm": ""
|
||||||
}
|
}
|
||||||
@@ -1871,8 +1871,8 @@ mod tests {
|
|||||||
async fn test_get_sampling_markets_with_cursor() {
|
async fn test_get_sampling_markets_with_cursor() {
|
||||||
let mut server = Server::new_async().await;
|
let mut server = Server::new_async().await;
|
||||||
let mock_response = r#"{
|
let mock_response = r#"{
|
||||||
"limit": "5",
|
"limit": 5,
|
||||||
"count": "0",
|
"count": 0,
|
||||||
"next_cursor": null,
|
"next_cursor": null,
|
||||||
"data": []
|
"data": []
|
||||||
}"#;
|
}"#;
|
||||||
|
|||||||
+6
-14
@@ -575,9 +575,7 @@ pub struct Market {
|
|||||||
pub active: bool,
|
pub active: bool,
|
||||||
pub closed: bool,
|
pub closed: bool,
|
||||||
pub question_id: String,
|
pub question_id: String,
|
||||||
#[serde(with = "rust_decimal::serde::str")]
|
|
||||||
pub minimum_order_size: Decimal,
|
pub minimum_order_size: Decimal,
|
||||||
#[serde(with = "rust_decimal::serde::str")]
|
|
||||||
pub minimum_tick_size: Decimal,
|
pub minimum_tick_size: Decimal,
|
||||||
pub description: String,
|
pub description: String,
|
||||||
pub category: Option<String>,
|
pub category: Option<String>,
|
||||||
@@ -585,7 +583,6 @@ pub struct Market {
|
|||||||
pub game_start_time: Option<String>,
|
pub game_start_time: Option<String>,
|
||||||
pub question: String,
|
pub question: String,
|
||||||
pub market_slug: String,
|
pub market_slug: String,
|
||||||
#[serde(with = "rust_decimal::serde::str")]
|
|
||||||
pub seconds_delay: Decimal,
|
pub seconds_delay: Decimal,
|
||||||
pub icon: String,
|
pub icon: String,
|
||||||
pub fpmm: String,
|
pub fpmm: String,
|
||||||
@@ -598,9 +595,9 @@ pub struct Market {
|
|||||||
pub accepting_orders: bool,
|
pub accepting_orders: bool,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub accepting_order_timestamp: Option<String>,
|
pub accepting_order_timestamp: Option<String>,
|
||||||
#[serde(with = "rust_decimal::serde::str", default)]
|
#[serde(default)]
|
||||||
pub maker_base_fee: Decimal,
|
pub maker_base_fee: Decimal,
|
||||||
#[serde(with = "rust_decimal::serde::str", default)]
|
#[serde(default)]
|
||||||
pub taker_base_fee: Decimal,
|
pub taker_base_fee: Decimal,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub notifications_enabled: bool,
|
pub notifications_enabled: bool,
|
||||||
@@ -621,7 +618,6 @@ pub struct Market {
|
|||||||
pub struct Token {
|
pub struct Token {
|
||||||
pub token_id: String,
|
pub token_id: String,
|
||||||
pub outcome: String,
|
pub outcome: String,
|
||||||
#[serde(with = "rust_decimal::serde::str", default)]
|
|
||||||
pub price: Decimal,
|
pub price: Decimal,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub winner: bool,
|
pub winner: bool,
|
||||||
@@ -1032,20 +1028,16 @@ pub struct OrderSummary {
|
|||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct MarketsResponse {
|
pub struct MarketsResponse {
|
||||||
#[serde(with = "rust_decimal::serde::str")]
|
pub limit: usize,
|
||||||
pub limit: Decimal,
|
pub count: usize,
|
||||||
#[serde(with = "rust_decimal::serde::str")]
|
|
||||||
pub count: Decimal,
|
|
||||||
pub next_cursor: Option<String>,
|
pub next_cursor: Option<String>,
|
||||||
pub data: Vec<Market>,
|
pub data: Vec<Market>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct SimplifiedMarketsResponse {
|
pub struct SimplifiedMarketsResponse {
|
||||||
#[serde(with = "rust_decimal::serde::str")]
|
pub limit: usize,
|
||||||
pub limit: Decimal,
|
pub count: usize,
|
||||||
#[serde(with = "rust_decimal::serde::str")]
|
|
||||||
pub count: Decimal,
|
|
||||||
pub next_cursor: Option<String>,
|
pub next_cursor: Option<String>,
|
||||||
pub data: Vec<SimplifiedMarket>,
|
pub data: Vec<SimplifiedMarket>,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user