pub trait PreimageRecipient<Hash>: PreimageProvider<Hash> {
    type MaxSize: Get<u32>;

    // Required methods
    fn note_preimage(bytes: BoundedVec<u8, Self::MaxSize>);
    fn unnote_preimage(hash: &Hash);
Expand description

A interface for managing preimages to hashes on chain.

Note that this API does not assume any underlying user is calling, and thus does not handle any preimage ownership or fees. Other system level logic that uses this API should implement that on their own side.

Required Associated Types§


type MaxSize: Get<u32>

Maximum size of a preimage.

Required Methods§


fn note_preimage(bytes: BoundedVec<u8, Self::MaxSize>)

Store the bytes of a preimage on chain infallible due to the bounded type.


fn unnote_preimage(hash: &Hash)

Clear a previously noted preimage. This is infallible and should be treated more like a hint - if it was not previously noted or if it is now requested, then this will not do anything.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§


impl<Hash> PreimageRecipient<Hash> for ()