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 This is just a thin wrapper over the “BackendTpuClient”, use that directly for more efficiency.
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 fn send_transaction(&self, transaction: &Transaction) -> bool
pub fn send_transaction(&self, transaction: &Transaction) -> bool
Serialize and send transaction to the current and upcoming leader TPUs according to fanout size
sourcepub fn send_wire_transaction(&self, wire_transaction: Vec<u8>) -> bool
pub 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 fn try_send_transaction(
&self,
transaction: &Transaction,
) -> TransportResult<()>
pub 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 fn try_send_transaction_batch(
&self,
transactions: &[Transaction],
) -> TransportResult<()>
pub fn try_send_transaction_batch( &self, transactions: &[Transaction], ) -> TransportResult<()>
Serialize and send a batch of transactions to the current and upcoming leader TPUs according to fanout size Returns the last error if all sends fail
sourcepub fn try_send_wire_transaction(
&self,
wire_transaction: Vec<u8>,
) -> TransportResult<()>
pub 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
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 fn new_with_connection_cache(
rpc_client: Arc<RpcClient>,
websocket_url: &str,
config: TpuClientConfig,
connection_cache: Arc<BackendConnectionCache<P, M, C>>,
) -> Result<Self>
pub fn new_with_connection_cache( rpc_client: Arc<RpcClient>, websocket_url: &str, config: TpuClientConfig, connection_cache: Arc<BackendConnectionCache<P, M, C>>, ) -> Result<Self>
Create a new client that disconnects when dropped
pub 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
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<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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