> For the complete documentation index, see [llms.txt](https://envida-protocol.gitbook.io/envida/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://envida-protocol.gitbook.io/envida/api-recipes/bundle.md).

# Bundle

## Register

#### Description:

This function registers a new bundle schema.

#### Previous Steps:

1. [Create a class](broken://pages/U0RjrSPg2emUTyyTlAs1#create-class)
2. [Create an asset](broken://pages/U0RjrSPg2emUTyyTlAs1#create)
3. [Mint an asset](broken://pages/U0RjrSPg2emUTyyTlAs1#mint)

#### Steps:

1. Call the bundle/register endpoint with the following request body:

* seed: the seed of the account that will pay for the transaction.
* class\_id: the new class identifier that the bundle will manage.
* asset\_id: the new asset identifier that the bundle will manage.
* schema: this will represent all the classes and assets that need to be present in order to fulfill the other transactions&#x20;
  * class\_ids: an array of the class identifiers that will be part of the schema.
  * asset\_ids: an array of asset\_ids arrays that will be related to each class\_id.
  * amounts:  an array of amount arrays that will be related to each asset\_id.
* metadata: additional information about the bundle.

#### Example Input:

```
{
    "seed": "//Alice",
    "class_id": 3,
    "asset_id": 0,
    "schema": {
        "class_ids": [1],
        "asset_ids": [
            [1]
        ],
        "amounts": [
            [5]
        ]
    },
    "metadata": {
        "userdata": ""
    }
}
```

#### Expected Output:

```
{
    "bundle_id": "460bf8be553867922d58c434b3e672ffee40d163d4e744d28c1f67f93d0b3a3c",
    "who": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
    "class_id": 3,
    "asset_id": 0
}
```

* who: the account address associated with the bundle.
* bundle\_id: the bundle identifier.
* class\_id: the class identifier managed by the bundle.
* asset\_id: the asset identifier managed by the bundle.

## Mint

#### Description:

This function mints a bundle.

#### Previous Steps:

1. [Create an account](broken://pages/PkADXmgJ4GV5VuHSeUDi#create)
2. [Register a bundle schema](#register)

#### Steps:

1. Call the bundle/mint endpoint with the following request body:

* seed: the seed of the account that will pay for the transaction.&#x20;
* from: the account address of the sender.
* to: the account address of the receiver.
* bundle\_id: the bundle identifier.
* amount: the amount to be minted.

#### Example Input:

```
{
    "seed": "//Alice",
    "from": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
    "to": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
    "bundle_id": "460bf8be553867922d58c434b3e672ffee40d163d4e744d28c1f67f93d0b3a3c",
    "amount": 10
}
```

#### Expected Output:

```
{
    "who": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
    "from": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
    "to": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
    "bundle_id": "460bf8be553867922d58c434b3e672ffee40d163d4e744d28c1f67f93d0b3a3c",
    "amount": 10
}
```

* who: the account address that paid for the transaction.&#x20;
* from: the account address of the sender.
* to: the account address of the receiver.
* bundle\_id: the bundle identifier.
* amount: the amount minted.
