Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(types,rpc)!: move TxConfig to celestia-rpc #485

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions node/tests/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::env;
use std::sync::OnceLock;
use std::time::Duration;

use celestia_rpc::{prelude::*, Client};
use celestia_types::{Blob, TxConfig};
use celestia_rpc::{prelude::*, Client, TxConfig};
use celestia_types::Blob;
use libp2p::{multiaddr::Protocol, Multiaddr, PeerId};
use lumina_node::blockstore::InMemoryBlockstore;
use lumina_node::events::EventSubscriber;
Expand Down
4 changes: 2 additions & 2 deletions rpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ A collection of traits for interacting with Celestia data availability nodes RPC
This crate builds on top of the [`jsonrpsee`](https://docs.rs/jsonrpsee) clients.

```rust,no_run
use celestia_rpc::{BlobClient, Client};
use celestia_types::{AppVersion, Blob, TxConfig, nmt::Namespace};
use celestia_rpc::{BlobClient, Client, TxConfig};
use celestia_types::{AppVersion, Blob, nmt::Namespace};

async fn submit_blob() {
// create a client to the celestia node
Expand Down
4 changes: 3 additions & 1 deletion rpc/src/blob.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
//! celestia-node rpc types and methods related to blobs

use celestia_types::nmt::{Namespace, NamespaceProof};
use celestia_types::{Blob, Commitment, TxConfig};
use celestia_types::{Blob, Commitment};
use jsonrpsee::proc_macros::rpc;
use serde::{Deserialize, Serialize};

use crate::TxConfig;

/// Response type for [`BlobClient::blob_subscribe`].
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
Expand Down
2 changes: 2 additions & 0 deletions rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mod header;
mod p2p;
pub mod share;
mod state;
mod tx_config;

pub use crate::blob::BlobClient;
#[cfg(any(
Expand All @@ -30,6 +31,7 @@ pub use crate::header::HeaderClient;
pub use crate::p2p::P2PClient;
pub use crate::share::ShareClient;
pub use crate::state::StateClient;
pub use crate::tx_config::TxConfig;

/// Re-exports of all the RPC traits.
pub mod prelude {
Expand Down
4 changes: 3 additions & 1 deletion rpc/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use celestia_types::blob::RawBlob;
use celestia_types::state::{
AccAddress, Address, Balance, QueryDelegationResponse, QueryRedelegationsResponse,
QueryUnbondingDelegationResponse, RawTxResponse, Uint, ValAddress,
};
use celestia_types::{blob::RawBlob, TxConfig};
use jsonrpsee::proc_macros::rpc;

use crate::TxConfig;

#[rpc(client)]
pub trait State {
/// AccountAddress retrieves the address of the node's account/signer
Expand Down
3 changes: 1 addition & 2 deletions types/src/tx_config.rs → rpc/src/tx_config.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use celestia_types::state::AccAddress;
use serde::{
ser::{SerializeStruct, Serializer},
Serialize,
};

use crate::state::AccAddress;

/// [`TxConfig`] specifies additional options that are be applied to the Tx.
///
/// If no options are provided, then the default ones will be used.
Expand Down
3 changes: 2 additions & 1 deletion rpc/tests/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

use crate::utils::{random_bytes, random_ns};
use celestia_rpc::prelude::*;
use celestia_types::{AppVersion, Blob, TxConfig};
use celestia_rpc::TxConfig;
use celestia_types::{AppVersion, Blob};

pub mod utils;

Expand Down
3 changes: 1 addition & 2 deletions rpc/tests/utils/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ use std::sync::OnceLock;

use anyhow::Result;
use celestia_rpc::prelude::*;
use celestia_rpc::Client;
use celestia_rpc::{Client, TxConfig};
use celestia_types::Blob;
use celestia_types::TxConfig;
use jsonrpsee::core::client::SubscriptionClientT;
use jsonrpsee::core::ClientError;
use tokio::sync::{Mutex, MutexGuard};
Expand Down
2 changes: 0 additions & 2 deletions types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ mod sync;
#[cfg_attr(docsrs, doc(cfg(feature = "test-utils")))]
pub mod test_utils;
pub mod trust_level;
mod tx_config;
mod validate;
mod validator_set;

Expand All @@ -42,5 +41,4 @@ pub use crate::fraud_proof::FraudProof;
pub use crate::merkle_proof::MerkleProof;
pub use crate::share::*;
pub use crate::sync::*;
pub use crate::tx_config::TxConfig;
pub use crate::validate::*;
Loading