JS encode:
const registry = new TypeRegistry();
const someNameInstance = registry.createType('{"current_fraction":"u32"}', { current_fraction: 123 });
const encoded = someNameInstance.toU8a();
console.log('Encoded:', encoded);
// Encoded: Uint8Array(4) [ 123, 0, 0, 0 ]
Rust decode:
#[derive(Debug, Decode)]
pub struct SomeName {
pub current_fraction: u32,
}
println!("{:?}", SomeName::decode(&mut [123, 0, 0, 0].as_slice()));
// Ok(SomeName { current_fraction: 123 })