pallet_messages_runtime_api/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2#![allow(clippy::too_many_arguments)]
3#![allow(clippy::unnecessary_mut_passed)]
4#![allow(rustdoc::bare_urls)]
5// Strong Documentation Lints
6#![deny(
7	rustdoc::broken_intra_doc_links,
8	rustdoc::missing_crate_level_docs,
9	rustdoc::invalid_codeblock_attributes,
10	missing_docs
11)]
12
13//! Runtime API definition for [Messages](../pallet_messages/index.html)
14//!
15//! This api must be implemented by the node runtime.
16//! Runtime APIs Provide:
17//! - An interface between the runtime and Custom RPCs.
18//! - Runtime interfaces for end users beyond just State Queries
19
20use common_primitives::{messages::*, node::BlockNumber, schema::*};
21extern crate alloc;
22use alloc::vec::Vec;
23
24// Here we declare the runtime API. It is implemented it the `impl` block in
25// runtime files (the `runtime` folder)
26sp_api::decl_runtime_apis! {
27
28	/// Runtime Version for Messages
29	/// - MUST be incremented if anything changes
30	/// - See: https://paritytech.github.io/polkadot/doc/polkadot_primitives/runtime_api/index.html
31	#[api_version(1)]
32
33	/// Runtime APIs for [Messages](../pallet_messages/index.html)
34	pub trait MessagesRuntimeApi
35	{
36		/// Retrieve the messages for a particular schema and block number
37		// TODO: Remove once all RPC nodes have been updated to remove get_messages_by_schema_id RPC method
38		#[deprecated(note = "Please use get_messages_by_intent_and_block instead")]
39		fn get_messages_by_schema_and_block(schema_id: SchemaId, schema_payload_location: PayloadLocation, block_number: BlockNumber) ->
40			Vec<MessageResponse>;
41
42		/// Retrieve the messages for a particular intent and block range (paginated)
43		#[api_version(2)]
44		fn get_messages_by_intent_id(intent_id: IntentId, pagination: BlockPaginationRequest) -> BlockPaginationResponse<MessageResponseV2>;
45
46		/// Retrieve a schema by id
47		// TODO: Remove once all RPC nodes have been updated to call the schemas pallet runtime for this
48		#[deprecated(note = "Use SchemasRuntimeApi_get_schema_by_id instead")]
49		fn get_schema_by_id(schema_id: SchemaId) -> Option<SchemaResponse>;
50	}
51}