pub struct Adapter<C, S = LockedState> {
pub client: Arc<C>,
/* private fields */
}
Expand description
The Adapter
struct and it’s states.
Used for communication with the underlying client implementation.
Available adapters
2 Adapters are available in this crate:
- Ethereum
crate::ethereum::LockedAdapter
andcrate::ethereum::UnlockedAdapter
- Client implementation
crate::Ethereum
for chains compatible with EVM.
- Dummy
crate::dummy::Adapter
and it’s client implementationcrate::Dummy
for testing.
Fields
client: Arc<C>
client in a specific state - Locked or Unlocked
Implementations
sourceimpl<C: Unlocked> Adapter<C, LockedState>
impl<C: Unlocked> Adapter<C, LockedState>
sourcepub fn with_unlocked(client: C) -> Adapter<C, UnlockedState>
pub fn with_unlocked(client: C) -> Adapter<C, UnlockedState>
Create a new Adapter
in state::UnlockedState
state using an Unlocked
client.
Trait Implementations
sourceimpl<C, S> Locked for Adapter<C, S>where
C: Locked + Sync + Send,
C::Error: Into<Error>,
S: Sync + Send,
impl<C, S> Locked for Adapter<C, S>where
C: Locked + Sync + Send,
C::Error: Into<Error>,
S: Sync + Send,
sourcefn whoami(&self) -> ValidatorId
fn whoami(&self) -> ValidatorId
Get Adapter whoami
sourcefn verify(
&self,
signer: ValidatorId,
state_root: &str,
signature: &str
) -> Result<bool, Error>
fn verify(
&self,
signer: ValidatorId,
state_root: &str,
signature: &str
) -> Result<bool, Error>
Verify, based on the signature & state_root, that the signer is the same
sourcefn session_from_token<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Session, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn session_from_token<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Session, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Creates a Session
from a provided Token by calling the Contract.
Does not cache the (Token
, Session
) pair.
type Error = Error
fn get_deposit<'life0, 'life1, 'async_trait>(
&'life0 self,
channel_context: &'life1 ChainOf<Channel>,
depositor_address: Address
) -> Pin<Box<dyn Future<Output = Result<Deposit, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Auto Trait Implementations
impl<C, S> RefUnwindSafe for Adapter<C, S>where
C: RefUnwindSafe,
S: RefUnwindSafe,
impl<C, S> Send for Adapter<C, S>where
C: Send + Sync,
S: Send,
impl<C, S> Sync for Adapter<C, S>where
C: Send + Sync,
S: Sync,
impl<C, S> Unpin for Adapter<C, S>where
S: Unpin,
impl<C, S> UnwindSafe for Adapter<C, S>where
C: RefUnwindSafe,
S: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more