Skip to content

Commit

Permalink
Add xcm_runtime_apis::conversions::LocationToAccountApi to all runt…
Browse files Browse the repository at this point in the history
…imes (#413)

Relates to: paritytech/polkadot-sdk#4298
Relates to: paritytech/polkadot-sdk#4857


<!-- Remember that you can run `/merge` to enable auto-merge in the PR
-->

<!-- Remember to modify the changelog. If you don't need to modify it,
you can check the following box.
Instead, if you have already modified it, simply delete the following
line. -->

- [ ] Does not require a CHANGELOG entry

---------

Co-authored-by: Adrian Catangiu <adrian@parity.io>
Co-authored-by: Dónal Murray <donalm@seadanda.dev>
  • Loading branch information
3 people authored Aug 7, 2024
1 parent b1b3776 commit ee234ad
Show file tree
Hide file tree
Showing 12 changed files with 133 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Core-Fellowship: new `promote_fast` call ([runtimes#381](https://github.com/polkadot-fellows/runtimes/pull/381), [SDK v1.14 #4877](https://github.com/paritytech/polkadot-sdk/pull/4877)).
- Pallet ranked collective: max member count per rank ([runtimes#381](https://github.com/polkadot-fellows/runtimes/pull/381), [SDK v1.14 #4807](https://github.com/paritytech/polkadot-sdk/pull/4807)).
- All runtimes: XcmPaymentApi and DryRunApi ([polkadot-fellows/runtimes#380](https://github.com/polkadot-fellows/runtimes/pull/380))
- All runtimes: add `LocationToAccountApi` ([polkadot-fellows/runtimes#413](https://github.com/polkadot-fellows/runtimes/pull/413))

#### From [#322](https://github.com/polkadot-fellows/runtimes/pull/322):

Expand Down
12 changes: 12 additions & 0 deletions relay/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2298,6 +2298,18 @@ sp_api::impl_runtime_apis! {
}
}

impl xcm_runtime_apis::conversions::LocationToAccountApi<Block, AccountId> for Runtime {
fn convert_location(location: VersionedLocation) -> Result<
AccountId,
xcm_runtime_apis::conversions::Error
> {
xcm_runtime_apis::conversions::LocationToAccountHelper::<
AccountId,
xcm_config::SovereignAccountOf,
>::convert_location(location)
}
}

impl pallet_nomination_pools_runtime_api::NominationPoolsApi<
Block,
AccountId,
Expand Down
12 changes: 12 additions & 0 deletions relay/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2520,6 +2520,18 @@ sp_api::impl_runtime_apis! {
}
}

impl xcm_runtime_apis::conversions::LocationToAccountApi<Block, AccountId> for Runtime {
fn convert_location(location: VersionedLocation) -> Result<
AccountId,
xcm_runtime_apis::conversions::Error
> {
xcm_runtime_apis::conversions::LocationToAccountHelper::<
AccountId,
xcm_config::SovereignAccountOf,
>::convert_location(location)
}
}

impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
fn build_state(config: Vec<u8>) -> sp_genesis_builder::Result {
build_state::<RuntimeGenesisConfig>(config)
Expand Down
12 changes: 12 additions & 0 deletions system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,18 @@ impl_runtime_apis! {
}
}

impl xcm_runtime_apis::conversions::LocationToAccountApi<Block, AccountId> for Runtime {
fn convert_location(location: VersionedLocation) -> Result<
AccountId,
xcm_runtime_apis::conversions::Error
> {
xcm_runtime_apis::conversions::LocationToAccountHelper::<
AccountId,
xcm_config::LocationToAccountId,
>::convert_location(location)
}
}

impl assets_common::runtime_api::FungiblesApi<
Block,
AccountId,
Expand Down
12 changes: 12 additions & 0 deletions system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,18 @@ impl_runtime_apis! {
}
}

impl xcm_runtime_apis::conversions::LocationToAccountApi<Block, AccountId> for Runtime {
fn convert_location(location: VersionedLocation) -> Result<
AccountId,
xcm_runtime_apis::conversions::Error
> {
xcm_runtime_apis::conversions::LocationToAccountHelper::<
AccountId,
xcm_config::LocationToAccountId,
>::convert_location(location)
}
}

impl assets_common::runtime_api::FungiblesApi<
Block,
AccountId,
Expand Down
12 changes: 12 additions & 0 deletions system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,18 @@ impl_runtime_apis! {
}
}

impl xcm_runtime_apis::conversions::LocationToAccountApi<Block, AccountId> for Runtime {
fn convert_location(location: VersionedLocation) -> Result<
AccountId,
xcm_runtime_apis::conversions::Error
> {
xcm_runtime_apis::conversions::LocationToAccountHelper::<
AccountId,
xcm_config::LocationToAccountId,
>::convert_location(location)
}
}

impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
ParachainSystem::collect_collation_info(header)
Expand Down
12 changes: 12 additions & 0 deletions system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,18 @@ impl_runtime_apis! {
}
}

impl xcm_runtime_apis::conversions::LocationToAccountApi<Block, AccountId> for Runtime {
fn convert_location(location: VersionedLocation) -> Result<
AccountId,
xcm_runtime_apis::conversions::Error
> {
xcm_runtime_apis::conversions::LocationToAccountHelper::<
AccountId,
xcm_config::LocationToAccountId,
>::convert_location(location)
}
}

impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
ParachainSystem::collect_collation_info(header)
Expand Down
12 changes: 12 additions & 0 deletions system-parachains/collectives/collectives-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,18 @@ impl_runtime_apis! {
}
}

impl xcm_runtime_apis::conversions::LocationToAccountApi<Block, AccountId> for Runtime {
fn convert_location(location: VersionedLocation) -> Result<
AccountId,
xcm_runtime_apis::conversions::Error
> {
xcm_runtime_apis::conversions::LocationToAccountHelper::<
AccountId,
xcm_config::LocationToAccountId,
>::convert_location(location)
}
}

impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
ParachainSystem::collect_collation_info(header)
Expand Down
12 changes: 12 additions & 0 deletions system-parachains/coretime/coretime-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,18 @@ impl_runtime_apis! {
}
}

impl xcm_runtime_apis::conversions::LocationToAccountApi<Block, AccountId> for Runtime {
fn convert_location(location: VersionedLocation) -> Result<
AccountId,
xcm_runtime_apis::conversions::Error
> {
xcm_runtime_apis::conversions::LocationToAccountHelper::<
AccountId,
xcm_config::LocationToAccountId,
>::convert_location(location)
}
}

impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
ParachainSystem::collect_collation_info(header)
Expand Down
12 changes: 12 additions & 0 deletions system-parachains/encointer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,18 @@ impl_runtime_apis! {
}
}

impl xcm_runtime_apis::conversions::LocationToAccountApi<Block, AccountId> for Runtime {
fn convert_location(location: VersionedLocation) -> Result<
AccountId,
xcm_runtime_apis::conversions::Error
> {
xcm_runtime_apis::conversions::LocationToAccountHelper::<
AccountId,
xcm_config::LocationToAccountId,
>::convert_location(location)
}
}

impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
ParachainSystem::collect_collation_info(header)
Expand Down
12 changes: 12 additions & 0 deletions system-parachains/people/people-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,18 @@ impl_runtime_apis! {
}
}

impl xcm_runtime_apis::conversions::LocationToAccountApi<Block, AccountId> for Runtime {
fn convert_location(location: VersionedLocation) -> Result<
AccountId,
xcm_runtime_apis::conversions::Error
> {
xcm_runtime_apis::conversions::LocationToAccountHelper::<
AccountId,
xcm_config::LocationToAccountId,
>::convert_location(location)
}
}

impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
ParachainSystem::collect_collation_info(header)
Expand Down
12 changes: 12 additions & 0 deletions system-parachains/people/people-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,18 @@ impl_runtime_apis! {
}
}

impl xcm_runtime_apis::conversions::LocationToAccountApi<Block, AccountId> for Runtime {
fn convert_location(location: VersionedLocation) -> Result<
AccountId,
xcm_runtime_apis::conversions::Error
> {
xcm_runtime_apis::conversions::LocationToAccountHelper::<
AccountId,
xcm_config::LocationToAccountId,
>::convert_location(location)
}
}

impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
ParachainSystem::collect_collation_info(header)
Expand Down

0 comments on commit ee234ad

Please sign in to comment.