Class SuspendTokenExtensions
Extension methods for suspending an account's ability to transact a token.
Inherited Members
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public static class SuspendTokenExtensions
Methods
| Edit this page View SourceSuspendTokenAsync(ConsensusClient, EntityId, EntityId, Action<IConsensusContext>?)
Suspends the associated account's ability to send or receive the specified token.
Declaration
public static Task<TransactionReceipt> SuspendTokenAsync(this ConsensusClient client, EntityId token, EntityId holder, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client orchestrating the suspend. |
| EntityId | token | The identifier of the token to suspend/freeze. |
| EntityId | holder | The account holding the token to suspend. |
| 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<TransactionReceipt> | A transaction receipt indicating a successful operation. |
Examples
// Freeze one holder's ability to move this token. Different from
// PauseTokenAsync (which affects all holders). Requires the token's
// SuspendEndorsement key to sign.
var receipt = await client.SuspendTokenAsync(token, holder);
Console.WriteLine($"Suspend status: {receipt.Status}");
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, for example, if the token is already deleted. |
| ConsensusException | If the network was unable to come to consensus before the duration of the transaction expired. |
| TransactionException | If the network rejected the request as invalid or had missing data. |
SuspendTokenAsync(ConsensusClient, SuspendTokenParams, Action<IConsensusContext>?)
Suspends the associated account's ability to send or receive the specified token.
Declaration
public static Task<TransactionReceipt> SuspendTokenAsync(this ConsensusClient client, SuspendTokenParams suspendParams, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client orchestrating the suspend. |
| SuspendTokenParams | suspendParams | The parameters identifying the token and holder account to suspend. |
| 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<TransactionReceipt> | A transaction receipt indicating a successful operation. |
Examples
// Freeze one holder's ability to move this token. Different from
// PauseTokenAsync (which affects all holders). Requires the token's
// SuspendEndorsement key to sign.
var receipt = await client.SuspendTokenAsync(token, holder);
Console.WriteLine($"Suspend status: {receipt.Status}");
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, for example, if the token is already deleted. |
| ConsensusException | If the network was unable to come to consensus before the duration of the transaction expired. |
| TransactionException | If the network rejected the request as invalid or had missing data. |