Use host as ws/dapps url if present.
This commit is contained in:
@@ -51,6 +51,6 @@ pub use self::signer::SignerService;
|
||||
pub use self::subscribers::Subscribers;
|
||||
pub use self::subscription_manager::GenericPollManager;
|
||||
|
||||
pub fn to_url(address: &Option<(String, u16)>) -> Option<String> {
|
||||
address.as_ref().map(|&(ref iface, ref port)| format!("{}:{}", iface, port))
|
||||
pub fn to_url(address: &Option<::Host>) -> Option<String> {
|
||||
address.as_ref().map(|host| (**host).to_owned())
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ use v1::types::{
|
||||
OperationsInfo, DappId, ChainStatus,
|
||||
AccountInfo, HwAccountInfo, Header, RichHeader,
|
||||
};
|
||||
use Host;
|
||||
|
||||
/// Parity implementation for light client.
|
||||
pub struct ParityClient {
|
||||
@@ -55,8 +56,8 @@ pub struct ParityClient {
|
||||
settings: Arc<NetworkSettings>,
|
||||
health: NodeHealth,
|
||||
signer: Option<Arc<SignerService>>,
|
||||
dapps_address: Option<(String, u16)>,
|
||||
ws_address: Option<(String, u16)>,
|
||||
dapps_address: Option<Host>,
|
||||
ws_address: Option<Host>,
|
||||
eip86_transition: u64,
|
||||
}
|
||||
|
||||
@@ -70,8 +71,8 @@ impl ParityClient {
|
||||
settings: Arc<NetworkSettings>,
|
||||
health: NodeHealth,
|
||||
signer: Option<Arc<SignerService>>,
|
||||
dapps_address: Option<(String, u16)>,
|
||||
ws_address: Option<(String, u16)>,
|
||||
dapps_address: Option<Host>,
|
||||
ws_address: Option<Host>,
|
||||
) -> Self {
|
||||
ParityClient {
|
||||
light_dispatch,
|
||||
|
||||
@@ -51,6 +51,7 @@ use v1::types::{
|
||||
OperationsInfo, DappId, ChainStatus,
|
||||
AccountInfo, HwAccountInfo, RichHeader
|
||||
};
|
||||
use Host;
|
||||
|
||||
/// Parity implementation.
|
||||
pub struct ParityClient<C, M, U> {
|
||||
@@ -64,8 +65,8 @@ pub struct ParityClient<C, M, U> {
|
||||
logger: Arc<RotatingLogger>,
|
||||
settings: Arc<NetworkSettings>,
|
||||
signer: Option<Arc<SignerService>>,
|
||||
dapps_address: Option<(String, u16)>,
|
||||
ws_address: Option<(String, u16)>,
|
||||
dapps_address: Option<Host>,
|
||||
ws_address: Option<Host>,
|
||||
eip86_transition: u64,
|
||||
}
|
||||
|
||||
@@ -84,8 +85,8 @@ impl<C, M, U> ParityClient<C, M, U> where
|
||||
logger: Arc<RotatingLogger>,
|
||||
settings: Arc<NetworkSettings>,
|
||||
signer: Option<Arc<SignerService>>,
|
||||
dapps_address: Option<(String, u16)>,
|
||||
ws_address: Option<(String, u16)>,
|
||||
dapps_address: Option<Host>,
|
||||
ws_address: Option<Host>,
|
||||
) -> Self {
|
||||
let eip86_transition = client.eip86_transition();
|
||||
ParityClient {
|
||||
|
||||
@@ -31,6 +31,7 @@ use v1::metadata::Metadata;
|
||||
use v1::helpers::{SignerService, NetworkSettings};
|
||||
use v1::tests::helpers::{TestSyncProvider, Config, TestMinerService, TestUpdater};
|
||||
use super::manage_network::TestManageNetwork;
|
||||
use Host;
|
||||
|
||||
pub type TestParityClient = ParityClient<TestBlockChainClient, TestMinerService, TestUpdater>;
|
||||
|
||||
@@ -44,8 +45,8 @@ pub struct Dependencies {
|
||||
pub settings: Arc<NetworkSettings>,
|
||||
pub network: Arc<ManageNetwork>,
|
||||
pub accounts: Arc<AccountProvider>,
|
||||
pub dapps_address: Option<(String, u16)>,
|
||||
pub ws_address: Option<(String, u16)>,
|
||||
pub dapps_address: Option<Host>,
|
||||
pub ws_address: Option<Host>,
|
||||
}
|
||||
|
||||
impl Dependencies {
|
||||
@@ -74,8 +75,8 @@ impl Dependencies {
|
||||
}),
|
||||
network: Arc::new(TestManageNetwork),
|
||||
accounts: Arc::new(AccountProvider::transient_provider()),
|
||||
dapps_address: Some(("127.0.0.1".into(), 18080)),
|
||||
ws_address: Some(("127.0.0.1".into(), 18546)),
|
||||
dapps_address: Some("127.0.0.1:18080".into()),
|
||||
ws_address: Some("127.0.0.1:18546".into()),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user