Skip to content

Commit

Permalink
deserialize without decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
tadeohepperle committed Jul 10, 2023
1 parent b32bc2d commit ebd7360
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions subxt/src/rpc/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,8 @@ pub type ConsensusEngineId = [u8; 4];
pub type EncodedJustification = Vec<u8>;

/// Bytes representing an extrinsic in a [`ChainBlock`].
#[derive(Clone, Debug)]
pub struct ChainBlockExtrinsic(pub Vec<u8>);

impl<'a> ::serde::Deserialize<'a> for ChainBlockExtrinsic {
fn deserialize<D>(de: D) -> Result<Self, D::Error>
where
D: ::serde::Deserializer<'a>,
{
let r = impl_serde::serialize::deserialize(de)?;
let bytes = Decode::decode(&mut &r[..])
.map_err(|e| ::serde::de::Error::custom(format!("Decode error: {e}")))?;
Ok(ChainBlockExtrinsic(bytes))
}
}
#[derive(Clone, Debug, Deserialize)]
pub struct ChainBlockExtrinsic(#[serde(with = "impl_serde::serialize")] pub Vec<u8>);

/// Wrapper for NumberOrHex to allow custom From impls
#[derive(Serialize)]
Expand Down

0 comments on commit ebd7360

Please sign in to comment.