lightclient: Add generic platform for AddedChain

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Alexandru Vasile
2024-01-26 15:05:37 +02:00
parent 123192091f
commit ab0f67f5e7
4 changed files with 13 additions and 16 deletions
+2 -2
View File
@@ -314,10 +314,10 @@ impl<TPlatform: PlatformRef, TChain> BackgroundTask<TPlatform, TChain> {
/// Perform the main background task:
/// - receiving requests from subxt RPC method / subscriptions
/// - provides the results from the light client back to users.
pub async fn start_task(
pub async fn start_task<TPlat: smoldot_light::platform::PlatformRef>(
&mut self,
from_subxt: mpsc::UnboundedReceiver<FromSubxt>,
from_node: Vec<AddedChain>,
from_node: Vec<AddedChain<TPlat>>,
) {
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<TPlat: 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<TPlat>,
}