Struct near_fetch::Client
source · pub struct Client { /* private fields */ }Expand description
Client that implements exponential retrying and caching of access key nonces.
Implementations§
source§impl Client
impl Client
sourcepub fn from_client(client: JsonRpcClient) -> Self
pub fn from_client(client: JsonRpcClient) -> Self
Construct a Client from an existing JsonRpcClient.
sourcepub async fn send_tx<T: Signer + ExposeAccountId>(
&self,
signer: &T,
receiver_id: &AccountId,
actions: Vec<Action>
) -> Result<FinalExecutionOutcomeView>
pub async fn send_tx<T: Signer + ExposeAccountId>( &self, signer: &T, receiver_id: &AccountId, actions: Vec<Action> ) -> Result<FinalExecutionOutcomeView>
Send a series of Actions as a [SignedTransaction] to the network.
sourcepub async fn view<T: Serialize, R: DeserializeOwned>(
&self,
receiver_id: &AccountId,
function_name: &str,
args: T
) -> Result<R>
pub async fn view<T: Serialize, R: DeserializeOwned>( &self, receiver_id: &AccountId, function_name: &str, args: T ) -> Result<R>
View into a function.
sourcepub async fn fetch_nonce(
&self,
account_id: &AccountId,
public_key: &PublicKey
) -> Result<(Nonce, CryptoHash, BlockHeight)>
pub async fn fetch_nonce( &self, account_id: &AccountId, public_key: &PublicKey ) -> Result<(Nonce, CryptoHash, BlockHeight)>
Fetches the nonce associated to the account id and public key, which essentially is the access key for the given account ID and public key. Utilize caching underneath to prevent querying for the same access key multiple times.
sourcepub async fn access_key(
&self,
account_id: &AccountId,
public_key: &PublicKey
) -> Result<(AccessKeyView, CryptoHash, BlockHeight)>
pub async fn access_key( &self, account_id: &AccountId, public_key: &PublicKey ) -> Result<(AccessKeyView, CryptoHash, BlockHeight)>
Fetches the access key for the given account ID and public key.
sourcepub async fn view_block(
&self,
block_reference: BlockReference
) -> Result<BlockView>
pub async fn view_block( &self, block_reference: BlockReference ) -> Result<BlockView>
Fetches the block for this block reference.
pub async fn check_and_invalidate_cache( &self, cache_key: &CacheKey, result: &Result<FinalExecutionOutcomeView, JsonRpcError<RpcTransactionError>> )
pub async fn invalidate_cache(&self, cache_key: &CacheKey)
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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
Mutably borrows from an owned value. Read more
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request