mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 21:01:03 +00:00
* Update .gitignore and bring into line with XCM v2's SendError * type * Some work * Weighed responses * extra fields to xcm pallet * Fixes * Bump
This commit is contained in:
@@ -33,20 +33,20 @@ use xcm::{WrapVersion, latest::prelude::*};
|
||||
/// for the `SendXcm` implementation.
|
||||
pub struct ParentAsUmp<T, W>(PhantomData<(T, W)>);
|
||||
impl<T: UpwardMessageSender, W: WrapVersion> SendXcm for ParentAsUmp<T, W> {
|
||||
fn send_xcm(dest: MultiLocation, msg: Xcm<()>) -> Result<(), XcmError> {
|
||||
fn send_xcm(dest: MultiLocation, msg: Xcm<()>) -> Result<(), SendError> {
|
||||
if dest.contains_parents_only(1) {
|
||||
// An upward message for the relay chain.
|
||||
let versioned_xcm = W::wrap_version(&dest, msg)
|
||||
.map_err(|()| XcmError::DestinationUnsupported)?;
|
||||
.map_err(|()| SendError::DestinationUnsupported)?;
|
||||
let data = versioned_xcm.encode();
|
||||
|
||||
T::send_upward_message(data)
|
||||
.map_err(|e| XcmError::SendFailed(e.into()))?;
|
||||
.map_err(|e| SendError::Transport(e.into()))?;
|
||||
|
||||
Ok(())
|
||||
} else {
|
||||
// Anything else is unhandled. This includes a message this is meant for us.
|
||||
Err(XcmError::CannotReachDestination(dest, msg))
|
||||
Err(SendError::CannotReachDestination(dest, msg))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user