Metadata V16: Implement support for Pallet View Functions (#1981)

* Support Pallet View Functions in Subxt

* fmt

* clippy

* Move a little view function logic to subxt_core

* clippy

* Add back check that prob isnt needed

* avoid vec macro in core

* Add view funciton test and apply various fixes to get it working

* Add test for dynamic view fn call and fix issues

* clippy

* fix test-runtime

* fmt

* remove export

* avoid vec for nostd core

* use const instead of fn for view fn call name

* Update to support latest unstable metadata

* Update metadata stripping tests for new v16 version
This commit is contained in:
James Wilson
2025-04-24 14:42:07 +01:00
committed by GitHub
parent 21b3f52191
commit 4524590821
28 changed files with 875 additions and 108 deletions
+6 -5
View File
@@ -439,6 +439,7 @@ mod test {
use std::collections::BTreeMap;
use super::*;
use codec::Compact;
use scale_info::meta_type;
/// Create dummy types that we can check the presense of with is_in_types.
@@ -817,7 +818,7 @@ mod test {
view_functions: vec![v16::PalletViewFunctionMetadata {
name: "some_view_function",
id: [0; 32],
inputs: vec![v16::PalletViewFunctionParamMetadata {
inputs: vec![v16::FunctionParamMetadata {
name: "input1",
ty: meta_type::<F>(),
}],
@@ -842,12 +843,12 @@ mod test {
let runtime_apis = vec![
v16::RuntimeApiMetadata {
name: "SomeApi",
version: 2,
version: Compact(2),
docs: vec![],
deprecation_info: v16::DeprecationStatus::NotDeprecated,
methods: vec![v16::RuntimeApiMethodMetadata {
name: "some_method",
inputs: vec![v16::RuntimeApiMethodParamMetadata {
inputs: vec![v16::FunctionParamMetadata {
name: "input1",
ty: meta_type::<J>(),
}],
@@ -858,12 +859,12 @@ mod test {
},
v16::RuntimeApiMetadata {
name: "AnotherApi",
version: 1,
version: Compact(1),
docs: vec![],
deprecation_info: v16::DeprecationStatus::NotDeprecated,
methods: vec![v16::RuntimeApiMethodMetadata {
name: "another_method",
inputs: vec![v16::RuntimeApiMethodParamMetadata {
inputs: vec![v16::FunctionParamMetadata {
name: "input1",
ty: meta_type::<L>(),
}],