TendermintApi, compilation fixes

This commit is contained in:
Luke Parker
2022-10-27 08:44:53 -04:00
parent 66f7663cb2
commit 5c08fa9701
14 changed files with 202 additions and 110 deletions

View File

@@ -10,3 +10,12 @@ edition = "2021"
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
sp-core = { git = "https://github.com/serai-dex/substrate", default-features = false }
sp-std = { git = "https://github.com/serai-dex/substrate", default-features = false }
sp-api = { git = "https://github.com/serai-dex/substrate", default-features = false }
[features]
std = ["sp-core/std", "sp-std/std", "sp-api/std"]
default = ["std"]

View File

@@ -1,7 +1,15 @@
#![cfg_attr(not(feature = "std"), no_std)]
use sp_core::sr25519::Public;
use sp_std::vec::Vec;
trait TendermintApi {
fn validators() -> Vec<Public>;
sp_api::decl_runtime_apis! {
pub trait TendermintApi {
/// Current session number. A session is NOT a fixed length of blocks, yet rather a continuous
/// set of validators.
fn current_session() -> u32;
/// Current validators.
fn validators() -> Vec<Public>;
}
}