Skip to content

Commit

Permalink
fix(mev_blocks): serialize from string
Browse files Browse the repository at this point in the history
  • Loading branch information
alextes committed Dec 3, 2024
1 parent 19c6bd8 commit e9cf1f3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/mev_blocks/relay_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use async_trait::async_trait;
use mockall::{automock, predicate::*};
use serde::Deserialize;

use crate::json_codecs::i32_from_string;
use crate::units::WeiNewtype;

use super::MevBlock;
Expand All @@ -14,7 +15,9 @@ pub const EARLIEST_AVAILABLE_SLOT: i32 = 5616303;
// These are accepted blocks only.
#[derive(Deserialize)]
pub struct MaybeMevBlock {
#[serde(deserialize_with = "i32_from_string")]
slot: i32,
#[serde(deserialize_with = "i32_from_string")]
block_number: i32,
block_hash: String,
#[serde(rename = "value")]
Expand Down Expand Up @@ -123,8 +126,8 @@ mod tests {
.with_status(200)
.with_body(
json!([{
"slot": 0,
"block_number": 9191911,
"slot": "0",
"block_number": "9191911",
"block_hash": "abc",
"value": "100"
}])
Expand Down

0 comments on commit e9cf1f3

Please sign in to comment.