mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 19:51:05 +00:00
committed by
Bastian Köcher
parent
0b2c3ae860
commit
25f56283b1
@@ -143,6 +143,7 @@ pub trait StartRPC<C: Components> {
|
||||
system_info: SystemInfo,
|
||||
rpc_http: Option<SocketAddr>,
|
||||
rpc_ws: Option<SocketAddr>,
|
||||
rpc_cors: Option<Vec<String>>,
|
||||
task_executor: TaskExecutor,
|
||||
transaction_pool: Arc<TransactionPool<C::TransactionPoolApi>>,
|
||||
) -> error::Result<Self::ServersHandle>;
|
||||
@@ -161,6 +162,7 @@ impl<C: Components> StartRPC<Self> for C where
|
||||
rpc_system_info: SystemInfo,
|
||||
rpc_http: Option<SocketAddr>,
|
||||
rpc_ws: Option<SocketAddr>,
|
||||
rpc_cors: Option<Vec<String>>,
|
||||
task_executor: TaskExecutor,
|
||||
transaction_pool: Arc<TransactionPool<C::TransactionPoolApi>>,
|
||||
) -> error::Result<Self::ServersHandle> {
|
||||
@@ -184,8 +186,8 @@ impl<C: Components> StartRPC<Self> for C where
|
||||
};
|
||||
|
||||
Ok((
|
||||
maybe_start_server(rpc_http, |address| rpc::start_http(address, handler()))?,
|
||||
maybe_start_server(rpc_ws, |address| rpc::start_ws(address, handler()))?.map(Mutex::new),
|
||||
maybe_start_server(rpc_http, |address| rpc::start_http(address, rpc_cors.as_ref(), handler()))?,
|
||||
maybe_start_server(rpc_ws, |address| rpc::start_ws(address, rpc_cors.as_ref(), handler()))?.map(Mutex::new),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,8 @@ pub struct Configuration<C, G: Serialize + DeserializeOwned + BuildStorage> {
|
||||
pub rpc_http: Option<SocketAddr>,
|
||||
/// RPC over Websockets binding address. `None` if disabled.
|
||||
pub rpc_ws: Option<SocketAddr>,
|
||||
/// CORS settings for HTTP & WS servers. `None` if all origins are allowed.
|
||||
pub rpc_cors: Option<Vec<String>>,
|
||||
/// Telemetry service URL. `None` if disabled.
|
||||
pub telemetry_endpoints: Option<TelemetryEndpoints>,
|
||||
/// The default number of 64KB pages to allocate for Wasm execution
|
||||
@@ -97,6 +99,7 @@ impl<C: Default, G: Serialize + DeserializeOwned + BuildStorage> Configuration<C
|
||||
execution_strategies: Default::default(),
|
||||
rpc_http: None,
|
||||
rpc_ws: None,
|
||||
rpc_cors: Some(vec![]),
|
||||
telemetry_endpoints: None,
|
||||
default_heap_pages: None,
|
||||
offchain_worker: Default::default(),
|
||||
|
||||
@@ -160,7 +160,7 @@ impl<Components: components::Components> Service<Components> {
|
||||
warn!("Using default protocol ID {:?} because none is configured in the \
|
||||
chain specs", DEFAULT_PROTOCOL_ID
|
||||
);
|
||||
DEFAULT_PROTOCOL_ID
|
||||
DEFAULT_PROTOCOL_ID
|
||||
}
|
||||
}.as_bytes();
|
||||
let mut protocol_id = network::ProtocolId::default();
|
||||
@@ -301,7 +301,7 @@ impl<Components: components::Components> Service<Components> {
|
||||
};
|
||||
let rpc = Components::RuntimeServices::start_rpc(
|
||||
client.clone(), network.clone(), has_bootnodes, system_info, config.rpc_http,
|
||||
config.rpc_ws, task_executor.clone(), transaction_pool.clone(),
|
||||
config.rpc_ws, config.rpc_cors.clone(), task_executor.clone(), transaction_pool.clone(),
|
||||
)?;
|
||||
|
||||
// Telemetry
|
||||
|
||||
Reference in New Issue
Block a user