Struct subxt_lightclient::LightClientRpc
source · pub struct LightClientRpc { /* private fields */ }Expand description
The light-client RPC implementation that is used to connect with the chain.
Implementations§
source§impl LightClientRpc
impl LightClientRpc
sourcepub fn new(
config: AddChainConfig<'_, (), impl Iterator<Item = ChainId>>
) -> Result<LightClientRpc, LightClientRpcError>
pub fn new( config: AddChainConfig<'_, (), impl Iterator<Item = ChainId>> ) -> Result<LightClientRpc, LightClientRpcError>
Constructs a new LightClientRpc, providing the chain specification.
The chain specification can be downloaded from a trusted network via
the sync_state_genSyncSpec RPC method. This parameter expects the
chain spec in text format (ie not in hex-encoded scale-encoded as RPC methods
will provide).
Panics
Panics if being called outside of tokio runtime context.
sourcepub fn method_request(
&self,
method: String,
params: String
) -> Result<Receiver<Result<Box<RawValue>, LightClientRpcError>>, SendError<FromSubxt>>
pub fn method_request( &self, method: String, params: String ) -> Result<Receiver<Result<Box<RawValue>, LightClientRpcError>>, SendError<FromSubxt>>
Submits an RPC method request to the light-client.
This method sends a request to the light-client to execute an RPC method with the provided parameters. The parameters are parsed into a valid JSON object in the background.
sourcepub fn subscription_request(
&self,
method: String,
params: String
) -> Result<(Receiver<Result<Box<RawValue>, LightClientRpcError>>, UnboundedReceiver<Box<RawValue>>), SendError<FromSubxt>>
pub fn subscription_request( &self, method: String, params: String ) -> Result<(Receiver<Result<Box<RawValue>, LightClientRpcError>>, UnboundedReceiver<Box<RawValue>>), SendError<FromSubxt>>
Makes an RPC subscription call to the light-client.
This method sends a request to the light-client to establish an RPC subscription with the provided parameters. The parameters are parsed into a valid JSON object in the background.
Trait Implementations§
source§impl Clone for LightClientRpc
impl Clone for LightClientRpc
source§fn clone(&self) -> LightClientRpc
fn clone(&self) -> LightClientRpc
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for LightClientRpc
impl Send for LightClientRpc
impl Sync for LightClientRpc
impl Unpin for LightClientRpc
impl !UnwindSafe for LightClientRpc
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.