mina-archive-sdk
Rust SDK for Mina Protocol's Archive Node GraphQL endpoint.
Companion to the daemon-targeting mina-sdk crate. This crate targets the separate archive endpoint defined by o1-labs/Archive-Node-API (events, actions, blocks, network state).
Install
[]
= "0.0.1"
= { = "1", = ["full"] }
Tested on Rust stable.
Quick start
use ;
async
API
Each method on ArchiveClient maps 1:1 to a GraphQL query in the Archive-Node-API schema:
| Method | Returns | Description |
|---|---|---|
get_events(input) |
Vec<EventOutput> |
Events emitted by a zkApp account. |
get_actions(input) |
Vec<ActionOutput> |
Actions dispatched from a zkApp account. |
get_network_state() |
NetworkStateOutput |
Archive's max canonical / pending block heights. |
get_blocks(opts) |
Vec<Block> |
Blocks filtered by height/date range and chain status. |
query(gql) |
builder | Arbitrary GraphQL through the same retry path. |
execute_query(gql, vars, name) |
serde_json::Value |
Low-level escape hatch returning the raw data field. |
Configuration
use Duration;
use ;
let client = with_config;
Currency
Currency wraps nanomina amounts in a u64 for safe parsing of coinbase / fee / user-command values:
use Currency;
let coinbase = from_graphql.unwrap;
assert_eq!;
let fee = from_mina.unwrap;
let total = coinbase + fee;
Errors
All fallible operations return Result<T> over the Error enum. Match on variants:
use ;
# async
Examples
ARCHIVE_GRAPHQL_URI=https://archive.example/graphql
See examples/:
events.rs— query events for an addressactions.rs— query actions for an addressblocks.rs— get the latest canonical blocks with currency parsingnetwork_state.rs— check archive sync state
Development
Integration tests are #[ignore]d by default — they require a running Archive-Node-API server. CI provisions one in .github/workflows/integration.yml. To run locally:
ARCHIVE_GRAPHQL_URI=http://localhost:8080/ \
Schema sync
schema.graphql is vendored from o1-labs/Archive-Node-API@main. The Schema Drift CI workflow compares them weekly and on PR; on drift, update both schema.graphql and src/types.rs in the same PR.
License
Apache-2.0 — see LICENSE.