Show / Hide Table of Contents

Class ContractResultDataExtensions

Extension methods for querying contract execution results from the mirror node.

Inheritance
object
ContractResultDataExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Hiero.Mirror
Assembly: Hiero.dll
Syntax
public static class ContractResultDataExtensions

Methods

| Edit this page View Source

GetAllContractResultsAsync(MirrorRestClient, params IMirrorQueryParameter[])

Enumerates contract-call results across every contract on the network from /api/v1/contracts/results. Same filter palette as GetContractResultsAsync(MirrorRestClient, EntityId, params IMirrorQueryParameter[]), without the per-contract scoping, plus the HbarTransferProjectionFilter toggle on the HBAR-transfer subtree.

Declaration
public static IAsyncEnumerable<ContractResultData> GetAllContractResultsAsync(this MirrorRestClient client, params IMirrorQueryParameter[] filters)
Parameters
Type Name Description
MirrorRestClient client

Mirror Rest Client to use for the request.

IMirrorQueryParameter[] filters

Additional query parameters. The endpoint supports BlockHashFilter, BlockNumberFilter, EvmSenderFilter, HbarTransferProjectionFilter, InternalProjectionFilter, TimestampFilter, TransactionIndexFilter, PageLimit, and OrderBy.

Returns
Type Description
IAsyncEnumerable<ContractResultData>

An async enumerable of contract-call records. Empty when no results match the supplied criteria.

| Edit this page View Source

GetChainIdAsync(MirrorRestClient)

Retrieves the EVM chain id that this mirror's network uses, derived by scanning recent results from /api/v1/contracts/results for the first record that carries a non-zero chain id. There is no dedicated chain-id endpoint on the mirror node.

Declaration
public static Task<BigInteger> GetChainIdAsync(this MirrorRestClient client)
Parameters
Type Name Description
MirrorRestClient client

Mirror Rest Client to use for the request.

Returns
Type Description
Task<BigInteger>

The Chain ID of the Hedera network, or zero if no record in the scanned page had one set.

Exceptions
Type Condition
MirrorException

Thrown when the mirror node has no contract-result records to scan (typically a freshly-started local network).

| Edit this page View Source

GetContractResultByBlockAndPositionAsync(MirrorRestClient, ReadOnlyMemory<byte>, long)

Retrieves a single contract-call result by its position within a block, via /api/v1/contracts/results?block.hash={hash}&transaction.index={position}. The server returns a list and this method unwraps the first item — a matching result should be unique for a given (block, position) pair.

Declaration
public static Task<ContractResultData?> GetContractResultByBlockAndPositionAsync(this MirrorRestClient client, ReadOnlyMemory<byte> blockHash, long position)
Parameters
Type Name Description
MirrorRestClient client

Mirror Rest Client to use for the request.

ReadOnlyMemory<byte> blockHash

The block hash bytes — accepts the 48-byte Hedera SHA-384 record-file hash returned by the mirror, or a 32-byte EVM block hash for callers that have one.

long position

The transaction position within the block.

Returns
Type Description
Task<ContractResultData>

The contract results data or null if not found.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown when blockHash is neither 32 nor 48 bytes long.

| Edit this page View Source

GetContractResultByTimestampAsync(MirrorRestClient, EntityId, ConsensusTimeStamp, params IMirrorQueryParameter[])

Retrieves the single contract result produced by the given contract at the given consensus timestamp — useful when the timestamp is already known (e.g., from a transaction record or a block listing) and a txid/hash lookup is not available.

Declaration
public static Task<ContractResultData?> GetContractResultByTimestampAsync(this MirrorRestClient client, EntityId contract, ConsensusTimeStamp timestamp, params IMirrorQueryParameter[] filters)
Parameters
Type Name Description
MirrorRestClient client

Mirror Rest Client to use for the request.

EntityId contract

The contract whose result is requested.

ConsensusTimeStamp timestamp

The consensus timestamp identifying the execution.

IMirrorQueryParameter[] filters

Additional query parameters. The endpoint supports HbarTransferProjectionFilter to opt out of the HBAR-transfer subtree on the returned record.

Returns
Type Description
Task<ContractResultData>

The contract result, or null if not found.

| Edit this page View Source

GetContractResultByTransactionHashAsync(MirrorRestClient, EvmHash, params IMirrorProjection[])

Retrieve the contract results for a specific transaction by hash.

Declaration
public static Task<ContractResultData?> GetContractResultByTransactionHashAsync(this MirrorRestClient client, EvmHash evmTransactionHash, params IMirrorProjection[] filters)
Parameters
Type Name Description
MirrorRestClient client

Mirror Rest Client to use for the request.

EvmHash evmTransactionHash

The EVM TransactionId hash (not to be confused with the raw HAPI transaction hash)

IMirrorProjection[] filters

Optional projection toggles recognized by this endpoint — currently HbarTransferProjectionFilter, which controls whether the HBAR-transfer subtree is included in the returned record.

Returns
Type Description
Task<ContractResultData>

The contract results data, or null if not found.

| Edit this page View Source

GetContractResultByTransactionIdAsync(MirrorRestClient, TransactionId, params IMirrorProjection[])

Retrieve the contract results for a specific transaction by HAPI transaction ID

Declaration
public static Task<ContractResultData?> GetContractResultByTransactionIdAsync(this MirrorRestClient client, TransactionId transactionId, params IMirrorProjection[] filters)
Parameters
Type Name Description
MirrorRestClient client

Mirror Rest Client to use for the request.

TransactionId transactionId

The HAPI transaction id, not the EVM transaction hash

IMirrorProjection[] filters

Optional projection toggles recognized by this endpoint — currently HbarTransferProjectionFilter, which controls whether the HBAR-transfer subtree is included in the returned record.

Returns
Type Description
Task<ContractResultData>

The contract results data or null if not found

| Edit this page View Source

GetContractResultsAsync(MirrorRestClient, EntityId, params IMirrorQueryParameter[])

Enumerates calls made to a specific contract from /api/v1/contracts/{id}/results, regardless of how the call was routed (HAPI or JSON-RPC). Use TimestampFilter or BlockNumberFilter to bracket a range, EvmSenderFilter to narrow by EVM caller, or InternalProjectionFilter to include child-transaction calls. Newest-first by default; pass Ascending to reverse.

Declaration
public static IAsyncEnumerable<ContractResultData> GetContractResultsAsync(this MirrorRestClient client, EntityId contract, params IMirrorQueryParameter[] filters)
Parameters
Type Name Description
MirrorRestClient client

Mirror Rest Client to use for the request.

EntityId contract

The entityId of the contract

IMirrorQueryParameter[] filters

Additional query parameters. The endpoint supports BlockHashFilter, BlockNumberFilter, EvmSenderFilter, InternalProjectionFilter, TimestampFilter, TransactionIndexFilter, PageLimit, and OrderBy.

Returns
Type Description
IAsyncEnumerable<ContractResultData>

An async enumerable of contract-call records. Each record is a lightweight summary; the full HAPI transaction details require a separate GetTransactionAsync lookup by consensus timestamp.

| Edit this page View Source

GetContractResultsByBlockHashAsync(MirrorRestClient, ReadOnlyMemory<byte>)

Enumerates every contract-call result contained in a block, via /api/v1/contracts/results?block.hash={hash}. Results are returned in ascending transaction-index order.

Declaration
public static IAsyncEnumerable<ContractResultData> GetContractResultsByBlockHashAsync(this MirrorRestClient client, ReadOnlyMemory<byte> blockHash)
Parameters
Type Name Description
MirrorRestClient client

Mirror Rest Client to use for the request.

ReadOnlyMemory<byte> blockHash

The block hash bytes — accepts the 48-byte Hedera SHA-384 record-file hash returned by the mirror, or a 32-byte EVM block hash for callers that have one.

Returns
Type Description
IAsyncEnumerable<ContractResultData>

An async enumerable of contract-call results in the block; may be empty if the block contained no contract calls.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown when blockHash is neither 32 nor 48 bytes long.

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