Expand description
§Celestia RPC
A collection of traits for interacting with Celestia data availability nodes RPC.
This crate builds on top of the jsonrpsee clients.
ⓘ
use celestia_rpc::{BlobClient, Client, TxConfig};
use celestia_types::{Blob, nmt::Namespace};
async fn submit_blob() {
// create a client to the celestia node
let token = std::env::var("CELESTIA_NODE_AUTH_TOKEN").expect("Token not provided");
let client = Client::new("ws://localhost:36658", Some(&token), None, None)
.await
.expect("Failed creating rpc client");
// create a blob that you want to submit
let my_namespace = Namespace::new_v0(&[1, 2, 3, 4, 5]).expect("Invalid namespace");
let blob = Blob::new(
my_namespace,
b"some data to store on blockchain".to_vec(),
None,
)
.expect("Failed to create a blob");
// submit it
client.blob_submit(&[blob], TxConfig::default())
.await
.expect("Failed submitting the blob");
}Re-exports§
pub use crate::blob::BlobClient;pub use crate::blob::BlobRpcServer;pub use crate::blob::BlobServer;pub use crate::blob::BlobSubscriptionRpcServer;pub use crate::blobstream::BlobstreamClient;pub use crate::blobstream::BlobstreamRpcServer;pub use crate::blobstream::BlobstreamServer;pub use crate::client::Client;Non-WebAssembly, or WebAssembly and wasm-bindgenpub use crate::das::DasClient;pub use crate::fraud::FraudClient;pub use crate::fraud::FraudRpcServer;pub use crate::fraud::FraudServer;pub use crate::fraud::FraudSubscriptionRpcServer;pub use crate::p2p::P2PClient;p2p
Modules§
- blob
- celestia-node rpc types and methods related to blobs
- blobstream
- celestia-node rpc types and methods related to blobstream
- client
- Clients for the celestia Json-RPC.
- das
- celestia-node rpc types and methods related to DAS (Data Availability Sampling)
- fraud
- celestia-node rpc types and methods related to fraud proofs
- p2p
p2p - Types and client for the p2p JSON-RPC API.
- prelude
- Re-exports of all the RPC traits.
- share
- celestia-node rpc types and methods related to shares
Structs§
Enums§
- Error
- Representation of all the errors that can occur when interacting with
celestia_rpc. - TxPriority
- Transaction priority for gas price estimation.
Traits§
- Header
Client - Client implementation for the
HeaderRPC API. - Header
RpcServer - Server trait implementation for the
HeaderRPC API. - Header
Server - Server trait for Header RPC endpoints.
- Header
Subscription RpcServer - Server trait implementation for the
HeaderSubscriptionRPC API. - State
Client - Client implementation for the
StateRPC API. - State
Server - Server trait implementation for the
StateRPC API.
Type Aliases§
- Result
- Alias for a
Resultwith the error typecelestia_rpc::Error.