Struct hedera::Query

source ·
pub struct Query<D>
where D: QueryExecute,
{ /* private fields */ }
Expand description

A query that can be executed on the Hedera network.

Implementations§

source§

impl Query<AccountBalanceQueryData>

source

pub fn get_account_id(&self) -> Option<AccountId>

Get the account ID for which information is requested.

source

pub fn account_id(&mut self, id: AccountId) -> &mut Self

Sets the account ID for which information is requested.

This is mutually exclusive with contract_id.

source

pub fn get_contract_id(&self) -> Option<ContractId>

Get the contract ID for which information is requested.

source

pub fn contract_id(&mut self, id: ContractId) -> &mut Self

Sets the contract ID for which information is requested.

This is mutually exclusive with account_id.

source§

impl Query<AccountInfoQueryData>

source

pub fn get_account_id(&self) -> Option<AccountId>

Gets the account ID for which information is requested.

source

pub fn account_id(&mut self, id: AccountId) -> &mut Self

Sets the account ID for which information is requested.

source§

impl Query<AccountRecordsQueryData>

source

pub fn get_account_id(&self) -> Option<AccountId>

Gets the account ID for which the records should be retrieved.

source

pub fn account_id(&mut self, id: AccountId) -> &mut Self

Sets the account ID for which the records should be retrieved.

source§

impl Query<AccountStakersQueryData>

source

pub fn get_account_id(&self) -> Option<AccountId>

Gets the account ID for which the records should be retrieved.

source

pub fn account_id(&mut self, id: AccountId) -> &mut Self

Sets the account ID for which the records should be retrieved.

source§

impl Query<ContractBytecodeQueryData>

source

pub fn get_contract_id(&self) -> Option<ContractId>

Gets the contract for which information is requested.

source

pub fn contract_id(&mut self, contract_id: ContractId) -> &mut Self

Sets the contract for which information is requested.

source§

impl Query<ContractCallQueryData>

source

pub fn get_contract_id(&self) -> Option<ContractId>

Gets the contract instance to call.

source

pub fn contract_id(&mut self, contract_id: ContractId) -> &mut Self

Sets the contract to make a static call against.

source

pub fn get_gas(&self) -> u64

Gets the amount of gas to use for the call.

source

pub fn gas(&mut self, gas: u64) -> &mut Self

Sets the amount of gas to use for the call.

source

pub fn get_contract_parameters(&self) -> &[u8]

Gets the function parameters as their raw bytes.

source

pub fn function_parameters(&mut self, data: Vec<u8>) -> &mut Self

Sets the function parameters as their raw bytes.

source

pub fn function(&mut self, name: &str) -> &mut Self

Sets the function with no parameters.

source

pub fn function_with_parameters( &mut self, name: &str, parameters: &ContractFunctionParameters ) -> &mut Self

Sets the function with parameters.

source

pub fn get_sender_account_id(&self) -> Option<AccountId>

Gets the sender for this transaction.

source

pub fn sender_account_id(&mut self, sender_account_id: AccountId) -> &mut Self

Sets the sender for this transaction.

source§

impl Query<ContractInfoQueryData>

source

pub fn get_contract_id(&self) -> Option<ContractId>

Returns the contract for which information is requested.

source

pub fn contract_id(&mut self, contract_id: ContractId) -> &mut Self

Sets the contract for which information is requested.

source§

impl Query<FileContentsQueryData>

source

pub fn get_file_id(&self) -> Option<FileId>

Returns the ID of the file for which contents are requested.

source

pub fn file_id(&mut self, id: impl Into<FileId>) -> &mut Self

Sets the file ID for which contents are requested.

source§

impl Query<FileInfoQueryData>

source

pub fn get_file_id(&self) -> Option<FileId>

Returns the ID of the file for which information is requested.

source

pub fn file_id(&mut self, id: impl Into<FileId>) -> &mut Self

Sets the ID of the file for which information is requested.

source§

impl<D> Query<D>
where D: QueryExecute + Default,

source

pub fn new() -> Self

Create a new query ready for configuration and execution.

source§

impl<D> Query<D>
where D: QueryExecute,

source

pub fn get_node_account_ids(&self) -> Option<&[AccountId]>

Returns the account IDs of the nodes that this query may be submitted to.

Defaults to the full list of nodes configured on the client; or, the node account IDs configured on the query payment transaction (if explicitly provided).

source

pub fn node_account_ids( &mut self, ids: impl IntoIterator<Item = AccountId> ) -> &mut Self

Sets the account IDs of the nodes that this query may be submitted to.

Defaults to the full list of nodes configured on the client; or, the node account IDs configured on the query payment transaction (if explicitly provided).

source

pub fn get_payment_amount(&self) -> Option<Hbar>

Returns the explicit payment amount for this query.

The client will submit exactly this amount for the payment of this query. Hedera will not return any remainder (over the actual cost for this query).

source

pub fn payment_amount(&mut self, amount: Hbar) -> &mut Self

Sets the explicit payment amount for this query.

The client will submit exactly this amount for the payment of this query. Hedera will not return any remainder (over the actual cost for this query).

source

pub fn get_max_amount(&self) -> Option<Hbar>

Returns the maximum payment allowable for this query.

source

pub fn max_payment_amount(&mut self, max: impl Into<Option<Hbar>>) -> &mut Self

Sets the maximum payment allowable for this query.

When a query is executed without an explicit payment amount set, the client will first request the cost of the given query from the node it will be submitted to and attach a payment for that amount from the operator account on the client.

If the returned value is greater than this value, a MaxQueryPaymentExceeded error will be returned.

Defaults to the maximum payment amount configured on the client.

Sets to None to allow unlimited payment amounts.

source

pub fn get_payment_transaction_valid_duration(&self) -> Option<Duration>

Returns the duration that the payment transaction is valid for, once finalized and signed.

source

pub fn payment_transaction_valid_duration( &mut self, duration: Duration ) -> &mut Self

Sets the duration that the payment transaction is valid for, once finalized and signed.

Defaults to 120 seconds (or two minutes).

source

pub fn get_max_payment_transaction_fee(&self) -> Option<Hbar>

Returns the maximum transaction fee the payer account is willing to pay for the query payment transaction.

source

pub fn max_payment_transaction_fee(&mut self, fee: Hbar) -> &mut Self

Sets the maximum transaction fee the payer account is willing to pay for the query payment transaction.

Defaults to 1 hbar.

source

pub fn get_payment_transaction_memo(&self) -> &str

Returns the note / description that should be recorded in the transaction record for the payment transaction.

source

pub fn payment_transaction_memo(&mut self, memo: impl AsRef<str>) -> &mut Self

Sets a note / description that should be recorded in the transaction record for the payment transaction.

Maximum length of 100 characters.

source

pub fn get_payment_transaction_id(&self) -> Option<TransactionId>

Returns the explicit transaction ID used to identify this query’s payment transaction, if set .

source

pub fn payment_transaction_id(&mut self, id: TransactionId) -> &mut Self

Sets an explicit transaction ID to use to identify the payment transaction on this query.

Overrides payer account defined on this query or on the client.

source

pub async fn get_cost(&self, client: &Client) -> Result<Hbar>

Fetch the cost of this query.

source

pub async fn get_cost_with_timeout( &self, client: &Client, timeout: Duration ) -> Result<Hbar>

Fetch the cost of this query.

source§

impl<D> Query<D>
where D: QueryExecute,

source

pub async fn execute(&mut self, client: &Client) -> Result<D::Response>

Execute this query against the provided client of the Hedera network.

source

pub async fn execute_with_timeout( &mut self, client: &Client, timeout: Duration ) -> Result<D::Response>

Execute this query against the provided client of the Hedera network.

source§

impl Query<ScheduleInfoQueryData>

source

pub fn get_schedule_id(&self) -> Option<ScheduleId>

Returns the schedule ID for which information is requested.

source

pub fn schedule_id(&mut self, id: impl Into<ScheduleId>) -> &mut Self

Sets the schedule ID for which information is requested.

source§

impl Query<TokenInfoQueryData>

source

pub fn get_token_id(&self) -> Option<TokenId>

Returns the token ID for which information is requested.

source

pub fn token_id(&mut self, id: impl Into<TokenId>) -> &mut Self

Sets the token ID for which information is requested.

source§

impl Query<TokenNftInfoQueryData>

source

pub fn get_nft_id(&self) -> Option<NftId>

Returns the ID of the NFT for which information is requested.

source

pub fn nft_id(&mut self, nft_id: impl Into<NftId>) -> &mut Self

Sets the ID of the NFT for which information is requested.

source§

impl Query<TopicInfoQueryData>

source

pub fn get_topic_id(&self) -> Option<TopicId>

Returns the topic to retrieve info about.

source

pub fn topic_id(&mut self, id: impl Into<TopicId>) -> &mut Self

Sets the topic to retrieve info about.

source§

impl Query<TransactionReceiptQueryData>

source

pub fn get_transaction_id(&self) -> Option<TransactionId>

Get the ID of the transaction for which the receipt is being requested.

source

pub fn transaction_id(&mut self, transaction_id: TransactionId) -> &mut Self

Sets the ID of the transaction for which the receipt is being requested.

source

pub fn get_include_children(&self) -> bool

Whether the response should include the receipts of any child transactions spawned by the top-level transaction with the given transaction.

source

pub fn include_children(&mut self, include: bool) -> &mut Self

Whether the response should include the receipts of any child transactions spawned by the top-level transaction with the given transaction.

source

pub fn get_include_duplicates(&self) -> bool

Whether receipts of processing duplicate transactions should be returned.

source

pub fn include_duplicates(&mut self, include: bool) -> &mut Self

Whether receipts of processing duplicate transactions should be returned.

source

pub fn get_validate_status(&self) -> bool

Whether the receipt status should be validated.

source

pub fn validate_status(&mut self, validate: bool) -> &mut Self

Whether the receipt status should be validated.

source§

impl Query<TransactionRecordQueryData>

source

pub fn get_transaction_id(&self) -> Option<TransactionId>

Get the ID of the transaction for which the record is being requested.

source

pub fn transaction_id(&mut self, transaction_id: TransactionId) -> &mut Self

Sets the ID of the transaction for which the record is being requested.

source

pub fn get_include_children(&self) -> bool

Whether the response should include the records of any child transactions spawned by the top-level transaction with the given transaction.

source

pub fn include_children(&mut self, include: bool) -> &mut Self

Whether the response should include the records of any child transactions spawned by the top-level transaction with the given transaction.

source

pub fn get_include_duplicates(&self) -> bool

Whether records of processing duplicate transactions should be returned.

source

pub fn include_duplicates(&mut self, include: bool) -> &mut Self

Whether records of processing duplicate transactions should be returned.

source

pub fn get_validate_status(&self) -> bool

Whether records of processing duplicate transactions should be returned.

source

pub fn validate_status(&mut self, validate: bool) -> &mut Self

Whether the record status should be validated.

Trait Implementations§

source§

impl<D> Debug for Query<D>
where D: QueryExecute + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<D> Default for Query<D>
where D: QueryExecute + Default,

source§

fn default() -> Query<D>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<D> !Freeze for Query<D>

§

impl<D> !RefUnwindSafe for Query<D>

§

impl<D> Send for Query<D>

§

impl<D> Sync for Query<D>

§

impl<D> !Unpin for Query<D>

§

impl<D> !UnwindSafe for Query<D>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more