mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Add validator sets RPC functions necessary for the coordinator
This commit is contained in:
@@ -10,6 +10,7 @@ use sp_version::RuntimeVersion;
|
||||
|
||||
use serai_abi::{
|
||||
primitives::{
|
||||
crypto::EmbeddedEllipticCurveKeys,
|
||||
network_id::{ExternalNetworkId, NetworkId},
|
||||
balance::{Amount, ExternalBalance},
|
||||
validator_sets::{Session, ExternalValidatorSet, ValidatorSet},
|
||||
@@ -582,6 +583,23 @@ sp_api::impl_runtime_apis! {
|
||||
})
|
||||
})
|
||||
}
|
||||
fn current_validators(network: NetworkId) -> Option<Vec<SeraiAddress>> {
|
||||
let session = ValidatorSets::current_session(network)?;
|
||||
Some(
|
||||
ValidatorSets::selected_validators(ValidatorSet { network, session })
|
||||
.map(|(key, _key_shares)| SeraiAddress::from(key))
|
||||
.collect()
|
||||
)
|
||||
}
|
||||
fn pending_slash_report(network: ExternalNetworkId) -> bool {
|
||||
ValidatorSets::pending_slash_report(network)
|
||||
}
|
||||
fn embedded_elliptic_curve_keys(
|
||||
validator: SeraiAddress,
|
||||
network: ExternalNetworkId,
|
||||
) -> Option<EmbeddedEllipticCurveKeys> {
|
||||
ValidatorSets::embedded_elliptic_curve_keys(validator.into(), network)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user