Show / Hide Table of Contents

Class MintNftExtensions

Extension methods for minting new NFT instances on the network.

Inheritance
object
MintNftExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public static class MintNftExtensions

Methods

| Edit this page View Source

MintNftAsync(ConsensusClient, EntityId, ReadOnlyMemory<byte>, Action<IConsensusContext>?)

Creates (Mints) a new Non-Fungible Token (NFTs) under the specified token definition.

Declaration
public static Task<NftMintReceipt> MintNftAsync(this ConsensusClient client, EntityId token, ReadOnlyMemory<byte> metadata, Action<IConsensusContext>? configure = null)
Parameters
Type Name Description
ConsensusClient client

The Consensus Node Client orchestrating the mint.

EntityId token

The identifier of the token type of NFTs to mint.

ReadOnlyMemory<byte> metadata

The Metadata associated with the newly created NFT.

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<NftMintReceipt>

A mint transaction receipt indicating a successful operation.

Examples
// Mint a single NFT with UTF-8-encoded JSON metadata (CID-style strings
// are the typical choice — the network does not interpret the bytes).
// The supply key must sign. The receipt's SerialNumbers array holds
// the newly issued serial number.
var metadata = Encoding.UTF8.GetBytes("{\"name\":\"Artifact #1\"}");
var receipt = await client.MintNftAsync(nftCollection, metadata);
Console.WriteLine($"Minted serial: {receipt.SerialNumbers[0]}");
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 transaction. Only a code about the transaction itself proves it did not execute; any other code leaves the outcome unknown, so settle it by its transaction id on a mirror node rather than resubmitting it (see PrecheckException).

ConsensusException

If the outcome could not be confirmed: the transaction may have executed, so settle it by its transaction id on a mirror node rather than resubmitting it.

TransactionException

If the network rejected the mint request as invalid or had missing data.

| Edit this page View Source

MintNftsAsync(ConsensusClient, MintNftParams, Action<IConsensusContext>?)

Creates (Mints) new Non-Fungible Tokens (NFTs) under the specified token definition.

Declaration
public static Task<NftMintReceipt> MintNftsAsync(this ConsensusClient client, MintNftParams mintParams, Action<IConsensusContext>? configure = null)
Parameters
Type Name Description
ConsensusClient client

The Consensus Node Client orchestrating the mint.

MintNftParams mintParams

The Parameters for minting the NFTs, including the metadata to be associated with each minted NFT.

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<NftMintReceipt>

A mint transaction receipt indicating a successful operation.

Examples
var mintReceipt = await client.MintNftsAsync(new MintNftParams
{
    Token = createReceipt.Token,
    Metadata = new[]
    {
        (ReadOnlyMemory<byte>)Encoding.UTF8.GetBytes("{\"name\":\"NFT #1\"}"),
        (ReadOnlyMemory<byte>)Encoding.UTF8.GetBytes("{\"name\":\"NFT #2\"}"),
        (ReadOnlyMemory<byte>)Encoding.UTF8.GetBytes("{\"name\":\"NFT #3\"}")
    }
});
Console.WriteLine($"Minted serial numbers: {string.Join(", ", mintReceipt.SerialNumbers)}");
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 transaction. Only a code about the transaction itself proves it did not execute; any other code leaves the outcome unknown, so settle it by its transaction id on a mirror node rather than resubmitting it (see PrecheckException).

ConsensusException

If the outcome could not be confirmed: the transaction may have executed, so settle it by its transaction id on a mirror node rather than resubmitting it.

TransactionException

If the network rejected the mint request as invalid or had missing data.

  • Edit this page
  • View Source
In this article
Back to top .NET Client Library for Hiero Network and Hedera Hashgraph