-
Hey folks, what is the idiomatic way to decode a particular extrinsic out of Currently I have a few nested data structures with indexes matching those generated by proc macros and strategic offset of 3 bytes from the beginning of Maybe I could add some method to runtime API that will be able to take |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
The most straightforward way is to deserialize as an UncheckedExtrinsic that you've configured for your runtime. For example, you could add a
Once you have an UncheckedExtrinsic, you can then match on the function to figure out which pallet call it was or inspect the signature to find the public key of the signer etc... |
Beta Was this translation helpful? Give feedback.
-
Decoding an extrinsic from the client is a bad idea, because there could be a runtime upgrade and then you are not being able to decode the extrinsic anymore. The better solution is to use a runtime api to call into the runtime to decode the extrinsic you are interested in and return fixed types. |
Beta Was this translation helpful? Give feedback.
The most straightforward way is to deserialize as an UncheckedExtrinsic that you've configured for your runtime. For example, you could add a
deserialize_opaque_extrinsic
fn to your mainruntime/lib.rs
.