ghost-node/utils/staking-miner/src/prelude.rs

46 lines
1.7 KiB
Rust
Raw Normal View History

pub use pallet_election_provider_multi_phase::{Miner, MinerConfig};
pub use subxt::ext::sp_core;
pub use primitives::{AccountId, Header, Hash, Balance};
// pub type AccountId = sp_runtime::AccountId32;
// pub type Header = subxt::config::substrate::SubstrateHeader<u32, subxt::config::substrate::BlakeTwo256>;
// pub type Hash = sp_core::H256;
// pub type Balance = u128;
pub use subxt::ext::sp_runtime::traits::{Block as BlockT, Header as HeaderT};
pub const DEFAULT_URI: &str = "ws://127.0.0.1:9944";
pub const LOG_TARGET: &str = "ghost-staking-miner";
pub const DEFAULT_PROMETHEUS_PORT: u16 = 9999;
pub type Pair = sp_core::sr25519::Pair;
pub type Accuracy = sp_runtime::Perbill;
// TODO: revisit
pub type RpcClient = subxt::backend::legacy::LegacyPrcMethods<subxt::SubstrateConfig>;
pub type ChainClient = subxt::OnlineClient<subxt::SubstrateConfig>;
pub type Config = subxt::SubstrateConfig;
pub type SignedSubmission<S> = pallet_election_provider_multi_phase::SignedSubmission<AccountId, Balance, S>;
#[subxt::subxt(
runtime_metadata_path = "artifacts/metadata.scale",
derive_for_all_types = "Clone, Debug, Eq, PartialEq",
derive_for_type(
path = "pallet_election_provider_multi_phase::RoundSnapshot",
derive = "Default"
),
substitute_type(
path = "sp_npos_elections::ElectionScore",
with = "::subxt::utils::Static<::sp_npos_elections::ElectionScore>"
),
substitute_type(
path = "pallet_election_provider_multi_phase::Phase<Bn>",
with = "::subxt::utils::Static<::pallet_election_provider_multi_phase::Phase<Bn>>"
)
)]
pub mod runtime {}
pub static SHARED_CLIENT: once_cell::sync::OnceCell<crate::client::Client> =
once_cell::sync::OnceCell::new();