Adding Serde Deserialisation to UncheckExtrinsics (#4793)

* Adding Serde:Deserialise to UncheckExtrinsics

to be able to use the ChainApi RPC from the client side

* Update primitives/runtime/src/generic/unchecked_extrinsic.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Benjamin Kampmann
2020-01-31 20:01:32 +01:00
committed by GitHub
parent 2f9315cc02
commit 111207afe8
@@ -274,6 +274,19 @@ impl<Address: Encode, Signature: Encode, Call: Encode, Extra: SignedExtension> s
}
}
#[cfg(feature = "std")]
impl<'a, Address: Decode, Signature: Decode, Call: Decode, Extra: SignedExtension> serde::Deserialize<'a>
for UncheckedExtrinsic<Address, Call, Signature, Extra>
{
fn deserialize<D>(de: D) -> Result<Self, D::Error> where
D: serde::Deserializer<'a>,
{
let r = sp_core::bytes::deserialize(de)?;
Decode::decode(&mut &r[..])
.map_err(|e| serde::de::Error::custom(format!("Decode error: {}", e)))
}
}
impl<Address, Call, Signature, Extra> fmt::Debug
for UncheckedExtrinsic<Address, Call, Signature, Extra>
where