Skip to content

Metadata v16: Include PalletViewFunctions into metadata #6833

Open
@lexnv

Description

The current plan is to merge pallet view functions by the end of year/beginning of next year:

We'll need to expose the pallet view functions from the linked PR into metadata V16.
This will include adding RuntimeViewFunctions structures into frame-metadata and exposing this information from substrate.

At the time of writing, the structures exposed will look similar to:

pub struct RuntimeViewFunctions<T: Form = MetaForm> {
	/// The type implementing the runtime query dispatch.
	pub ty: T::Type,
	/// The view function groupings metadata.
	pub groups: Vec<ViewFunctionGroupIR<T>>,
}

pub struct ViewFunctionGroupIR<T: Form = MetaForm> {
	/// Name of the view function group.
	pub name: T::String,
	/// View functions belonging to the group.
	pub view_functions: Vec<ViewFunctionMetadataIR<T>>,
	/// View function group documentation.
	pub docs: Vec<T::String>,
}

pub struct ViewFunctionMetadataIR<T: Form = MetaForm> {
	/// Query name.
	pub name: T::String,
	/// Query id.
	pub id: [u8; 32],
	/// Query args.
	pub args: Vec<ViewFunctionArgMetadataIR<T>>,
	/// Query output.
	pub output: T::Type,
	/// Query documentation.
	pub docs: Vec<T::String>,
}

pub struct ViewFunctionArgMetadataIR<T: Form = MetaForm> {
	/// Query argument name.
	pub name: T::String,
	/// Query argument type.
	pub ty: T::Type,
}

Since reviews might affect this format (e.g., moving view fn at the pallet level: #4722 (comment)), we'll start working on it once the PR is merged.

cc @paritytech/subxt-team

Metadata

Assignees

No one assigned

    Labels

    I5-enhancementAn additional feature request.T1-FRAMEThis PR/Issue is related to core FRAME, the framework.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions