pub async fn create(
        chain_id: ChainId,
        rpc_addr: net::Address,
        channel_to_handler: Sender<(ChainId, Vec<IBCEvent>)>,
    ) -> Result<Self, Box<dyn std::error::Error>> {
        let mut event_listener = event_listener::EventListener::connect(rpc_addr.clone()).await?;
        // TODO move them to config file(?)
        let event_queries = vec![
            EventSubscription::TransactionSubscription,
            EventSubscription::BlockSubscription,
        ];
        for query in event_queries.clone() {
            event_listener.subscribe(query.clone()).await?;
        }
        Ok(EventMonitor {
            chain_id,
            event_listener,
            channel_to_handler,
            node_addr: rpc_addr.clone(),
            event_queries,
        })
    }
/// Create an event monitor, connect to a node and subscribe to queries.
Create an event monitor, connect to a node and subscribe to queries.
Create an event monitor connect to a node and subscribe to queries .
pub async fn create(
        chain_id: ChainId,
        rpc_addr: net::Address,
        channel_to_handler: Sender<(ChainId, Vec<IBCEvent>)>,
    ) -> Result<Self, Box<dyn std::error::Error>> {
        let mut event_listener = event_listener::EventListener::connect(rpc_addr.clone()).await?;
        // TODO move them to config file(?)
        let event_queries = vec![
            EventSubscription::TransactionSubscription,
            EventSubscription::BlockSubscription,
        ];
        for query in event_queries.clone() {
            event_listener.subscribe(query.clone()).await?;
        }
        Ok(EventMonitor {
            chain_id,
            event_listener,
            channel_to_handler,
            node_addr: rpc_addr.clone(),
            event_queries,
        })
    }
pub async fn create ( chain_id : ChainId , rpc_addr : net :: Address , channel_to_handler : Sender < ( ChainId , Vec < IBCEvent > ) > , ) -> Result < Self , Box < dyn std :: error :: Error > > { let mut event_listener = event_listener :: EventListener :: connect ( rpc_addr . clone ( ) ) . await ? ; // TODO move them to config file(?) let event_queries = vec ! [ EventSubscription TransactionSubscription EventSubscription BlockSubscription ] ; for query in event_queries . clone ( ) { event_listener . subscribe ( query . clone ( ) ) . await ? ; } Ok ( EventMonitor { chain_id , event_listener , channel_to_handler , node_addr : rpc_addr . clone ( ) , event_queries , } ) }
Create an event monitor, connect to a node and subscribe to queries.
Create an event monitor connect to a node and subscribe to queries .
chain_id
ChainId
rpc_addr
net::Address
channel_to_handler
Sender<(ChainId, Vec<IBCEvent>)>
chain_id
ChainId
rpc_addr
net::Address
channel_to_handler
Sender<(ChainId, Vec<IBCEvent>)>