Trait ibc_test_framework::prelude::ChainHandle
source · pub trait ChainHandle: Clone + Display + Send + Sync + Debug + 'static {
Show 54 methods
// Required methods
fn new(chain_id: ChainId, sender: Sender<(Span, ChainRequest)>) -> Self;
fn id(&self) -> ChainId;
fn shutdown(&self) -> Result<(), Error>;
fn health_check(&self) -> Result<HealthCheck, Error>;
fn subscribe(
&self
) -> Result<Receiver<Arc<Result<EventBatch, Error>>>, Error>;
fn send_messages_and_wait_commit(
&self,
tracked_msgs: TrackedMsgs
) -> Result<Vec<IbcEventWithHeight>, Error>;
fn send_messages_and_wait_check_tx(
&self,
tracked_msgs: TrackedMsgs
) -> Result<Vec<Response>, Error>;
fn get_signer(&self) -> Result<Signer, Error>;
fn config(&self) -> Result<ChainConfig, Error>;
fn get_key(&self) -> Result<AnySigningKeyPair, Error>;
fn add_key(
&self,
key_name: String,
key: AnySigningKeyPair
) -> Result<(), Error>;
fn ibc_version(&self) -> Result<Option<Version>, Error>;
fn query_balance(
&self,
key_name: Option<String>,
denom: Option<String>
) -> Result<Balance, Error>;
fn query_all_balances(
&self,
key_name: Option<String>
) -> Result<Vec<Balance>, Error>;
fn query_denom_trace(&self, hash: String) -> Result<DenomTrace, Error>;
fn query_application_status(&self) -> Result<ChainStatus, Error>;
fn query_clients(
&self,
request: QueryClientStatesRequest
) -> Result<Vec<IdentifiedAnyClientState>, Error>;
fn query_client_state(
&self,
request: QueryClientStateRequest,
include_proof: IncludeProof
) -> Result<(AnyClientState, Option<MerkleProof>), Error>;
fn query_client_connections(
&self,
request: QueryClientConnectionsRequest
) -> Result<Vec<ConnectionId>, Error>;
fn query_consensus_state(
&self,
request: QueryConsensusStateRequest,
include_proof: IncludeProof
) -> Result<(AnyConsensusState, Option<MerkleProof>), Error>;
fn query_consensus_state_heights(
&self,
request: QueryConsensusStateHeightsRequest
) -> Result<Vec<Height>, Error>;
fn query_upgraded_client_state(
&self,
request: QueryUpgradedClientStateRequest
) -> Result<(AnyClientState, MerkleProof), Error>;
fn query_upgraded_consensus_state(
&self,
request: QueryUpgradedConsensusStateRequest
) -> Result<(AnyConsensusState, MerkleProof), Error>;
fn query_commitment_prefix(&self) -> Result<CommitmentPrefix, Error>;
fn query_compatible_versions(&self) -> Result<Vec<Version>, Error>;
fn query_connection(
&self,
request: QueryConnectionRequest,
include_proof: IncludeProof
) -> Result<(ConnectionEnd, Option<MerkleProof>), Error>;
fn query_connections(
&self,
request: QueryConnectionsRequest
) -> Result<Vec<IdentifiedConnectionEnd>, Error>;
fn query_connection_channels(
&self,
request: QueryConnectionChannelsRequest
) -> Result<Vec<IdentifiedChannelEnd>, Error>;
fn query_next_sequence_receive(
&self,
request: QueryNextSequenceReceiveRequest,
include_proof: IncludeProof
) -> Result<(Sequence, Option<MerkleProof>), Error>;
fn query_channels(
&self,
request: QueryChannelsRequest
) -> Result<Vec<IdentifiedChannelEnd>, Error>;
fn query_channel(
&self,
request: QueryChannelRequest,
include_proof: IncludeProof
) -> Result<(ChannelEnd, Option<MerkleProof>), Error>;
fn query_channel_client_state(
&self,
request: QueryChannelClientStateRequest
) -> Result<Option<IdentifiedAnyClientState>, Error>;
fn build_header(
&self,
trusted_height: Height,
target_height: Height,
client_state: AnyClientState
) -> Result<(AnyHeader, Vec<AnyHeader>), Error>;
fn build_client_state(
&self,
height: Height,
settings: ClientSettings
) -> Result<AnyClientState, Error>;
fn build_consensus_state(
&self,
trusted: Height,
target: Height,
client_state: AnyClientState
) -> Result<AnyConsensusState, Error>;
fn check_misbehaviour(
&self,
update: UpdateClient,
client_state: AnyClientState
) -> Result<Option<MisbehaviourEvidence>, Error>;
fn build_connection_proofs_and_client_state(
&self,
message_type: ConnectionMsgType,
connection_id: &ConnectionId,
client_id: &ClientId,
height: Height
) -> Result<(Option<AnyClientState>, Proofs), Error>;
fn build_channel_proofs(
&self,
port_id: &PortId,
channel_id: &ChannelId,
height: Height
) -> Result<Proofs, Error>;
fn build_packet_proofs(
&self,
packet_type: PacketMsgType,
port_id: &PortId,
channel_id: &ChannelId,
sequence: Sequence,
height: Height
) -> Result<Proofs, Error>;
fn query_packet_commitment(
&self,
request: QueryPacketCommitmentRequest,
include_proof: IncludeProof
) -> Result<(Vec<u8>, Option<MerkleProof>), Error>;
fn query_packet_commitments(
&self,
request: QueryPacketCommitmentsRequest
) -> Result<(Vec<Sequence>, Height), Error>;
fn query_packet_receipt(
&self,
request: QueryPacketReceiptRequest,
include_proof: IncludeProof
) -> Result<(Vec<u8>, Option<MerkleProof>), Error>;
fn query_unreceived_packets(
&self,
request: QueryUnreceivedPacketsRequest
) -> Result<Vec<Sequence>, Error>;
fn query_packet_acknowledgement(
&self,
request: QueryPacketAcknowledgementRequest,
include_proof: IncludeProof
) -> Result<(Vec<u8>, Option<MerkleProof>), Error>;
fn query_packet_acknowledgements(
&self,
request: QueryPacketAcknowledgementsRequest
) -> Result<(Vec<Sequence>, Height), Error>;
fn query_unreceived_acknowledgements(
&self,
request: QueryUnreceivedAcksRequest
) -> Result<Vec<Sequence>, Error>;
fn query_txs(
&self,
request: QueryTxRequest
) -> Result<Vec<IbcEventWithHeight>, Error>;
fn query_packet_events(
&self,
request: QueryPacketEventDataRequest
) -> Result<Vec<IbcEventWithHeight>, Error>;
fn query_host_consensus_state(
&self,
request: QueryHostConsensusStateRequest
) -> Result<AnyConsensusState, Error>;
fn maybe_register_counterparty_payee(
&self,
channel_id: ChannelId,
port_id: PortId,
counterparty_payee: Signer
) -> Result<(), Error>;
fn cross_chain_query(
&self,
request: Vec<CrossChainQueryRequest>
) -> Result<Vec<CrossChainQueryResponse>, Error>;
fn query_incentivized_packet(
&self,
request: QueryIncentivizedPacketRequest
) -> Result<QueryIncentivizedPacketResponse, Error>;
fn query_consumer_chains(&self) -> Result<Vec<(ChainId, ClientId)>, Error>;
// Provided method
fn query_latest_height(&self) -> Result<Height, Error> { ... }
}
Required Methods§
fn new(chain_id: ChainId, sender: Sender<(Span, ChainRequest)>) -> Self
sourcefn health_check(&self) -> Result<HealthCheck, Error>
fn health_check(&self) -> Result<HealthCheck, Error>
Perform a health check
sourcefn subscribe(&self) -> Result<Receiver<Arc<Result<EventBatch, Error>>>, Error>
fn subscribe(&self) -> Result<Receiver<Arc<Result<EventBatch, Error>>>, Error>
Subscribe to the events emitted by the chain.
sourcefn send_messages_and_wait_commit(
&self,
tracked_msgs: TrackedMsgs
) -> Result<Vec<IbcEventWithHeight>, Error>
fn send_messages_and_wait_commit( &self, tracked_msgs: TrackedMsgs ) -> Result<Vec<IbcEventWithHeight>, Error>
Send the given msgs
to the chain, packaged as one or more transactions,
and return the list of events emitted by the chain after the transaction was committed.
sourcefn send_messages_and_wait_check_tx(
&self,
tracked_msgs: TrackedMsgs
) -> Result<Vec<Response>, Error>
fn send_messages_and_wait_check_tx( &self, tracked_msgs: TrackedMsgs ) -> Result<Vec<Response>, Error>
Submit messages asynchronously. Does not block waiting on the chain to produce the resulting events. Instead of events, this method returns a set of transaction hashes.
fn get_signer(&self) -> Result<Signer, Error>
fn config(&self) -> Result<ChainConfig, Error>
fn get_key(&self) -> Result<AnySigningKeyPair, Error>
fn add_key(&self, key_name: String, key: AnySigningKeyPair) -> Result<(), Error>
sourcefn ibc_version(&self) -> Result<Option<Version>, Error>
fn ibc_version(&self) -> Result<Option<Version>, Error>
Return the version of the IBC protocol that this chain is running, if known.
sourcefn query_balance(
&self,
key_name: Option<String>,
denom: Option<String>
) -> Result<Balance, Error>
fn query_balance( &self, key_name: Option<String>, denom: Option<String> ) -> Result<Balance, Error>
Query the balance of the given account for the given denom. If no account is given, behavior must be specified, e.g. retrieve it from configuration file. If no denom is given, behavior must be specified, e.g. using the denom used to pay tx fees
sourcefn query_all_balances(
&self,
key_name: Option<String>
) -> Result<Vec<Balance>, Error>
fn query_all_balances( &self, key_name: Option<String> ) -> Result<Vec<Balance>, Error>
Query the balances from all denom of the given account. If no account is given, behavior must be specified, e.g. retrieve it from configuration file.
sourcefn query_denom_trace(&self, hash: String) -> Result<DenomTrace, Error>
fn query_denom_trace(&self, hash: String) -> Result<DenomTrace, Error>
Query the denomination trace given a trace hash.
sourcefn query_application_status(&self) -> Result<ChainStatus, Error>
fn query_application_status(&self) -> Result<ChainStatus, Error>
Query the latest height and timestamp the application is at
sourcefn query_clients(
&self,
request: QueryClientStatesRequest
) -> Result<Vec<IdentifiedAnyClientState>, Error>
fn query_clients( &self, request: QueryClientStatesRequest ) -> Result<Vec<IdentifiedAnyClientState>, Error>
Performs a query to retrieve the state of all clients that a chain hosts.
sourcefn query_client_state(
&self,
request: QueryClientStateRequest,
include_proof: IncludeProof
) -> Result<(AnyClientState, Option<MerkleProof>), Error>
fn query_client_state( &self, request: QueryClientStateRequest, include_proof: IncludeProof ) -> Result<(AnyClientState, Option<MerkleProof>), Error>
Performs a query to retrieve the state of the specified light client. A proof can optionally be returned along with the result.
sourcefn query_client_connections(
&self,
request: QueryClientConnectionsRequest
) -> Result<Vec<ConnectionId>, Error>
fn query_client_connections( &self, request: QueryClientConnectionsRequest ) -> Result<Vec<ConnectionId>, Error>
Performs a query to retrieve the identifiers of all connections.
sourcefn query_consensus_state(
&self,
request: QueryConsensusStateRequest,
include_proof: IncludeProof
) -> Result<(AnyConsensusState, Option<MerkleProof>), Error>
fn query_consensus_state( &self, request: QueryConsensusStateRequest, include_proof: IncludeProof ) -> Result<(AnyConsensusState, Option<MerkleProof>), Error>
Query the consensus state at the specified height for a given client.
sourcefn query_consensus_state_heights(
&self,
request: QueryConsensusStateHeightsRequest
) -> Result<Vec<Height>, Error>
fn query_consensus_state_heights( &self, request: QueryConsensusStateHeightsRequest ) -> Result<Vec<Height>, Error>
Query the heights of every consensus state for a given client.
fn query_upgraded_client_state( &self, request: QueryUpgradedClientStateRequest ) -> Result<(AnyClientState, MerkleProof), Error>
fn query_upgraded_consensus_state( &self, request: QueryUpgradedConsensusStateRequest ) -> Result<(AnyConsensusState, MerkleProof), Error>
fn query_commitment_prefix(&self) -> Result<CommitmentPrefix, Error>
fn query_compatible_versions(&self) -> Result<Vec<Version>, Error>
sourcefn query_connection(
&self,
request: QueryConnectionRequest,
include_proof: IncludeProof
) -> Result<(ConnectionEnd, Option<MerkleProof>), Error>
fn query_connection( &self, request: QueryConnectionRequest, include_proof: IncludeProof ) -> Result<(ConnectionEnd, Option<MerkleProof>), Error>
Performs a query to retrieve the connection associated with a given connection identifier. A proof can optionally be returned along with the result.
sourcefn query_connections(
&self,
request: QueryConnectionsRequest
) -> Result<Vec<IdentifiedConnectionEnd>, Error>
fn query_connections( &self, request: QueryConnectionsRequest ) -> Result<Vec<IdentifiedConnectionEnd>, Error>
Performs a query to retrieve the identifiers of all connections.
sourcefn query_connection_channels(
&self,
request: QueryConnectionChannelsRequest
) -> Result<Vec<IdentifiedChannelEnd>, Error>
fn query_connection_channels( &self, request: QueryConnectionChannelsRequest ) -> Result<Vec<IdentifiedChannelEnd>, Error>
Performs a query to retrieve all channels associated with a connection.
sourcefn query_next_sequence_receive(
&self,
request: QueryNextSequenceReceiveRequest,
include_proof: IncludeProof
) -> Result<(Sequence, Option<MerkleProof>), Error>
fn query_next_sequence_receive( &self, request: QueryNextSequenceReceiveRequest, include_proof: IncludeProof ) -> Result<(Sequence, Option<MerkleProof>), Error>
Performs a query to retrieve nextSequenceRecv
stored at path
path::SeqRecvsPath
as defined in ICS-4. A proof can optionally be
returned along with the result.
sourcefn query_channels(
&self,
request: QueryChannelsRequest
) -> Result<Vec<IdentifiedChannelEnd>, Error>
fn query_channels( &self, request: QueryChannelsRequest ) -> Result<Vec<IdentifiedChannelEnd>, Error>
Performs a query to retrieve all the channels of a chain.
sourcefn query_channel(
&self,
request: QueryChannelRequest,
include_proof: IncludeProof
) -> Result<(ChannelEnd, Option<MerkleProof>), Error>
fn query_channel( &self, request: QueryChannelRequest, include_proof: IncludeProof ) -> Result<(ChannelEnd, Option<MerkleProof>), Error>
Performs a query to retrieve the channel associated with a given channel identifier. A proof can optionally be returned along with the result.
sourcefn query_channel_client_state(
&self,
request: QueryChannelClientStateRequest
) -> Result<Option<IdentifiedAnyClientState>, Error>
fn query_channel_client_state( &self, request: QueryChannelClientStateRequest ) -> Result<Option<IdentifiedAnyClientState>, Error>
Performs a query to retrieve the client state for the channel associated with a given channel identifier.
fn build_header( &self, trusted_height: Height, target_height: Height, client_state: AnyClientState ) -> Result<(AnyHeader, Vec<AnyHeader>), Error>
sourcefn build_client_state(
&self,
height: Height,
settings: ClientSettings
) -> Result<AnyClientState, Error>
fn build_client_state( &self, height: Height, settings: ClientSettings ) -> Result<AnyClientState, Error>
Constructs a client state at the given height
sourcefn build_consensus_state(
&self,
trusted: Height,
target: Height,
client_state: AnyClientState
) -> Result<AnyConsensusState, Error>
fn build_consensus_state( &self, trusted: Height, target: Height, client_state: AnyClientState ) -> Result<AnyConsensusState, Error>
Constructs a consensus state at the given height
fn check_misbehaviour( &self, update: UpdateClient, client_state: AnyClientState ) -> Result<Option<MisbehaviourEvidence>, Error>
fn build_connection_proofs_and_client_state( &self, message_type: ConnectionMsgType, connection_id: &ConnectionId, client_id: &ClientId, height: Height ) -> Result<(Option<AnyClientState>, Proofs), Error>
fn build_channel_proofs( &self, port_id: &PortId, channel_id: &ChannelId, height: Height ) -> Result<Proofs, Error>
fn build_packet_proofs( &self, packet_type: PacketMsgType, port_id: &PortId, channel_id: &ChannelId, sequence: Sequence, height: Height ) -> Result<Proofs, Error>
sourcefn query_packet_commitment(
&self,
request: QueryPacketCommitmentRequest,
include_proof: IncludeProof
) -> Result<(Vec<u8>, Option<MerkleProof>), Error>
fn query_packet_commitment( &self, request: QueryPacketCommitmentRequest, include_proof: IncludeProof ) -> Result<(Vec<u8>, Option<MerkleProof>), Error>
Performs a query to retrieve a stored packet commitment hash, stored on
the chain at path path::CommitmentsPath
. A proof can optionally be
returned along with the result.
sourcefn query_packet_commitments(
&self,
request: QueryPacketCommitmentsRequest
) -> Result<(Vec<Sequence>, Height), Error>
fn query_packet_commitments( &self, request: QueryPacketCommitmentsRequest ) -> Result<(Vec<Sequence>, Height), Error>
Performs a query to retrieve all the packet commitments hashes associated with a channel. Returns the corresponding packet sequence numbers and the height at which they were retrieved.
sourcefn query_packet_receipt(
&self,
request: QueryPacketReceiptRequest,
include_proof: IncludeProof
) -> Result<(Vec<u8>, Option<MerkleProof>), Error>
fn query_packet_receipt( &self, request: QueryPacketReceiptRequest, include_proof: IncludeProof ) -> Result<(Vec<u8>, Option<MerkleProof>), Error>
Performs a query to retrieve a given packet receipt, stored on the chain at path
path::CommitmentsPath
. A proof can optionally be returned along with the result.
sourcefn query_unreceived_packets(
&self,
request: QueryUnreceivedPacketsRequest
) -> Result<Vec<Sequence>, Error>
fn query_unreceived_packets( &self, request: QueryUnreceivedPacketsRequest ) -> Result<Vec<Sequence>, Error>
Performs a query about which IBC packets in the specified list has not been received. Returns the sequence numbers of the packets that were not received.
For example, given a request with the sequence numbers [5,6,7,8]
, a
response of [7,8]
would indicate that packets 5 & 6 were received,
while packets 7, 8 were not.
sourcefn query_packet_acknowledgement(
&self,
request: QueryPacketAcknowledgementRequest,
include_proof: IncludeProof
) -> Result<(Vec<u8>, Option<MerkleProof>), Error>
fn query_packet_acknowledgement( &self, request: QueryPacketAcknowledgementRequest, include_proof: IncludeProof ) -> Result<(Vec<u8>, Option<MerkleProof>), Error>
Performs a query to retrieve a stored packet acknowledgement hash,
stored on the chain at path path::AcksPath
. A proof can optionally be
returned along with the result.
sourcefn query_packet_acknowledgements(
&self,
request: QueryPacketAcknowledgementsRequest
) -> Result<(Vec<Sequence>, Height), Error>
fn query_packet_acknowledgements( &self, request: QueryPacketAcknowledgementsRequest ) -> Result<(Vec<Sequence>, Height), Error>
Performs a query to retrieve all the packet acknowledgements associated with a channel. Returns the corresponding packet sequence numbers and the height at which they were retrieved.
sourcefn query_unreceived_acknowledgements(
&self,
request: QueryUnreceivedAcksRequest
) -> Result<Vec<Sequence>, Error>
fn query_unreceived_acknowledgements( &self, request: QueryUnreceivedAcksRequest ) -> Result<Vec<Sequence>, Error>
Performs a query about which IBC packets in the specified list has not been acknowledged. Returns the sequence numbers of the packets that were not acknowledged.
For example, given a request with the sequence numbers [5,6,7,8]
, a
response of [7,8]
would indicate that packets 5 & 6 were acknowledged,
while packets 7, 8 were not.
fn query_txs( &self, request: QueryTxRequest ) -> Result<Vec<IbcEventWithHeight>, Error>
fn query_packet_events( &self, request: QueryPacketEventDataRequest ) -> Result<Vec<IbcEventWithHeight>, Error>
fn query_host_consensus_state( &self, request: QueryHostConsensusStateRequest ) -> Result<AnyConsensusState, Error>
fn maybe_register_counterparty_payee( &self, channel_id: ChannelId, port_id: PortId, counterparty_payee: Signer ) -> Result<(), Error>
fn cross_chain_query( &self, request: Vec<CrossChainQueryRequest> ) -> Result<Vec<CrossChainQueryResponse>, Error>
fn query_incentivized_packet( &self, request: QueryIncentivizedPacketRequest ) -> Result<QueryIncentivizedPacketResponse, Error>
fn query_consumer_chains(&self) -> Result<Vec<(ChainId, ClientId)>, Error>
Provided Methods§
fn query_latest_height(&self) -> Result<Height, Error>
Object Safety§
Implementors§
impl ChainHandle for BaseChainHandle
impl<Handle> ChainHandle for CountingChainHandle<Handle>where Handle: ChainHandle,
impl<Tag, Handle> ChainHandle for MonoTagged<Tag, Handle>where Tag: Send + Sync + 'static, Handle: ChainHandle,
Implement ChainHandle
for any existential type Handle: ChainHandle
.
This allows us to tag values for chains that are tagged by position
in N-ary chains.