Instantiate all Light RPC extensions.
(deps: LightDeps<C, F, P>)
| 190 | |
| 191 | /// Instantiate all Light RPC extensions. |
| 192 | pub fn create_light<C, P, M, F>(deps: LightDeps<C, F, P>) -> jsonrpc_core::IoHandler<M> |
| 193 | where |
| 194 | C: sp_blockchain::HeaderBackend<Block>, |
| 195 | C: Send + Sync + 'static, |
| 196 | F: sc_client_api::light::Fetcher<Block> + 'static, |
| 197 | P: TransactionPool + 'static, |
| 198 | M: jsonrpc_core::Metadata + Default, |
| 199 | { |
| 200 | use substrate_frame_rpc_system::{ |
| 201 | LightSystem, |
| 202 | SystemApi, |
| 203 | }; |
| 204 | |
| 205 | let LightDeps { |
| 206 | client, |
| 207 | pool, |
| 208 | remote_blockchain, |
| 209 | fetcher, |
| 210 | } = deps; |
| 211 | let mut io = jsonrpc_core::IoHandler::default(); |
| 212 | io.extend_with(SystemApi::<Hash, AccountId, Index>::to_delegate(LightSystem::new( |
| 213 | client, |
| 214 | remote_blockchain, |
| 215 | fetcher, |
| 216 | pool, |
| 217 | ))); |
| 218 | |
| 219 | io |
| 220 | } |