mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 05:51:02 +00:00
[parachain-template] runtime API Implementations into mod apis (#3817)
This PR significantly refactors the runtime API implementations to improve project structure, maintainability, and readability. Key changes include: 1. **Enhancing Visibility**: Adjusts the visibility of `RUNTIME_API_VERSIONS` in `impl_runtime_apis.rs` to `pub`, making it accessible throughout the runtime module. 2. **Centralizing API Implementations**: Introduces a new file, `apis.rs`, within the parachain template's runtime directory. 3. **Streamlining `lib.rs`**: Updates the main runtime library file to reflect these structural changes. It removes redundant API implementations and points `VERSION` to the newly exposed `RUNTIME_API_VERSIONS` from `apis.rs`, simplifying the overall runtime configuration. ### Motivations Behind the Refactoring: - **Improved Project Structure**: Centralizing API implementations in `apis.rs` offers a clearer, more navigable project structure. - **Better Readability**: Streamlining `lib.rs` and reducing clutter enhance readability, making it easier for new contributors to understand the project layout and logic. ### Summary of Changes: - Made `RUNTIME_API_VERSIONS` public in `impl_runtime_apis.rs`. - Added `apis.rs` to centralize runtime API implementations. - Streamlined `lib.rs` to adjust to the refactored project structure.
This commit is contained in:
committed by
GitHub
parent
1ed44af368
commit
60846a081f
@@ -6,8 +6,8 @@ use std::{sync::Arc, time::Duration};
|
||||
use cumulus_client_cli::CollatorOptions;
|
||||
// Local Runtime Types
|
||||
use parachain_template_runtime::{
|
||||
apis::RuntimeApi,
|
||||
opaque::{Block, Hash},
|
||||
RuntimeApi,
|
||||
};
|
||||
|
||||
// Cumulus Imports
|
||||
@@ -46,7 +46,7 @@ impl sc_executor::NativeExecutionDispatch for ParachainNativeExecutor {
|
||||
);
|
||||
|
||||
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
|
||||
parachain_template_runtime::api::dispatch(method, data)
|
||||
parachain_template_runtime::apis::api::dispatch(method, data)
|
||||
}
|
||||
|
||||
fn native_version() -> sc_executor::NativeVersion {
|
||||
|
||||
Reference in New Issue
Block a user