Class TransactionRecordExtensions
Extension methods for retrieving transaction records from the network.
Inherited Members
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public static class TransactionRecordExtensions
Methods
| Edit this page View SourceGetAccountRecordsAsync(ConsensusClient, EntityId, CancellationToken, Action<IConsensusContext>?)
Retrieves the account records associated with an account that are presently held within the network because they exceeded the receive or send threshold values for autogeneration of records.
Declaration
public static Task<TransactionRecord[]> GetAccountRecordsAsync(this ConsensusClient client, EntityId account, CancellationToken cancellationToken = default, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client to query. |
| EntityId | account | The Hedera account to retrieve associated records for. |
| CancellationToken | cancellationToken | Optional cancellation token. |
| Action<IConsensusContext> | configure | Optional callback method providing an opportunity to modify the execution configuration for just this method call. It is executed prior to submitting the request to the network. |
Returns
| Type | Description |
|---|---|
| Task<TransactionRecord[]> | An array of transaction records associated with the given account. |
Remarks
Record types are resolved on a best-effort basis. Four kinds are
identified by fields the wire format cannot distinguish from unset when
their value is zero — TokenRecord,
NftMintRecord, ConsensusNodeRecord and
RegisteredNodeRecord — and resolve to the base
TransactionRecord in that case. Prefer an is
pattern over a hard cast, which would throw. No data is lost, since the
fallback occurs only when the value is zero.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | If required arguments are missing or invalid. |
| InvalidOperationException | If required context configuration is missing. |
| PrecheckException | If the gateway node refused the query. |
GetAllTransactionRecordsAsync(ConsensusClient, TransactionId, CancellationToken, Action<IConsensusContext>?)
Retrieves every record the network holds for the given transaction ID, grouped into the submitted transaction's own record, the records of any child transactions it spawned, and the records of any duplicate submissions of the same transaction ID. Typically only the parent record is present, but a transaction that causes the network to act on its behalf — or that was submitted more than once — will populate the other groups.
Declaration
public static Task<TransactionRecords> GetAllTransactionRecordsAsync(this ConsensusClient client, TransactionId transaction, CancellationToken cancellationToken = default, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client to query. |
| TransactionId | transaction | TransactionId identifier of the record |
| CancellationToken | cancellationToken | Optional cancellation token. |
| Action<IConsensusContext> | configure | Optional callback method providing an opportunity to modify the execution configuration for just this method call. It is executed prior to submitting the request to the network. |
Returns
| Type | Description |
|---|---|
| Task<TransactionRecords> | A collection of all the transaction records known to the system at the time of query having the identified transaction id. |
Remarks
Record types are resolved on a best-effort basis. Four kinds are
identified by fields the wire format cannot distinguish from unset when
their value is zero — TokenRecord,
NftMintRecord, ConsensusNodeRecord and
RegisteredNodeRecord — and resolve to the base
TransactionRecord in that case. Prefer an is
pattern over a hard cast, which would throw. No data is lost, since the
fallback occurs only when the value is zero.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | If required arguments are missing or invalid. |
| InvalidOperationException | If required context configuration is missing. |
| PrecheckException | If the gateway node refused the query. |
| TransactionException | If the node refuses the paid lookup with any status other than RECORD_NOT_FOUND, for example when the network changes the query's price mid-request. Its receipt is a stand-in carrying that status, not a verdict on the transaction. A transaction id the node holds no records for does not throw: Parent is then
. |
GetTransactionRecordAsync(ConsensusClient, TransactionId, CancellationToken, Action<IConsensusContext>?)
Retrieves the transaction records for a given transaction ID that was successfully processed, otherwise the first one to reach consensus.
Declaration
public static Task<TransactionRecord> GetTransactionRecordAsync(this ConsensusClient client, TransactionId transaction, CancellationToken cancellationToken = default, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client to query. |
| TransactionId | transaction | TransactionId identifier of the record |
| CancellationToken | cancellationToken | Optional cancellation token. |
| Action<IConsensusContext> | configure | Optional callback method providing an opportunity to modify the execution configuration for just this method call. It is executed prior to submitting the request to the network. |
Returns
| Type | Description |
|---|---|
| Task<TransactionRecord> | A transaction record with the specified id, or an exception if not found. |
Remarks
Generally there is only one record per transaction, but in certain cases where there is a transaction ID collision (deliberate or accidental) there may be more, the GetAllTransactionRecordsAsync(ConsensusClient, TransactionId, CancellationToken, Action<IConsensusContext>?) method may be used to retrieve all records.
Record types are resolved on a best-effort basis. Four kinds are
identified by fields the wire format cannot distinguish from unset when
their value is zero — TokenRecord,
NftMintRecord, ConsensusNodeRecord and
RegisteredNodeRecord — and resolve to the base
TransactionRecord in that case. Prefer an is
pattern over a hard cast, which would throw. No data is lost, since the
fallback occurs only when the value is zero.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | If required arguments are missing or invalid. |
| InvalidOperationException | If required context configuration is missing. |
| PrecheckException | If the gateway node refused the query. |
| TransactionException | If the network has no records of the transaction or request has invalid or had missing data. |