pub struct Query<'a, T> { /* private fields */ }Expand description
Query object allows creating queries into the network of our choice. This object is
usually given from making calls from other functions such as view_state.
Implementations§
source§impl<'a, T> Query<'a, T>
impl<'a, T> Query<'a, T>
sourcepub fn block_height(self, height: BlockHeight) -> Self
pub fn block_height(self, height: BlockHeight) -> Self
Specify at which block height to query from. Note that only archival networks will have the full history while networks like mainnet or testnet will only have the history from 5 or less epochs ago.
sourcepub fn block_hash(self, hash: CryptoHash) -> Self
pub fn block_hash(self, hash: CryptoHash) -> Self
Specify at which block hash to query from. Note that only archival networks will have the full history while networks like mainnet or testnet will only have the history from 5 or less epochs ago.
source§impl<'a, T> Query<'a, T>where
T: ProcessQuery<Method = RpcQueryRequest>,
impl<'a, T> Query<'a, T>where
T: ProcessQuery<Method = RpcQueryRequest>,
source§impl Query<'_, ViewFunction>
impl Query<'_, ViewFunction>
sourcepub fn args(self, args: Vec<u8>) -> Self
pub fn args(self, args: Vec<u8>) -> Self
Provide the arguments for the call. These args are serialized bytes from either
a JSON or Borsh serializable set of arguments. To use the more specific versions
with better quality of life, use args_json or args_borsh.
sourcepub fn args_json<U: Serialize>(self, args: U) -> Self
pub fn args_json<U: Serialize>(self, args: U) -> Self
Similar to args, specify an argument that is JSON serializable and can be
accepted by the equivalent contract. Recommend to use something like
serde_json::json! macro to easily serialize the arguments.
sourcepub fn args_borsh<U: BorshSerialize>(self, args: U) -> Self
pub fn args_borsh<U: BorshSerialize>(self, args: U) -> Self
Similar to args, specify an argument that is borsh serializable and can be
accepted by the equivalent contract.
Trait Implementations§
source§impl<'a, T, R> IntoFuture for Query<'a, T>
impl<'a, T, R> IntoFuture for Query<'a, T>
source§type IntoFuture = Pin<Box<dyn Future<Output = <Query<'a, T> as IntoFuture>::Output> + Send + 'a>>
type IntoFuture = Pin<Box<dyn Future<Output = <Query<'a, T> as IntoFuture>::Output> + Send + 'a>>
source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Auto Trait Implementations§
impl<'a, T> Freeze for Query<'a, T>where
T: Freeze,
impl<'a, T> !RefUnwindSafe for Query<'a, T>
impl<'a, T> Send for Query<'a, T>where
T: Send,
impl<'a, T> Sync for Query<'a, T>where
T: Sync,
impl<'a, T> Unpin for Query<'a, T>where
T: Unpin,
impl<'a, T> !UnwindSafe for Query<'a, T>
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more