I'm using Bounded trait from preimages frame that allows to store dispatchable calls, e.g. similar to the one that is used in pallet-democracy:
pub type CallOf<T> = <T as frame_system::Config>::RuntimeCall;
pub type BoundedCallOf<T> = Bounded<CallOf<T>>;
See the source code for reference: https://github.com/paritytech/substrate/blob/2dbf62591fd35725c6e39f8ddfd27c3695dab594/frame/democracy/src/lib.rs#L206
There is a possibility to decode it via preimages peek function on the backend side:
fn peek<T: Decode>(bounded: &Bounded<T>) -> Result<(T, Option<u32>), DispatchError>
and retrieve dispatch data.
However when I receive data via storage view call on the client side, the response looks like this:
Inline: “0x30000000000090b5ab205c6974c9ea841be688864633dc9ca8a357843eeacf2314649965fe22"
So the question is - is there a possibility to decode the dispatchable data? I'm not able to pre-process storage view functions unwrapping the encoded bounded data.
I've tried to use parity scale codec TS implementation: https://github.com/paritytech/scale-ts but the examples described there are not clear.
Any help is appreciated.
Thanks in advance!
peek
function already decodes it for you. And what arestorage view call on the client side
? Means that the value will not be in the preimages storage, but directly stored in theBounded
.