Skip to main content

ChainKeyOperations

Trait ChainKeyOperations 

pub trait ChainKeyOperations {
    type Error: Error + Send + Sync + 'static;
    type Mapper: KeyIdMapping<KeyIdent, OffchainPublicKey> + Clone + Send + Sync + 'static;

    // Required methods
    fn chain_key_to_packet_key<'life0, 'life1, 'async_trait>(
        &'life0 self,
        chain: &'life1 Address,
    ) -> Pin<Box<dyn Future<Output = Result<Option<OffchainPublicKey>, Self::Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn packet_key_to_chain_key<'life0, 'life1, 'async_trait>(
        &'life0 self,
        packet: &'life1 OffchainPublicKey,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Address>, Self::Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn key_id_mapper_ref(&self) -> &Self::Mapper;
}
Expand description

Operations for offchain keys.

This typically translates to optimized (and cached) versions of [ChainReadChannelOperations].

The Id is a unique identifier for offchain public keys.

Required Associated Types§

type Error: Error + Send + Sync + 'static

type Mapper: KeyIdMapping<KeyIdent, OffchainPublicKey> + Clone + Send + Sync + 'static

Mapping between [KeyIdent] and OffchainPublicKey

Required Methods§

fn chain_key_to_packet_key<'life0, 'life1, 'async_trait>( &'life0 self, chain: &'life1 Address, ) -> Pin<Box<dyn Future<Output = Result<Option<OffchainPublicKey>, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Translates Address into OffchainPublicKey.

fn packet_key_to_chain_key<'life0, 'life1, 'async_trait>( &'life0 self, packet: &'life1 OffchainPublicKey, ) -> Pin<Box<dyn Future<Output = Result<Option<Address>, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Translates OffchainPublicKey into Address.

fn key_id_mapper_ref(&self) -> &Self::Mapper

Returns mapper for offchain key IDs as a reference.

Implementations on Foreign Types§

§

impl<'a, T> ChainKeyOperations for &'a T
where T: 'a + ChainKeyOperations + ?Sized,

§

type Error = <T as ChainKeyOperations>::Error

§

type Mapper = <T as ChainKeyOperations>::Mapper

§

fn chain_key_to_packet_key<'life0, 'life1, 'async_trait>( &'life0 self, chain: &'life1 Address, ) -> Pin<Box<dyn Future<Output = Result<Option<OffchainPublicKey>, <&'a T as ChainKeyOperations>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, &'a T: 'async_trait,

§

fn packet_key_to_chain_key<'life0, 'life1, 'async_trait>( &'life0 self, packet: &'life1 OffchainPublicKey, ) -> Pin<Box<dyn Future<Output = Result<Option<Address>, <&'a T as ChainKeyOperations>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, &'a T: 'async_trait,

§

fn key_id_mapper_ref(&self) -> &<&'a T as ChainKeyOperations>::Mapper

§

impl<T> ChainKeyOperations for Box<T>

§

type Error = <T as ChainKeyOperations>::Error

§

type Mapper = <T as ChainKeyOperations>::Mapper

§

fn chain_key_to_packet_key<'life0, 'life1, 'async_trait>( &'life0 self, chain: &'life1 Address, ) -> Pin<Box<dyn Future<Output = Result<Option<OffchainPublicKey>, <Box<T> as ChainKeyOperations>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<T>: 'async_trait,

§

fn packet_key_to_chain_key<'life0, 'life1, 'async_trait>( &'life0 self, packet: &'life1 OffchainPublicKey, ) -> Pin<Box<dyn Future<Output = Result<Option<Address>, <Box<T> as ChainKeyOperations>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<T>: 'async_trait,

§

fn key_id_mapper_ref(&self) -> &<Box<T> as ChainKeyOperations>::Mapper

§

impl<T> ChainKeyOperations for Arc<T>

§

type Error = <T as ChainKeyOperations>::Error

§

type Mapper = <T as ChainKeyOperations>::Mapper

§

fn chain_key_to_packet_key<'life0, 'life1, 'async_trait>( &'life0 self, chain: &'life1 Address, ) -> Pin<Box<dyn Future<Output = Result<Option<OffchainPublicKey>, <Arc<T> as ChainKeyOperations>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Arc<T>: 'async_trait,

§

fn packet_key_to_chain_key<'life0, 'life1, 'async_trait>( &'life0 self, packet: &'life1 OffchainPublicKey, ) -> Pin<Box<dyn Future<Output = Result<Option<Address>, <Arc<T> as ChainKeyOperations>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Arc<T>: 'async_trait,

§

fn key_id_mapper_ref(&self) -> &<Arc<T> as ChainKeyOperations>::Mapper

Implementors§