sentrix-grpc-wasm 0.1.0-alpha.0

Rust + WASM gRPC-Web client for Sentrix Chain. Extracted from sentrix-explorer-v2; usable from any browser dApp via wasm-pack.
Documentation

sentrix-grpc-wasm

CI License: MIT

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.

Picking the right SDK

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.

Quick start

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 --release

Then import the generated pkg/ from your bundler (Vite, webpack, etc).

Available calls (chain v0.4+)

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.

Endpoints

Network URL
Mainnet https://grpc.sentrixchain.com
Testnet https://grpc-testnet.sentrixchain.com

Roadmap

  • Extract from sentrix-explorer-v2/src/grpc/
  • Standalone crate with tonic-build codegen
  • CI: cargo build + cargo build --target wasm32-unknown-unknown
  • Smoke test: wasm-pack test --headless --chrome against staging endpoint
  • Publish to crates.io once API surface stabilises
  • Optional: pre-built WASM artifact npm package (skip the local wasm-pack step for JS consumers)

Status

v0.1.0-alpha.0 — works, used in production by sentrix-explorer-v2. Surface is the same as the explorer was using; nothing here is speculative.

License

MIT — see LICENSE.