Class TransactionDetailDataExtensions
Extension methods for querying transaction detail data from the mirror node.
Inherited Members
Namespace: Hiero.Mirror
Assembly: Hiero.dll
Syntax
public static class TransactionDetailDataExtensions
Methods
| Edit this page View SourceGetTransactionAsync(MirrorRestClient, ConsensusTimeStamp, CancellationToken)
Retrieves the single transaction record at a given consensus
timestamp via
/api/v1/transactions?timestamp={consensus}&limit=100
— consensus timestamps are globally unique across the network,
so equality narrows the list to at most one record. The method
unwraps the first item.
Declaration
public static Task<TransactionDetailData?> GetTransactionAsync(this MirrorRestClient client, ConsensusTimeStamp consensus, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| MirrorRestClient | client | Mirror Rest Client to use for the request. |
| ConsensusTimeStamp | consensus | The consensus timestamp for the transaction. |
| CancellationToken | cancellationToken | Optional token that cancels the request. |
Returns
| Type | Description |
|---|---|
| Task<TransactionDetailData> | The transaction details, or null if not found. |
GetTransactionGroupAsync(MirrorRestClient, TransactionId, CancellationToken)
Retrieves the parent/child transaction group for the given
root transaction id via /api/v1/transactions/{id}. A
single HAPI transaction can fan out into a parent record plus
zero or more child records (from nested contract calls,
scheduled transactions, etc.); this method returns the whole
group in one call.
Declaration
public static Task<TransactionDetailData[]> GetTransactionGroupAsync(this MirrorRestClient client, TransactionId transactionId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| MirrorRestClient | client | Mirror Rest Client to use for the request. |
| TransactionId | transactionId | The transaction ID to search by. |
| CancellationToken | cancellationToken | Optional token that cancels the request. |
Returns
| Type | Description |
|---|---|
| Task<TransactionDetailData[]> | A list of transactions (including child transactions with nonces) matching the given transaction ID, or an empty list if none are found. |
Remarks
The mirror's "not found" (HTTP 404) is returned as an empty array, not an exception. For a recent transaction that may only mean the mirror has not caught up: absence proves a transaction did not execute only once the mirror's latest consensus time (GetLatestConsensusTimestampAsync(MirrorRestClient, CancellationToken)), read before this lookup, is past its valid start plus its duration plus a margin for lagging mirror replicas. To settle a transaction whose outcome is unknown, see the example on ConsensusException.
The array is not ordered parent-first. The mirror node returns
the group in its own order, and child records are commonly listed
ahead of the transaction you asked about — so group[0] is not
reliably the submitted transaction. Select by content instead of by
position:
var group = await mirror.GetTransactionGroupAsync(txId);
var submitted = group.Where(t => t.Nonce == 0 && !t.IsScheduled && t.TransactionId == txId).ToArray();
var children = group.Where(t => t.Nonce > 0);
submitted is an array on purpose: it is empty while the mirror
has not caught up, and holds more than one record when the
transaction was submitted to more than one node, as described below.
A Success among them means it executed.
The group holds every record filed under the transaction id.
Nonce > 0 marks a child record the network generated on the
transaction's behalf. A schedule that executed adds the executed
transaction, with Nonce == 0 and
IsScheduled set. An atomic batch adds its
inner transactions, each with Nonce == 0 but its own
TransactionId and a
BatchEndorsement. Where a transaction was
submitted to more than one node, the extra submissions also pass the
filter above; they are told apart by
Status and
GossipNode. Do not use
ParentConsensus to identify children: it
is null for a child recorded ahead of its parent, such as an account
auto-created for an alias.
This method deliberately returns the mirror's flat array rather than pre-sorted groups, unlike the consensus-node counterpart GetAllReceiptsAsync(ConsensusClient, TransactionId, CancellationToken, Action<IConsensusContext>?). The difference is not an oversight: the consensus node sends parent, child and duplicate receipts as three separate fields, so grouping there restores structure the wire supplied, whereas the mirror sends a single array and grouping here would invent structure by applying an interpretive rule. Callers who need a particular slice are better served extracting it themselves than paying for allocations they may not want on a polling loop.
Passing a TransactionId that already carries a
ChildNonce or Scheduled flag narrows the response
to that specific record — this method turns those flags into the
nonce= and scheduled= query parameters on the
request. In that case the "group"
is usually a single record, and the method's plural return
shape (TransactionDetailData[]) degrades
gracefully to length 1.
GetTransactionsAsync(MirrorRestClient, params IMirrorQueryParameter[])
Enumerates transactions across the network. Pair with AccountFilter to narrow to a single account (credit or debit), ResultFilter to restrict to success or failure, TransferDirectionFilter for credit/debit, TransactionTypeFilter for a specific HAPI transaction kind, or TimestampFilter to bracket a time window.
Declaration
public static IAsyncEnumerable<TransactionDetailData> GetTransactionsAsync(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 AccountFilter, ResultFilter, TransferDirectionFilter, TransactionTypeFilter, TimestampFilter, PageLimit, and OrderBy. |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<TransactionDetailData> | An async enumerable of transactions (which may include child
transactions) matching the supplied filters. To list
transactions that involve a specific account (regardless of
payer status), pass |
GetTransactionsAsync(MirrorRestClient, CancellationToken, params IMirrorQueryParameter[])
Enumerates transactions across the network. Pair with AccountFilter to narrow to a single account (credit or debit), ResultFilter to restrict to success or failure, TransferDirectionFilter for credit/debit, TransactionTypeFilter for a specific HAPI transaction kind, or TimestampFilter to bracket a time window.
Declaration
public static IAsyncEnumerable<TransactionDetailData> GetTransactionsAsync(this MirrorRestClient client, CancellationToken cancellationToken, params IMirrorQueryParameter[] filters)
Parameters
| Type | Name | Description |
|---|---|---|
| MirrorRestClient | client | Mirror Rest Client to use for the request. |
| CancellationToken | cancellationToken | Token that cancels the enumeration, including a page request in
flight. |
| IMirrorQueryParameter[] | filters | Additional query parameters. The endpoint supports AccountFilter, ResultFilter, TransferDirectionFilter, TransactionTypeFilter, TimestampFilter, PageLimit, and OrderBy. |
Returns
| Type | Description |
|---|---|
| IAsyncEnumerable<TransactionDetailData> | An async enumerable of transactions (which may include child
transactions) matching the supplied filters. To list
transactions that involve a specific account (regardless of
payer status), pass |