Skip to content

Commit

Permalink
extract rpc-sender crate from rpc-client
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinheavey committed Jul 20, 2024
1 parent fe652ca commit a5e0778
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 7 deletions.
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
1 change: 1 addition & 0 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
}
11 changes: 11 additions & 0 deletions programs/sbf/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rpc-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion rpc-client/src/http_sender.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Nonblocking [`RpcSender`] over HTTP.
use {
crate::rpc_sender::*,
async_trait::async_trait,
log::*,
reqwest::{
Expand All @@ -16,6 +15,7 @@ use {
request::{RpcError, RpcRequest, RpcResponseErrorData},
response::RpcSimulateTransactionResult,
},
solana_rpc_sender::*,
std::{
sync::{
atomic::{AtomicU64, Ordering},
Expand Down
3 changes: 2 additions & 1 deletion rpc-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion rpc-client/src/mock_sender.rs
Original file line number Diff line number Diff line change
@@ -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},
Expand All @@ -19,6 +18,7 @@ use {
RpcVoteAccountStatus,
},
},
solana_rpc_sender::*,
solana_sdk::{
account::Account,
clock::{Slot, UnixTimestamp},
Expand Down
2 changes: 1 addition & 1 deletion rpc-client/src/nonblocking/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use {
GetConfirmedSignaturesForAddress2Config, RpcClientConfig, SerializableMessage,
SerializableTransaction,
},
rpc_sender::*,
},
base64::{prelude::BASE64_STANDARD, Engine},
bincode::serialize,
Expand All @@ -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},
Expand Down
2 changes: 1 addition & 1 deletion rpc-client/src/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -29,6 +28,7 @@ use {
request::{RpcRequest, TokenAccountsFilter},
response::*,
},
solana_rpc_sender::*,
solana_sdk::{
account::{Account, ReadableAccount},
clock::{Epoch, Slot, UnixTimestamp},
Expand Down
18 changes: 18 additions & 0 deletions rpc-sender/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 1 addition & 1 deletion rpc-client/src/rpc_sender.rs → rpc-sender/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit a5e0778

Please sign in to comment.