Trait HasChainApi
pub trait HasChainApi {
type ChainApi: HoprChainApi + ComponentStatusReporter + Clone + Send + Sync + 'static;
type ChainError: Error + Send + Sync + 'static;
// Required methods
fn identity(&self) -> &NodeOnchainIdentity;
fn chain_api(&self) -> &Self::ChainApi;
fn status(&self) -> ComponentStatus;
fn wait_for_on_chain_event<F>(
&self,
predicate: F,
context: String,
timeout: Duration,
) -> Result<(Pin<Box<dyn Future<Output = Result<ChainEvent, EitherErr<<Self::ChainApi as HoprChainApi>::ChainError, Self::ChainError>>> + Send>>, AbortHandle), <Self::ChainApi as HoprChainApi>::ChainError>
where F: Fn(&ChainEvent) -> bool + Send + Sync + 'static;
}Expand description
Provides access to the chain component of a HOPR node.
Required Associated Types§
type ChainApi: HoprChainApi + ComponentStatusReporter + Clone + Send + Sync + 'static
type ChainApi: HoprChainApi + ComponentStatusReporter + Clone + Send + Sync + 'static
The concrete chain API implementation.
type ChainError: Error + Send + Sync + 'static
type ChainError: Error + Send + Sync + 'static
Error type for node-level chain operations (distinct from on-chain errors).
Required Methods§
fn identity(&self) -> &NodeOnchainIdentity
fn identity(&self) -> &NodeOnchainIdentity
Returns the node’s on-chain identity (node address, Safe address, module address).
fn status(&self) -> ComponentStatus
fn status(&self) -> ComponentStatus
Reports the current health of the chain component.
fn wait_for_on_chain_event<F>(
&self,
predicate: F,
context: String,
timeout: Duration,
) -> Result<(Pin<Box<dyn Future<Output = Result<ChainEvent, EitherErr<<Self::ChainApi as HoprChainApi>::ChainError, Self::ChainError>>> + Send>>, AbortHandle), <Self::ChainApi as HoprChainApi>::ChainError>
fn wait_for_on_chain_event<F>( &self, predicate: F, context: String, timeout: Duration, ) -> Result<(Pin<Box<dyn Future<Output = Result<ChainEvent, EitherErr<<Self::ChainApi as HoprChainApi>::ChainError, Self::ChainError>>> + Send>>, AbortHandle), <Self::ChainApi as HoprChainApi>::ChainError>
Spawns an asynchronous waiter that subscribes to ChainEvents
and resolves when predicate matches or timeout elapses.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.