mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 23:21:02 +00:00
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:
@@ -125,7 +125,7 @@ mod tests {
|
||||
Relay::execute_with(|| {
|
||||
assert_ok!(RelayChainPalletXcm::send_xcm(
|
||||
Here,
|
||||
Parachain(1).into(),
|
||||
Parachain(1),
|
||||
Xcm(vec![Transact {
|
||||
origin_type: OriginKind::SovereignAccount,
|
||||
require_weight_at_most: INITIAL_BALANCE as u64,
|
||||
@@ -152,7 +152,7 @@ mod tests {
|
||||
ParaA::execute_with(|| {
|
||||
assert_ok!(ParachainPalletXcm::send_xcm(
|
||||
Here,
|
||||
Parent.into(),
|
||||
Parent,
|
||||
Xcm(vec![Transact {
|
||||
origin_type: OriginKind::SovereignAccount,
|
||||
require_weight_at_most: INITIAL_BALANCE as u64,
|
||||
@@ -180,7 +180,7 @@ mod tests {
|
||||
ParaA::execute_with(|| {
|
||||
assert_ok!(ParachainPalletXcm::send_xcm(
|
||||
Here,
|
||||
MultiLocation::new(1, X1(Parachain(2))),
|
||||
(Parent, Parachain(2)),
|
||||
Xcm(vec![Transact {
|
||||
origin_type: OriginKind::SovereignAccount,
|
||||
require_weight_at_most: INITIAL_BALANCE as u64,
|
||||
@@ -247,7 +247,7 @@ mod tests {
|
||||
},
|
||||
]);
|
||||
// Send withdraw and deposit
|
||||
assert_ok!(ParachainPalletXcm::send_xcm(Here, Parent.into(), message.clone()));
|
||||
assert_ok!(ParachainPalletXcm::send_xcm(Here, Parent, message.clone()));
|
||||
});
|
||||
|
||||
Relay::execute_with(|| {
|
||||
@@ -289,7 +289,7 @@ mod tests {
|
||||
},
|
||||
]);
|
||||
// Send withdraw and deposit with query holding
|
||||
assert_ok!(ParachainPalletXcm::send_xcm(Here, Parent.into(), message.clone(),));
|
||||
assert_ok!(ParachainPalletXcm::send_xcm(Here, Parent, message.clone(),));
|
||||
});
|
||||
|
||||
// Check that transfer was executed
|
||||
|
||||
@@ -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));
|
||||
},
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user