Skip to main content

Task State

A task's state can be retrieved using the namespace methods.

getTaskState

ParameterTypeDescription
optionsobjectOptions for the getTaskState call
Return ValueTypeDescription
responseobjectThe response from getTaskState call or null

Example:

options = {
is_submission_required: true,
is_distribution_required: true,
is_available_balances_required: true,
is_stake_list_required: true
}
namespaceWrapper.getTaskState(options);

getTaskSubmissionInfo

ParameterTypeDescription
roundnumberThe round for task submission
Return ValueTypeDescription
taskSubmissionInfoobjectThe task submission information or null

Example:

namespaceWrapper.getTaskSubmissionInfo(0);

getTaskDistributionInfo

ParameterTypeDescription
roundnumberThe round for task distribution
Return ValueTypeDescription
taskDistributionInfoobjectThe task distribution information or null

Example:

namespaceWrapper.getTaskDistributionInfo(0);

A task's state can be retrieved using the namespace methods. It returns an object containing information about the task.

The task state object:

KeyDescription
is_allowlistedBoolean value to show if the task is allowlisted
task_nameThe name of the task
task_descriptionThe description of the task
task_managerThe public key of the task creator in uint8 format
is_activeBoolean value to show if the task is active
task_audit_programThe IPFS CID / Arweave ID pointing to the JavaScript executable file of the task
stake_pot_accountAccount to which all the stakes go
submissionsThe values submitted to K2; it also includes the round and slots in which a submission was made
submissions_audit_triggerIncludes the submission value for a raised audit, also shows who audited it, who submitted the value and the submission value
total_bounty_amountTotal KOII added by the task creator to be distributed amongst the nodes
bounty_amount_per_roundKOII to be rewarded per round, this cannot be more than total_bounty_amount
total_stake_amountSum of all the stakes by the nodes running the task
minimum_stake_amountMinimum KOII required to run the task
available_balancesList of pending rewards of nodes that are available to be claimed
stake_listObject of staker publicKey mapped with the amount they staked
ip_address_listStatic IPs of the nodes that are running the current task
round_timeThe total number of slots it takes for each period of the current task
starting_slotThe slot at which the task is created
audit_windowTotal number of slots given for nodes to perform audit
submission_windowTotal number of slots given for nodes to complete submission
task_executable_networkEither IPFS/DEVELOPMENT/ARWEAVE. It specifies the location to fetch the task executable, if "DEVELOPMENT", then it assumes the task_audit_program (executable file) is on the task creator's local device
distribution_rewards_submissionTracks all the distribution submissions submitted to K2 for each round
distributions_audit_triggerTracks all the audits raised in each round for distribution submissions in the respective rounds
distributions_audit_recordRecords of payout statuses for the latest finished rounds containing Uninitialized, PayoutSuccessful, and PayoutFailed statuses.
task_metadataIPFS CID containing metadata for the task
task_varsnot used
koii_varsnot used
is_migratedBoolean to show the state of migration, if true then migrated_to will have the new address
migrated_toNew task Id to which the task is migrated
allowed_failed_distributionsThe number of failed distributions allowed
task_idtask_id

Task state sample:

{
taskName: 'Arweave Verifier',
taskManager: 'FnQm11NXJxPSjza3fuhuQ6Cu4fKNqdaPkVSRyLSWf14d',
is_allowlisted: true,
isActive: true,
taskAuditProgram: 'bafybeihjtsyty2sjmhriyvqlwxdldz2jkoyjr5pnko3t7jyais4kpgcdhm',
stakePotAccount: 'stakepotaccounti1drd3maNYcUgyohxwjfNVskco5v',
totalBountyAmount: 43635761521266,
bountyAmountPerRound: 1000000000000,
currentRound: undefined,
availableBalances: [Object],
stakeList: [Object],
startingSlot: 7603543,
isRunning: false,
hasError: false,
metadataCID: 'bafybeiek6a3ymp6xa3wluetm6v6qwsays6swhs4hihg4uzn4h2frqmzsui',
minimumStakeAmount: 1900000000,
roundTime: 6000,
submissions: [Object],
distributionsAuditTrigger: [Object],
submissionsAuditTrigger: {},
isMigrated: false,
migratedTo: '',
distributionRewardsSubmission: [Object]
}