Crate xcm_builder
source ·Expand description
XCM-Builder
Types and helpers for building XCM configuration.
Modules
Structs
- Extracts the
AccountId32from the passedlocationif the network matches. - Alias a Foreign
AccountId32with a localAccountId32if the foreignAccountId32matches thePrefixpattern. - Conversion implementation which converts from a
[u8; 32]-basedAccountIdinto aMultiLocationconsisting solely of aAccountId32junction with a fixed value for its network (provided byNetwork) and theAccountId’s[u8; 32]datum for theid. - Allows execution from any origin that is contained in
T(i.e.T::Contains(origin)) if the message begins with the instructionUnpaidExecution. - Allows only messages if the generic
ResponseHandlerexpects them viaexpecting_response. - Allows execution from
originif it is just a straightSubscribeVersionorUnsubscribeVersioninstruction. - Allows execution from
originif it is contained inT(i.e.T::Contains(origin)) taking payments into account. - Allows execution from any origin that is contained in
T(i.e.T::Contains(origin)). - Converter struct implementing
AssetIdConversionconverting a numeric asset ID (must beTryFrom/TryInto<u128>) into aGeneralIndexjunction, prefixed by someMultiLocationvalue. TheMultiLocationvalue will typically be aPalletInstancejunction. Convertimplementation to convert from some an origin which implementsBackinginto a correspondingPluralityMultiLocation.- Accepts an asset if it is contained in the given
T’sGetimplementation. - Simple adapter to use a currency as asset transactor. This type can be used as
type AssetTransactorinxcm::Config. - Deny executing the XCM if it matches any of the Deny filter regardless of anything else. If it passes the Deny, and matches one of the Allow cases then it is let through.
- Implementation of
AssetCheckingwhich subjects a given set of assetsLto having their teleportations recorded with aMintLocation::Localand a second set of assetsRto having their teleportations recorded with aMintLocation::NonLocal. EnsureOriginbarrier to convert from dispatch origin to XCM origin, if one exists.- Adapter
structwhich implements a conversion from anyAssetKindinto a [LocatableAsset] value using a fixedLocationfor thelocationfield. - Simple fee calculator that requires payment in a single fungible at a fixed rate.
TransactAssetimplementation to convert afungiblesimplementation to become usable in XCM.- Converts a location which is a top-level relay chain (which provides its own consensus) into a 32-byte
AccountId. - Converts a location which is a top-level parachain (i.e. a parachain held on a Relay-chain which provides its own consensus) into a 32-byte
AccountId. - Same as
IsConcretebut for a fungible with abstract location. - Allows a message only if it is from a system-level child parachain.
- Converts a
MultiAssetinto balanceBif it is a concrete fungible with an id equal to that given byT’sGet. - Implementation of
AssetCheckingwhich subjects a given set of assetsTto having their teleportations recorded with aMintLocation::Local. - Simple struct which contains both an XCM
locationandasset_idto identify an asset which exists on some chain. - Struct created from calling
fn matcher()on a mutable slice ofInstructions. - Accepts an asset iff it is a native asset.
- Implementation of
AssetCheckingwhich subjects no assets to having their teleportations recorded. - Implementation of
AssetCheckingwhich subjects a given set of assetsTto having their teleportations recorded with aMintLocation::NonLocal. Convertimplementation to convert from an origin which passes the check of anEnsureOrigininto a voice of a given pluralisticBody.- Implementation of the
frame_support::traits::tokens::Paytrait, to allow for XCM-based payments of a givenBalanceof some asset ID existing on some chain under ownership of someInteriorlocation of the local chain to a particularBeneficiary. TheAssetKindvalue is not itself bounded (to avoid the issue of needing to wrap some preexisting datatype), however a converter typeAssetKindToLocatableAssetmust be provided in order to translate it into aLocatableAsset, which comprises both an XCMMultiLocationdescribing the XCM endpoint on which the asset to be paid resides and an XCMAssetIdto identify the specific asset at that endpoint. - A message processor that delegates execution to an [
XcmExecutor]. - Barrier condition that allows for a
SuspensionCheckerthat controls whether or not the XCM executor will be suspended from executing the given XCM. Convertimplementation to convert from some aSigned(system)Origininto anAccountId32.- Implementation of
SendXcmwhich wraps the message inside anExportMessageinstruction and sends it to a destination known to be able to handle it. - Sovereign accounts use the system’s
Signedorigin with an account ID derived from theLocationConverter. - Execution barrier that just takes
max_weightfromproperties.weight_credit. - Sets the message ID to
tusing aSetTopic(t)in the last position if present. - Implementation of
SendXcmwhich uses the givenExportXcmimplementation in order to forward the message over a bridge. - Implementation of
SendXcmwhich wraps the message inside anExportMessageinstruction and sends it to a destination known to be able to handle it. - Weight trader which uses the configured
WeightToFeeto set the right price for weight and then places any weight bought into the right account. - A derivative barrier, which scans the first
MaxPrefixesinstructions for origin-alterers and then evaluatesshould_executeof theInnerBarrierbased on the remaining instructions and the newly computed origin. - Wrapper router which, if the message does not already end with a
SetTopicinstruction, prepends one to the message filled with an ID fromTopicSource. This ID is returned from a successfuldeliver. - Wrapper router which, if the message does not already end with a
SetTopicinstruction, appends one to the message filled with a universally unique ID. This ID is returned from a successfuldeliver.
Enums
- The location which is allowed to mint a particular asset.
Traits
- Simple trait to indicate whether an asset is subject to having its teleportation into and out of this chain recorded and if so in what
MintLocation. - Creates an instruction matcher from an XCM. Since XCM versions differ, we need to make a trait here to unify the interfaces among them.
- Means of converting a location into a stable and unique descriptive identifier.
- API that allows to pattern-match against anything that is contained within an XCM.
- Function trait for handling some revenue. Similar to a negative imbalance (credit) handler, but for a
MultiAsset. Sensible implementations will deposit the asset in some known treasury or block-author account.
Functions
- Returns the network ID and consensus location within that network of the remote location
destwhich is itself specified as a location relative to the local chain, itself situated atuniversal_localwithin the consensus universe. Ifdestis not a location in remote consensus, then an error is returned.
Type Definitions
- ConvertedAbstractAssetIdDeprecated
- ConvertedConcreteAssetIdDeprecated
- ForeignChainAliasAccountDeprecatedThis is deprecated in favor of the more modular
HashedDescriptionconverter. If your chain has previously used this, then you can retain backwards compatibility usingHashedDescriptionand a tuple withLegacyDescribeForeignChainAccountas the first element. For example: - Specialization of the
PayOverXcmtrait to allow[u8; 32]-basedAccountIdvalues to be paid on a remote chain.