10 stable releases (4 major)

2503.0.0 May 28, 2025
2412.0.0 May 14, 2025
16.0.0 Feb 3, 2025
15.0.0 Jan 10, 2025
1.6.2 May 10, 2024

#7 in #ismp

Download history 236/week @ 2025-02-25 99/week @ 2025-03-04 177/week @ 2025-03-11 115/week @ 2025-03-18 98/week @ 2025-03-25 44/week @ 2025-04-01 181/week @ 2025-04-08 220/week @ 2025-04-15 254/week @ 2025-04-22 43/week @ 2025-04-29 103/week @ 2025-05-06 212/week @ 2025-05-13 155/week @ 2025-05-20 296/week @ 2025-05-27 112/week @ 2025-06-03 119/week @ 2025-06-10

691 downloads per month
Used in 2 crates

Apache-2.0 and maybe GPL-3.0-only

275KB
3.5K SLoC

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<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)
        }

        /// 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)
        }
    }
}

License

This library is licensed under the Apache 2.0 License, Copyright (c) 2025 Polytope Labs.

Dependencies

~23–49MB
~871K SLoC