Skip to content

Commit

Permalink
replace expiration_time i64 type with Int64
Browse files Browse the repository at this point in the history
  • Loading branch information
sotnikov-s committed Dec 5, 2023
1 parent 558dcbe commit f3b1800
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/neutron-sdk/src/stargate/types_dex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ pub struct LimitOrderTranche {
pub total_maker_denom: Int128,
pub total_taker_denom: Int128,
#[serde(deserialize_with = "deserialize_expiration_time")]
pub expiration_time: Option<i64>,
pub expiration_time: Option<Int64>,
/// a decimal with precision equal to 26
pub price_taker_to_maker: String,
}
Expand Down Expand Up @@ -771,7 +771,7 @@ fn convert_page_request(page_request: Option<PageRequest>) -> Option<PageRequest
/// it returns 0, because the timestamp for this value is invalid (-62135596800);
/// - in the rest of the cases, it assumes it's a valid RFC 3339 formatted date time and tries to
/// parse it and returns a unix timestamp.
fn deserialize_expiration_time<'de, D>(deserializer: D) -> Result<Option<i64>, D::Error>
fn deserialize_expiration_time<'de, D>(deserializer: D) -> Result<Option<Int64>, D::Error>
where
D: Deserializer<'de>,
{
Expand All @@ -782,7 +782,9 @@ where
None => Ok(None),

Some(date_time_str) => match date_time_str {
JIT_LIMIT_ORDER_TYPE_EXP_DATE_TIME => Ok(Some(JIT_LIMIT_ORDER_TYPE_EXP_TIMESTAMP)),
JIT_LIMIT_ORDER_TYPE_EXP_DATE_TIME => {
Ok(Some(JIT_LIMIT_ORDER_TYPE_EXP_TIMESTAMP.into()))
}

// some RFC 3339 formatted date time to be parsed to a unix timestamp
_ => Ok(Some(
Expand All @@ -793,7 +795,8 @@ where
&"an RFC 3339 formatted date time",
)
})?
.timestamp(),
.timestamp()
.into(),
)),
},
}
Expand Down

0 comments on commit f3b1800

Please sign in to comment.