mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 15:51:12 +00:00
* make staking miner compatible with new OnlineConfig * remove dead code
This commit is contained in:
@@ -50,7 +50,7 @@ use frame_election_provider_support::NposSolver;
|
||||
use frame_support::traits::Get;
|
||||
use futures_util::StreamExt;
|
||||
use jsonrpsee::ws_client::{WsClient, WsClientBuilder};
|
||||
use remote_externalities::{Builder, Mode, OnlineConfig};
|
||||
use remote_externalities::{Builder, Mode, OnlineConfig, Transport};
|
||||
use rpc::{RpcApiClient, SharedRpcClient};
|
||||
use runtime_versions::RuntimeVersions;
|
||||
use signal_hook::consts::signal::*;
|
||||
@@ -314,7 +314,7 @@ where
|
||||
pallets.extend(additional);
|
||||
Builder::<B>::new()
|
||||
.mode(Mode::Online(OnlineConfig {
|
||||
transport: client.into_inner().into(),
|
||||
transport: Transport::Uri(client.uri().to_owned()),
|
||||
at,
|
||||
pallets,
|
||||
hashed_prefixes: vec![<frame_system::BlockHash<T>>::prefix_hash()],
|
||||
|
||||
@@ -103,9 +103,11 @@ pub trait RpcApi {
|
||||
fn subscribe_finalized_heads(&self);
|
||||
}
|
||||
|
||||
type Uri = String;
|
||||
|
||||
/// Wraps a shared web-socket JSON-RPC client that can be cloned.
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct SharedRpcClient(Arc<WsClient>);
|
||||
pub(crate) struct SharedRpcClient(Arc<WsClient>, Uri);
|
||||
|
||||
impl Deref for SharedRpcClient {
|
||||
type Target = WsClient;
|
||||
@@ -116,9 +118,9 @@ impl Deref for SharedRpcClient {
|
||||
}
|
||||
|
||||
impl SharedRpcClient {
|
||||
/// Consume and extract the inner client.
|
||||
pub fn into_inner(self) -> Arc<WsClient> {
|
||||
self.0
|
||||
/// Get the URI of the client.
|
||||
pub fn uri(&self) -> &str {
|
||||
&self.1
|
||||
}
|
||||
|
||||
/// Create a new shared JSON-RPC web-socket client.
|
||||
@@ -134,7 +136,7 @@ impl SharedRpcClient {
|
||||
.max_concurrent_requests(u32::MAX as usize)
|
||||
.build(uri)
|
||||
.await?;
|
||||
Ok(Self(Arc::new(client)))
|
||||
Ok(Self(Arc::new(client), uri.to_owned()))
|
||||
}
|
||||
|
||||
/// Get a storage item and decode it as `T`.
|
||||
|
||||
Reference in New Issue
Block a user