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
@@ -219,7 +219,7 @@ pub mod mock_msg_queue {
let hash = Encode::using_encoded(&xcm, T::Hashing::hash);
let (result, event) = match Xcm::<T::Call>::try_from(xcm) {
Ok(xcm) => {
let location = MultiLocation::new(1, X1(Parachain(sender.into())));
let location = (1, Parachain(sender.into()));
match T::XcmExecutor::execute_xcm(location, xcm, max_weight) {
Outcome::Error(e) => (Err(e.clone()), Event::Fail(Some(hash), e)),
Outcome::Complete(w) => (Ok(w), Event::Success(Some(hash))),
@@ -275,7 +275,7 @@ pub mod mock_msg_queue {
Self::deposit_event(Event::UnsupportedVersion(id));
},
Ok(Ok(x)) => {
let outcome = T::XcmExecutor::execute_xcm(Parent.into(), x.clone(), limit);
let outcome = T::XcmExecutor::execute_xcm(Parent, x.clone(), limit);
<ReceivedDmp<T>>::append(x);
Self::deposit_event(Event::ExecutedDownward(id, outcome));
},