mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 00:11:01 +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:
@@ -49,6 +49,7 @@ use serde::{Deserialize, Serialize};
|
||||
Serialize,
|
||||
Deserialize,
|
||||
)]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum NetworkId {
|
||||
/// Network specified by the first 32 bytes of its genesis block.
|
||||
ByGenesis([u8; 32]),
|
||||
@@ -116,6 +117,7 @@ impl TryFrom<OldNetworkId> for NetworkId {
|
||||
Serialize,
|
||||
Deserialize,
|
||||
)]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum BodyId {
|
||||
/// The only body in its context.
|
||||
Unit,
|
||||
@@ -186,6 +188,7 @@ impl TryFrom<OldBodyId> for BodyId {
|
||||
Serialize,
|
||||
Deserialize,
|
||||
)]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum BodyPart {
|
||||
/// The body's declaration, under whatever means it decides.
|
||||
Voice,
|
||||
@@ -261,6 +264,7 @@ impl TryFrom<OldBodyPart> for BodyPart {
|
||||
Serialize,
|
||||
Deserialize,
|
||||
)]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum Junction {
|
||||
/// An indexed parachain belonging to and operated by the context.
|
||||
///
|
||||
|
||||
@@ -44,6 +44,7 @@ pub(crate) const MAX_JUNCTIONS: usize = 8;
|
||||
serde::Serialize,
|
||||
serde::Deserialize,
|
||||
)]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum Junctions {
|
||||
/// The interpreting consensus system.
|
||||
Here,
|
||||
|
||||
@@ -68,6 +68,7 @@ pub type QueryId = u64;
|
||||
#[derivative(Clone(bound = ""), Eq(bound = ""), PartialEq(bound = ""), Debug(bound = ""))]
|
||||
#[codec(encode_bound())]
|
||||
#[scale_info(bounds(), skip_type_params(Call))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub struct Xcm<Call>(pub Vec<Instruction<Call>>);
|
||||
|
||||
pub const MAX_INSTRUCTIONS_TO_DECODE: u8 = 100;
|
||||
@@ -236,6 +237,7 @@ parameter_types! {
|
||||
}
|
||||
|
||||
#[derive(Clone, Eq, PartialEq, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub struct PalletInfo {
|
||||
#[codec(compact)]
|
||||
index: u32,
|
||||
@@ -266,6 +268,7 @@ impl PalletInfo {
|
||||
}
|
||||
|
||||
#[derive(Clone, Eq, PartialEq, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum MaybeErrorCode {
|
||||
Success,
|
||||
Error(BoundedVec<u8, MaxDispatchErrorLen>),
|
||||
@@ -289,6 +292,7 @@ impl Default for MaybeErrorCode {
|
||||
|
||||
/// Response data to a query.
|
||||
#[derive(Clone, Eq, PartialEq, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum Response {
|
||||
/// No response. Serves as a neutral default.
|
||||
Null,
|
||||
@@ -312,6 +316,7 @@ impl Default for Response {
|
||||
|
||||
/// Information regarding the composition of a query response.
|
||||
#[derive(Clone, Eq, PartialEq, Encode, Decode, Debug, TypeInfo)]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub struct QueryResponseInfo {
|
||||
/// The destination to which the query response message should be send.
|
||||
pub destination: MultiLocation,
|
||||
@@ -324,6 +329,7 @@ pub struct QueryResponseInfo {
|
||||
|
||||
/// 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,
|
||||
@@ -400,6 +406,7 @@ impl XcmContext {
|
||||
#[codec(encode_bound())]
|
||||
#[codec(decode_bound())]
|
||||
#[scale_info(bounds(), skip_type_params(Call))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum Instruction<Call> {
|
||||
/// Withdraw asset(s) (`assets`) from the ownership of `origin` and place them into the Holding
|
||||
/// Register.
|
||||
|
||||
@@ -47,6 +47,7 @@ use scale_info::TypeInfo;
|
||||
Copy, 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 AssetInstance {
|
||||
/// Undefined - used if the non-fungible asset class has only one instance.
|
||||
Undefined,
|
||||
@@ -242,6 +243,7 @@ impl TryFrom<AssetInstance> for u128 {
|
||||
/// instance.
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Encode, TypeInfo, MaxEncodedLen)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum Fungibility {
|
||||
/// A fungible asset; we record a number of units, as a `u128` in the inner item.
|
||||
Fungible(#[codec(compact)] u128),
|
||||
@@ -311,6 +313,7 @@ impl TryFrom<OldFungibility> for Fungibility {
|
||||
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Encode, Decode, TypeInfo, MaxEncodedLen,
|
||||
)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum WildFungibility {
|
||||
/// The asset is fungible.
|
||||
Fungible,
|
||||
@@ -334,6 +337,7 @@ impl TryFrom<OldWildFungibility> for WildFungibility {
|
||||
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Encode, Decode, TypeInfo, MaxEncodedLen,
|
||||
)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum AssetId {
|
||||
/// A specific location identifying an asset.
|
||||
Concrete(MultiLocation),
|
||||
@@ -408,6 +412,7 @@ impl AssetId {
|
||||
/// Either an amount of a single fungible asset, or a single well-identified non-fungible asset.
|
||||
#[derive(Clone, Eq, PartialEq, Debug, Encode, Decode, TypeInfo, MaxEncodedLen)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub struct MultiAsset {
|
||||
/// The overall asset identity (aka *class*, in the case of a non-fungible).
|
||||
pub id: AssetId,
|
||||
@@ -505,6 +510,7 @@ impl TryFrom<OldMultiAsset> for MultiAsset {
|
||||
/// - The number of items should grow no larger than `MAX_ITEMS_IN_MULTIASSETS`.
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Encode, TypeInfo, Default)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub struct MultiAssets(Vec<MultiAsset>);
|
||||
|
||||
/// Maximum number of items in a single `MultiAssets` value that can be decoded.
|
||||
@@ -700,6 +706,7 @@ impl MultiAssets {
|
||||
/// A wildcard representing a set of assets.
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Encode, Decode, TypeInfo, MaxEncodedLen)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum WildMultiAsset {
|
||||
/// All assets in Holding.
|
||||
All,
|
||||
@@ -812,6 +819,7 @@ impl<A: Into<AssetId>, B: Into<WildFungibility>> From<(A, B)> for WildMultiAsset
|
||||
/// `MultiAsset` collection, defined either by a number of `MultiAssets` or a single wildcard.
|
||||
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Encode, Decode, TypeInfo, MaxEncodedLen)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[scale_info(replace_segment("staging_xcm", "xcm"))]
|
||||
pub enum MultiAssetFilter {
|
||||
/// Specify the filter as being everything contained by the given `MultiAssets` inner.
|
||||
Definite(MultiAssets),
|
||||
|
||||
@@ -29,6 +29,7 @@ use super::*;
|
||||
/// format. Those trailing are merely part of the XCM implementation; there is no expectation that
|
||||
/// they will retain the same index over time.
|
||||
#[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.
|
||||
@@ -262,6 +263,7 @@ impl From<Error> for Outcome {
|
||||
|
||||
/// 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),
|
||||
@@ -410,6 +412,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