pub trait Payload {
type ReturnType: DecodeWithMetadata;
// Required methods
fn query_id(&self) -> &[u8; 32];
fn encode_args_to(
&self,
metadata: &Metadata,
out: &mut Vec<u8>,
) -> Result<(), Error>;
// Provided methods
fn encode_args(&self, metadata: &Metadata) -> Result<Vec<u8>, Error> { ... }
fn validation_hash(&self) -> Option<[u8; 32]> { ... }
}Expand description
This represents a View Function payload that can call into the runtime of node.
§Components
- associated return type
Resulting bytes of the call are interpreted into this type.
- query ID
The ID used to identify in the runtime which view function to call.
- encoded arguments
Each argument of the View Function must be scale-encoded.
Required Associated Types§
Sourcetype ReturnType: DecodeWithMetadata
type ReturnType: DecodeWithMetadata
The return type of the function call.
Required Methods§
Provided Methods§
Sourcefn encode_args(&self, metadata: &Metadata) -> Result<Vec<u8>, Error>
fn encode_args(&self, metadata: &Metadata) -> Result<Vec<u8>, Error>
Encode arguments data and return the output. This is a convenience
wrapper around Payload::encode_args_to.
Sourcefn validation_hash(&self) -> Option<[u8; 32]>
fn validation_hash(&self) -> Option<[u8; 32]>
Returns the statically generated validation hash.