Rust + WASM gRPC-Web client for Sentrix Chain. Compiles to WASM via wasm-pack and is consumable from any browser dApp that wants typed gRPC-Web access to the chain's sentrix.v1.Sentrix service.
Extracted from sentrix-explorer-v2 so other browser apps can reuse the wrapper instead of re-implementing the tonic-web-wasm-client glue.
| Use case | Crate / package |
|---|---|
| Browser dApp, Rust+WASM (Leptos, Yew, plain wasm-bindgen) | this crate |
| Browser dApp, TypeScript | @sentrix/chain/grpc-web (uses @protobuf-ts/grpcweb-transport) |
| Node.js service (Rust) | sentrix-chain grpc feature |
| Node.js service (TypeScript) | @sentrix/chain/grpc (uses @grpc/grpc-js) |
All four hit the same grpc.sentrixchain.com:443 endpoint — Caddy at the edge transcodes between gRPC-Web and native gRPC via tonic-web.
use sentrix_grpc_wasm::SentrixGrpcClient;
#[wasm_bindgen]
pub async fn read_tip() -> Result<String, JsError> {
let mut client = SentrixGrpcClient::new("https://grpc.sentrixchain.com");
let block = client.get_latest_block().await
.map_err(|s| JsError::new(&format!("rpc: {s}")))?;
Ok(format!("tip: {}", block.index))
}Build to WASM:
wasm-pack build --target web --releaseThen import the generated pkg/ from your bundler (Vite, webpack, etc).
| Method | Returns |
|---|---|
get_latest_block() / get_block_by_height(h) |
pb::Block |
get_balance(address) |
pb::Account (20-byte address) |
get_validator_set() |
pb::ValidatorSet |
get_supply() |
pb::Supply |
get_mempool(limit) |
pb::Mempool |
subscribe_events(filters) |
server-stream pb::ChainEvent |
Older chain hosts (v0.2 / v0.3) return Status::unimplemented for the newer methods; the SDK forwards the error verbatim so callers can fall back to JSON-RPC / REST.
| Network | URL |
|---|---|
| Mainnet | https://grpc.sentrixchain.com |
| Testnet | https://grpc-testnet.sentrixchain.com |
- Extract from
sentrix-explorer-v2/src/grpc/ - Standalone crate with
tonic-buildcodegen - CI:
cargo build+cargo build --target wasm32-unknown-unknown - Smoke test:
wasm-pack test --headless --chromeagainst staging endpoint - Published to crates.io (
sentrix-grpc-wasm) — v0.1.0-alpha.0 since 2026-05-12 - Optional: pre-built WASM artifact npm package (skip the local
wasm-packstep for JS consumers)
v0.1.0-alpha.0 on crates.io. Born as the gRPC-Web wrapper inside sentrix-explorer-v2; now extracted as a sibling crate that any browser dApp can pull as a thin client over sentrix-proto without re-implementing the tonic-web-wasm-client glue. (explorer-v2 itself depends on sentrix-proto directly, not on this crate — they're siblings, not parent/child.)
MIT — see LICENSE.