Expand description
Re-export the entire miden_client crate so external projects can use a single dependency.
Provides an interface for the client to communicate with a Miden node using
Remote Procedure Calls (RPC).
This module defines the NodeRpcClient trait which abstracts calls to the RPC protocol used
to:
- Submit proven transactions.
- Retrieve block headers (optionally with MMR proofs).
- Sync state updates (including notes, nullifiers, and account updates).
- Fetch details for specific notes and accounts.
The client implementation adapts to the target environment automatically:
- Native targets use
tonictransport with TLS. wasm32targets usetonic-web-wasm-clienttransport.
§Example
// Create a gRPC client instance (assumes default endpoint configuration).
let endpoint = Endpoint::new("https".into(), "localhost".into(), Some(57291));
let mut rpc_client = GrpcClient::new(&endpoint, 1000);
// Fetch the latest block header (by passing None).
let (block_header, mmr_proof) = rpc_client.get_block_header_by_number(None, true).await?;
println!("Latest block number: {}", block_header.block_num());
if let Some(proof) = mmr_proof {
println!("MMR proof received accordingly");
}
The client also makes use of this component in order to communicate with the node.
For further details and examples, see the documentation for the individual methods in the
NodeRpcClient trait.
Modules§
- domain
- Contains domain types related to RPC requests and responses, as well as utility functions for dealing with them.
Structs§
- Endpoint
- The
Endpointstruct represents a network endpoint, consisting of a protocol, a host, and a port. - Grpc
Client - Client for the Node RPC API using gRPC.
Enums§
- Accept
Header Error - Errors that can occur during accept header validation.
- Account
State At - Represents the state that we want to retrieve from the network
- Grpc
Error - Categorizes gRPC errors based on their status codes and common patterns
- Node
RpcClient Endpoint - RPC methods for the Miden protocol.
- RpcConversion
Error - RpcError
Constants§
Traits§
- Node
RpcClient - Defines the interface for communicating with the Miden node.