Commit 65ec5ec1 authored by Hero Bird's avatar Hero Bird

[pdsl_model] Add CallData constructor from types implementing Message

parent 4f3154cb
......@@ -67,6 +67,26 @@ impl CallData {
pub fn params(&self) -> &[u8] {
/// Creates a proper call data from a message and its required input.
/// # Note
/// This should normally only be needed in test code if a user
/// wants to test the handling of a specific message.
pub fn from_msg<Msg>(args: <Msg as Message>::Input) -> Self
Msg: Message,
<Msg as Message>::Input: parity_codec::Encode,
use parity_codec::Encode;
Self {
selector: <Msg as Message>::ID,
// TODO: For performance reasons we maybe don't want to encode this
// and we should maybe allow storing arguments directly somehow.
raw_params: args.encode(),
/// A hash to identify a called function.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment