diff --git a/Cargo.lock b/Cargo.lock index 78c67d3c5bc072..7c1531da4af74d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5957,6 +5957,7 @@ dependencies = [ "solana-rpc-client", "solana-rpc-client-api", "solana-rpc-client-nonce-utils", + "solana-rpc-sender", "solana-sdk", "solana-streamer", "solana-thin-client", @@ -7095,6 +7096,7 @@ dependencies = [ "serde_json", "solana-account-decoder", "solana-rpc-client-api", + "solana-rpc-sender", "solana-sdk", "solana-transaction-status", "solana-version", @@ -7142,6 +7144,15 @@ dependencies = [ "tokio", ] +[[package]] +name = "solana-rpc-sender" +version = "2.1.0" +dependencies = [ + "async-trait", + "serde_json", + "solana-rpc-client-api", +] + [[package]] name = "solana-rpc-test" version = "2.1.0" diff --git a/Cargo.toml b/Cargo.toml index 2d4eb9feebb131..15c9ed2081a67a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -397,6 +397,7 @@ solana-rpc = { path = "rpc", version = "=2.1.0" } solana-rpc-client = { path = "rpc-client", version = "=2.1.0", default-features = false } solana-rpc-client-api = { path = "rpc-client-api", version = "=2.1.0" } solana-rpc-client-nonce-utils = { path = "rpc-client-nonce-utils", version = "=2.1.0" } +solana-rpc-sender = { path = "rpc-sender", version = "=2.1.0" } solana-runtime = { path = "runtime", version = "=2.1.0" } solana-runtime-transaction = { path = "runtime-transaction", version = "=2.1.0" } solana-sdk = { path = "sdk", version = "=2.1.0" } diff --git a/client/Cargo.toml b/client/Cargo.toml index ece0bc82a9cacb..70337e6224c253 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -28,6 +28,7 @@ solana-quic-client = { workspace = true } solana-rpc-client = { workspace = true, features = ["default"] } solana-rpc-client-api = { workspace = true } solana-rpc-client-nonce-utils = { workspace = true } +solana-rpc-sender = { workspace = true } solana-sdk = { workspace = true } solana-streamer = { workspace = true } solana-thin-client = { workspace = true } diff --git a/client/src/lib.rs b/client/src/lib.rs index f5e045ff531604..ebdf887ce7b5c7 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -55,5 +55,5 @@ pub mod rpc_response { } /// A transport for RPC calls. pub mod rpc_sender { - pub use solana_rpc_client::rpc_sender::*; + pub use solana_rpc_sender::*; } diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index c0a6b7558bf3aa..03fc2f1721b401 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -4763,6 +4763,7 @@ dependencies = [ "solana-rpc-client", "solana-rpc-client-api", "solana-rpc-client-nonce-utils", + "solana-rpc-sender", "solana-sdk", "solana-streamer", "solana-thin-client", @@ -5545,6 +5546,7 @@ dependencies = [ "serde_json", "solana-account-decoder", "solana-rpc-client-api", + "solana-rpc-sender", "solana-sdk", "solana-transaction-status", "solana-version", @@ -5585,6 +5587,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "solana-rpc-sender" +version = "2.1.0" +dependencies = [ + "async-trait", + "serde_json", + "solana-rpc-client-api", +] + [[package]] name = "solana-runtime" version = "2.1.0" diff --git a/rpc-client/Cargo.toml b/rpc-client/Cargo.toml index 26b0ed8322ce91..497b8509d836b8 100644 --- a/rpc-client/Cargo.toml +++ b/rpc-client/Cargo.toml @@ -24,6 +24,7 @@ serde_derive = { workspace = true } serde_json = { workspace = true } solana-account-decoder = { workspace = true } solana-rpc-client-api = { workspace = true } +solana-rpc-sender = { workspace = true } solana-sdk = { workspace = true } solana-transaction-status = { workspace = true } solana-version = { workspace = true } diff --git a/rpc-client/src/http_sender.rs b/rpc-client/src/http_sender.rs index 1048d7d507b463..2fc3d3319c5dce 100644 --- a/rpc-client/src/http_sender.rs +++ b/rpc-client/src/http_sender.rs @@ -1,7 +1,6 @@ //! Nonblocking [`RpcSender`] over HTTP. use { - crate::rpc_sender::*, async_trait::async_trait, log::*, reqwest::{ @@ -16,6 +15,7 @@ use { request::{RpcError, RpcRequest, RpcResponseErrorData}, response::RpcSimulateTransactionResult, }, + solana_rpc_sender::*, std::{ sync::{ atomic::{AtomicU64, Ordering}, diff --git a/rpc-client/src/lib.rs b/rpc-client/src/lib.rs index fddf3e0aab2d8c..db2f90aebba33e 100644 --- a/rpc-client/src/lib.rs +++ b/rpc-client/src/lib.rs @@ -4,8 +4,9 @@ pub mod http_sender; pub mod mock_sender; pub mod nonblocking; pub mod rpc_client; -pub mod rpc_sender; pub mod spinner; +#[deprecated(since = "2.1.0", note = "Use `solana-rpc-sender` crate instead.")] +pub use solana_rpc_sender as rpc_sender; pub mod mock_sender_for_cli { /// Magic `SIGNATURE` value used by `solana-cli` unit tests. diff --git a/rpc-client/src/mock_sender.rs b/rpc-client/src/mock_sender.rs index 9730a6ff24a983..388429e054fc3c 100644 --- a/rpc-client/src/mock_sender.rs +++ b/rpc-client/src/mock_sender.rs @@ -1,7 +1,6 @@ //! A nonblocking [`RpcSender`] used for unit testing [`RpcClient`](crate::rpc_client::RpcClient). use { - crate::rpc_sender::*, async_trait::async_trait, base64::{prelude::BASE64_STANDARD, Engine}, serde_json::{json, Number, Value}, @@ -19,6 +18,7 @@ use { RpcVoteAccountStatus, }, }, + solana_rpc_sender::*, solana_sdk::{ account::Account, clock::{Slot, UnixTimestamp}, diff --git a/rpc-client/src/nonblocking/rpc_client.rs b/rpc-client/src/nonblocking/rpc_client.rs index 0ca5f76a49f829..e41a587adbe4b2 100644 --- a/rpc-client/src/nonblocking/rpc_client.rs +++ b/rpc-client/src/nonblocking/rpc_client.rs @@ -17,7 +17,6 @@ use { GetConfirmedSignaturesForAddress2Config, RpcClientConfig, SerializableMessage, SerializableTransaction, }, - rpc_sender::*, }, base64::{prelude::BASE64_STANDARD, Engine}, bincode::serialize, @@ -35,6 +34,7 @@ use { request::{RpcError, RpcRequest, RpcResponseErrorData, TokenAccountsFilter}, response::*, }, + solana_rpc_sender::*, solana_sdk::{ account::Account, clock::{Epoch, Slot, UnixTimestamp, DEFAULT_MS_PER_SLOT}, diff --git a/rpc-client/src/rpc_client.rs b/rpc-client/src/rpc_client.rs index 32bd08cef49f03..4c3e9e77f79f6a 100644 --- a/rpc-client/src/rpc_client.rs +++ b/rpc-client/src/rpc_client.rs @@ -15,7 +15,6 @@ use { http_sender::HttpSender, mock_sender::MockSender, nonblocking::{self, rpc_client::get_rpc_request_str}, - rpc_sender::*, }, serde::Serialize, serde_json::Value, @@ -29,6 +28,7 @@ use { request::{RpcRequest, TokenAccountsFilter}, response::*, }, + solana_rpc_sender::*, solana_sdk::{ account::{Account, ReadableAccount}, clock::{Epoch, Slot, UnixTimestamp}, diff --git a/rpc-sender/Cargo.toml b/rpc-sender/Cargo.toml new file mode 100644 index 00000000000000..83958838ef4386 --- /dev/null +++ b/rpc-sender/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "solana-rpc-sender" +description = "Solana RpcSender trait" +documentation = "https://docs.rs/solana-rpc-sender" +version = { workspace = true } +authors = { workspace = true } +repository = { workspace = true } +homepage = { workspace = true } +license = { workspace = true } +edition = { workspace = true } + +[dependencies] +async-trait = { workspace = true } +serde_json = { workspace = true } +solana-rpc-client-api = { workspace = true } + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] diff --git a/rpc-client/src/rpc_sender.rs b/rpc-sender/src/lib.rs similarity index 89% rename from rpc-client/src/rpc_sender.rs rename to rpc-sender/src/lib.rs index 948ac45a461c89..3ce238c39f30fa 100644 --- a/rpc-client/src/rpc_sender.rs +++ b/rpc-sender/src/lib.rs @@ -23,7 +23,7 @@ pub struct RpcTransportStats { /// `RpcSender` implements the underlying transport of requests to, and /// responses from, a Solana node, and is used primarily by [`RpcClient`]. /// -/// [`RpcClient`]: crate::rpc_client::RpcClient +/// [`RpcClient`]: https://docs.rs/solana-rpc-client/latest/solana_rpc_client/rpc_client/struct.RpcClient.html #[async_trait] pub trait RpcSender { async fn send(