Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata v16: Include PalletViewFunctions into metadata #6833

Open
Tracked by #4520
lexnv opened this issue Dec 10, 2024 · 0 comments
Open
Tracked by #4520

Metadata v16: Include PalletViewFunctions into metadata #6833

lexnv opened this issue Dec 10, 2024 · 0 comments
Labels
I5-enhancement An additional feature request. T1-FRAME This PR/Issue is related to core FRAME, the framework.

Comments

@lexnv
Copy link
Contributor

lexnv commented Dec 10, 2024

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

@lexnv lexnv added I5-enhancement An additional feature request. T1-FRAME This PR/Issue is related to core FRAME, the framework. labels Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I5-enhancement An additional feature request. T1-FRAME This PR/Issue is related to core FRAME, the framework.
Projects
None yet
Development

No branches or pull requests

1 participant