-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Something that I find I would like to do often is bundle multiple types of messages together inside a vec and send them off. May want to send a wasm store_code, instantiate, then execute for example. It would be even better if this was inside the same tx. This could be achieved with a trait that look like this:
pub trait Request {
fn to_any(&self, sender_addr: Address) -> DeployResult<Any>;
}
impl<S> Request for ExecRequest<S>
where
S: Serialize + Clone + 'static,
{
fn to_any(&self, sender_addr: Address) -> DeployResult<Any> {
let proto = self.clone().to_proto(sender_addr)?;
let any = proto.to_any()?;
Ok(any)
}
}
impl<S> Request for StoreCodeRequest<S> {
...
}Then one could simply pass a vec of these Request objects to an execute function that takes in a Vec<&dyn Request>
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels