Crates.io | substreams-cosmos-core |
lib.rs | substreams-cosmos-core |
version | 0.2.1 |
source | src |
created_at | 2024-09-23 02:46:29.023618 |
updated_at | 2024-10-29 20:47:45.328021 |
description | Substreams development kit for Cosmos chains, contains Firehose Block model and helpers. |
homepage | https://github.com/pinax-network/substreams-cosmos |
repository | https://github.com/pinax-network/substreams-cosmos |
max_upload_size | |
id | 1383479 |
size | 17,530 |
Substreams
for CosmosThis library contains the generated Rust protobuf bindings for Cosmos Block as well as helper methods to extract and parse block data.
cargo add substreams-cosmos
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 })
}
Make
if there were changes in protobufsCargo.toml
core
, substreams-cosmos
.