mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 20:55:41 +00:00
xcm: Change TypeInfo::path to not include staging (#1948)
The `xcm` crate was renamed to `staging-xcm` to be able to publish it to crates.io as someone as squatted `xcm`. The problem with this rename is that the `TypeInfo` includes the crate name which ultimately lands in the metadata. The metadata is consumed by downstream users like `polkadot-js` or people building on top of `polkadot-js`. These people are using the entire `path` to find the type in the type registry. Thus, their code would break as the type path would now be [`staging_xcm`, `VersionedXcm`] instead of [`xcm`, `VersionedXcm`]. This pull request fixes this by renaming the path segment `staging_xcm` to `xcm`. This requires: https://github.com/paritytech/scale-info/pull/197 --------- Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
This commit is contained in:
@@ -27,6 +27,7 @@ use scale_info::TypeInfo;
|
||||
/// Each item assumes a pre-existing location as its context and is defined in terms of it.
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum Junction {
|
||||
/// An indexed parachain belonging to and operated by the context.
|
||||
///
|
||||
|
||||
@@ -81,6 +81,7 @@ pub use traits::{Error, ExecuteXcm, GetWeight, Outcome, Result, SendError, SendR
|
||||
|
||||
/// Basically just the XCM (more general) version of `ParachainDispatchOrigin`.
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Encode, Decode, Debug, TypeInfo)]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum OriginKind {
|
||||
/// Origin should just be the native dispatch origin representation for the sender in the
|
||||
/// local runtime framework. For Cumulus/Frame chains this is the `Parachain` or `Relay` origin
|
||||
@@ -105,6 +106,7 @@ pub enum OriginKind {
|
||||
/// A global identifier of an account-bearing consensus system.
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum NetworkId {
|
||||
/// Unidentified/any.
|
||||
Any,
|
||||
@@ -141,6 +143,7 @@ impl TryFrom<NewNetworkId> for NetworkId {
|
||||
/// An identifier of a pluralistic body.
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum BodyId {
|
||||
/// The only body in its context.
|
||||
Unit,
|
||||
@@ -195,6 +198,7 @@ impl From<NewBodyId> for BodyId {
|
||||
/// A part of a pluralistic body.
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum BodyPart {
|
||||
/// The body's declaration, under whatever means it decides.
|
||||
Voice,
|
||||
@@ -262,6 +266,7 @@ pub type QueryId = u64;
|
||||
#[codec(encode_bound())]
|
||||
#[codec(decode_bound())]
|
||||
#[scale_info(bounds(), skip_type_params(RuntimeCall))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub struct Xcm<RuntimeCall>(pub Vec<Instruction<RuntimeCall>>);
|
||||
|
||||
impl<RuntimeCall> Xcm<RuntimeCall> {
|
||||
@@ -357,6 +362,7 @@ pub mod prelude {
|
||||
|
||||
/// Response data to a query.
|
||||
#[derive(Clone, Eq, PartialEq, Encode, Decode, Debug, TypeInfo)]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum Response {
|
||||
/// No response. Serves as a neutral default.
|
||||
Null,
|
||||
@@ -376,6 +382,7 @@ impl Default for Response {
|
||||
|
||||
/// An optional weight limit.
|
||||
#[derive(Clone, Eq, PartialEq, Encode, Decode, Debug, TypeInfo)]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum WeightLimit {
|
||||
/// No weight limit imposed.
|
||||
Unlimited,
|
||||
@@ -428,6 +435,7 @@ pub type Weight = u64;
|
||||
#[codec(encode_bound())]
|
||||
#[codec(decode_bound())]
|
||||
#[scale_info(bounds(), skip_type_params(RuntimeCall))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum Instruction<RuntimeCall> {
|
||||
/// Withdraw asset(s) (`assets`) from the ownership of `origin` and place them into the Holding
|
||||
/// Register.
|
||||
|
||||
@@ -41,6 +41,7 @@ use scale_info::TypeInfo;
|
||||
/// A general identifier for an instance of a non-fungible asset class.
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum AssetInstance {
|
||||
/// Undefined - used if the non-fungible asset class has only one instance.
|
||||
Undefined,
|
||||
@@ -119,6 +120,7 @@ impl TryFrom<NewAssetInstance> for AssetInstance {
|
||||
/// Classification of an asset being concrete or abstract.
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Encode, Decode, TypeInfo)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum AssetId {
|
||||
Concrete(MultiLocation),
|
||||
Abstract(Vec<u8>),
|
||||
@@ -185,6 +187,7 @@ impl AssetId {
|
||||
/// instance.
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Encode, Decode, TypeInfo)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum Fungibility {
|
||||
Fungible(#[codec(compact)] u128),
|
||||
NonFungible(AssetInstance),
|
||||
@@ -224,6 +227,7 @@ impl TryFrom<NewFungibility> for Fungibility {
|
||||
|
||||
#[derive(Clone, Eq, PartialEq, Debug, Encode, Decode, TypeInfo)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub struct MultiAsset {
|
||||
pub id: AssetId,
|
||||
pub fun: Fungibility,
|
||||
@@ -309,6 +313,7 @@ impl TryFrom<NewMultiAsset> for MultiAsset {
|
||||
/// they must be sorted.
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Encode, TypeInfo)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub struct MultiAssets(Vec<MultiAsset>);
|
||||
|
||||
impl Decode for MultiAssets {
|
||||
@@ -479,6 +484,7 @@ impl MultiAssets {
|
||||
/// Classification of whether an asset is fungible or not.
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Encode, Decode, TypeInfo)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum WildFungibility {
|
||||
Fungible,
|
||||
NonFungible,
|
||||
@@ -498,6 +504,7 @@ impl TryFrom<NewWildFungibility> for WildFungibility {
|
||||
/// A wildcard representing a set of assets.
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Encode, Decode, TypeInfo)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum WildMultiAsset {
|
||||
/// All assets in the holding register, up to `usize` individual assets (different instances of
|
||||
/// non-fungibles could be separate assets).
|
||||
@@ -543,6 +550,7 @@ impl<A: Into<AssetId>, B: Into<WildFungibility>> From<(A, B)> for WildMultiAsset
|
||||
/// in this implementation and will result in a decode error.
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Encode, Decode, TypeInfo)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum MultiAssetFilter {
|
||||
Definite(MultiAssets),
|
||||
Wild(WildMultiAsset),
|
||||
|
||||
@@ -50,6 +50,7 @@ use scale_info::TypeInfo;
|
||||
/// The `MultiLocation` value of `Null` simply refers to the interpreting consensus system.
|
||||
#[derive(Clone, Decode, Encode, Eq, PartialEq, Ord, PartialOrd, Debug, TypeInfo, MaxEncodedLen)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub struct MultiLocation {
|
||||
/// The number of parent junctions at the beginning of this `MultiLocation`.
|
||||
pub parents: u8,
|
||||
@@ -465,6 +466,7 @@ const MAX_JUNCTIONS: usize = 8;
|
||||
/// instructions on constructing parent junctions.
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum Junctions {
|
||||
/// The interpreting consensus system.
|
||||
Here,
|
||||
|
||||
@@ -29,6 +29,7 @@ pub trait GetWeight<W> {
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Encode, Decode, Eq, PartialEq, Debug, TypeInfo)]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum Error {
|
||||
// Errors that happen due to instructions being executed. These alone are defined in the
|
||||
// XCM specification.
|
||||
@@ -165,6 +166,7 @@ pub type Result = result::Result<(), Error>;
|
||||
|
||||
/// Outcome of an XCM execution.
|
||||
#[derive(Clone, Encode, Decode, Eq, PartialEq, Debug, TypeInfo)]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum Outcome {
|
||||
/// Execution completed successfully; given weight was used.
|
||||
Complete(Weight),
|
||||
@@ -246,6 +248,7 @@ impl<C> ExecuteXcm<C> for () {
|
||||
|
||||
/// Error result value when attempting to send an XCM message.
|
||||
#[derive(Clone, Encode, Decode, Eq, PartialEq, Debug, scale_info::TypeInfo)]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum SendError {
|
||||
/// The message and destination combination was not recognized as being reachable.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user