referrerpolicy=no-referrer-when-downgrade

snowbridge_pallet_system_v2/
api.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2023 Snowfork <hello@snowfork.com>
//! Helpers for implementing runtime api

use crate::Config;
use sp_core::H256;
use xcm::{prelude::*, VersionedLocation};

pub fn agent_id<Runtime>(location: VersionedLocation) -> Option<H256>
where
	Runtime: Config,
{
	let location: Location = location.try_into().ok()?;
	crate::Pallet::<Runtime>::location_to_message_origin(location).ok()
}