mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 10:31:03 +00:00
XCM Revamp Continued (#2865)
* Introduce plurality XCM locations * Add RelayedFrom * DMP dispatch weight handling. * Add pallet for XCM sending, add routing logic. * Update error types & doc * Fix warnings. * Fixes * Fixes * Fixes * Bump Substrate * Fixes * Docs * Docs * Docs * Fixes * Fixes * Fixes * Update xcm/pallet-xcm/src/lib.rs Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> * Docs * Fixes * Update lib.rs * Fixes Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -22,21 +22,22 @@ use xcm::opaque::{VersionedXcm, v0::{SendXcm, MultiLocation, Junction, Xcm, Resu
|
||||
use runtime_parachains::{configuration, dmp};
|
||||
|
||||
/// Xcm sender for relay chain. It only sends downward message.
|
||||
pub struct RelayChainXcmSender<T>(PhantomData<T>);
|
||||
pub struct ChildParachainRouter<T>(PhantomData<T>);
|
||||
|
||||
impl<T: configuration::Config + dmp::Config> SendXcm for RelayChainXcmSender<T> {
|
||||
impl<T: configuration::Config + dmp::Config> SendXcm for ChildParachainRouter<T> {
|
||||
fn send_xcm(dest: MultiLocation, msg: Xcm) -> Result {
|
||||
if let MultiLocation::X1(Junction::Parachain { id }) = dest {
|
||||
// Downward message passing.
|
||||
let config = <configuration::Module<T>>::config();
|
||||
<dmp::Module<T>>::queue_downward_message(
|
||||
&config,
|
||||
id.into(),
|
||||
VersionedXcm::from(msg).encode(),
|
||||
).map_err(Into::<Error>::into)?;
|
||||
Ok(())
|
||||
} else {
|
||||
Err(Error::CannotReachDestination("UnsupportedDestination"))
|
||||
match dest {
|
||||
MultiLocation::X1(Junction::Parachain { id }) => {
|
||||
// Downward message passing.
|
||||
let config = <configuration::Module<T>>::config();
|
||||
<dmp::Module<T>>::queue_downward_message(
|
||||
&config,
|
||||
id.into(),
|
||||
VersionedXcm::from(msg).encode(),
|
||||
).map_err(Into::<Error>::into)?;
|
||||
Ok(())
|
||||
}
|
||||
d => Err(Error::CannotReachDestination(d, msg)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user