5 releases (breaking)

0.5.0 Dec 1, 2021
0.4.0 Nov 30, 2021
0.3.0 Nov 30, 2021
0.2.0 Nov 28, 2021
0.1.0 Nov 28, 2021

#12 in #terra

GPL-3.0-or-later

18KB
412 lines

twelvepool

Watch for new txs in a Terra node mempool.

Example

use twelvepool::Watcher;

#[tokio::main]
async fn main() {
    let mut receiver = Watcher::new(
        String::from("http://localhost:26657"),  // RPC address
        String::from("http://localhost:1317"),   // LCD address
        None,                                    // Optional reqwest client
        None,                                    // Optional interval duration (default to 100ms)
    )
    .run();

    loop {
        if let Some(mempool_item) = receiver.recv().await {
            if mempool_item.tx.memo == "my memo" {
                println!("tx with our memo found (tx hash {})", mempool_item.tx_hash);
            }
        }
    }
}

Dependencies

~7–21MB
~300K SLoC