Crate celestia_rpc

source ·
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};
use celestia_types::{Blob, nmt::Namespace};
use celestia_types::blob::GasPrice;

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:26658", Some(&token))
        .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())
        .expect("Failed to create a blob");

    // submit it
    client.blob_submit(&[blob], GasPrice::default())
        .await
        .expect("Failed submitting the blob");
}

Re-exports§

  • pub use crate::client::Client;

Modules§

  • Clients for the celestia Json-RPC.
  • Re-exports of all the RPC traits.

Enums§

  • Representation of all the errors that can occur when interacting with celestia_rpc.

Traits§

  • Client implementation for the Blob RPC API.
  • Client implementation for the Header RPC API.
  • Client implementation for the P2P RPC API.
  • Client implementation for the Share RPC API.
  • Client implementation for the State RPC API.

Type Aliases§