Skip to content
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
add unit tests for handling general transaction
  • Loading branch information
clangenb committed Sep 11, 2025
commit 23907d58305d8f0baee869c84a71713bcd471eb7
24 changes: 24 additions & 0 deletions app-libs/parentchain-interface/src/extrinsic_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,30 @@ mod tests {
assert_eq!(parsed.call_index, [1, 2]);
}

#[test]
fn can_parse_v5_general_transaction() {
use substrate_api_client::ac_primitives::extrinsics::UncheckedExtrinsic as XTV5;

let (_, extension, _) = get_default_signer_data();

let ex_v5: XTV5<Address, _, ParentchainSignature, ParentchainTxExtension> =
XTV5::new_transaction([1u8, 2u8, 0, 0, 0], extension.clone());

let encoded = ex_v5.encode();

let parsed = ExtrinsicParser::<ParentchainTxExtension>::parse(&encoded).unwrap();

match &parsed.preamble {
Preamble::General(extension_version, ext) => {
assert_eq!(extension_version, &0);
assert_eq!(ext, &extension);
},
other => panic!("unexpected preamble: {:?}", other),
};

assert_eq!(parsed.call_index, [1, 2]);
}

#[test]
fn opaque_extrinsic_works() {
use substrate_api_client::ac_primitives::extrinsics::UncheckedExtrinsic as XTV5;
Expand Down