use alloc::borrow::Cow; use serai_abi::{ primitives::{ crypto::{KeyPair, EmbeddedEllipticCurveKeys}, network_id::{ExternalNetworkId, NetworkId}, validator_sets::{Session, ExternalValidatorSet}, balance::Amount, address::SeraiAddress, }, SubstrateHeader as Header, SubstrateBlock as Block, }; use super::*; #[sp_version::runtime_version] pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion { spec_name: Cow::Borrowed("serai"), impl_name: Cow::Borrowed("core"), authoring_version: 0, // Use the highest possible value so the node doesn't attempt to use this in place of the WASM spec_version: 0xffffffff, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 0, system_version: 0, }; /// A `struct` representing the runtime as necessary to define the available APIs. pub struct Runtime; sp_api::impl_runtime_apis! { impl sp_api::Core for Runtime { fn version() -> sp_version::RuntimeVersion { VERSION } fn initialize_block(header: &Header) -> sp_runtime::ExtrinsicInclusionMode { unimplemented!("runtime is only implemented when WASM") } fn execute_block(block: Block) { unimplemented!("runtime is only implemented when WASM") } } impl sp_block_builder::BlockBuilder for Runtime { fn apply_extrinsic( extrinsic: ::Extrinsic, ) -> sp_runtime::ApplyExtrinsicResult { unimplemented!("runtime is only implemented when WASM") } fn finalize_block() -> Header { unimplemented!("runtime is only implemented when WASM") } fn inherent_extrinsics( data: sp_inherents::InherentData, ) -> Vec<::Extrinsic> { unimplemented!("runtime is only implemented when WASM") } fn check_inherents( block: Block, data: sp_inherents::InherentData, ) -> sp_inherents::CheckInherentsResult { unimplemented!("runtime is only implemented when WASM") } } impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { fn validate_transaction( source: sp_runtime::transaction_validity::TransactionSource, tx: ::Extrinsic, block_hash: ::Hash, ) -> sp_runtime::transaction_validity::TransactionValidity { unimplemented!("runtime is only implemented when WASM") } } impl sp_consensus_babe::BabeApi for Runtime { fn configuration() -> sp_consensus_babe::BabeConfiguration { unimplemented!("runtime is only implemented when WASM") } fn current_epoch_start() -> sp_consensus_babe::Slot { unimplemented!("runtime is only implemented when WASM") } fn current_epoch() -> sp_consensus_babe::Epoch { unimplemented!("runtime is only implemented when WASM") } fn next_epoch() -> sp_consensus_babe::Epoch { unimplemented!("runtime is only implemented when WASM") } fn generate_key_ownership_proof( _slot: sp_consensus_babe::Slot, _authority_id: sp_consensus_babe::AuthorityId, ) -> Option { unimplemented!("runtime is only implemented when WASM") } fn submit_report_equivocation_unsigned_extrinsic( equivocation_proof: sp_consensus_babe::EquivocationProof
, _: sp_consensus_babe::OpaqueKeyOwnershipProof, ) -> Option<()> { unimplemented!("runtime is only implemented when WASM") } } impl sp_consensus_grandpa::GrandpaApi for Runtime { fn grandpa_authorities() -> sp_consensus_grandpa::AuthorityList { unimplemented!("runtime is only implemented when WASM") } fn current_set_id() -> sp_consensus_grandpa::SetId { unimplemented!("runtime is only implemented when WASM") } fn generate_key_ownership_proof( _set_id: sp_consensus_grandpa::SetId, _authority_id: sp_consensus_grandpa::AuthorityId, ) -> Option { unimplemented!("runtime is only implemented when WASM") } fn submit_report_equivocation_unsigned_extrinsic( equivocation_proof: sp_consensus_grandpa::EquivocationProof< ::Hash, u64, >, _: sp_consensus_grandpa::OpaqueKeyOwnershipProof, ) -> Option<()> { unimplemented!("runtime is only implemented when WASM") } } impl sp_authority_discovery::AuthorityDiscoveryApi for Runtime { fn authorities() -> Vec { unimplemented!("runtime is only implemented when WASM") } } impl crate::SeraiApi for Runtime { fn events() -> Vec>> { unimplemented!("runtime is only implemented when WASM") } fn validators( network: NetworkId ) -> Vec { unimplemented!("runtime is only implemented when WASM") } fn current_session(network: NetworkId) -> Option { unimplemented!("runtime is only implemented when WASM") } fn current_stake(network: NetworkId) -> Option { unimplemented!("runtime is only implemented when WASM") } fn keys(set: ExternalValidatorSet) -> Option { unimplemented!("runtime is only implemented when WASM") } fn current_validators(network: NetworkId) -> Option> { unimplemented!("runtime is only implemented when WASM") } fn pending_slash_report(network: ExternalNetworkId) -> bool { unimplemented!("runtime is only implemented when WASM") } fn embedded_elliptic_curve_keys( validator: SeraiAddress, network: ExternalNetworkId, ) -> Option { unimplemented!("runtime is only implemented when WASM") } } }