Struct safecoin_client::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 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 new(
rpc_client: Arc<RpcClient>,
websocket_url: &str,
config: TpuClientConfig
) -> Result<Self, TpuSenderError>
pub fn new( rpc_client: Arc<RpcClient>, websocket_url: &str, config: TpuClientConfig ) -> Result<Self, TpuSenderError>
Create a new client that disconnects when dropped
sourcepub fn new_with_connection_cache(
rpc_client: Arc<RpcClient>,
websocket_url: &str,
config: TpuClientConfig,
connection_cache: Arc<ConnectionCache>
) -> Result<Self, TpuSenderError>
pub 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