lightclient: Make AddedChain generic over the PlatformRef

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Alexandru Vasile
2024-01-10 19:27:00 +02:00
parent 04f2faa90b
commit c7ed160fd0
5 changed files with 13 additions and 16 deletions
+1 -1
View File
@@ -322,7 +322,7 @@ impl<TPlatform: PlatformRef, TChain> BackgroundTask<TPlatform, TChain> {
pub async fn start_task(
&mut self,
from_subxt: mpsc::UnboundedReceiver<FromSubxt>,
from_node: Vec<AddedChain>,
from_node: Vec<AddedChain<TPlatform>>,
) {
let from_subxt_event = tokio_stream::wrappers::UnboundedReceiverStream::new(from_subxt);
+3 -3
View File
@@ -123,7 +123,7 @@ impl LightClientRpc {
/// https://docs.rs/wasm-bindgen-futures/latest/wasm_bindgen_futures/fn.future_to_promise.html.
pub fn new_from_client<TPlat>(
client: smoldot_light::Client<TPlat>,
chains: impl IntoIterator<Item = AddedChain>,
chains: impl IntoIterator<Item = AddedChain<TPlat>>,
) -> RawLightClientRpc
where
TPlat: smoldot_light::platform::PlatformRef + Clone,
@@ -202,9 +202,9 @@ impl LightClientRpc {
}
/// The added chain of the light-client.
pub struct AddedChain {
pub struct AddedChain<TPlatform: smoldot_light::platform::PlatformRef> {
/// The id of the chain.
pub chain_id: smoldot_light::ChainId,
/// Producer of RPC responses for the chain.
pub rpc_responses: smoldot_light::JsonRpcResponses,
pub rpc_responses: smoldot_light::JsonRpcResponses<TPlatform>,
}
+1 -1
View File
@@ -11,7 +11,7 @@ mod wasm_platform;
#[cfg(feature = "web")]
mod wasm_socket;
pub use helpers::build_platform;
pub use helpers::{build_platform, PlatformType};
#[cfg(feature = "native")]
mod helpers {