difftreelog
Add RuntimeInstance trait
in: master
5 files changed
runtime/common/Cargo.tomldiffbeforeafterboth1[package]2authors = ['Unique Network <support@uniquenetwork.io>']3description = 'Unique Runtime Common'4edition = '2021'5homepage = 'https://unique.network'6license = 'All Rights Reserved'7name = 'unique-runtime-common'8repository = 'https://github.com/UniqueNetwork/unique-chain'9version = '0.1.0'1011[features]12default = ['std']13std = [14 'sp-core/std',15 'sp-runtime/std',16 'codec/std',17 'frame-support/std',18 'frame-system/std',19]20runtime-benchmarks = [21 'sp-runtime/runtime-benchmarks',22 'frame-support/runtime-benchmarks',23 'frame-system/runtime-benchmarks'24]2526[dependencies.sp-core]27default-features = false28git = 'https://github.com/paritytech/substrate.git'29branch = 'polkadot-v0.9.17'3031[dependencies.sp-runtime]32default-features = false33git = 'https://github.com/paritytech/substrate.git'34branch = 'polkadot-v0.9.17'3536[dependencies.codec]37default-features = false38features = ['derive']39package = 'parity-scale-codec'40version = '2.3.0'4142[dependencies.scale-info]43default-features = false44features = ["derive"]45version = "1.0.0"4647[dependencies.frame-support]48default-features = false49git = 'https://github.com/paritytech/substrate.git'50branch = 'polkadot-v0.9.17'5152[dependencies.frame-system]53default-features = false54git = 'https://github.com/paritytech/substrate.git'55branch = 'polkadot-v0.9.17'1[package]2authors = ['Unique Network <support@uniquenetwork.io>']3description = 'Unique Runtime Common'4edition = '2021'5homepage = 'https://unique.network'6license = 'All Rights Reserved'7name = 'unique-runtime-common'8repository = 'https://github.com/UniqueNetwork/unique-chain'9version = '0.1.0'1011[features]12default = ['std']13std = [14 'sp-core/std',15 'sp-runtime/std',16 'codec/std',17 'frame-support/std',18 'frame-system/std',19 'sp-consensus-aura/std',20 'pallet-common/std',21 'fp-rpc/std',22]23runtime-benchmarks = [24 'sp-runtime/runtime-benchmarks',25 'frame-support/runtime-benchmarks',26 'frame-system/runtime-benchmarks'27]2829[dependencies.sp-core]30default-features = false31git = 'https://github.com/paritytech/substrate.git'32branch = 'polkadot-v0.9.17'3334[dependencies.sp-runtime]35default-features = false36git = 'https://github.com/paritytech/substrate.git'37branch = 'polkadot-v0.9.17'3839[dependencies.codec]40default-features = false41features = ['derive']42package = 'parity-scale-codec'43version = '2.3.0'4445[dependencies.scale-info]46default-features = false47features = ["derive"]48version = "1.0.0"4950[dependencies.frame-support]51default-features = false52git = 'https://github.com/paritytech/substrate.git'53branch = 'polkadot-v0.9.17'5455[dependencies.frame-system]56default-features = false57git = 'https://github.com/paritytech/substrate.git'58branch = 'polkadot-v0.9.17'5960[dependencies.pallet-common]61default-features = false62path = "../../pallets/common"6364[dependencies.sp-consensus-aura]65default-features = false66git = 'https://github.com/paritytech/substrate.git'67branch = 'polkadot-v0.9.17'6869[dependencies.fp-rpc]70default-features = false71git = "https://github.com/uniquenetwork/frontier.git"72branch = "unique-polkadot-v0.9.17"runtime/common/src/types.rsdiffbeforeafterboth--- a/runtime/common/src/types.rs
+++ b/runtime/common/src/types.rs
@@ -38,3 +38,15 @@
/// Digest item type.
pub type DigestItem = generic::DigestItem;
+
+pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
+
+pub trait RuntimeInstance {
+ type CrossAccountId: pallet_common::account::CrossAccountId<sp_runtime::AccountId32>
+ + Send + Sync + 'static;
+
+ type TransactionConverter: fp_rpc::ConvertTransaction<UncheckedExtrinsic>
+ + Send + Sync + 'static;
+
+ fn get_transaction_converter() -> Self::TransactionConverter;
+}
runtime/opal/src/lib.rsdiffbeforeafterboth--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -116,8 +116,18 @@
pub const RUNTIME_NAME: &str = "Opal";
-pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
+type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
+
+impl RuntimeInstance for Runtime {
+ type CrossAccountId = self::CrossAccountId;
+
+ type TransactionConverter = self::TransactionConverter;
+ fn get_transaction_converter() -> TransactionConverter {
+ TransactionConverter
+ }
+}
+
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
/// the specifics of the runtime. They can then be made to be agnostic over specific formats
/// of data like extrinsics, allowing for them to continue syncing the network through upgrades
@@ -128,7 +138,6 @@
use super::Aura;
pub use unique_runtime_common::types::*;
- pub use super::CrossAccountId;
impl_opaque_keys! {
pub struct SessionKeys {
runtime/quartz/src/lib.rsdiffbeforeafterboth--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -116,8 +116,18 @@
pub const RUNTIME_NAME: &str = "Quartz";
-pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
+type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
+
+impl RuntimeInstance for Runtime {
+ type CrossAccountId = self::CrossAccountId;
+
+ type TransactionConverter = self::TransactionConverter;
+ fn get_transaction_converter() -> TransactionConverter {
+ TransactionConverter
+ }
+}
+
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
/// the specifics of the runtime. They can then be made to be agnostic over specific formats
/// of data like extrinsics, allowing for them to continue syncing the network through upgrades
@@ -128,7 +138,6 @@
use super::Aura;
pub use unique_runtime_common::types::*;
- pub use super::CrossAccountId;
impl_opaque_keys! {
pub struct SessionKeys {
runtime/unique/src/lib.rsdiffbeforeafterboth--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -85,7 +85,6 @@
};
// pub use pallet_timestamp::Call as TimestampCall;
-pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
// Polkadot imports
use pallet_xcm::XcmPassthrough;
@@ -116,7 +115,17 @@
pub const RUNTIME_NAME: &str = "Unique";
-pub type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
+type CrossAccountId = pallet_common::account::BasicCrossAccountId<Runtime>;
+
+impl RuntimeInstance for Runtime {
+ type CrossAccountId = self::CrossAccountId;
+
+ type TransactionConverter = self::TransactionConverter;
+
+ fn get_transaction_converter() -> TransactionConverter {
+ TransactionConverter
+ }
+}
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
/// the specifics of the runtime. They can then be made to be agnostic over specific formats
@@ -128,7 +137,6 @@
use super::Aura;
pub use unique_runtime_common::types::*;
- pub use super::CrossAccountId;
impl_opaque_keys! {
pub struct SessionKeys {
@@ -207,7 +215,7 @@
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
.build_or_panic();
pub const Version: RuntimeVersion = VERSION;
- pub const SS58Prefix: u8 = 7391;
+ pub const SS58Prefix: u16 = 7391;
}
parameter_types! {