substreams-cosmos

Crates.iosubstreams-cosmos
lib.rssubstreams-cosmos
version0.2.1
sourcesrc
created_at2024-09-23 02:46:44.044186
updated_at2024-10-29 20:48:03.395205
descriptionSubstreams development kit for Cosmos chains, contains Firehose Block model and helpers.
homepagehttps://github.com/pinax-network/substreams-cosmos
repositoryhttps://github.com/pinax-network/substreams-cosmos
max_upload_size
id1383480
size4,096
Denis (DenisCarriere)

documentation

README

Substreams for Cosmos

github crates.io docs.rs GitHub Workflow Status

This library contains the generated Rust protobuf bindings for Cosmos Block as well as helper methods to extract and parse block data.

📖 Documentation

https://docs.rs/substreams-cosmos

Further resources

Install

cargo add substreams-cosmos

Usage

Refer to Docs.rs for helper methods on Block that extract action and transaction iterators from the Cosmos block.

Cargo.toml

[dependencies]
substreams = "0.5"
substreams-cosmos = "0.1"

src/lib.rs

use substreams::errors::Error;
use substreams_cosmos::pb::{Block, Events};

#[substreams::handlers::map]
fn map_events(block: Block) -> Result<Events, Error> {
    let mut events = vec![];

    for tx in block.tx_results {
        for event in tx.events {
            events.push(event);
        }
    }
    Ok(Events { events })
}

Release

Commit count: 10

cargo fmt