# Developer - Mint a Capsule NFT

Users have the option to store tokens within a Capsule NFT at the time of mint and embed the Capsule NFT with artwork. At current date, the tokens stored within Capsule NFTs can be ERC-20 tokens, ERC-721 tokens (including Capsule NFTs), or ERC-1155 tokens. You are also able to create Simple Capsule NFTs, which hold no tokens and function as basic ERC-721 NFTs. All Capsule NFTs are minted from Capsule Collections, which you can learn about in [Developer - Create a Capsule Collection](/capsulenft/developer-walkthroughs/developer-create-a-capsule-collection.md).

Below are some examples of creating your own Capsule NFT using a pre-existing Capsule Collection.

### Methodology

In order to create a Capsule NFT you mus&#x74;**:**

1. [Select a Capsule Collection](#selecting-a-capsule-collection) from which it will be minted (this could be your Capsule Collection, or anyone else's public Capsule Collection)
2. Decide which type of Capsule NFT you'd like to create
   * Simple Capsule NFT (a basic ERC-721 Token)
   * ERC-20 Capsule NFT (a Capsule NFT which holds any number of ERC-20 tokens)
     * Depending on the amount of different tokens stored within the ERC-20 Capsule NFT, you will need to decide between methods `mintSingleERC20Capsule` (storing one token) and `mintMultiERC20Capsule` (storing two or more tokens)
   * ERC-721 Capsule NFT (a Capsule NFT which holds any number of ERC-721 tokens)
     * Depending on the amount of different NFTs stored within the ERC-721 Capsule NFT, you will need to decide between methods `mintSingleERC721Capsule` (storing one NFT) and `mintMultiERC721Capsule` (storing two or more NFTs)
   * ERC-1155 Capsule NFT (a Capsule NFT which holds any number of ERC-1155 tokens)
     * Only `mintMultiERC1155Capsule` is available to users and can still be used to store a single ERC-1155 token.
3. (if not a Simple Capsule NFT) - supply the Capsule NFT with the token(s) to store

#### Selecting a Capsule Collection

You'll need the address of the Capsule Collection you'd like to mint the Capsule NFT from. This can be found on the [CapsuleNFT Application](https://docs.capsulelabs.xyz/capsulenft/developer-walkthroughs/www.capsulenft.com/app) Collections Tab, by obtaining a response from the [Create a Capsule Collection](/capsulenft/developer-walkthroughs/developer-create-a-capsule-collection.md) method (upon creation), or by calling `getCapsuleCollectionsOf` and passing in an address as a parameter. This Capsule Collection address will be in the form of `0x...`.

### Capsule NFT Types and Methods

More information on the methods below can be found at the [CapsuleMinter.sol](/capsulenft/developer-walkthroughs/contracts/capsuleminter.sol.md) page. Depending on the type of Capsule NFT you are creating, you will call either:

#### [Simple Capsule NFT](#example-simple-capsule-nft-mint-call)

```solidity
function mintSimpleCapsule(address _capsule, string _uri, address _receiver) external payable
```

#### [ERC-20 Capsule NFT or Multi ERC-20 Capsule NFT](#erc-20-capsule-nft-minting)

{% code overflow="wrap" %}

```solidity
function mintSingleERC20Capsule(address _capsule, address _token, uint256 _amount, string _uri, address _receiver) external payable
```

{% endcode %}

{% code overflow="wrap" %}

```solidity
function mintMultiERC20Capsule(address _capsule, address[] _tokens, uint256[] _amounts, string _uri, address _receiver) external payable
```

{% endcode %}

#### [ERC-721 Capsule NFT or Multi ERC-721 Capsule NFT](#erc-721-capsule-nft-minting)

{% code overflow="wrap" %}

```solidity
function mintSingleERC721Capsule(address _capsule, address _token, uint256 _id, string _uri, address _receiver) external payable
```

{% endcode %}

{% code overflow="wrap" %}

```solidity
function mintMultiERC721Capsule(address _capsule, address[] _tokens, uint256[] _ids, string _uri, address _receiver) external payable
```

{% endcode %}

#### [Multi ERC-1155 Capsule NFT](#erc-1155-capsule-nft-minting)

Only `mintMultiERC1155Capsule` is available to the user. **Note: you can still create ERC-1155 Capsule NFTs that store a single token using this method.**

{% code overflow="wrap" %}

```solidity
function mintMultiERC1155Capsule(address _capsule, address[] _tokens, uint256[] _ids, string _uri, address _receiver) external payable
```

{% endcode %}

### Example Simple Capsule NFT Mint Call

An example call to create a Simple Capsule NFT is shown here:

```
mintSimpleCapsule(
    "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // Capsule Collection address
    "ipfs://bafyreibfmk7yeraghmiw5eygdjzjhgc2pqyh5ycyg5d2tm2lg5c2bop2by/metadata.json", // tokenURI/link to Metadata
    "0xB58992cfA9B39A2FFA0dd286248503A2eFbc65Db", // address to receive minted Capsule NFT
    { value: 0.001 }
);
```

This call will create a Simple Capsule NFT:

* In the Capsule Collection at address `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`
* With `tokenURI` (metadata) linking to `ipfs://bafy...p2by/metadata.json`
* And send that Simple Capsule NFT to the address `0xB58992cfA9B39A2FFA0dd286248503A2eFbc65Db`
* With ETH fee amount specified. This is the [required amount to create](/economics/fee-structure.md) a Capsule NFT.

### ERC-20 Capsule NFT Minting

Note that two different methods, `mintSingleERC20Capsule` and `mintMultiERC20Capsule` are available to the user.

`mintSingleERC20Capsule` is an optimized function meant to save the user gas in the case where only a single ERC-20 token would be embedded within a Capsule NFT.&#x20;

`mintMultiERC20Capsule` is a function meant to be called when more than one different token is meant to be embedded within a Capsule NFT. **Note: you can create ERC-20 Capsule NFTs that store one token using the** `mintMultiERC20Capsule` **method, but it would be gas inefficient to do so.**

#### Example Single ERC-20 Capsule NFT Mint Call

An example call to create a Single ERC-20 Capsule NFT is shown here:

```
mintSingleERC20Capsule(
    "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // Capsule Collection address
    "0x1b40183EFB4Dd766f11bDa7A7c3AD8982e998421", // Token address
    200000000000000000000, // Token amount
    "ipfs://bafyreibfmk7yeraghmiw5eygdjzjhgc2pqyh5ycyg5d2tm2lg5c2bop2by/metadata.json", // tokenURI/link to Metadata
    "0xB58992cfA9B39A2FFA0dd286248503A2eFbc65Db", // address to receive minted Capsule NFT
    { value: 0.001 }
);
```

This call will create a Single ERC-20 Capsule NFT:

* In the Capsule Collection at address `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`
* Storing `200` of the token at `0x1b40183EFB4Dd766f11bDa7A7c3AD8982e998421`
  * (Assuming 18 decimals)
* With `tokenURI` (metadata) linking to `ipfs://bafy...p2by/metadata.json`
* And send that Single ERC-20 Capsule NFT to the address `0xB58992cfA9B39A2FFA0dd286248503A2eFbc65Db`
* With ETH fee amount specified. This is the [required amount to create](/economics/fee-structure.md) a Capsule NFT.

#### Example Multi ERC-20 Capsule NFT Mint Call

An example call to create a Multi ERC-20 Capsule NFT is shown here:

```
mintMultiERC20Capsule(
    "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // Capsule Collection address
    [
        "0x1b40183EFB4Dd766f11bDa7A7c3AD8982e998421",
        "0xa3d58c4E56fedCae3a7c43A725aeE9A71F0ece4e"
    ], // Token addresses in an array
    [
        200000000000000000000,
        100000000000000000000
    ], // Token amounts in an array
    "ipfs://bafyreibfmk7yeraghmiw5eygdjzjhgc2pqyh5ycyg5d2tm2lg5c2bop2by/metadata.json", // tokenURI/link to Metadata
    "0xB58992cfA9B39A2FFA0dd286248503A2eFbc65Db", // address to receive minted Capsule NFT
    { value: 0.001 }
);
```

This call will create a Multi ERC-20 Capsule NFT:

* In the Capsule Collection at address `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`
* Storing both:
  * `200` of the token at `0x1b40183EFB4Dd766f11bDa7A7c3AD8982e998421`
    * (Assuming 18 decimals)
  * `100` of the token at `0xa3d58c4E56fedCae3a7c43A725aeE9A71F0ece4e`
    * (Assuming 18 decimals)
* With `tokenURI` (metadata) linking to `ipfs://bafy...p2by/metadata.json`
* And send that Multi ERC-20 Capsule NFT to the address `0xB58992cfA9B39A2FFA0dd286248503A2eFbc65Db`
* With ETH fee amount specified. This is the [required amount to create](/economics/fee-structure.md) a Capsule NFT.

### ERC-721 Capsule NFT Minting

Note that two different methods, `mintSingleERC721Capsule` and `mintMultiERC721Capsule` are available to the user.

`mintSingleERC721Capsule` is an optimized function meant to save the user gas in the case where only a single ERC-721 token would be embedded within a Capsule NFT.&#x20;

`mintMultiERC721Capsule` is a function meant to be called when more than one different token is meant to be embedded within a Capsule NFT. **Note: you can create ERC-721 Capsule NFTs that store one token using the** `mintMultiERC721Capsule` **method, but it would be gas inefficient to do so.**

#### Example Single ERC-721 Capsule NFT Mint Call

An example call to create a Single ERC-721 Capsule NFT is shown here:

```
mintSingleERC721Capsule(
    "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // Capsule Collection address
    "0x1a0a69a267b3e72d22dEB970b2Cc6296aC31A80c", // NFT address
    1, // NFT ID
    "ipfs://bafyreibfmk7yeraghmiw5eygdjzjhgc2pqyh5ycyg5d2tm2lg5c2bop2by/metadata.json", // tokenURI/link to Metadata
    "0xB58992cfA9B39A2FFA0dd286248503A2eFbc65Db", // address to receive minted Capsule NFT
    { value: 0.001 }
);
```

This call will create a Single ERC-721 Capsule NFT:

* In the Capsule Collection at address `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`
* Storing the NFT of ID `1` from `0x1a0a69a267b3e72d22dEB970b2Cc6296aC31A80c`
* With `tokenURI` (metadata) linking to `ipfs://bafy...p2by/metadata.json`
* And send that Single ERC-721 Capsule NFT to the address `0xB58992cfA9B39A2FFA0dd286248503A2eFbc65Db`
* With ETH fee amount specified. This is the [required amount to create](/economics/fee-structure.md) a Capsule NFT.

#### Example Multi ERC-721 Capsule NFT Mint Call

An example call to create a Multi ERC-721 Capsule NFT is shown here:

```
mintMultiERC721Capsule(
    "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // Capsule Collection address
    [
        "0x1a0a69a267b3e72d22dEB970b2Cc6296aC31A80c",
        "0xECE3053E1e7C4Dd365975e8AB4Db7D1b238e30B6"
    ], // NFT addresses in an array
    [
        1,
        15
    ], // NFT IDs in an array
    "ipfs://bafyreibfmk7yeraghmiw5eygdjzjhgc2pqyh5ycyg5d2tm2lg5c2bop2by/metadata.json", // tokenURI/link to Metadata
    "0xB58992cfA9B39A2FFA0dd286248503A2eFbc65Db", // address to receive minted Capsule NFT
    { value: 0.001 }
);
```

This call will create a Multi ERC-721 Capsule NFT:

* In the Capsule Collection at address `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`
* Storing both:
  * The NFT of ID `1` from `0x1a0a69a267b3e72d22dEB970b2Cc6296aC31A80c`
  * The NFT of ID `15` from `0xECE3053E1e7C4Dd365975e8AB4Db7D1b238e30B6`
* With `tokenURI` (metadata) linking to `ipfs://bafy...p2by/metadata.json`
* And send that Multi ERC-721 Capsule NFT to the address `0xB58992cfA9B39A2FFA0dd286248503A2eFbc65Db`
* With ETH fee amount specified. This is the [required amount to create](/economics/fee-structure.md) a Capsule NFT.

### ERC-1155 Capsule NFT Minting

For ERC-1155 tokens, only `mintMultiERC1155Capsule` is available to the user.

`mintMultiERC1155Capsule` is a function meant to be called when more than one different token is meant to be embedded within a Capsule NFT. **Note: you can still create ERC-1155 Capsule NFTs that store a single token using the** `mintMultiERC1155Capsule` **method.**

#### Example Multi ERC-1155 Capsule NFT Mint Call

An example call to create a Multi ERC-1155 Capsule NFT is shown here:

```
mintMultiERC1155Capsule(
    "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // Capsule Collection address
    [
        "0xe8aE4BfD7521d26283bc14f2395675144AA65e6d",
        "0xd07dc4262BCDbf85190C01c996b4C06a461d2430"
    ], // ERC-1155 NFT addresses in an array
    [
        1,
        15
    ], // ERC-1155 NFT IDs in an array
    [
        2,
        1
    ], // ERC-1155 Token amounts in an array
    "ipfs://bafyreibfmk7yeraghmiw5eygdjzjhgc2pqyh5ycyg5d2tm2lg5c2bop2by/metadata.json", // tokenURI/link to Metadata
    "0xB58992cfA9B39A2FFA0dd286248503A2eFbc65Db", // address to receive minted Capsule NFT
    { value: 0.001 }
);
```

This call will create a Multi ERC-1155 Capsule NFT:

* In the Capsule Collection at address `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`
* Storing both:
  * The NFT of ID `1` from `0xe8aE4BfD7521d26283bc14f2395675144AA65e6d`
    * of which we will store `2` tokens
  * The NFT of ID `15` from `0xd07dc4262BCDbf85190C01c996b4C06a461d2430`
    * of which we will store `1` token
* With `tokenURI` (metadata) linking to `ipfs://bafy...p2by/metadata.json`
* And send that Multi ERC-1155 Capsule NFT to the address `0xB58992cfA9B39A2FFA0dd286248503A2eFbc65Db`
* With ETH fee amount specified. This is the [required amount to create](/economics/fee-structure.md) a Capsule NFT.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.capsulelabs.xyz/capsulenft/developer-walkthroughs/developer-mint-a-capsule-nft.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
