Class ExternalExtensions
Extension methods for querying and preparing externally constructed transactions.
Inherited Members
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public static class ExternalExtensions
Methods
| Edit this page View SourcePrepareExternalTransactionAsync<TReceipt>(ConsensusClient, TransactionParams<TReceipt>, Action<IConsensusContext>?)
Creates a protobuf encoded signed transaction suitable for submission to the Hedera Network. The client must be configured with a gossip node and payer, however signatories are optional to support the use case of signing by third party external wallets.
Declaration
public static Task<ReadOnlyMemory<byte>> PrepareExternalTransactionAsync<TReceipt>(this ConsensusClient client, TransactionParams<TReceipt> transactionParams, Action<IConsensusContext>? configure = null) where TReceipt : TransactionReceipt
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | Consensus Node Client |
| TransactionParams<TReceipt> | transactionParams | One of the supported transaction parameters objects, typically each network function has a corresponding set of parameters necessary to define the details of each request. |
| 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<ReadOnlyMemory<byte>> | Binary serialized encoding of a SignedTransaction Protobuf primitive representing the desired hedera transaction. |
Type Parameters
| Name | Description |
|---|---|
| TReceipt |
QueryExternalAsync(ConsensusClient, ReadOnlyMemory<byte>, CancellationToken, Action<IConsensusContext>?)
Submits the given query represented in the protobuf encoded byte message to the network, returning the Proto.Response protobuf encoded as bytes.
Declaration
public static Task<ReadOnlyMemory<byte>> QueryExternalAsync(this ConsensusClient client, ReadOnlyMemory<byte> queryBytes, CancellationToken cancellationToken = default, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client to query. |
| ReadOnlyMemory<byte> | queryBytes | The encoded protobuf bytes of the query to perform. |
| 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<ReadOnlyMemory<byte>> | The bytes of the Proto.Response representing the query results. |
Remarks
Payment information attached to the query will be ignored, the algorithm will attempt to query for free first, then sign with the Payer/Signatory pair contained within the configuration if the query requires a payment. Additionally, querying for a receipt is a special case, it is never charged a query fee and the algorithm, when it recognizes a receipt query, will wait for consensus if necessary before returning results.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | If the bytes do not represent a valid Protobuf Encoded Query. |