Skip to content

Commit 13f411d

Browse files
fn preset_names added
1 parent ccdfe51 commit 13f411d

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

cumulus/parachains/runtimes/assets/asset-hub-rococo/src/genesis_config_presets.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use cumulus_primitives_core::ParaId;
2020
use hex_literal::hex;
2121
use parachains_common::{genesis_config_helpers::*, AccountId, AuraId, Balance as AssetHubBalance};
2222
use sp_core::{crypto::UncheckedInto, sr25519};
23+
use sp_genesis_builder::PresetId;
2324
use testnet_parachains_constants::rococo::xcm_version::SAFE_XCM_VERSION;
2425

2526
const ASSET_HUB_ROCOCO_ED: AssetHubBalance = crate::ExistentialDeposit::get();
@@ -75,14 +76,14 @@ fn asset_hub_rococo_genesis(
7576
}
7677

7778
/// Encapsulates names of predefined presets.
78-
pub mod preset_names {
79+
mod preset_names {
7980
pub const PRESET_DEVELOPMENT: &str = "development";
8081
pub const PRESET_LOCAL: &str = "local";
8182
pub const PRESET_GENESIS: &str = "genesis";
8283
}
8384

8485
/// Provides the JSON representation of predefined genesis config for given `id`.
85-
pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option<Vec<u8>> {
86+
pub fn get_preset(id: &PresetId) -> Option<Vec<u8>> {
8687
use preset_names::*;
8788
let patch = match id.try_into() {
8889
Ok(PRESET_GENESIS) => asset_hub_rococo_genesis(
@@ -170,3 +171,13 @@ pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option<Vec<u8>> {
170171
.into_bytes(),
171172
)
172173
}
174+
175+
/// List of supported presets.
176+
pub fn preset_names() -> Vec<PresetId> {
177+
use preset_names::*;
178+
vec![
179+
PresetId::from(PRESET_GENESIS),
180+
PresetId::from(PRESET_DEVELOPMENT),
181+
PresetId::from(PRESET_LOCAL),
182+
]
183+
}

cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1776,12 +1776,7 @@ impl_runtime_apis! {
17761776
}
17771777

17781778
fn preset_names() -> Vec<PresetId> {
1779-
use crate::genesis_config_presets::preset_names::*;
1780-
vec![
1781-
PresetId::from(PRESET_GENESIS),
1782-
PresetId::from(PRESET_DEVELOPMENT),
1783-
PresetId::from(PRESET_LOCAL),
1784-
]
1779+
genesis_config_presets::preset_names()
17851780
}
17861781
}
17871782
}

0 commit comments

Comments
 (0)