Projects
Pre-requisites
Before following this guide, make sure you go through our getting started guide and set up your development environment.
If you need any help at any point, please get in touch.
What are projects
Projects are the core of the Honeycomb Protocol. Essentially, a project represents an app. It can be game or it can any app that takes advantage of the blockchain.
All the currencies, profiles, characters, missions, resources, and other elements are associated with a project.
Creating a project
Here's how you can create a project on Honeycomb Protocol.
- JavaScript
- GraphQL
const {
createCreateProjectTransaction: {
project: projectAddress, // This is the project address once it'll be created
tx: txResponse, // This is the transaction response, you'll need to sign and send this transaction
},
} = await client.createCreateProjectTransaction({
name: "Test Project", // Name of the project
authority: authorityPublicKey, // Public key of the project authority, this authority has complete control over the project
payer: payerPublicKey, // Optional public key of the payer, the payer pays the transaction fees for creating this project
profileDataConfig: {
customDataFields: [ // Specify an array of custom data fields that you want to be able to set on your users' profiles
"NFTs owned",
]
}
});
query CreateCreateProjectTransaction($authority: String!, $name: String!, $driver: String, $payer: String, $profileDataConfig: ProfileDataConfigInput, $associatedPrograms: [AssociatedProgramInput!]) {
createCreateProjectTransaction(authority: $authority, name: $name, driver: $driver, payer: $payer, profileDataConfig: $profileDataConfig, associatedPrograms: $associatedPrograms) {
project
tx {
blockhash
lastValidBlockHeight
transaction
}
}
}
Provide the data like this:
{
"authority": "pubkey", // Public key as a string
"name": "string", // Name of the project
"driver": "pubkey", // Optional pubkey for the project driver
"payer": "pubkey", // Public key as a string
"profileDataConfig": {
"customDataFields": ["string"], // Custom data fields as a string array, these custom fields can be added to the project profiles
},
"associatedPrograms": [
{
"address": "pubkey", // Public key of the associated program as a string
"trustedActions": [
{
"kind": "string", // The kind of trusted action as a string
}
]
}
]
}
For more information on trustedActions, see the Honeycomb Trusted Actions documentation.
Project driver
The project driver's keypair can be used to sign a project's transactions when neither the user nor the project admin's signature is required.
In such instances, the project driver’s keypair provides the necessary authorization, ensuring that transactions can execute without direct interaction from the user or admin.
Changing the project driver
- JavaScript
- GraphQL
const {
createChangeProjectDriverTransaction: txResponse, // This is the transaction response, you'll need to sign and send this transaction
} = await client.createChangeProjectDriverTransaction({
authority: adminPublicKey.toString(), // Provide the project authority's public key
project: projectAddress.toString(), // The project's public key
driver: newDriverAddress.toString(), // The new driver's public key
payer: payerPublicKey.toString() // Optional, the transaction payer's public key
});
query CreateChangeProjectDriverTransaction($project: String!, $driver: String!, $authority: String!, $payer: String) {
createChangeProjectDriverTransaction(project: $project, driver: $driver, authority: $authority, payer: $payer) {
blockhash
lastValidBlockHeight
transaction
}
}
Provide the project ID, the new driver's wallet address, and the authority's wallet address like this:
{
"project": "pubkey", // Project's pubkey address in string format
"driver": "pubkey", // New driver's pubkey address in string format
"authority": "pubkey", // Authority's pubkey address in string format
"payer": "pubkey" // Optional, transaction payer's pubkey address in string format
}
Delegates
A project's authority has complete control over that project. But sometimes, you may want to give another account the ability to act on your behalf. This is where delegates come in.
Honeycomb Protocol lets you define delegate authorities that can make certain changes to your project without having full control over it. You, as the project authority, will get to fine-tune the permissions you want to give your delegates.
Creating a delegate authority
- JavaScript
- GraphQL
import { HiveControlPermissionInput } from '@honeycomb-protocol/edge-client';
const {
createCreateDelegateAuthorityTransaction: txResponse // This is the transaction response, you'll need to sign and send this transaction
} = await client.createCreateDelegateAuthorityTransaction({
authority: adminPublicKey.toString(),
delegate: delegatePublicAddress.toString(),
project: projectAddress.toString(),
payer: txPayerPublicKey.toString(), // Optional, the transaction payer's public key
serviceDelegations: {
serviceDelegations: {
HiveControl: [ // Put the service name here, for example: HiveControl
{
// Each service's permissions enum can be imported from @honeycomb-protocol/edge-client
permission: HiveControlPermissionInput.ManageProfiles,
// In some cases an index will also be required in this object, for example: index: 0
}
]
}
}
});
query CreateCreateDelegateAuthorityTransaction($project: String!, $serviceDelegations: ServiceDelegationInput!, $authority: String!, $delegate: String!, $payer: String) {
createCreateDelegateAuthorityTransaction(project: $project, serviceDelegations: $serviceDelegations, authority: $authority, delegate: $delegate, payer: $payer) {
blockhash
lastValidBlockHeight
transaction
}
}
Provide the project ID, service delegations, authority's wallet address, delegate's wallet address, and payer's wallet address like this:
{
"project": "pubkey", // Project's pubkey address in string format
"serviceDelegations": {
"ServiceName": [ // For service name and delegations, refer to the services and delegations section
{
"index": int,
"permission": "string" // For service name and delegations, refer to the services and delegations section
}
],
},
"authority": "pubkey", // Project authority's pubkey address in string format
"delegate": "pubkey", // Delegate's pubkey address in string format
"payer": "pubkey" // Payer's pubkey address in string format
}
Modifying a delegate authority
- JavaScript
- GraphQL
const {
createModifyDelegationTransaction: txResponse // This is the transaction response, you'll need to sign and send this transaction
} = await client.createModifyDelegationTransaction({
authority: adminPublicKey.toString(), // Provide the project authority's public key
project: projectAddress.toString(), // The project's public key
delegate: delegatePublicKey.toString(), // The delegate's public key
modifyDelegation: {
delegation: {
HiveControl: {
permission: HiveControlPermissionInput.ManageProfiles,
},
}
}
});
query CreateModifyDelegationTransaction($project: String!, $delegate: String!, $modifyDelegation: ModifyDelegationInput!, $authority: String!, $payer: String) {
createModifyDelegationTransaction(project: $project, delegate: $delegate, modifyDelegation: $modifyDelegation, authority: $authority, payer: $payer) {
blockhash
lastValidBlockHeight
transaction
}
}
Provide the project ID, delegate's wallet address, modify delegation object, authority's wallet address, and payer's wallet address like this:
{
"project": "pubkey", // Project's pubkey address in string format
"delegate": "pubkey", // Delegate's pubkey address in string format
"modifyDelegation": {
"ServiceName": [ // For service name and delegations, refer to the services and delegations section
{
"index": int,
"permission": "string" // For service name and delegations, refer to the services and delegations section
}
],
},
"authority": "pubkey", // Project authority's pubkey address in string format
"payer": "pubkey" // Payer's pubkey address in string format
}
Here are the details about services and delegations.
Badges
Badges are essentially achievements that users can earn in your app. Developers can create badges in their project and assign them to users to reward them for certain actions.
Create a badge
- JavaScript
- GraphQL
import { BadgesCondition } from '@honeycomb-protocol/edge-client';
const {
createCreateBadgeCriteriaTransaction: {
blockhash,
lastValidBlockHeight,
transaction,
},
} = await client.createCreateBadgeCriteriaTransaction({
args: {
authority: authorityPublicKey, // Project authority public key
projectAddress: projectAddress, // Project public key
payer: payerPublicKey, // Optional transaction payer public key
badgeIndex: 0, // Badge index as an integer, used to identify the badge
condition: BadgesCondition.Public, // Badge condition, only Public is available for now
startTime: 0, // Optional start time, UNIX timestamp
endTime: 0, // Optional end time, UNIX timestamp
},
});
query CreateInitializeBadgeCriteriaTransaction($args: CreateBadgeCriteriaInput!) {
createInitializeBadgeCriteriaTransaction(args: $args) {
blockhash
lastValidBlockHeight
transaction
}
}
Provide the badge criteria like this:
{
"args": {
"authority": "pubkey", // Project authority public key as a string
"projectAddress": "pubkey", // Project public key as a string
"payer": "pubkey", // Optional transaction payer public key as a string
"badgeIndex": "Int", // Badge index as an integer
"condition": "Public", // Badge condition as a string, only Public is available for now
"startTime": "Int", // Optional start time as an integer, UNIX timestamp
"endTime": "Int", // Optional end time as an integer, UNIX timestamp
}
}
Update a badge
- JavaScript
- GraphQL
import { BadgesCondition } from '@honeycomb-protocol/edge-client';
const {
createUpdateBadgeCriteriaTransaction: {
blockhash,
lastValidBlockHeight,
transaction,
},
} = await client.createUpdateBadgeCriteriaTransaction({
args: {
authority: authorityPublicKey, // Project authority public key
projectAddress: projectAddress, // Project public key
payer: payerPublicKey, // Optional transaction payer public key
criteriaIndex: 0, // Badge index as an integer, used to identify the badge (when adding a badge you'll use this index)
condition: BadgesCondition.Public, // Badge condition, only Public is available for now
startTime: 0, // Optional start time, UNIX timestamp
endTime: 0, // Optional end time, UNIX timestamp
},
});
query CreateUpdateBadgeCriteriaTransaction($args: UpdateBadgeCriteriaInput!) {
createUpdateBadgeCriteriaTransaction(
args: $args
) {
blockhash
lastValidBlockHeight
transaction
}
}
Provide the badge criteria like this:
{
"args": {
"authority": "pubkey", // Project authority public key as a string
"projectAddress": "pubkey", // Project public key as a string
"payer": "pubkey", // Optional transaction payer public key as a string
"criteriaIndex": "Int", // Badge index as an integer, used to identify the badge
"condition": "Public", // Badge condition as a string, only Public is available for now
"startTime": "Int", // Optional start time as an integer, UNIX timestamp
"endTime": "Int", // Optional end time as an integer, UNIX timestamp
}
}
Give/assign a badge to a user profile
- JavaScript
- GraphQL
import { BadgesCondition } from '@honeycomb-protocol/edge-client';
const { createClaimBadgeCriteriaTransaction: {
blockhash,
lastValidBlockHeight,
transaction,
} } =
await client.createClaimBadgeCriteriaTransaction({
args: {
profileAddress: profileAddress, // User profile public key, this profile will be assigned the badge
projectAddress: projectAddress, // Project public key
proof: BadgesCondition.Public, // Proof of the badge, only Public is available for now
payer: userPublicKey.toString(), // Transaction payer public key
criteriaIndex: 0, // Badge index as an integer, used to identify the badge (the badge that matches this index will be added to the profile)
},
});