@hashgraph/sdk
    Preparing search index...

    Class Query<OutputT>Abstract

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

    Type Parameters

    • OutputT

    Hierarchy (View Summary)

    Index

    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.

    _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

    • 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 MirrorChannel

      Parameters

      Returns Promise<void>

    • Create a payment transaction for a query

      Parameters

      Returns Promise<ITransaction>

    • Parameters

      • request: Query

      Returns Uint8Array<ArrayBufferLike>

    • Parameters

      • response: Response

      Returns Uint8Array<ArrayBufferLike>

    • Validate checksums of the query.

      Parameters

      • client: Client<any, any>

      Returns void

    • Fetch the cost of this query from a consensus node

      Parameters

      • client: Client<Channel, any>

      Returns Promise<Hbar>

    • 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

      Returns Query<OutputT>

    • Serialize the query into bytes.

      NOTE: Does not preserve payment transactions

      Returns Uint8Array<ArrayBufferLike>

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

      Type Parameters

      • T

      Parameters

      • bytes: Uint8Array<ArrayBufferLike>

      Returns Query<T>