mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 12:07:57 +00:00
Fixes GrandpaApi implementation and usage
This commit is contained in:
@@ -14,7 +14,8 @@ parity-codec-derive = "2.1"
|
||||
sr-std = { path = "../../core/sr-std" }
|
||||
srml-support = { path = "../../srml/support" }
|
||||
substrate-primitives = { path = "../../core/primitives" }
|
||||
substrate-client = { path = "../../core/client", optional = true }
|
||||
substrate-fg-primitives = { path = "../../core/finality-grandpa/primitives" }
|
||||
substrate-client = { path = "../../core/client" }
|
||||
substrate-keyring = { path = "../../core/keyring" }
|
||||
srml-balances = { path = "../../srml/balances" }
|
||||
srml-consensus = { path = "../../srml/consensus" }
|
||||
@@ -57,5 +58,6 @@ std = [
|
||||
"serde_derive",
|
||||
"serde/std",
|
||||
"safe-mix/std",
|
||||
"substrate-client",
|
||||
"substrate-client/std",
|
||||
"substrate-fg-primitives/std",
|
||||
]
|
||||
|
||||
@@ -56,6 +56,7 @@ extern crate srml_upgrade_key as upgrade_key;
|
||||
#[macro_use]
|
||||
extern crate sr_version as version;
|
||||
extern crate node_primitives;
|
||||
extern crate substrate_fg_primitives;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use codec::{Encode, Decode};
|
||||
@@ -72,7 +73,7 @@ use client::runtime_api::ApiExt;
|
||||
use runtime_primitives::ApplyResult;
|
||||
use runtime_primitives::transaction_validity::TransactionValidity;
|
||||
use runtime_primitives::generic;
|
||||
use runtime_primitives::traits::{Convert, BlakeTwo256, Block as BlockT};
|
||||
use runtime_primitives::traits::{Convert, BlakeTwo256, Block as BlockT, DigestFor, NumberFor};
|
||||
#[cfg(feature = "std")]
|
||||
use runtime_primitives::traits::ApiRef;
|
||||
#[cfg(feature = "std")]
|
||||
@@ -84,6 +85,7 @@ use council::seats as council_seats;
|
||||
#[cfg(any(feature = "std", test))]
|
||||
use version::NativeVersion;
|
||||
use substrate_primitives::OpaqueMetadata;
|
||||
use substrate_fg_primitives::{runtime::GrandpaApi, ScheduledChange};
|
||||
|
||||
#[cfg(any(feature = "std", test))]
|
||||
pub use runtime_primitives::BuildStorage;
|
||||
@@ -395,6 +397,19 @@ impl client::runtime_api::Metadata<GBlock> for ClientWithApi {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl substrate_fg_primitives::GrandpaApi<GBlock> for ClientWithApi {
|
||||
fn grandpa_pending_change(&self, at: &GBlockId, digest: &DigestFor<GBlock>)
|
||||
-> Result<Option<ScheduledChange<NumberFor<GBlock>>>, client::error::Error> {
|
||||
self.call_api_at(at, "grandpa_pending_change", digest)
|
||||
}
|
||||
|
||||
fn grandpa_authorities(&self, at: &GBlockId)
|
||||
-> Result<Vec<(AuthorityId, u64)>, client::error::Error> {
|
||||
self.call_api_at(at, "grandpa_authorities", &())
|
||||
}
|
||||
}
|
||||
|
||||
impl_runtime_apis! {
|
||||
impl Core<Block> for Runtime {
|
||||
fn version() -> RuntimeVersion {
|
||||
@@ -447,4 +462,16 @@ impl_runtime_apis! {
|
||||
Executive::validate_transaction(tx)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl GrandpaApi<Block> for ClientWithApi {
|
||||
fn grandpa_pending_change(digest: DigestFor<Block>)
|
||||
-> Option<ScheduledChange<NumberFor<Block>>> {
|
||||
unimplemented!("Robert, where is the impl?")
|
||||
}
|
||||
|
||||
fn grandpa_authorities() -> Vec<(SessionKey, u64)> {
|
||||
unimplemented!("Robert, where is the impl?")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+13
@@ -526,6 +526,7 @@ dependencies = [
|
||||
"srml-treasury 0.1.0",
|
||||
"srml-upgrade-key 0.1.0",
|
||||
"substrate-client 0.1.0",
|
||||
"substrate-fg-primitives 0.1.0",
|
||||
"substrate-primitives 0.1.0",
|
||||
]
|
||||
|
||||
@@ -1272,6 +1273,18 @@ dependencies = [
|
||||
"wasmi 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "substrate-fg-primitives"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"parity-codec 2.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-codec-derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sr-primitives 0.1.0",
|
||||
"sr-std 0.1.0",
|
||||
"substrate-client 0.1.0",
|
||||
"substrate-primitives 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "substrate-keyring"
|
||||
version = "0.1.0"
|
||||
|
||||
@@ -12,6 +12,7 @@ safe-mix = { version = "1.0", default-features = false }
|
||||
parity-codec-derive = { version = "2.1" }
|
||||
parity-codec = { version = "2.1", default-features = false }
|
||||
substrate-primitives = { path = "../../../core/primitives", default-features = false }
|
||||
substrate-fg-primitives = { path = "../../../core/finality-grandpa/primitives", default-features = false }
|
||||
substrate-client = { path = "../../../core/client", default-features = false }
|
||||
sr-std = { path = "../../../core/sr-std", default-features = false }
|
||||
srml-support = { path = "../../../srml/support", default-features = false }
|
||||
@@ -38,6 +39,7 @@ std = [
|
||||
"parity-codec/std",
|
||||
"substrate-primitives/std",
|
||||
"substrate-client/std",
|
||||
"substrate-fg-primitives/std",
|
||||
"sr-std/std",
|
||||
"srml-support/std",
|
||||
"srml-balances/std",
|
||||
|
||||
BIN
Binary file not shown.
Reference in New Issue
Block a user