#![warn(missing_docs)]
mod chain;
mod client;
mod error;
mod sync_header;
mod transaction_tracker;
pub mod calls;
pub mod guard;
pub mod metrics;
pub mod test_chain;
use std::time::Duration;
pub use crate::{
chain::{
AccountKeyPairOf, BlockWithJustification, CallOf, Chain, ChainWithBalances,
ChainWithGrandpa, ChainWithMessages, ChainWithRuntimeVersion, ChainWithTransactions,
ChainWithUtilityPallet, FullRuntimeUtilityPallet, MockedRuntimeUtilityPallet, Parachain,
RelayChain, SignParam, SignedBlockOf, TransactionStatusOf, UnsignedTransaction,
UtilityPallet,
},
client::{
is_ancient_block, rpc_with_caching as new, ChainRuntimeVersion, Client,
OpaqueGrandpaAuthoritiesSet, RpcWithCachingClient, SimpleRuntimeVersion, StreamDescription,
Subscription, ANCIENT_BLOCK_THRESHOLD,
},
error::{Error, Result},
sync_header::SyncHeader,
transaction_tracker::TransactionTracker,
};
pub use bp_runtime::{
AccountIdOf, AccountPublicOf, BalanceOf, BlockNumberOf, Chain as ChainBase, HashOf, HeaderIdOf,
HeaderOf, NonceOf, Parachain as ParachainBase, SignatureOf, TransactionEra, TransactionEraOf,
UnderlyingChainProvider,
};
#[derive(Debug, Clone)]
pub struct ConnectionParams {
pub uri: Option<String>,
pub host: String,
pub port: u16,
pub path: Option<String>,
pub secure: bool,
pub chain_runtime_version: ChainRuntimeVersion,
}
impl Default for ConnectionParams {
fn default() -> Self {
ConnectionParams {
uri: None,
host: "localhost".into(),
port: 9944,
path: None,
secure: false,
chain_runtime_version: ChainRuntimeVersion::Auto,
}
}
}
pub fn transaction_stall_timeout(
mortality_period: Option<u32>,
average_block_interval: Duration,
default_stall_timeout: Duration,
) -> Duration {
mortality_period
.map(|mortality_period| average_block_interval.saturating_mul(mortality_period + 1 + 1))
.unwrap_or(default_stall_timeout)
}