Skip to main content

quicknode_cascade/
lib.rs

1//! # quicknode-cascade
2//!
3//! Stream blockchain data at scale. Plugin-based framework powered by
4//! [QuickNode Cascade](https://cascade.quiknode.io) — an edge-cached block archive
5//! served from 300+ global PoPs with sub-50ms latency.
6//!
7//! Currently supports **Solana**. More chains coming soon.
8//!
9//! ## Two Approaches
10//!
11//! **Custom extraction** — implement [`solana::Plugin::on_slot`] and parse raw JSON yourself:
12//!
13//! ```rust,no_run
14//! use quicknode_cascade::{CascadeRunner, solana};
15//!
16//! struct MyParser;
17//! impl solana::Plugin for MyParser {
18//!     fn name(&self) -> &'static str { "my-parser" }
19//!     fn on_slot<'a>(&'a self, slot: u64, raw: &'a serde_json::Value) -> solana::PluginFuture<'a> {
20//!         Box::pin(async move {
21//!             let txs = raw.get("transactions").and_then(|v| v.as_array());
22//!             println!("slot {} — {} txs", slot, txs.map_or(0, |t| t.len()));
23//!             Ok(())
24//!         })
25//!     }
26//! }
27//! ```
28//!
29//! **Built-in extraction** — let the framework extract structured data for you:
30//!
31//! ```rust,no_run
32//! use quicknode_cascade::{CascadeRunner, solana};
33//!
34//! struct MyIndexer;
35//! impl solana::Plugin for MyIndexer {
36//!     fn name(&self) -> &'static str { "my-indexer" }
37//!     fn on_block<'a>(&'a self, block: &'a solana::BlockData) -> solana::PluginFuture<'a> {
38//!         Box::pin(async move {
39//!             println!("slot {} — {} txs", block.slot, block.transaction_count);
40//!             Ok(())
41//!         })
42//!     }
43//! }
44//! ```
45//!
46//! Both can be combined. [`solana::extract_block()`] is also available as a utility.
47
48pub mod solana;
49pub mod plugins;
50
51pub(crate) mod source;
52pub(crate) mod cursor;
53mod runner;
54
55pub use runner::CascadeRunner;