mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 12:49:23 +00:00
Add method to fetch a block's events to the RPC
This commit is contained in:
@@ -4,10 +4,13 @@
|
||||
extern crate alloc;
|
||||
|
||||
use alloc::vec::Vec;
|
||||
use serai_abi::primitives::{
|
||||
crypto::{Public, SignedEmbeddedEllipticCurveKeys},
|
||||
network_id::NetworkId,
|
||||
balance::Balance,
|
||||
use serai_abi::{
|
||||
primitives::{
|
||||
crypto::{Public, SignedEmbeddedEllipticCurveKeys},
|
||||
network_id::NetworkId,
|
||||
balance::Balance,
|
||||
},
|
||||
Event,
|
||||
};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
@@ -30,6 +33,7 @@ sp_api::decl_runtime_apis! {
|
||||
fn build(genesis: GenesisConfig);
|
||||
}
|
||||
pub trait SeraiApi {
|
||||
fn events() -> Vec<Vec<u8>>;
|
||||
fn validators(network_id: NetworkId) -> Vec<Public>;
|
||||
}
|
||||
}
|
||||
@@ -169,6 +173,9 @@ mod apis {
|
||||
}
|
||||
|
||||
impl crate::SeraiApi<Block> for Runtime {
|
||||
fn events() -> Vec<Vec<u8>> {
|
||||
unimplemented!("runtime is only implemented when WASM")
|
||||
}
|
||||
fn validators(
|
||||
network: serai_abi::primitives::network_id::NetworkId
|
||||
) -> Vec<serai_abi::primitives::crypto::Public> {
|
||||
|
||||
@@ -505,6 +505,9 @@ sp_api::impl_runtime_apis! {
|
||||
}
|
||||
|
||||
impl crate::SeraiApi<Block> for Runtime {
|
||||
fn events() -> Vec<Vec<u8>> {
|
||||
Core::events()
|
||||
}
|
||||
fn validators(network: NetworkId) -> Vec<serai_abi::primitives::crypto::Public> {
|
||||
// Returning the latest-decided, not latest and active, means the active set
|
||||
// may fail to peer find if there isn't sufficient overlap. If a large amount reboot,
|
||||
|
||||
Reference in New Issue
Block a user