Make most XCM APIs accept an Into<MultiLocation> where MultiLocation is accepted (#3627)

* Change send_xcm MultiLocation argument to be generic

* Change pallet_xcm::send_xcm MultiLocation and Junctions argument to be generic

* Change convert_origin MultiLocation argument to be generic

* Change OnResponse MultiLocation arguments to be generic

* Change UniversalWeigher MultiLocation argumente to be generic

* Change ExecuteXcm MultiLocation argument to be generic

* Remove usages of into for the MultiLocation argument in execute_xcm

* Make use of generic MultiLocation arguments in rustdocs

* Cargo fmt

* Remove unused import in tests

* Resolve conflicts

* cargo fmt

* Appease spellcheck

* impl Into<MultiLocation> in more places
This commit is contained in:
Keith Yeung
2021-09-29 16:24:49 -07:00
committed by GitHub
parent 7542a73f12
commit 819849f097
18 changed files with 179 additions and 117 deletions
+4 -2
View File
@@ -296,9 +296,10 @@ macro_rules! decl_test_network {
pub struct ParachainXcmRouter<T>($crate::PhantomData<T>);
impl<T: $crate::Get<$crate::ParaId>> $crate::SendXcm for ParachainXcmRouter<T> {
fn send_xcm(destination: $crate::MultiLocation, message: $crate::Xcm<()>) -> $crate::SendResult {
fn send_xcm(destination: impl Into<$crate::MultiLocation>, message: $crate::Xcm<()>) -> $crate::SendResult {
use $crate::{UmpSink, XcmpMessageHandlerT};
let destination = destination.into();
match destination.interior() {
$crate::Junctions::Here if destination.parent_count() == 1 => {
$crate::PARA_MESSAGE_BUS.with(
@@ -320,9 +321,10 @@ macro_rules! decl_test_network {
/// XCM router for relay chain.
pub struct RelayChainXcmRouter;
impl $crate::SendXcm for RelayChainXcmRouter {
fn send_xcm(destination: $crate::MultiLocation, message: $crate::Xcm<()>) -> $crate::SendResult {
fn send_xcm(destination: impl Into<$crate::MultiLocation>, message: $crate::Xcm<()>) -> $crate::SendResult {
use $crate::DmpMessageHandlerT;
let destination = destination.into();
match destination.interior() {
$(
$crate::X1($crate::Parachain(id)) if *id == $para_id && destination.parent_count() == 0 => {