pub struct TpuClient<P, M, C> { /* private fields */ }
Expand description
Client which sends transactions directly to the current leader’s TPU port over UDP. The client uses RPC to determine the current leader and fetch node contact info
Implementations§
Source§impl<P, M, C> TpuClient<P, M, C>where
P: ConnectionPool<NewConnectionConfig = C>,
M: ConnectionManager<ConnectionPool = P, NewConnectionConfig = C>,
C: NewConnectionConfig,
impl<P, M, C> TpuClient<P, M, C>where
P: ConnectionPool<NewConnectionConfig = C>,
M: ConnectionManager<ConnectionPool = P, NewConnectionConfig = C>,
C: NewConnectionConfig,
Sourcepub async fn send_transaction(&self, transaction: &Transaction) -> bool
pub async fn send_transaction(&self, transaction: &Transaction) -> bool
Serialize and send transaction to the current and upcoming leader TPUs according to fanout size
Sourcepub async fn send_wire_transaction(&self, wire_transaction: Vec<u8>) -> bool
pub async fn send_wire_transaction(&self, wire_transaction: Vec<u8>) -> bool
Send a wire transaction to the current and upcoming leader TPUs according to fanout size
Sourcepub async fn try_send_transaction(
&self,
transaction: &Transaction,
) -> TransportResult<()>
pub async fn try_send_transaction( &self, transaction: &Transaction, ) -> TransportResult<()>
Serialize and send transaction to the current and upcoming leader TPUs according to fanout size Returns the last error if all sends fail
Sourcepub async fn try_send_wire_transaction(
&self,
wire_transaction: Vec<u8>,
) -> TransportResult<()>
pub async fn try_send_wire_transaction( &self, wire_transaction: Vec<u8>, ) -> TransportResult<()>
Send a wire transaction to the current and upcoming leader TPUs according to fanout size Returns the last error if all sends fail
Sourcepub async fn try_send_wire_transaction_batch(
&self,
wire_transactions: Vec<Vec<u8>>,
) -> TransportResult<()>
pub async fn try_send_wire_transaction_batch( &self, wire_transactions: Vec<Vec<u8>>, ) -> TransportResult<()>
Send a batch of wire transactions to the current and upcoming leader TPUs according to fanout size Returns the last error if all sends fail
Sourcepub async fn new(
name: &'static str,
rpc_client: Arc<RpcClient>,
websocket_url: &str,
config: TpuClientConfig,
connection_manager: M,
) -> Result<Self>
pub async fn new( name: &'static str, rpc_client: Arc<RpcClient>, websocket_url: &str, config: TpuClientConfig, connection_manager: M, ) -> Result<Self>
Create a new client that disconnects when dropped
Sourcepub async fn new_with_connection_cache(
rpc_client: Arc<RpcClient>,
websocket_url: &str,
config: TpuClientConfig,
connection_cache: Arc<ConnectionCache<P, M, C>>,
) -> Result<Self>
pub async fn new_with_connection_cache( rpc_client: Arc<RpcClient>, websocket_url: &str, config: TpuClientConfig, connection_cache: Arc<ConnectionCache<P, M, C>>, ) -> Result<Self>
Create a new client that disconnects when dropped
pub async fn send_and_confirm_messages_with_spinner<T: Signers + ?Sized>( &self, messages: &[Message], signers: &T, ) -> Result<Vec<Option<TransactionError>>>
pub fn rpc_client(&self) -> &RpcClient
pub async fn shutdown(&mut self)
pub fn get_connection_cache(&self) -> &Arc<ConnectionCache<P, M, C>>where
P: ConnectionPool<NewConnectionConfig = C>,
M: ConnectionManager<ConnectionPool = P, NewConnectionConfig = C>,
C: NewConnectionConfig,
pub fn get_leader_tpu_service(&self) -> &LeaderTpuService
pub fn get_fanout_slots(&self) -> u64
Trait Implementations§
Auto Trait Implementations§
impl<P, M, C> Freeze for TpuClient<P, M, C>
impl<P, M, C> !RefUnwindSafe for TpuClient<P, M, C>
impl<P, M, C> Send for TpuClient<P, M, C>
impl<P, M, C> Sync for TpuClient<P, M, C>
impl<P, M, C> Unpin for TpuClient<P, M, C>
impl<P, M, C> !UnwindSafe for TpuClient<P, M, C>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more