We can access the bytes in each block with eg api.blocks().at(hash).await?.body().await?.extrinsics(). This returns an iterator over each extrinsic in the block. From this you can call extrinsic.bytes() to get the bytes for the extrinsic.
Extrinsic bytes consist of a signature and such, and then additional details, and then the call data.
It'd be nice if we could expand this Extrinsic interface to include functions similar to EventDetails. This is one idea:
// get bytes representing the fields (call data)
ext.field_bytes()
// indexes, like events
ext.pallet_index()
ext.variant_index()
// maybe these too from EventDetails?
// decode into a specific call data entry
ext.as_call()
// decode into a specific pallet Call enum (can decode to Value)
ext.as_pallet_call()
// decode into a top level generated calls enum.
ext.as_root_call()
We could also (possibly later) extend with methods to access the signature part of the extrinsic.
This would only work for blocks that we can decode with the currently supported metadata version etc.
We can access the bytes in each block with eg
api.blocks().at(hash).await?.body().await?.extrinsics(). This returns an iterator over each extrinsic in the block. From this you can callextrinsic.bytes()to get the bytes for the extrinsic.Extrinsic bytes consist of a signature and such, and then additional details, and then the call data.
It'd be nice if we could expand this
Extrinsicinterface to include functions similar toEventDetails. This is one idea:We could also (possibly later) extend with methods to access the signature part of the extrinsic.
This would only work for blocks that we can decode with the currently supported metadata version etc.