Show / Hide Table of Contents

Class QueryContractParams

Provides the details of the request to the client when invoking a contract local query function.

Inheritance
object
QueryContractParams
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public sealed class QueryContractParams
Examples

Query a read-only method on an existing contract. No transaction, no state change, no consensus timestamp — executed locally on the gateway:

var result = await client.QueryContractAsync(new QueryContractParams
{
    Contract = contract,
    Gas = 50_000,
    MethodName = methodName
});
Console.WriteLine($"Result: {result}");

Properties

| Edit this page View Source

CancellationToken

Optional Cancellation token that can interrupt the query.

Declaration
public CancellationToken? CancellationToken { get; set; }
Property Value
Type Description
CancellationToken?
| Edit this page View Source

Contract

The address of the contract to call.

Declaration
public EntityId Contract { get; set; }
Property Value
Type Description
EntityId
| Edit this page View Source

Gas

The amount of gas that is allowed for the call.

Declaration
public long Gas { get; set; }
Property Value
Type Description
long
| Edit this page View Source

MessageSender

The account that is the "message.sender" of the contract call, if not specified it is the transaction Payer.

Declaration
public EntityId MessageSender { get; set; }
Property Value
Type Description
EntityId
| Edit this page View Source

MethodArgs

The function arguments to send with the method call.

Declaration
public object[] MethodArgs { get; set; }
Property Value
Type Description
object[]
| Edit this page View Source

MethodName

Name of the contract function to call.

Declaration
public string MethodName { get; set; }
Property Value
Type Description
string
| Edit this page View Source

ReturnedDataGasAllowance

The amount of GAS required to pay for returning the output data from the contract. This is an additional fee that is incorporated into the max gas fee under the hood. Gas can be set at what a mirror node would estimate as the necessary charge, and this accounts for the bytes returned. Honestly, you should be using mirror nodes for read-only queries of the EVM anyway, it will be cheaper for your wallet.

Declaration
public long ReturnedDataGasAllowance { get; set; }
Property Value
Type Description
long
| Edit this page View Source

ThrowOnFail

Throw a <xref href="Hiero.ContractException" data-throw-if-not-resolved="false"></xref> exception if the query
call returns a code other than success.  Default is true to maintain
backwards compatibility.  If set to false, the 
<xref href="Hiero.ContractCallResult" data-throw-if-not-resolved="false"></xref> will be returned without an exception.
The exception returned also includes the contract call result.
Default is 
true

.

Declaration
public bool ThrowOnFail { get; set; }
Property Value
Type Description
bool
  • Edit this page
  • View Source
In this article
Back to top .NET Client Library for Hiero Network and Hedera Hashgraph