Struct ibc_client_cw::context::Context
source · pub struct Context<'a, C: ClientType<'a>> { /* private fields */ }Expand description
Context is a wrapper around the deps and env that gives access to the methods under the ibc-rs Validation and Execution traits.
Implementations§
source§impl<'a, C: ClientType<'a>> Context<'a, C>
impl<'a, C: ClientType<'a>> Context<'a, C>
sourcepub fn new_ref(deps: Deps<'a>, env: Env) -> Result<Self, ContractError>
pub fn new_ref(deps: Deps<'a>, env: Env) -> Result<Self, ContractError>
Constructs a new Context object with the given deps and env.
sourcepub fn new_mut(deps_mut: DepsMut<'a>, env: Env) -> Result<Self, ContractError>
pub fn new_mut(deps_mut: DepsMut<'a>, env: Env) -> Result<Self, ContractError>
Constructs a new Context object with the given deps_mut and env.
sourcepub fn set_checksum(&mut self, checksum: Vec<u8>)
pub fn set_checksum(&mut self, checksum: Vec<u8>)
Sets the checksum of the context.
sourcepub fn set_subject_prefix(&mut self)
pub fn set_subject_prefix(&mut self)
Enables the migration mode with the subject prefix.
sourcepub fn set_substitute_prefix(&mut self)
pub fn set_substitute_prefix(&mut self)
Enables the migration mode with the substitute prefix.
sourcepub fn prefixed_key(&self, key: impl AsRef<[u8]>) -> Vec<u8> ⓘ
pub fn prefixed_key(&self, key: impl AsRef<[u8]>) -> Vec<u8> ⓘ
Prefixes the given key with the migration prefix.
sourcepub fn retrieve(&self, key: impl AsRef<[u8]>) -> Result<Vec<u8>, ClientError>
pub fn retrieve(&self, key: impl AsRef<[u8]>) -> Result<Vec<u8>, ClientError>
Retrieves the value of the given key.
sourcepub fn insert(&mut self, key: impl AsRef<[u8]>, value: impl AsRef<[u8]>)
pub fn insert(&mut self, key: impl AsRef<[u8]>, value: impl AsRef<[u8]>)
Inserts the given key-value pair.
sourcepub fn get_heights(&self) -> Result<Vec<Height>, ClientError>
pub fn get_heights(&self) -> Result<Vec<Height>, ClientError>
Returns the storage of the context.
sourcepub fn get_adjacent_height(
&self,
height: &Height,
travel: HeightTravel
) -> Result<Option<Height>, ClientError>
pub fn get_adjacent_height( &self, height: &Height, travel: HeightTravel ) -> Result<Option<Height>, ClientError>
Searches for either the earliest next or latest previous height based on the given height and travel direction.
sourcepub fn client_update_time_key(&self, height: &Height) -> Vec<u8> ⓘ
pub fn client_update_time_key(&self, height: &Height) -> Vec<u8> ⓘ
Returns the key for the client update time.
sourcepub fn client_update_height_key(&self, height: &Height) -> Vec<u8> ⓘ
pub fn client_update_height_key(&self, height: &Height) -> Vec<u8> ⓘ
Returns the key for the client update height.
sourcepub fn get_metadata(
&self
) -> Result<Option<Vec<GenesisMetadata>>, ContractError>
pub fn get_metadata( &self ) -> Result<Option<Vec<GenesisMetadata>>, ContractError>
Returns the genesis metadata by iterating over the stored consensus state metadata.
sourcepub fn obtain_checksum(&self) -> Result<Vec<u8>, ClientError>
pub fn obtain_checksum(&self) -> Result<Vec<u8>, ClientError>
Returns the checksum of the current contract.
sourcepub fn encode_client_state(
&self,
client_state: C::ClientState
) -> Result<Vec<u8>, ClientError>
pub fn encode_client_state( &self, client_state: C::ClientState ) -> Result<Vec<u8>, ClientError>
Encodes the given client state into a byte vector.
source§impl<'a, C: ClientType<'a>> Context<'a, C>
impl<'a, C: ClientType<'a>> Context<'a, C>
sourcepub fn instantiate(
&mut self,
msg: InstantiateMsg
) -> Result<Binary, ContractError>
pub fn instantiate( &mut self, msg: InstantiateMsg ) -> Result<Binary, ContractError>
Instantiates a new client with the given InstantiateMsg message.
Trait Implementations§
source§impl<'a, C: ClientType<'a>> ClientExecutionContext for Context<'a, C>
impl<'a, C: ClientType<'a>> ClientExecutionContext for Context<'a, C>
type ClientStateMut = <C as ClientType<'a>>::ClientState
source§fn store_client_state(
&mut self,
_client_state_path: ClientStatePath,
client_state: Self::ClientStateMut
) -> Result<(), ContextError>
fn store_client_state( &mut self, _client_state_path: ClientStatePath, client_state: Self::ClientStateMut ) -> Result<(), ContextError>
source§fn store_consensus_state(
&mut self,
consensus_state_path: ClientConsensusStatePath,
consensus_state: Self::ConsensusStateRef
) -> Result<(), ContextError>
fn store_consensus_state( &mut self, consensus_state_path: ClientConsensusStatePath, consensus_state: Self::ConsensusStateRef ) -> Result<(), ContextError>
source§fn delete_consensus_state(
&mut self,
consensus_state_path: ClientConsensusStatePath
) -> Result<(), ContextError>
fn delete_consensus_state( &mut self, consensus_state_path: ClientConsensusStatePath ) -> Result<(), ContextError>
ClientConsensusStatePathsource§fn store_update_meta(
&mut self,
_client_id: ClientId,
height: Height,
host_timestamp: Timestamp,
host_height: Height
) -> Result<(), ContextError>
fn store_update_meta( &mut self, _client_id: ClientId, height: Height, host_timestamp: Timestamp, host_height: Height ) -> Result<(), ContextError>
source§fn delete_update_meta(
&mut self,
_client_id: ClientId,
height: Height
) -> Result<(), ContextError>
fn delete_update_meta( &mut self, _client_id: ClientId, height: Height ) -> Result<(), ContextError>
fn client_state_mut( &self, client_id: &ClientId ) -> Result<Self::ClientStateMut, ContextError>
source§impl<'a, C: ClientType<'a>> ClientValidationContext for Context<'a, C>
impl<'a, C: ClientType<'a>> ClientValidationContext for Context<'a, C>
type ClientStateRef = <C as ClientType<'a>>::ClientState
type ConsensusStateRef = <C as ClientType<'a>>::ConsensusState
source§fn client_state(
&self,
_client_id: &ClientId
) -> Result<Self::ClientStateRef, ContextError>
fn client_state( &self, _client_id: &ClientId ) -> Result<Self::ClientStateRef, ContextError>
client_id. Read moresource§fn consensus_state(
&self,
client_cons_state_path: &ClientConsensusStatePath
) -> Result<Self::ConsensusStateRef, ContextError>
fn consensus_state( &self, client_cons_state_path: &ClientConsensusStatePath ) -> Result<Self::ConsensusStateRef, ContextError>
source§fn client_update_meta(
&self,
_client_id: &ClientId,
height: &Height
) -> Result<(Timestamp, Height), ContextError>
fn client_update_meta( &self, _client_id: &ClientId, height: &Height ) -> Result<(Timestamp, Height), ContextError>
source§impl<'a, C: ClientType<'a>> ExtClientValidationContext for Context<'a, C>
impl<'a, C: ClientType<'a>> ExtClientValidationContext for Context<'a, C>
source§fn host_timestamp(&self) -> Result<Timestamp, ContextError>
fn host_timestamp(&self) -> Result<Timestamp, ContextError>
source§fn host_height(&self) -> Result<Height, ContextError>
fn host_height(&self) -> Result<Height, ContextError>
source§fn consensus_state_heights(
&self,
_client_id: &ClientId
) -> Result<Vec<Height>, ContextError>
fn consensus_state_heights( &self, _client_id: &ClientId ) -> Result<Vec<Height>, ContextError>
source§fn next_consensus_state(
&self,
client_id: &ClientId,
height: &Height
) -> Result<Option<Self::ConsensusStateRef>, ContextError>
fn next_consensus_state( &self, client_id: &ClientId, height: &Height ) -> Result<Option<Self::ConsensusStateRef>, ContextError>
height.source§fn prev_consensus_state(
&self,
client_id: &ClientId,
height: &Height
) -> Result<Option<Self::ConsensusStateRef>, ContextError>
fn prev_consensus_state( &self, client_id: &ClientId, height: &Height ) -> Result<Option<Self::ConsensusStateRef>, ContextError>
height.