Assembling Characters
Pre-requisites
Before following this guide to assemble characters, Please make sure you have followed our getting started guide and set up your development environment.
You will also need to have an existing project on Honeycomb. If you don't have one, please see this guide.
Intro
Honeycomb has different ways to make characters. We've already covered how to create characters through wrapping. Now, we'll cover how to assemble characters.
The difference between the two is wrapping locks the NFT into a vault and creates a new Honeycomb character, while assembling gives you two other ways to create characters:
- Creating a character without an NFT. Using this method, your users will not need to own any NFTs to create characters. Characters created using this method are called native Honeycomb characters.
- Creating a character using an NFT. This method allows you to take the update authority of an NFT and create a new Honeycomb character from it.
Setting up
These are the mandatory steps before you can start assembling characters:
1. Create an assembler config
In order to assemble a character, you first need to create an assembler config. This config will mainly contain the information about the traits characters can have when they are made using this assembler config.
- JavaScript
- GraphQL
- Unity/C#
await client.createCreateAssemblerConfigTransaction({
project: projectAddress.toString(),
authority: adminPublicKey.toString(),
payer: adminPublicKey.toString(), // Optional payer
treeConfig: { // This tree is used to store character traits and their necessary information
// 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 character information 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: {
// maxDepth: 20, // Max depth of the tree
// maxBufferSize: 64, // Max buffer size of the tree
// canopyDepth: 14, // Canopy depth of the tree
// },
},
ticker: "unique-string-id", // Provide a unique ticker for the config (the ticker ID only needs to be unique within the project)
order: ["Background", "Skin", "Expression", "Clothes", "Armor", "Weapon", "Shield"], // Provide the character traits here; the order matters, in the example order, the background image will be applied and then the skin, expression, clothes, armor, weapon, and shield (if you need your character's expression to appear over the skin, the skin needs to come first in the order)
});
query CreateCreateAssemblerConfigTransaction($treeConfig: TreeSetupConfig!, $ticker: String!, $order: [String!]!, $project: String!, $authority: String!, $payer: String) {
createCreateAssemblerConfigTransaction(treeConfig: $treeConfig, ticker: $ticker, order: $order, project: $project, authority: $authority, payer: $payer) {
tx {
transaction
lastValidBlockHeight
blockhash
}
assemblerConfig
}
}
Provide the accompanying data:
{
"project": "pubkey", // Project public key as a string
"authority": "pubkey", // Project authority public key as a string
"treeConfig": { // This tree is used to store character traits and their necessary information
// 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": int // The desired number of character information this tree will be able to store as an integer
},
// Use the following config if you want to configure your own profile tree (also remove the above basic config)
// "advanced": {
// "maxDepth": int, // Max depth as an integer
// "maxBufferSize": int, // Max buffer size as an integer
// "canopyDepth": int // Canopy depth as an integer
// }
},
"ticker": "string", // Provide a unique ticker ID as a string (the ticker ID only needs to be unique within the project)
"order": ["string"], // Provide the character traits here; the order matters, in the example order, the background image will be applied and then the skin, expression, clothes, armor, weapon, and shield (if you need your character's expression to appear over the skin, the skin needs to come first in the order)
"payer": "pubkey" // Optional transaction payer public key as a string
},
var treeConfig = new TreeSetupConfig
{
// This tree is used to store character traits and their necessary information
Basic = new BasicTreeConfig
{
// The desired number of character information this tree will be able to store
NumAssets = 100000
},
// Uncomment the following config if you want to configure your own profile tree
// Advanced = new AdvancedTreeConfig
// {
// MaxDepth = 20, // Max depth of the tree
// MaxBufferSize = 64, // Max buffer size of the tree
// CanopyDepth = 14, // Canopy depth of the tree
// }
};
var configTransaction = new CreateCreateAssemblerConfigTransactionParams
{
Project = projectAddress,
Authority = adminPublicKey,
Payer = adminPublicKey, // Optional payer
TreeConfig = treeConfig,
Ticker = "unique-string-id", // Provide a unique ticker ID as a string (the ticker ID only needs to be unique within the project)
Order = new List<string> { "Weapon", "Armor", "Clothes", "Shield" } // Provide the character traits here; the order matters, in the example order, the background image will be applied and then the skin, expression, clothes, armor, weapon, and shield (if you need your character's expression to appear over the skin, the skin needs to come first in the order)
};
await Client.CreateCreateAssemblerConfigTransaction(configTransaction);
2. Add traits and their URIs
Each of the character traits you've added in the assembler config will need values and corresponding URIs. For example, if you have a trait called "Weapon", you can have values like "Sword", "Axe", "Bow", etc. and their corresponding image URLS.
- JavaScript
- GraphQL
- Unity/C#
await client.createAddCharacterTraitsTransactions({
traits: [ // Example traits given below, the labels have to match what you've declared in the assembler config
{
label: "Weapon",
name: "Bow",
uri: "https://example.com/bow.png",
},
{
label: "Weapon",
name: "Sword",
uri: "https://example.com/sword.png",
},
{
label: "Armor",
name: "Helmet",
uri: "https://example.com/helmet.png",
},
{
label: "Armor",
name: "Chestplate",
uri: "https://example.com/chestplate.png",
},
],
assemblerConfig: assemblerConfigAddress.toString(),
authority: adminPublicKey.toString(),
payer: adminPublicKey.toString(),
});
query CreateAddCharacterTraitsTransactions($assemblerConfig: String!, $traits: [CharacterTraitInput!]!, $authority: String!, $payer: String) {
createAddCharacterTraitsTransactions(assemblerConfig: $assemblerConfig, traits: $traits, authority: $authority, payer: $payer) {
transactions
lastValidBlockHeight
blockhash
}
}
Provide the accompanying data:
{
"assemblerConfig": "pubkey", // Assembler config public key as a string
"authority": "pubkey", // Project authority public key as a string
"payer": "pubkey", // Optional payer public key as a string
"traits": [
{
"label": "string", // Label for the trait, example: "Weapon"
"name": "string", // Name of the trait, example: "Bow"
"uri": "string" // URI of the trait, example: "https://example.com/bow.png"
}
]
}
var traits = new List<CharacterTraitInput>
{
// Example traits given below, the labels have to match what you've declared in the assembler config
new CharacterTraitInput
{
Label = "Weapon",
Name = "Bow",
Uri = "https://example.com/bow.png"
},
new CharacterTraitInput
{
Label = "Weapon",
Name = "Sword",
Uri = "https://example.com/sword.png"
},
new CharacterTraitInput
{
Label = "Armor",
Name = "Helmet",
Uri = "https://example.com/helmet.png"
},
new CharacterTraitInput
{
Label = "Armor",
Name = "Chestplate",
Uri = "https://example.com/chestplate.png"
}
};
var addCharacterTraitsTransaction = new CreateAddCharacterTraitsTransactionsParams
{
Traits = traits,
AssemblerConfig = assemblerConfigAddress.ToString(),
Authority = adminPublicKey.ToString(),
Payer = adminPublicKey.ToString()
};
// Execute the transaction
await Client.CreateAddCharacterTraitsTransactions(addCharacterTraitsTransaction);
3. Create a character model
After creating an assembler config, you need to create a character model. It's worth noting that character models for assembled characters are different from wrapped ones.
- JavaScript
- GraphQL
- Unity/C#
import { MintAsKind } from "@honeycomb-protocol/edge-client";
await client.createCreateCharacterModelTransaction({
project: projectAddress.toString(),
authority: adminPublicKey.toString(),
payer: adminPublicKey.toString(), // Optional, use this if you want a different wallet to pay the transaction fee, by default the authority pays for this tx
mintAs: { // Optional, you can define the underlying protocol, default is MplCore
kind: MintAsKind.MplCore,
// Uncomment the following config if you are using MplBubblegum as the underlying protocol in kind
// mplBubblegum: {
// maxDepth: 3,
// maxBufferSize: 8,
// }
},
config: {
kind: "Assembled",
assemblerConfigInput: {
assemblerConfig: assemblerConfigAddress.toString(),
collectionName: "Assembled NFT Collection",
name: "Assembled Character NFT 0",
symbol: "ACNFT",
description: "Creating this NFT with assembler",
sellerFeeBasisPoints: 0,
creators: [
{
address: adminPublicKey.toString(),
share: 100,
},
],
},
},
attributes: [ // Optional attributes
["Weapon", "Bow"],
["Armor", "Helmet"],
],
cooldown: { // Optional, add a cool down period (in seconds) before the characters can be unwrapped
ejection: 1, // Ejection/unwrap cool down (in seconds)
}
});
query CreateCreateCharacterModelTransaction($config: CharacterConfigInput!, $project: String!, $authority: String!, $payer: String, $attributes: JSON, $mintAs: MintAsInput, $cooldown: CharacterCooldownInput) {
createCreateCharacterModelTransaction(config: $config, project: $project, authority: $authority, payer: $payer, attributes: $attributes, mintAs: $mintAs, cooldown: $cooldown) {
tx {
transaction
lastValidBlockHeight
blockhash
}
characterModel
}
}
Provide the accompanying data:
{
"project": "pubkey", // Project public key as a string
"authority": "pubkey", // Project authority public key as a string
"payer": "pubkey", // Optional payer public key as a string
"mintAs": { // Optional, you can define the underlying protocol, default is MplCore
"kind": "string",
// Use the following config if you are using MplBubblegum as the underlying protocol in kind
// "mplBubblegum": {
// "maxDepth": int,
// "maxBufferSize": int
// }
},
"config": {
"kind": "Assembled",
"assemblerConfigInput": {
"assemblerConfig": "pubkey", // Assembler config public key as a string
"collectionName": "string", // Collection name as a string
"name": "string", // Name of the character as a string
"symbol": "string", // Symbol of the character NFT as a string
"description": "string", // Description of the character as a string
"sellerFeeBasisPoints": int, // Seller fee basis points as an integer
"creators": [
{
"address": "pubkey", // Creator's public key as a string
"share": int // Share as an integer
}
]
}
},
"attributes": [ // Optional attributes
["string", "string"] // Array of string tuples, example: [["Weapon", "Bow"], ["Armor", "Helmet"]]
],
}
using HplEdgeClient.Enums; // Import the MintAsKind enum
var config = new CharacterConfigInput
{
Kind = "Assembled",
AssemblerConfigInput = new AssemblerConfigInput
{
AssemblerConfig = "assemblerConfigAddress.ToString()",
CollectionName = "Assembled NFT Collection",
Name = "Assembled Character NFT 0",
Symbol = "ACNFT",
Description = "Creating this NFT with assembler",
Creators = new List<NftCreatorInput>
{
new NftCreatorInput
{
Address = adminPublicKey.ToString(),
Share = 100
}
},
SellerFeeBasisPoints = 0
}
};
var createCharacterModelTransactionParams = new CreateCreateCharacterModelTransactionParams
{
Project = projectAddress.ToString(),
Authority = adminPublicKey.ToString(),
Payer = adminPublicKey.ToString(), // Optional, use this if you want a different wallet to pay the transaction fee
Config = config,
MintAs = new MintAsInput
{
Kind = MintAsKind.MplCore,
// Uncomment the following config if you are using MplBubblegum as the underlying protocol in kind
// MplBubblegum = new MintAsMplBubblegumInput
// {
// MaxDepth = 3,
// MaxBufferSize = 8,
// }
},
Cooldown = new CharacterCooldownInput
{
Ejection = 1 // Ejection/unwrap cool down (in seconds)
}, // Optional, add a cool down period (in seconds) before the characters can be unwrapped
};
// Execute the transaction
await Client.CreateCreateCharacterModelTransaction(createCharacterModelTransactionParams);
4. Create a characters 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.
- JavaScript
- GraphQL
- Unity/C#
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: { // Tree configuration, this affects how many characters this tree can store
basic: {
numAssets: 100000,
},
// Uncomment the following config if you want to configure your own profile tree (also comment out the above config)
// advanced: {
// maxDepth: 3,
// maxBufferSize: 8,
// canopyDepth: 3,
// },
},
});
query CreateCharacterTreeTransaction($treeConfig: TreeConfig!, $project: Bytes!, $characterModel: Bytes!, $authority: Bytes!, $payer: Bytes) {
createCreateCharactersTreeTransaction(treeConfig: $treeConfig, project: $project, characterModel: $characterModel, authority: $authority, payer: $payer) {
blockhash
lastValidBlockHeight
transaction
}
}
Pass the variables like this:
{
"project": "pubkey", // Project public key as a string
"characterModel": "pubkey", // Character model public as a string
"authority": "pubkey", // Authority public key as a string
"payer": "pubkey", // Payer public key as a string
"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": int // The desired number of resources this tree will be able to store, each leaf (asset) in the tree represents one ownership record; for example: everytime you mint this resource, a new leaf will be added to the tree with the ownership and amount information
},
// Use the following config if you want to configure your own profile tree (also remove the above basic config)
// "advanced": {
// "maxDepth": int, // Maximum depth of the tree
// "maxBufferSize": int, // Maximum buffer size
// "canopyDepth": int // Canopy depth
// }
}
}
var treeConfig = new TreeSetupConfig
{
// Tree configuration, this affects how many characters this tree can store
Basic = new BasicTreeConfig
{
NumAssets = 100000
},
// Uncomment the following config if you want to configure your own profile tree
// Advanced = new AdvancedTreeConfig
// {
// MaxDepth = 3,
// MaxBufferSize = 8,
// CanopyDepth = 3,
// }
};
var createCharactersTreeTransaction = new CreateCreateCharactersTreeTransactionParams
{
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 = treeConfig
};
// Execute the transaction
await Client.CreateCreateCharactersTreeTransaction(createCharactersTreeTransaction);
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.
Making a character
Make sure you follow all the previous steps before proceeding as they are required. Afterwards, you have two options to make a character:
Without an NFT (Honeycomb native character)
- JavaScript
- GraphQL
- Unity/C#
await client.createAssembleCharacterTransaction({
project: projectAddress.toString(), // Project public key as a string
assemblerConfig: assemblerConfigAddress.toString(), // Assembler config address as a string
characterModel: characterModelAddress.toString(), // Character model public key as a string
wallet: userPublicKey.toString(), // User wallet public key as a string, this user will receive the character
attributes: [ // Define the character's attributes here in string tuple format
["Weapon", "Bow"],
["Armor", "Helmet"],
],
});
query CreateAssembleCharacterTransaction($attributes: [StringTuple!]!, $project: String!, $assemblerConfig: String!, $characterModel: String!, $wallet: String!) {
createAssembleCharacterTransaction(attributes: $attributes, project: $project, assemblerConfig: $assemblerConfig, characterModel: $characterModel, wallet: $wallet) {
transaction
lastValidBlockHeight
blockhash
}
}
Provide the accompanying data like this:
{
"attributes": [["string", "string"]], // Array of string tuples, example: [["Weapon", "Bow"], ["Armor", "Helmet"]]
"project": "pubkey", // Project public key as a string
"assemblerConfig": "pubkey", // Assembler config public key as a string
"characterModel": "pubkey", // Character model public key as a string
"wallet": "pubkey" // User wallet public key as a string, this user will receive the character
}
var attributes = new List<List<string>>
{
// Attributes for the character
new List<string> { "Weapon", "Bow" },
new List<string> { "Armor", "Helmet" }
};
var assembleCharacterTransaction = new CreateAssembleCharacterTransactionParams
{
Project = projectAddress.ToString(),
AssemblerConfig = assemblerConfigAddress.ToString(),
CharacterModel = characterModelAddress.ToString(),
Wallet = userPublicKey.ToString(),
Attributes = attributes
};
// Execute the transaction
await Client.CreateAssembleCharacterTransaction(assembleCharacterTransaction);
Using an NFT
The second method of creating a character using the assembler is by using an NFT. This method allows you to take the update authority of an NFT and create a new Honeycomb character from it.
You'll still need to follow steps 1 through 4 above. Aferwards, it's a two-step process:
1. Populate character
Populating an assembleable character will create a new character in an ejected state. This means that the character will be created, but it will not be usable (yet).
- JavaScript
- GraphQL
- Unity/C#
await client.createPopulateCharacterTransaction({
project: projectAddress.toString(),
characterModel: characterModelAddress.toString(),
mint: mintAddress.toString(),
owner: userPublicKey.toString(),
updateAuthority: adminPublicKey.toString(),
payer: adminPublicKey.toString(), // Optional, use this if you want to pay from a different wallet
attributes: [ // Optional attributes, provide the NFT's attributes here in string tuple format
["Weapon", "Bow"],
["Armor", "Helmet"],
],
});
query CreatePopulateCharacterTransaction($attributes: [StringTuple!]!, $project: String!, $characterModel: String!, $mint: String!, $owner: String!, $updateAuthority: String!, $payer: String) {
createPopulateCharacterTransaction(attributes: $attributes, project: $project, characterModel: $characterModel, mint: $mint, owner: $owner, updateAuthority: $updateAuthority, payer: $payer) {
transaction
lastValidBlockHeight
blockhash
}
}
Provide the accompanying data like this:
{
"attributes": [["string", "string"]], // Array of string tuples, example: [["Weapon", "Bow"], ["Armor", "Helmet"]]
"project": "pubkey", // Project public key as a string
"characterModel": "pubkey", // Character model public key as a string
"mint": "pubkey", // NFT mint public key as a string
"owner": "pubkey", // Owner public key as a string
"updateAuthority": "pubkey", // Update authority public key as a string
"payer": "pubkey" // Optional payer public key as a string
}
var attributes = new List<List<string>>
{
// Attributes for the character
new List<string> { "Weapon", "Bow" },
new List<string> { "Armor", "Helmet" }
};
var populateCharacterTransaction = new CreatePopulateCharacterTransactionParams
{
Project = projectAddress.ToString(),
CharacterModel = characterModelAddress.ToString(),
Mint = mintAddress.ToString(),
Owner = userPublicKey.ToString(),
UpdateAuthority = adminPublicKey.ToString(),
Payer = adminPublicKey.ToString(), // Optional, use this if you want to pay from a different wallet
Attributes = attributes
};
// Execute the transaction
await Client.CreatePopulateCharacterTransaction(populateCharacterTransaction);
This step will create a Honeycomb Protocol character in an ejected state. Ejected characters are not immediately usable as the associated NFT is not frozen yet. Please follow the next step to wrap the character and make it usable within Honeycomb Protocol.
2. Wrap characters
In order to use the ejected characters in Honeycomb, you need to wrap them first. You can do so by sending a query like this:
- JavaScript
- GraphQL
- Unity/C#
await client.createWrapAssetsToCharacterTransactions({
project: projectAddress.toString(),
characterModel: characterModelAddress.toString(),
wallet: userPublicKey.toString(),
mintList: [ // Mint public keys as a string
mintAddress.toString(),
]
});
query CreateWrapAssetsToCharacterTransactions($mintList: [String!]!, $project: String!, $characterModel: String!, $activeCharactersMerkleTree: String!, $wallet: String!) {
createWrapAssetsToCharacterTransactions(mintList: $mintList, project: $project, characterModel: $characterModel, activeCharactersMerkleTree: $activeCharactersMerkleTree, wallet: $wallet) {
transactions
lastValidBlockHeight
blockhash
}
}
Provide the accompanying data like this:
{
"mintList": ["pubkey"], // Mint public keys as a string
"project": "pubkey", // Project public key as a string
"characterModel": "pubkey", // Character model public key as a string
"wallet": "pubkey", // Wallet (fee payer) public key as a string
"libreplexDeployment": "pubkey" // Optional LibrePlex deployment public key as a string
}
var wrapAssetsToCharacterTransaction = new CreateWrapAssetsToCharacterTransactionsParams
{
Project = projectAddress.ToString(),
CharacterModel = characterModelAddress.ToString(),
Wallet = userPublicKey.ToString(),
MintList = new List<string>
{
// Mint public keys as a string
mintAddress.ToString(),
},
};
// Execute the transaction
await Client.CreateWrapAssetsToCharacterTransactions(wrapAssetsToCharacterTransaction);
Other operations
Here are some other operations you can perform with the assembler.
Find characters
All of the variables in the find characters function are optional. You can use any combination of them as needed.
- JavaScript
- GraphQL
- Unity/C#
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
});
query Character($addresses: [Bytes!], $trees: [Bytes!], $wallets: [Pubkey!], $mints: [Pubkey!], $attributeHashes: [Pubkey!], $includeProof: Boolean, $filters: CharactersFilter) {
character(addresses: $addresses, trees: $trees, wallets: $wallets, mints: $mints, attributeHashes: $attributeHashes, includeProof: $includeProof, filters: $filters) {
address
tree_id
leaf_idx
owner
source {
params {
... on Wrapped {
mint
criteria {
kind
params
}
isCompressed
}
... on Assembled {
hash
mint
uri
attributes
updateAuthority
}
}
kind
}
usedBy {
kind
params {
... on UsedByStaking {
pool
staker
stakedAt
claimedAt
}
... on UsedByMission {
missionId
participationId
rewards {
rewardIdx
delta
collected
}
endTime
}
... on UsedByGuild {
id
role {
kind
}
order
}
... on UsedByEjected {
wasAssembled
mint
}
... on UsedByCustom {
user
data
}
}
}
proof {
root
proof
node_index
leaf
leaf_index
tree_id
}
asset
}
}
Provide the accompanying data like this:
{
"addresses": [], // Array of character addresses
"trees": [], // Array of character model merkle tree public keys as a string
"wallets": [], // Array of wallet public keys as a string (user wallets that hold the characters)
"mints": [], // Array of NFT mint public keys as a string
"attributeHashes": [], // Array of attribute hashes as a string
"includeProof": boolean, // Determines if the proof should be included in the result or not
"filters": { // Filters for the characters,
"usedBy": {
"params": {
"wasAssembled": boolean,
"user": "pubkey",
"staker": "pubkey",
"stakedAt": int,
"role": {
"kind": "string"
},
"rewards": [
{
"rewardIdx": int,
"delta": int,
"collected": boolean
}
],
"pool": "pubkey", // Staking pool public key
"order": int, // Guild order
"mint": "pubkey",
"id": "pubkey",
"endTime": int,
"claimedAt": int
},
"kind": "string"
},
"source": {
"params": {
"mint": "pubkey",
"is_compressed": boolean,
"criteria": { // NFT Wrap criteria
"params": "pubkey",
"kind": "string"
}
},
"kind": "string"
},
"owner": "pubkey" // Character owner public key
}
}
var findCharactersParams = new FindCharactersParams
{
Addresses = new List<string>
{
// String array of character addresses
},
IncludeProof = true,
Filters = new CharactersFilter
{
// Available filters are usedBy, owner, and source
},
Mints = new List<string>
{
// Array of NFT mint public keys as a string
},
Trees = new List<string>
{
// Array of character model merkle tree public keys as a string
},
Wallets = new List<string>
{
// Array of wallet public keys as a string (wallets that own the characters)
},
AttributeHashes = new List<string>
{
// Array of attribute hashes as a string
}
};
// Execute the find characters method
var characters = await Client.FindCharacters(findCharactersParams);
Update a character's traits
If you want to update a particular character's traits, you can do so by sending a query like this:
- JavaScript
- GraphQL
- Unity/C#
await client.createUpdateCharacterTraitsTransaction({
project: projectAddress.toString(), // Project public key as a string
wallet: userPublicKey.toString(), // The wallet that holds the character
assemblerConfig: assemblerConfigAddress.toString(), // Assembler config address as a string
characterAddress: characterAddress.toString(), // Character address as a string, this character's traits will get updated
characterModel: characterModelAddress.toString(), // Character model public key as a string
attributes: [ // Send the updated attributes here in string tuple format
["Weapon", "Sword"],
["Armor", "Chestplate"],
],
});
query CreateUpdateCharacterTraitsTransaction($characterAddress: String!, $attributes: [StringTuple!]!, $project: String!, $assemblerConfig: String!, $characterModel: String!, $wallet: String!) {
createUpdateCharacterTraitsTransaction(characterAddress: $characterAddress, attributes: $attributes, project: $project, assemblerConfig: $assemblerConfig, characterModel: $characterModel, wallet: $wallet) {
transaction
lastValidBlockHeight
blockhash
}
}
Provide the data like this:
{
"characterAddress": "pubkey", // Character address as string
"attributes": [["string", "string"]], // Array of string tuples, example: [["Weapon", "Bow"], ["Armor", "Helmet"]]
"project": "pubkey", // Project public key as a string
"assemblerConfig": "pubkey", // Assembler config address as a string
"characterModel": "pubkey", // Character model public key as a string
"wallet": "pubkey" // Authority and transaction payer public key as a string
}
var attributes = new List<object>
{
// Send the updated attributes here in string tuple format
new List<string> { "Weapon", "Sword" },
new List<string> { "Armor", "Chestplate" }
};
var updateCharacterTraitsTransaction = new CreateUpdateCharacterTraitsTransactionParams
{
Project = projectAddress.ToString(),
Wallet = adminPublicKey.ToString(),
AssemblerConfig = assemblerConfigAddress.ToString(),
Attributes = attributes,
CharacterAddress = characterAddress.ToString(),
CharacterModel = characterModelAddress.ToString(),
};
// Execute the transaction
await Client.CreateUpdateCharacterTraitsTransaction(updateCharacterTraitsTransaction);
Unwrap a character
When a character made using the assembler is unwrapped, the NFT is sent to the user but the character is not deleted. The character will still exist on Honeycomb, albeit in an ejected state.
Unwrapping an asset means that the assets (NFTs/cNFTs) will be returned to the user's wallet. If it was a native Honeycomb assembled character (created without an NFT), a new NFT will be created and sent to the user's wallet.
- JavaScript
- GraphQL
- Unity/C#
await client.createUnwrapAssetsFromCharacterTransactions({
characterAddresses: [characterAddress.toString()], // String array of character addresses
project: projectAddress.toString(),
characterModel: characterModelAddress.toString(),
wallet: userPublicKey.toString() // User wallet public key as a string, this user must own the characters and has to sign the tx
});
query CreateUnwrapAssetsFromCharacterTransactions($characterAddresses: [String!]!, $project: String!, $characterModel: String!, $wallet: String!) {
createUnwrapAssetsFromCharacterTransactions(characterAddresses: $characterAddresses, project: $project, characterModel: $characterModel, wallet: $wallet) {
transactions
lastValidBlockHeight
blockhash
}
}
Provide the data like this:
{
"characterAddresses": ["pubkey"], // Character addresses as a string array
"project": "pubkey", // Project public key as a string
"characterModel": "pubkey", // Character model public key as a string
"wallet": "pubkey", // User wallet public key as a string, this user must own the characters and has to sign the tx
}
var unwrapAssetsFromCharacterTransaction = new CreateUnwrapAssetsFromCharacterTransactionsParams
{
CharacterAddresses = new List<string>
{
// String array of character addresses
characterAddress.ToString()
},
Project = projectAddress.ToString(),
CharacterModel = characterModelAddress.ToString(),
Wallet = userPublicKey.ToString(),
LibreplexDeployment = libreplexDeploymentAddress.ToString() // Optional, only needed in case of LibrePlex NFTs
};
// Execute the transaction
await Client.CreateUnwrapAssetsFromCharacterTransactions(unwrapAssetsFromCharacterTransaction);
Rewrap an ejected character
When a character is rewrapped, the character's usedBy status on Honeycomb goes from "Ejected" to "None". The character will be usable again in Honeycomb.
- JavaScript
- GraphQL
- Unity/C#
await client.createWrapAssetsToCharacterTransactions({
project: projectAddress.toString(),
characterModel: characterModelAddress.toString(),
wallet: userPublicKey.toString(), // The user must own all of the NFTs given in the mintList below
mintList: [ // NFT mint keys array as a string
mintAddress.toString(),
],
});
query CreateWrapAssetsToCharacterTransactions($mintList: [String!]!, $project: String!, $characterModel: String!, $wallet: String!) {
createWrapAssetsToCharacterTransactions(mintList: $mintList, project: $project, characterModel: $characterModel, wallet: $wallet) {
transactions
lastValidBlockHeight
blockhash
}
}
Provide the data like this:
{
"mintList": ["pubkey"], // Mint public keys as a string
"project": "pubkey", // Project public key as a string
"characterModel": "pubkey", // Character model public key as a string
"wallet": "pubkey", // User wallet public key as a string, the user must own the NFTs in the mintlist and has to sign the tx
}
var wrapAssetsToCharacterTransaction = new CreateWrapAssetsToCharacterTransactionsParams
{
Project = projectAddress.ToString(),
CharacterModel = characterModelAddress.ToString(),
ActiveCharactersMerkleTree = charactersTreeAddress.ToString(), // This is the tree that's currently active in the character model
Wallet = userPublicKey.ToString(), // The user must own all of the NFTs given in the mintList below
MintList = new List<string>
{
// NFT mint keys array as a string
mintAddress.ToString()
},
LibreplexDeployment = libreplexDeployment.ToString() // Optional, only needed in case of LibrePlex NFTs
};
// Execute the transaction
await Client.CreateWrapAssetsToCharacterTransactions(wrapAssetsToCharacterTransaction);