Skip to content

Commit

Permalink
further trials in docify
Browse files Browse the repository at this point in the history
  • Loading branch information
seemantaggarwal committed Jan 11, 2025
1 parent 318d589 commit 219baa4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
7 changes: 4 additions & 3 deletions templates/parachain/README.docify.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<div align="center">

[cfg(all(doc, feature = "generate-readme"))]
compile_markdown!("README.docify.md", "README.md");

<!-- docify::embed!("runtime/src/genesis_config_presets.rs", get_parachain_id)-->

# Polkadot SDK's Parachain Template

<img height="70px" alt="Polkadot SDK Logo" src="https://github.com/paritytech/polkadot-sdk/raw/master/docs/images/Polkadot_Logo_Horizontal_Pink_White.png#gh-dark-mode-only"/>
Expand Down Expand Up @@ -99,7 +100,7 @@ Please see the installation section at [`crates.io/staging-chain-spec-builder`](
#### Use `chain-spec-builder` to generate the `chain_spec.json` file

```sh
chain-spec-builder create --relay-chain "rococo-local" --para-id <!-- docify::embed!("runtime/src/genesis_config_cmd_list_presets.rs", get_parachain_id)--> --runtime \
chain-spec-builder create --relay-chain "rococo-local" --para-id <!-- docify::embed!("runtime/src/genesis_config_presets.rs", get_parachain_id)--> --runtime \
target/release/wbuild/parachain-template-runtime/parachain_template_runtime.wasm named-preset development
```

Expand Down Expand Up @@ -144,7 +145,7 @@ export PATH="$PATH:<path/to/binaries>"
```toml
# ...
[[parachains]]
id = {{PARACHAIN_ID}}
id = <!-- docify::embed!("runtime/src/genesis_config_presets.rs", get_parachain_id)-->
chain_spec_path = "<TO BE UPDATED WITH A VALID PATH>"
# ...
```
Expand Down
2 changes: 0 additions & 2 deletions templates/parachain/runtime/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use std::process::Command;

#[cfg(all(feature = "std", feature = "metadata-hash"))]
#[docify::export(template_enable_metadata_hash)]
fn main() {
println!("cargo:rerun-if-changed=../../parachain/runtime/src/genesis_config_presets.rs");
substrate_wasm_builder::WasmBuilder::init_with_defaults()
Expand Down
11 changes: 6 additions & 5 deletions templates/parachain/runtime/src/genesis_config_presets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ use crate::{
use alloc::{vec, vec::Vec};

use polkadot_sdk::{staging_xcm as xcm, *};
use docify::{compile_markdown, export, export_content};

#[doc = include_str!("../../README.md")]
#[cfg(feature = "generate-readme")]
docify::compile_markdown!("../../README.docify.md","../../README.md");

use docify::{export, export_content};

use cumulus_primitives_core::ParaId;
use frame_support::build_struct_json_patch;
Expand All @@ -22,17 +23,17 @@ use sp_keyring::Sr25519Keyring;
/// The default XCM version to set in genesis config.
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;
/// Parachain id used for genesis config presets of parachain template.
pub const PARACHAIN_ID: u32 = 2000;
pub const PARACHAIN_ID: u32 = 1000;

/// Generate the session keys from individual elements.
///
/// The input must be a tuple of individual keys (a single arg for now since we have just one key).
pub fn template_session_keys(keys: AuraId) -> SessionKeys {
SessionKeys { aura: keys }
}
#[export(name = "get_parachain_id")]
const fn get_parachain_id() -> u32 {
1000
#[docify::export_content]
pub fn get_parachain_id() -> String {
PARACHAIN_ID.to_string()
}

fn testnet_genesis(
Expand Down

0 comments on commit 219baa4

Please sign in to comment.