mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 21:01:02 +00:00
Kusama origins as xcm multi_location (#6273)
* Kusamsa origins as xcm multilocation * Fellows origin index * origins to xcm plurality body * cleanup * fix cargo spellcheck * Apply suggestions from code review Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * include Fellows into scope * include Fellows into scope Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: Gavin Wood <gavin@parity.io>
This commit is contained in:
@@ -1527,6 +1527,19 @@ impl<Prefix: Get<MultiLocation>, Body: Get<BodyId>> Contains<MultiLocation>
|
||||
}
|
||||
}
|
||||
|
||||
/// Filter for `MultiLocation` to find those which represent a voice of an identified plurality.
|
||||
///
|
||||
/// May reasonably be used with `EnsureXcm`.
|
||||
pub struct IsVoiceOfBody<Prefix, Body>(PhantomData<(Prefix, Body)>);
|
||||
impl<Prefix: Get<MultiLocation>, Body: Get<BodyId>> Contains<MultiLocation>
|
||||
for IsVoiceOfBody<Prefix, Body>
|
||||
{
|
||||
fn contains(l: &MultiLocation) -> bool {
|
||||
let maybe_suffix = l.match_and_split(&Prefix::get());
|
||||
matches!(maybe_suffix, Some(Plurality { id, part }) if id == &Body::get() && part == &BodyPart::Voice)
|
||||
}
|
||||
}
|
||||
|
||||
/// `EnsureOrigin` implementation succeeding with a `MultiLocation` value to recognize and filter the
|
||||
/// `Origin::Xcm` item.
|
||||
pub struct EnsureXcm<F>(PhantomData<F>);
|
||||
|
||||
Reference in New Issue
Block a user