Crate xcm_builder
source ·Expand description
XCM-Builder
Types and helpers for building XCM configuration.
Modules
Structs
- Extracts the
AccountId32
from the passedlocation
if the network matches. - Alias a Foreign
AccountId32
with a localAccountId32
if the foreignAccountId32
matches thePrefix
pattern. - Conversion implementation which converts from a
[u8; 32]
-basedAccountId
into aMultiLocation
consisting solely of aAccountId32
junction 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
ResponseHandler
expects them viaexpecting_response
. - Allows execution from
origin
if it is just a straightSubscribeVersion
orUnsubscribeVersion
instruction. - Allows execution from
origin
if 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
AssetIdConversion
converting a numeric asset ID (must beTryFrom/TryInto<u128>
) into aGeneralIndex
junction, prefixed by someMultiLocation
value. TheMultiLocation
value will typically be aPalletInstance
junction. Convert
implementation to convert from some an origin which implementsBacking
into a correspondingPlurality
MultiLocation
.- Accepts an asset if it is contained in the given
T
’sGet
implementation. - Simple adapter to use a currency as asset transactor. This type can be used as
type AssetTransactor
inxcm::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
AssetChecking
which subjects a given set of assetsL
to having their teleportations recorded with aMintLocation::Local
and a second set of assetsR
to having their teleportations recorded with aMintLocation::NonLocal
. EnsureOrigin
barrier to convert from dispatch origin to XCM origin, if one exists.- Adapter
struct
which implements a conversion from anyAssetKind
into a [LocatableAsset
] value using a fixedLocation
for thelocation
field. - Simple fee calculator that requires payment in a single fungible at a fixed rate.
TransactAsset
implementation to convert afungibles
implementation 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
IsConcrete
but for a fungible with abstract location. - Allows a message only if it is from a system-level child parachain.
- Converts a
MultiAsset
into balanceB
if it is a concrete fungible with an id equal to that given byT
’sGet
. - Implementation of
AssetChecking
which subjects a given set of assetsT
to having their teleportations recorded with aMintLocation::Local
. - Simple struct which contains both an XCM
location
andasset_id
to identify an asset which exists on some chain. - Struct created from calling
fn matcher()
on a mutable slice ofInstruction
s. - Accepts an asset iff it is a native asset.
- Implementation of
AssetChecking
which subjects no assets to having their teleportations recorded. - Implementation of
AssetChecking
which subjects a given set of assetsT
to having their teleportations recorded with aMintLocation::NonLocal
. Convert
implementation to convert from an origin which passes the check of anEnsureOrigin
into a voice of a given pluralisticBody
.- Implementation of the
frame_support::traits::tokens::Pay
trait, to allow for XCM-based payments of a givenBalance
of some asset ID existing on some chain under ownership of someInterior
location of the local chain to a particularBeneficiary
. TheAssetKind
value is not itself bounded (to avoid the issue of needing to wrap some preexisting datatype), however a converter typeAssetKindToLocatableAsset
must be provided in order to translate it into aLocatableAsset
, which comprises both an XCMMultiLocation
describing the XCM endpoint on which the asset to be paid resides and an XCMAssetId
to identify the specific asset at that endpoint. - A message processor that delegates execution to an [
XcmExecutor
]. - Barrier condition that allows for a
SuspensionChecker
that controls whether or not the XCM executor will be suspended from executing the given XCM. Convert
implementation to convert from some aSigned
(system)Origin
into anAccountId32
.- Implementation of
SendXcm
which wraps the message inside anExportMessage
instruction and sends it to a destination known to be able to handle it. - Sovereign accounts use the system’s
Signed
origin with an account ID derived from theLocationConverter
. - Execution barrier that just takes
max_weight
fromproperties.weight_credit
. - Sets the message ID to
t
using aSetTopic(t)
in the last position if present. - Implementation of
SendXcm
which uses the givenExportXcm
implementation in order to forward the message over a bridge. - Implementation of
SendXcm
which wraps the message inside anExportMessage
instruction and sends it to a destination known to be able to handle it. - Weight trader which uses the configured
WeightToFee
to set the right price for weight and then places any weight bought into the right account. - A derivative barrier, which scans the first
MaxPrefixes
instructions for origin-alterers and then evaluatesshould_execute
of theInnerBarrier
based on the remaining instructions and the newly computed origin. - Wrapper router which, if the message does not already end with a
SetTopic
instruction, 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
SetTopic
instruction, 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
dest
which is itself specified as a location relative to the local chain, itself situated atuniversal_local
within the consensus universe. Ifdest
is not a location in remote consensus, then an error is returned.
Type Definitions
- ConvertedAbstractAssetIdDeprecated
- ConvertedConcreteAssetIdDeprecated
- ForeignChainAliasAccountDeprecatedThis is deprecated in favor of the more modular
HashedDescription
converter. If your chain has previously used this, then you can retain backwards compatibility usingHashedDescription
and a tuple withLegacyDescribeForeignChainAccount
as the first element. For example: - Specialization of the
PayOverXcm
trait to allow[u8; 32]
-basedAccountId
values to be paid on a remote chain.