gadget_common/module/
network.rs1use crate::environments::GadgetEnvironment;
2use crate::Error;
3use async_trait::async_trait;
4use sp_core::ecdsa;
5
6#[async_trait]
7pub trait Network<Env: GadgetEnvironment>: Send + Sync + Clone + 'static {
8 async fn next_message(&self) -> Option<Env::ProtocolMessage>;
9 async fn send_message(&self, message: Env::ProtocolMessage) -> Result<(), Error>;
10
11 fn greatest_authority_id(&self) -> Option<ecdsa::Public> {
13 None
14 }
15 async fn run(self) -> Result<(), Error> {
18 Ok(())
19 }
20}