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
+3 -4
View File
@@ -91,7 +91,7 @@ impl<XcmExecutor: xcm::latest::ExecuteXcm<C::Call>, C: Config> UmpSink for XcmSi
) -> Result<Weight, (MessageId, Weight)> {
use parity_scale_codec::DecodeLimit;
use xcm::{
latest::{Error as XcmError, Junction, MultiLocation, Xcm},
latest::{Error as XcmError, Junction, Xcm},
VersionedXcm,
};
@@ -111,9 +111,8 @@ impl<XcmExecutor: xcm::latest::ExecuteXcm<C::Call>, C: Config> UmpSink for XcmSi
Ok(0)
},
Ok(Ok(xcm_message)) => {
let xcm_junction: Junction = Junction::Parachain(origin.into());
let xcm_location: MultiLocation = xcm_junction.into();
let outcome = XcmExecutor::execute_xcm(xcm_location, xcm_message, max_weight);
let xcm_junction = Junction::Parachain(origin.into());
let outcome = XcmExecutor::execute_xcm(xcm_junction, xcm_message, max_weight);
match outcome {
Outcome::Error(XcmError::WeightLimitReached(required)) => Err((id, required)),
outcome => {