Class MintTokenExtensions
Extension methods for minting fungible tokens to the treasury.
Inherited Members
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public static class MintTokenExtensions
Methods
| Edit this page View SourceMintTokenAsync(ConsensusClient, EntityId, ulong, Action<IConsensusContext>?)
Adds token coins to the treasury.
Declaration
public static Task<TokenReceipt> MintTokenAsync(this ConsensusClient client, EntityId token, ulong amount, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client orchestrating the mint. |
| EntityId | token | The identifier of the token to increase. |
| ulong | amount | The amount of tokens to add, denoted in the smallest denomination. |
| 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<TokenReceipt> | A transaction receipt indicating a successful operation. |
Examples
// Mint 500,000 additional tokens (smallest unit) into the token's
// treasury account. The transaction must be signed by the token's
// supply key — supply it via the client's Signatory or on the params.
var receipt = await client.MintTokenAsync(token, 500_000);
Console.WriteLine($"Mint status: {receipt.Status}");
Console.WriteLine($"New circulation: {receipt.Circulation}");
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. |
MintTokenAsync(ConsensusClient, MintTokenParams, Action<IConsensusContext>?)
Adds token coins to the treasury.
Declaration
public static Task<TokenReceipt> MintTokenAsync(this ConsensusClient client, MintTokenParams mintParams, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client orchestrating the mint. |
| MintTokenParams | mintParams | The details identifying the token and amount to mint. |
| 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<TokenReceipt> | A transaction receipt indicating a successful operation. |
Examples
// Mint 500,000 additional tokens (smallest unit) into the token's
// treasury account. The transaction must be signed by the token's
// supply key — supply it via the client's Signatory or on the params.
var receipt = await client.MintTokenAsync(token, 500_000);
Console.WriteLine($"Mint status: {receipt.Status}");
Console.WriteLine($"New circulation: {receipt.Circulation}");
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. |