Skip to main content

Wrapping characters

Pre-requisites

Before following this guide to wrap characters, please make sure that you've followed our getting started guide and set up your development environment. If you need any help at any point.

You will also need to have an existing project on Honeycomb. If you don't have one, you can create a project by following the steps here.

Intro

Wrapping characters is a process that basically locks an NFT into a vault and creates a Honeycomb character. This process is useful for creating characters from NFTs that are not part of the Honeycomb Protocol.

Follow these steps to create a character using wrapping.

1. Create a character model

In order to wrap a character, you first need to create a character model. This model will contain the information about the character's traits.

await client.createCreateCharacterModelTransaction({
authority: adminPublicKey.toString(), // Project authority public key as a string
project: projectAddress.toString(),
payer: adminPublicKey.toString(), // Optional, if you want to pay from a different wallet
config: {
kind: "Wrapped",
criterias: [
{
kind: "MerkleTree", // Can be Collection, Creator, or MerkleTree
params: merkleTreeAddress.toString(), // Provide the relevant address here
}
]
},
});

2. Creating a character tree

After creating a character model, you need to create a character tree. This tree is used to store characters and their necessary information, like who owns the character and if a character is on a mission.

await client.createCreateCharactersTreeTransaction({
authority: adminPublicKey.toString(),
project: projectAddress.toString(),
characterModel: characterModelAddress.toString(),
payer: adminPublicKey.toString(), // Optional, only use if you want to pay from a different wallet
treeConfig: {
// Provide either the basic or advanced configuration, we recommend using the basic configuration if you don't know the exact values of maxDepth, maxBufferSize, and canopyDepth (the basic configuration will automatically configure these values for you)
basic: {
numAssets: 100000, // The desired number of characters this tree will be able to store
},
// Uncomment the following config if you want to configure your own profile tree (also comment out the above config)
// advanced: {
// canopyDepth: 20,
// maxBufferSize: 64,
// maxDepth: 14,
// }
},
});

To calculate the canopy depth, buffer size, and depth, use compressed.app. If you have any confusions about these values, please reach out to us on Discord or email.

3. Wrap assets to character

After creating a character model and a character tree, you can wrap assets to create a new character.

This process will lock the NFT(s) and create a Honeycomb character.

To wrap, send a query like this:

await client.createWrapAssetsToCharacterTransactions({
project: projectAddress.toString(),
mintList: [ // Provide NFT addresses here
],
wallet: userPublicKey.toString(), // User's wallet public key as a string
activeCharactersMerkleTree: merkleTreeAddress.toString(), // Provide the merkle tree address that's currently active in the character model
characterModel: characterModelAddress.toString(),
});

Other operations

Honeycomb also supports other utility operations, covered below.

Find characters

All of the variables in the find characters function are optional. You can use any combination of them as needed.

await client.findCharacters({
addresses: [], // String array of character addresses
includeProof: true,
filters: {}, // Available filters are usedBy, owner, and source
mints: [], // Array of NFT mint public keys as a string
trees: [], // Array of character model merkle tree public keys as a string
wallets: [], // Array of wallet public keys as a string (wallets that own the characters)
attributeHashes: [] // Array of attribute hashes as a string
});

Unwrapping characters (optional)

Unwrapping an asset means that the character will be removed from your project and the assets (NFTs/cNFTs) will be returned to the user's wallet.

await client.createUnwrapAssetsFromCharacterTransactions({
characterAddresses: [], // Array of character addresses as a string
characterModel: characterModelAddress.toString(),
project: projectAddress.toString(),
wallet: userPublicKey.toString(),
libreplexDeployment: libreplexDeploymentAddress.toString(), // Optional, Libreplex deployment public key as a string
});