This repository contains the Rust client library for Blokli's GraphQL API and transaction endpoints.
The main entry point is BlokliClient. Query, subscription, and transaction methods are provided by traits, so import the trait for the API
family you want to use:
use blokli_client::{BlokliClient, BlokliClientConfig, BlokliQueryClient};
async fn query_version() -> Result<String, Box<dyn std::error::Error>> {
let client = BlokliClient::new(
"https://blokli.example.org".parse()?,
BlokliClientConfig::default(),
);
Ok(client.query_version().await?)
}Common public items are re-exported at the crate root:
BlokliQueryClient: one-shot GraphQL queriesBlokliSubscriptionClient: SSE-backed subscriptionsBlokliTransactionClient: signed transaction submission and tracking- selector types such as
AccountSelector,ChannelSelector,SafeSelector, andTicketSelector - response models under
blokli_client::types
Full API documentation, including advanced configuration such as timeouts, subscriptions, transactions, and DNS overrides, is available on docs.rs.
client/:blokli-clientlibrary, Cynic GraphQL types, query helpers, subscriptions, transactions, and test utilitiesinspector/: CLI helper for inspecting a running Blokli instance through the clienttests/integration/: client integration tests against a running Blokli-compatible environment
This project uses just as a command runner and Nix Flakes for the development environment.
Enter the Nix development environment:
nix developBuild the workspace:
just buildRun unit tests:
just testFormat, lint, and check compilation:
just quickRun the inspector:
just run-inspector --helpThe testing feature exposes an in-memory test client:
blokli-client = { version = "...", features = ["testing"] }BlokliTestClient implements the same query, subscription, and transaction traits as BlokliClient, backed by a BlokliTestState. Tests
can provide a BlokliTestStateMutator to model the effects of submitted signed transactions without running a Blokli service.
The client code generation schema lives at client/target-api-schema.graphql.
When the upstream Blokli API schema changes, update this file and regenerate/check the client by running:
just quickRun all non-integration tests:
just testRun a specific package:
just test-package blokli-client
just test-package blokli-inspectorRun integration tests:
BLOKLI_TEST_REMOTE_IMAGE='europe-west3-docker.pkg.dev/hoprassociation/docker-images/bloklid-anvil:latest' \
nix run .#test-integrationThe command builds a cacheable Nextest archive, pulls the self-contained bloklid-anvil image, and runs one isolated container per test
binary. The image embeds Anvil, deployed HOPR contracts, and Blokli. Replace <digest> with the immutable digest to test; explicitly
setting BLOKLI_TEST_REMOTE_IMAGE overrides the pinned default image.
client/src/api/: schema-facing GraphQL modulesclient/src/client/: public client implementationclient/src/errors.rs: client error typesclient/tests/: client unit and mock-server testsinspector/src/: inspector CLI implementationtests/integration/: integration test fixtures and test cases
just # list available commands
just fmt # format
just clippy # lint
just check # cargo check
just nextest # run unit tests with nextest
nix build . # build default Nix package
nix build .#checks.$(nix eval --impure --raw --expr builtins.currentSystem).clippy