# Pallet ISMP Runtime API This exports the runtime API definitions required by client subsystems like the RPC. ## Usage The required methods are already implemented in [`pallet_ismp::Pallet`](https://docs.rs/pallet-ismp/latest/pallet_ismp/pallet/struct.Pallet.html) ```rust,ignore sp_api::impl_runtime_apis! { impl pallet_ismp_runtime_api::IsmpRuntimeApi::Hash> for Runtime { fn host_state_machine() -> StateMachine { ::HostStateMachine::get() } fn challenge_period(consensus_state_id: [u8; 4]) -> Option { pallet_ismp::Pallet::::challenge_period(consensus_state_id) } /// Generate a proof for the provided leaf indices fn generate_proof( keys: ProofKeys ) -> Result<(Vec, Proof<::Hash>), sp_mmr_primitives::Error> { pallet_ismp::Pallet::::generate_proof(keys) } /// Fetch all ISMP events and their extrinsic metadata, should only be called from runtime-api. fn block_events() -> Vec { pallet_ismp::Pallet::::block_events() } /// Fetch all ISMP events and their extrinsic metadata fn block_events_with_metadata() -> Vec<(ismp::events::Event, Option)> { pallet_ismp::Pallet::::block_events_with_metadata() } /// Return the scale encoded consensus state fn consensus_state(id: ConsensusClientId) -> Option> { pallet_ismp::Pallet::::consensus_states(id) } /// Return the timestamp this client was last updated in seconds fn consensus_update_time(id: ConsensusClientId) -> Option { pallet_ismp::Pallet::::consensus_update_time(id) } /// Return the latest height of the state machine fn latest_state_machine_height(id: StateMachineId) -> Option { pallet_ismp::Pallet::::latest_state_machine_height(id) } /// Get actual requests fn get_requests(commitments: Vec) -> Vec { pallet_ismp::Pallet::::requests(commitments) } /// Get actual requests fn get_responses(commitments: Vec) -> Vec { pallet_ismp::Pallet::::responses(commitments) } } } ``` ## License This library is licensed under the Apache 2.0 License, Copyright (c) 2024 Polytope Labs.