Struct safecoin_client::nonblocking::tpu_client::TpuClient
source · pub struct TpuClient { /* 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 TpuClient
impl TpuClient
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_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(
rpc_client: Arc<RpcClient>,
websocket_url: &str,
config: TpuClientConfig
) -> Result<Self, TpuSenderError>
pub async fn new( rpc_client: Arc<RpcClient>, websocket_url: &str, config: TpuClientConfig ) -> Result<Self, TpuSenderError>
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>
) -> Result<Self, TpuSenderError>
pub async fn new_with_connection_cache( rpc_client: Arc<RpcClient>, websocket_url: &str, config: TpuClientConfig, connection_cache: Arc<ConnectionCache> ) -> Result<Self, TpuSenderError>
Create a new client that disconnects when dropped