Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime API: Substitute UncheckedExtrinsic with custom encoding #1076

Merged
merged 20 commits into from
Jul 21, 2023
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion subxt/src/utils/unchecked_extrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use scale_decode::{visitor::DecodeAsTypeResult, DecodeAsType, IntoVisitor, Visit
use super::{Encoded, Static};

/// The unchecked extrinsic from substrate.
#[derive(Clone, Debug, Eq, PartialEq, Decode, Encode)]
#[derive(Clone, Debug, Eq, PartialEq, Encode)]
pub struct UncheckedExtrinsic<Address, Call, Signature, Extra>(
Static<Encoded>,
#[codec(skip)] PhantomData<(Address, Call, Signature, Extra)>,
Expand All @@ -35,6 +35,15 @@ impl<Address, Call, Signature, Extra> UncheckedExtrinsic<Address, Call, Signatur
}
}

impl<Address, Call, Signature, Extra> Decode
for UncheckedExtrinsic<Address, Call, Signature, Extra>
{
fn decode<I: codec::Input>(input: &mut I) -> Result<Self, codec::Error> {
let xt_vec: Vec<u8> = Decode::decode(input)?;
lexnv marked this conversation as resolved.
Show resolved Hide resolved
Ok(UncheckedExtrinsic::new(xt_vec))
}
}

impl<Address, Call, Signature, Extra> scale_encode::EncodeAsType
for UncheckedExtrinsic<Address, Call, Signature, Extra>
{
Expand Down