Show / Hide Table of Contents

Class CallContractParams

Represents the parameters required to call a smart contract on the Hedera network.

Inheritance
object
TransactionParams
TransactionParams<TransactionReceipt>
CallContractParams
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 CallContractParams : TransactionParams<TransactionReceipt>
Examples

Call a state-changing method on a deployed contract. The receipt confirms consensus but does not carry the return data — fetch it from the mirror node if you need it:

// Call a state-changing method. The receipt confirms consensus but
// does not carry the return data — fetch the CallContractRecord via
// the mirror node if you need the emitted logs/returns. Arguments in
// MethodArgs are ABI-encoded automatically from CLR types (string,
// long, byte[], etc.).
var receipt = await client.CallContractAsync(new CallContractParams
{
    Contract = contract,
    Gas = 100_000,
    MethodName = "setMessage",
    MethodArgs = new object[] { "hello world" }
});
Console.WriteLine($"Call status: {receipt.Status}");

Properties

| Edit this page View Source

CancellationToken

Optional Cancellation token that can interrupt the contract call.

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

MethodArgs

The 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

PayableAmount

For payable function calls, the amount of tinybars to send to the contract.

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

Signatory

Additional private key, keys or signing callback method required to invoke this contract. Typically not used however there are some edge cases where it may send crypto to accounts that require a signature to receive funds.

Declaration
public Signatory? Signatory { get; set; }
Property Value
Type Description
Signatory
Remarks

Keys/callbacks added here will be combined with those already identified in the client object's context when signing this transaction.

  • Edit this page
  • View Source
In this article
Back to top .NET Client Library for Hiero Network and Hedera Hashgraph