pub struct TychoStreamBuilder { /* private fields */ }Implementations§
Source§impl TychoStreamBuilder
impl TychoStreamBuilder
Sourcepub fn new(tycho_url: &str, chain: Chain) -> Self
pub fn new(tycho_url: &str, chain: Chain) -> Self
Creates a new TychoStreamBuilder with the given Tycho URL and blockchain network.
Initializes the builder with default values for block time and timeout based on the chain.
Sourcepub fn exchange(self, name: &str, filter: ComponentFilter) -> Self
pub fn exchange(self, name: &str, filter: ComponentFilter) -> Self
Adds an exchange and its corresponding filter to the Tycho client.
Sourcepub fn block_time(self, block_time: u64) -> Self
pub fn block_time(self, block_time: u64) -> Self
Sets the block time for the Tycho client.
pub fn startup_timeout(self, timeout: Duration) -> Self
pub fn max_missed_blocks(self, max_missed_blocks: u64) -> Self
pub fn websockets_retry_config(self, retry_config: &RetryConfiguration) -> Self
pub fn state_synchronizer_retry_config( self, retry_config: &RetryConfiguration, ) -> Self
Sourcepub fn no_state(self, no_state: bool) -> Self
pub fn no_state(self, no_state: bool) -> Self
Configures the client to exclude state updates from the stream.
Sourcepub fn auth_key(self, auth_key: Option<String>) -> Self
pub fn auth_key(self, auth_key: Option<String>) -> Self
Sets the API key for authenticating with the Tycho server.
Optionally you can set the TYCHO_AUTH_TOKEN env var instead. Make sure to set no_tsl to false if you do this.
Sourcepub fn no_tls(self, no_tls: bool) -> Self
pub fn no_tls(self, no_tls: bool) -> Self
Disables TLS/SSL for the connection, using http and ws protocols.
Sourcepub fn include_tvl(self, include_tvl: bool) -> Self
pub fn include_tvl(self, include_tvl: bool) -> Self
Configures the client to include TVL in the stream.
If set to true, this will increase start-up time due to additional requests.
Sourcepub fn disable_compression(self) -> Self
pub fn disable_compression(self) -> Self
Disables compression for RPC and WebSocket communication. By default, messages are compressed using zstd.
Sourcepub async fn build(
self,
) -> Result<(JoinHandle<()>, Receiver<Result<FeedMessage<BlockHeader>, BlockSynchronizerError>>), StreamError>
pub async fn build( self, ) -> Result<(JoinHandle<()>, Receiver<Result<FeedMessage<BlockHeader>, BlockSynchronizerError>>), StreamError>
Builds and starts the Tycho client, connecting to the Tycho server and setting up the synchronization of exchange components.