Missions
Pre-requisites
Please make sure that you've followed our getting started guide and set up your development environment.
You'll also need the following:
In order to participate in missions, your users will need to have created a profile for your project. They'll also need eligible characters that can go on the missions you create (more on this below).
Overview
Honeycomb Protocol offers timed-missions that users can participate in to earn rewards.
Developers, when creating a mission, can decide how long the mission will take to complete and what the rewards will be.
Each mission has a mission pool that defines the criteria regarding which character models can participate in the mission.
Create a mission pool
Missions pools group missions together based on the criteria you define. For example, you could create a mission pool for all missions that require a certain character model.
Users who don't have a character based on that model won't be able to participate in the missions in that pool.
- JavaScript
- GraphQL
const {
createCreateMissionPoolTransaction: {
missionPoolAddress, // The address of the mission pool
tx, // The transaction response, you'll need to sign and send this transaction
},
} = await client.createCreateMissionPoolTransaction({
data: {
name: "Test Mission Pool",
project: projectAddress.toString(),
payer: adminPublicKey.toString(),
authority: adminPublicKey.toString(),
delegateAuthority: delegateAuthority.toString(), // Optional
characterModel: characterModelAddress.toString(),
},
});
query CreateCreateMissionPoolTransaction($data: NewMissionPoolData!) {
createCreateMissionPoolTransaction(data: $data) {
tx {
transaction
blockhash
lastValidBlockHeight
}
missionPoolAddress
}
}
Provide the accompanying data:
{
"data": {
"name": "string", // The name of the mission pool
"project": "pubkey", // The project for which you're creating the mission pool
"authority": "pubkey", // Project authority pubkey
"delegateAuthority": "pubkey", // Optional, delegate authority pubkey
"payer": "pubkey", // Payer pubkey
"characterModel": "pubkey", // The character model that will be allowed to participate in missions in this pool
}
}
Create a mission
- JavaScript
- GraphQL
import { RewardKind } from "@honeycomb-protocol/edge-client";
const {
createCreateMissionTransaction: {
missionAddress, // The address of the mission
tx, // The transaction response, you'll need to sign and send this transaction
},
} = await client.createCreateMissionTransaction({
data: {
name: "Test mission",
project: projectAddress.toString(),
cost: {
address: resourceAddress.toString(),
amount: "100000",
},
duration: "86400", // 1 day
minXp: "50000", // Minimum XP required to participate in the mission
rewards: [
{
kind: RewardKind.Xp,
max: "100",
min: "100",
},
{
kind: RewardKind.Resource,
max: "25000000",
min: "50000000",
resource: resourceAddress.toString(),
},
],
missionPool: missionPoolAddress.toString(),
authority: adminPublicKey.toString(),
payer: adminPublicKey.toString(),
},
});
query CreateCreateMissionTransaction($data: NewMissionData!) {
createCreateMissionTransaction(data: $data) {
tx {
transaction
blockhash
lastValidBlockHeight
}
missionAddress
}
}
Provide the accompanying data:
{
"data": {
"project": "pubkey", // The project for which you're creating the mission
"missionPool": "pubkey", // The mission pool to which the mission belongs
"authority": "pubkey", // Project authority pubkey
"delegateAuthority": "pubkey", // Optional, delegate authority pubkey
"payer": "pubkey", // Payer pubkey
"name": "string", // The name of the mission
"minXp": "int", // The minimum XP required to participate in the mission, send it as a string
"cost": {
"address": "pubkey", // A valid project resource address, this cost will be deducted from the user's account when they participate in the mission
"amount": "int" // The amount of the resource required to participate in the mission, send it as a string
},
"duration": "int", // The duration of the mission in seconds (for example: 1 hour = 3600), send it as a string
"rewards": [
{
"kind": "string", // The kind of reward, valid values: "Xp" or "Resource"
"min": "int", // The minimum amount of the reward, send it as a string
"max": "int", // The maximum amount of the reward, send it as a string
"resource": "pubkey" // Optional, the resource address for the reward, only specify if the reward kind is "Resource"
}
]
}
}
Send characters on mission
- JavaScript
- GraphQL
const {
createSendCharactersOnMissionTransaction: txResponse // This is the transaction response, you'll need to sign and send this transaction
} = await client.createSendCharactersOnMissionTransaction({
data: {
mission: missionAddress.toString(),
characterAddresses: [
characterAddress.toString(),
],
authority: userPublicKey.toString(),
payer: payerPublicKey.toString(), // Optional
},
});
query CreateSendCharactersOnMissionTransaction($data: ParticipateOnMissionData!) {
createSendCharactersOnMissionTransaction(data: $data) {
transactions
blockhash
lastValidBlockHeight
}
}
{
"data": {
"mission": "pubkey", // The mission for which you're sending characters
"characterAddresses": ["pubkey"], // An array of character addresses that you're sending on the mission, these characters must be eligible to participate in the mission
"authority": "pubkey", // User pubkey, the user must own these characters
"payer": "pubkey" // Optional, payer pubkey
}
}
Recall characters from a mission
- JavaScript
- GraphQL
const {
createRecallCharactersTransaction: txResponse // This is the transaction response, you'll need to sign and send this transaction
} = await client.createRecallCharactersTransaction({
data: {
mission: missionAddress.toString(),
characterAddresses: [
characterAddress.toString()
],
authority: userPublicKey.toString(),
payer: payerPublicKey.toString(), // Optional
},
lutAddresses: [lookupTableAddress],
});
query CreateRecallCharactersTransaction($data: RecallFromMissionData!) {
createRecallCharactersTransaction(data: $data) {
transactions
blockhash
lastValidBlockHeight
}
}
{
"data": {
"mission": "pubkey", // The mission from which you're recalling characters
"characterAddresses": ["pubkey"], // An array of character addresses that you're recalling from the mission
"authority": "pubkey", // User pubkey, the user must own these characters
"payer": "pubkey" // Optional, payer pubkey
}
}
Fetching a character's history
Please see the character history guide to learn how to fetch a character's history.