Crates.io | pallet-ismp-runtime-api |
lib.rs | pallet-ismp-runtime-api |
version | |
source | src |
created_at | 2024-05-02 13:47:46.131603 |
updated_at | 2024-12-10 14:00:46.966921 |
description | The substrate runtime API for pallet-ismp |
homepage | https://docs.hyperbridge.network/developers/polkadot/getting-started |
repository | https://github.com/polytope-labs/hyperbridge |
max_upload_size | |
id | 1227756 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
This exports the runtime API definitions required by client subsystems like the RPC.
The required methods are already implemented in pallet_ismp::Pallet<T>
sp_api::impl_runtime_apis! {
impl pallet_ismp_runtime_api::IsmpRuntimeApi<Block, <Block as BlockT>::Hash> for Runtime {
fn host_state_machine() -> StateMachine {
<Runtime as pallet_ismp::Config>::HostStateMachine::get()
}
fn challenge_period(consensus_state_id: [u8; 4]) -> Option<u64> {
pallet_ismp::Pallet::<Runtime>::challenge_period(consensus_state_id)
}
/// Generate a proof for the provided leaf indices
fn generate_proof(
keys: ProofKeys
) -> Result<(Vec<Leaf>, Proof<<Block as BlockT>::Hash>), sp_mmr_primitives::Error> {
pallet_ismp::Pallet::<Runtime>::generate_proof(keys)
}
/// Fetch all ISMP events and their extrinsic metadata, should only be called from runtime-api.
fn block_events() -> Vec<ismp::events::Event> {
pallet_ismp::Pallet::<Runtime>::block_events()
}
/// Fetch all ISMP events and their extrinsic metadata
fn block_events_with_metadata() -> Vec<(ismp::events::Event, Option<u32>)> {
pallet_ismp::Pallet::<Runtime>::block_events_with_metadata()
}
/// Return the scale encoded consensus state
fn consensus_state(id: ConsensusClientId) -> Option<Vec<u8>> {
pallet_ismp::Pallet::<Runtime>::consensus_states(id)
}
/// Return the timestamp this client was last updated in seconds
fn consensus_update_time(id: ConsensusClientId) -> Option<u64> {
pallet_ismp::Pallet::<Runtime>::consensus_update_time(id)
}
/// Return the latest height of the state machine
fn latest_state_machine_height(id: StateMachineId) -> Option<u64> {
pallet_ismp::Pallet::<Runtime>::latest_state_machine_height(id)
}
/// Get actual requests
fn get_requests(commitments: Vec<H256>) -> Vec<Request> {
pallet_ismp::Pallet::<Runtime>::requests(commitments)
}
/// Get actual requests
fn get_responses(commitments: Vec<H256>) -> Vec<Response> {
pallet_ismp::Pallet::<Runtime>::responses(commitments)
}
}
}
This library is licensed under the Apache 2.0 License, Copyright (c) 2024 Polytope Labs.