Class Query<OutputT>

Base class for all queries that can be submitted to Hedera.

Abstract

Type Parameters

  • OutputT

Hierarchy

Constructors

Properties

_maxQueryPayment: null | Hbar

The maximum query payment a user is willing to pay. Unlike Transaction.maxTransactionFee this field only exists in the SDK; there is no protobuf field equivalent. If and when we query the actual cost of the query and the cost is greater than the max query payment we'll throw a MaxQueryPaymentExceeded error.

_operator: null | ClientOperator
_paymentTransactionId: null | TransactionId

The payment transaction ID

_paymentTransactions: ITransaction[]

The payment transactions list where each index points to a different node

_queryPayment: null | Hbar

The amount being paid to the node for this query. A user can set this field explicitly, or we'll query the value during execution.

_timestamp: number

This is strictly used for _getLogId() which requires a timestamp. The timestamp it typically uses comes from the payment transaction ID, but that field is not set if this query is free. For those occasions we use this timestamp field generated at query construction instead.

Accessors

  • get grpcDeadline(): null | number
  • Get the grpc deadline

    Returns null | number

  • get maxAttempts(): number
  • Get the max attempts on the request

    Returns number

  • get maxBackoff(): number
  • Get the max backoff

    Returns number

  • get maxRetries(): number
  • Returns number

    Deprecated

  • get minBackoff(): null | number
  • Get the min backoff

    Returns null | number

  • get nodeAccountIds(): null | AccountId[]
  • Get the list of node account IDs on the request. If no nodes are set, then null is returned. The reasoning for this is simply "legacy behavior".

    Returns null | AccountId[]

Methods

  • Before we proceed exeuction, we need to do a couple checks

    Type Parameters

    • MirrorChannelT extends default<MirrorChannelT>

    Parameters

    • client: default<default, MirrorChannelT>

    Returns Promise<void>

  • Parameters

    • request: Query

    Returns Uint8Array

  • Parameters

    • response: Response

    Returns Uint8Array

  • Validate checksums of the query.

    Parameters

    • client: default<any, any>

    Returns void

  • Execute the request using a client and an optional request timeout

    Type Parameters

    • ChannelT extends default<ChannelT>

    • MirrorChannelT extends default<MirrorChannelT>

    Parameters

    • client: default<ChannelT, MirrorChannelT>
    • requestTimeout: undefined | number

    Returns Promise<OutputT>

  • Fetch the cost of this query from a consensus node

    Parameters

    • client: default<default, any>

    Returns Promise<Hbar>

  • Set the grpc deadline

    Parameters

    • grpcDeadline: number

    Returns Query<OutputT>

  • Set the max attempts on the request

    Parameters

    • maxAttempts: number

    Returns Query<OutputT>

  • Set the max backoff for the request

    Parameters

    • maxBackoff: null | number

    Returns Query<OutputT>

  • Set the maximum payment allowable for this query.

    Parameters

    • maxQueryPayment: Hbar

    Returns Query<OutputT>

  • Parameters

    • maxRetries: number

    Returns Query<OutputT>

  • Set the min backoff for the request

    Parameters

    • minBackoff: number

    Returns Query<OutputT>

  • Set the node account IDs on the request

    Parameters

    Returns Query<OutputT>

  • Set an 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.

    Parameters

    • queryPayment: Hbar

    Returns Query<OutputT>

  • Serialize the query into bytes.

    NOTE: Does not preserve payment transactions

    Returns Uint8Array

  • Deserialize a query from bytes. The bytes should be a proto.Query.

    Type Parameters

    • T

    Parameters

    • bytes: Uint8Array

    Returns Query<T>

Generated using TypeDoc