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
- C#
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
}
}
var createMissionPoolParams = new CreateCreateMissionPoolTransactionParams
{
Data = new NewMissionPoolData
{
Name = "Test Mission Pool", // Name of the mission pool
Project = projectAddress, // Project address
Payer = adminPublicKey, // Public key of the payer
Authority = adminPublicKey, // Public key of the project authority
DelegateAuthority = delegateAuthority, // Optional
CharacterModel = characterModelAddress // Character model address
}
}
// Create a mission pool transaction
var tx = await Client.CreateCreateMissionPoolTransaction(createMissionPoolParams)
// Extract mission pool address and transaction response from the result
var missionPoolAddress = tx.CreateCreateMissionPoolTransaction.MissionPoolAddress; // This is the mission pool address once created
var txResponse = tx.CreateCreateMissionPoolTransaction.Tx; // This is the transaction response, which you'll need to sign and send
Create a mission
- JavaScript
- GraphQL
- C#
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"
}
]
}
}
var createMissionTransaction = await Client.CreateCreateMissionTransaction(new CreateCreateMissionTransactionParams
{
Data = new NewMissionData
{
Name = "Test mission",
Project = projectAddress.ToString(),
Cost = new MissionCost
{
Resource_address = resourceAddress.ToString(),
Amount = "100000"
},
Duration = "86400", // 1 day
MinXp = "50000", // Minimum XP required to participate in the mission
Rewards = new List<MissionReward>
{
new MissionReward
{
Kind = RewardKind.Xp,
Max = "100",
Min = "100"
},
new MissionReward
{
Kind = RewardKind.Resource,
Max = "25000000",
Min = "50000000",
Resource = resourceAddress.ToString()
}
},
MissionPool = missionPoolAddress.ToString(),
Authority = adminPublicKey.ToString(),
Payer = adminPublicKey.ToString()
}
});
var missionAddress = createMissionTransaction.MissionAddress; // Address of the created mission
var tx = createMissionTransaction.Tx; // Transaction response, to be signed and sent
Send characters on mission
- JavaScript
- GraphQL
- C#
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
}
}
var sendCharactersOnMissionParams = new CreateSendCharactersOnMissionTransactionParams
{
Data = new ParticipateOnMissionData
{
Mission = missionAddress.ToString(), // Mission address
CharacterAddresses = new List<string>
{
characterAddress.ToString(), // Character address
},
Authority = userPublicKey.ToString(), // Public key of the authority
Payer = payerPublicKey.ToString(), // Optional: public key of the payer
}
};
// Create a send characters on mission transaction
var txResponse = await Client.CreateSendCharactersOnMissionTransaction(sendCharactersOnMissionParams); // This is the transaction response, you'll need to sign and send this transaction
Recall characters from a mission
- JavaScript
- GraphQL
- C#
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
}
}
var recallCharactersParams = new CreateRecallCharactersTransactionParams
{
Data = new RecallFromMissionData
{
Mission = missionAddress.ToString(), // Mission address
CharacterAddresses = new List<string>
{
characterAddress.ToString() // Character address
},
Authority = userPublicKey.ToString(), // Public key of the authority
Payer = payerPublicKey.ToString(), // Optional: public key of the payer
},
LutAddresses = new List<string>
{
lookupTableAddress // Lookup table address
}
};
// Create a recall characters transaction
var txResponse = await Client.CreateRecallCharactersTransaction(recallCharactersParams); // This is the transaction response, you'll need to sign and send this transaction
Fetching a character's history
Please see the character history guide to learn how to fetch a character's history.