pub struct NearRpcClient { /* private fields */ }Expand description
Read-only NEAR JSON-RPC namespace.
Only the three typed reads below are available. The private underlying
RpcNamespace is intentionally not exposed and this type does not
implement Deref or AsRef.
let rpc = ErpcClient::new(ErpcClientConfig::new("key"))?.near.rpc;
let _ = rpc.raw::<serde_json::Value>("query", None);let rpc = ErpcClient::new(ErpcClientConfig::new("key"))?.near.rpc;
let _ = rpc.request::<serde_json::Value>("query", serde_json::Value::Null);let rpc = ErpcClient::new(ErpcClientConfig::new("key"))?.near.rpc;
let _ = rpc.batch(Vec::new());let rpc = ErpcClient::new(ErpcClientConfig::new("key"))?.near.rpc;
let _ = rpc.subscribe("heads", Vec::new());let rpc = ErpcClient::new(ErpcClientConfig::new("key"))?.near.rpc;
let _ = rpc.call_function("account", "method", Vec::<u8>::new());let rpc = ErpcClient::new(ErpcClientConfig::new("key"))?.near.rpc;
let _ = rpc.send_tx(Vec::<u8>::new());let rpc = ErpcClient::new(ErpcClientConfig::new("key"))?.near.rpc;
let _ = rpc.broadcast_tx_async(Vec::<u8>::new());let rpc = ErpcClient::new(ErpcClientConfig::new("key"))?.near.rpc;
let _ = rpc.broadcast_tx_commit(Vec::<u8>::new());Implementations§
Source§impl NearRpcClient
impl NearRpcClient
Sourcepub fn endpoint(&self) -> String
pub fn endpoint(&self) -> String
Returns only the configured origin and /, with credentials and route
prefixes removed. Empty string denotes an unavailable namespace.
Sourcepub fn status(&self) -> PendingRpcRequest<NearStatus>
pub fn status(&self) -> PendingRpcRequest<NearStatus>
Creates a pending status read with exactly params: [].
§Panics
This method panics only if serializing the built-in empty parameter
array fails; serialization of Vec<Value> is infallible for this
value.
Sourcepub fn block(
&self,
reference: NearBlockReference,
) -> Result<PendingRpcRequest<NearBlockView>>
pub fn block( &self, reference: NearBlockReference, ) -> Result<PendingRpcRequest<NearBlockView>>
Creates a pending block read for exactly one selector.
Sourcepub fn view_account(
&self,
account_id: impl Into<String>,
reference: NearBlockReference,
) -> Result<PendingRpcRequest<NearAccountView>>
pub fn view_account( &self, account_id: impl Into<String>, reference: NearBlockReference, ) -> Result<PendingRpcRequest<NearAccountView>>
Creates the fixed view_account query for an opaque account ID.
§Panics
This method panics only if the internal one-key block selector cannot be serialized or does not serialize as an object. The selector type’s implementation guarantees both properties for its two variants.