You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Developers use associated types from pallet config traits to determine how to encode transactions (ie what hash is used by the node, the accountId, asset id etc). For example, subxt uses the following configs for Substrate and Polkadot to communicate with different chains.
This information can be exposed in the metadata V16, initially as unstable metadata (version u32::max).
Types included in the metadata must implement scale_info::TypeInfo.
Default to include associated types to metadata
By default, all associated types from config traits are captured in the metadata:
Developers use associated types from pallet config traits to determine how to encode transactions (ie what hash is used by the node, the accountId, asset id etc). For example, subxt uses the following configs for Substrate and Polkadot to communicate with different chains.
This information can be exposed in the metadata V16, initially as unstable metadata (version u32::max).
Types included in the metadata must implement
scale_info::TypeInfo
.Default to include associated types to metadata
By default, all associated types from config traits are captured in the metadata:
polkadot-sdk/substrate/frame/system/src/lib.rs
Lines 481 to 518 in 313fe0f
Opt-out of associated types from metadata
Developers that do not want to include types into the metadata can specify it by the following attribute (name tbd):
Selectively include associated types
There might be scenarios where only a single associated type is needed to express the pallet in the metadata.
One such case is the AssetId:
polkadot-sdk/substrate/frame/assets/src/lib.rs
Lines 294 to 295 in 313fe0f
In this example, the
AssetId
is selectively included in the metadata, where theSecondType
is not included.PoC to capture associated types: #4358
PoC in subx to use associated metadata types: paritytech/subxt#1566
cc @jsdw @niklasad1 @bkchr @paritytech/subxt-team
The text was updated successfully, but these errors were encountered: