mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 19:01:08 +00:00
Refactor sr-api to not depend on client anymore (#4086)
* Refactor sr-api to not depend on client anymore * Fix benches * Apply suggestions from code review Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * Apply suggestions from code review
This commit is contained in:
committed by
Benjamin Kampmann
parent
e26d1a0b3e
commit
2ecffa1cd0
@@ -26,8 +26,11 @@ timestamp = { package = "srml-timestamp", path = "../../srml/timestamp", default
|
||||
sudo = { package = "srml-sudo", path = "../../srml/sudo", default_features = false }
|
||||
transaction-payment = { package = "srml-transaction-payment", path = "../../srml/transaction-payment", default_features = false }
|
||||
sr-primitives = { path = "../../core/sr-primitives", default_features = false }
|
||||
client = { package = "substrate-client", path = "../../core/client", default_features = false }
|
||||
sr-api = { path = "../../core/sr-api", default_features = false }
|
||||
offchain-primitives = { package = "substrate-offchain-primitives", path = "../../core/offchain/primitives", default-features = false }
|
||||
block-builder-api = { package = "substrate-block-builder-runtime-api", path = "../../core/block-builder/runtime-api", default-features = false }
|
||||
tx-pool-api = { package = "substrate-transaction-pool-runtime-api", path = "../../core/transaction-pool/runtime-api", default-features = false }
|
||||
inherents = { package = "substrate-inherents", path = "../../core/inherents", default-features = false }
|
||||
|
||||
[build-dependencies]
|
||||
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.4" }
|
||||
@@ -36,7 +39,7 @@ wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.
|
||||
default = ["std"]
|
||||
std = [
|
||||
"codec/std",
|
||||
"client/std",
|
||||
"sr-api/std",
|
||||
"rstd/std",
|
||||
"runtime-io/std",
|
||||
"support/std",
|
||||
@@ -58,4 +61,7 @@ std = [
|
||||
"safe-mix/std",
|
||||
"offchain-primitives/std",
|
||||
"substrate-session/std",
|
||||
"block-builder-api/std",
|
||||
"tx-pool-api/std",
|
||||
"inherents/std",
|
||||
]
|
||||
|
||||
@@ -18,10 +18,7 @@ use sr_primitives::traits::{
|
||||
NumberFor, BlakeTwo256, Block as BlockT, StaticLookup, Verify, ConvertInto, IdentifyAccount
|
||||
};
|
||||
use sr_primitives::weights::Weight;
|
||||
use client::{
|
||||
block_builder::api::{CheckInherentsResult, InherentData, self as block_builder_api},
|
||||
runtime_api as client_api, impl_runtime_apis
|
||||
};
|
||||
use sr_api::impl_runtime_apis;
|
||||
use aura_primitives::sr25519::AuthorityId as AuraId;
|
||||
use grandpa::AuthorityList as GrandpaAuthorityList;
|
||||
use grandpa::fg_primitives;
|
||||
@@ -283,7 +280,7 @@ pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExt
|
||||
pub type Executive = executive::Executive<Runtime, Block, system::ChainContext<Runtime>, Runtime, AllModules>;
|
||||
|
||||
impl_runtime_apis! {
|
||||
impl client_api::Core<Block> for Runtime {
|
||||
impl sr_api::Core<Block> for Runtime {
|
||||
fn version() -> RuntimeVersion {
|
||||
VERSION
|
||||
}
|
||||
@@ -297,7 +294,7 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl client_api::Metadata<Block> for Runtime {
|
||||
impl sr_api::Metadata<Block> for Runtime {
|
||||
fn metadata() -> OpaqueMetadata {
|
||||
Runtime::metadata().into()
|
||||
}
|
||||
@@ -312,11 +309,14 @@ impl_runtime_apis! {
|
||||
Executive::finalize_block()
|
||||
}
|
||||
|
||||
fn inherent_extrinsics(data: InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
|
||||
fn inherent_extrinsics(data: inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
|
||||
data.create_extrinsics()
|
||||
}
|
||||
|
||||
fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult {
|
||||
fn check_inherents(
|
||||
block: Block,
|
||||
data: inherents::InherentData,
|
||||
) -> inherents::CheckInherentsResult {
|
||||
data.check_extrinsics(&block)
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ impl_runtime_apis! {
|
||||
}
|
||||
}
|
||||
|
||||
impl client_api::TaggedTransactionQueue<Block> for Runtime {
|
||||
impl tx_pool_api::TaggedTransactionQueue<Block> for Runtime {
|
||||
fn validate_transaction(tx: <Block as BlockT>::Extrinsic) -> TransactionValidity {
|
||||
Executive::validate_transaction(tx)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user