Class ContractInfoExtensions
Extension methods for querying smart contract information and bytecode.
Inherited Members
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public static class ContractInfoExtensions
Methods
| Edit this page View SourceGetContractBytecodeAsync(ConsensusClient, EntityId, CancellationToken, Action<IConsensusContext>?)
Retrieves the bytecode for the specified contract.
Declaration
public static Task<ReadOnlyMemory<byte>> GetContractBytecodeAsync(this ConsensusClient client, EntityId contract, CancellationToken cancellationToken = default, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client to query. |
| EntityId | contract | The address of the Contract. |
| 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 bytecode for the specified contract instance. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | If required arguments are missing. |
| InvalidOperationException | If required context configuration is missing. |
| PrecheckException | If the gateway node rejected the request upon submission. |
GetContractInfoAsync(ConsensusClient, EntityId, CancellationToken, Action<IConsensusContext>?)
Retrieves detailed information regarding a Smart Contract Instance.
Declaration
public static Task<ContractInfo> GetContractInfoAsync(this ConsensusClient client, EntityId contract, CancellationToken cancellationToken = default, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client to query. |
| EntityId | contract | The address of the Contract instance to retrieve. |
| 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<ContractInfo> | A detailed description of the contract instance. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | If required arguments are missing. |
| InvalidOperationException | If required context configuration is missing. |
| PrecheckException | If the gateway node rejected the request upon submission. |