Skip to content

Latest commit

 

History

History
72 lines (50 loc) · 1.64 KB

Manual K2 Calls.md

File metadata and controls

72 lines (50 loc) · 1.64 KB

GUIDE TO CALLS K2 FUNCTIONS MANUALLY

If you wish to do the development by avoiding the timers then you can do the intended calls to K2 directly using these function calls.

To disable timers please set the TIMERS flag in task-node ENV to disable

NOTE : K2 will still have the windows to accept the submission and audit values, so you are expected to make calls in the intended slots of your round time.

Get the task state

console.log(await namespaceWrapper.getTaskState());

Get round

const round = await namespaceWrapper.getRound();
console.log("ROUND", round);

Call to do the work for the task

import { taskRunner } from "@_koii/taskRunner";
await taskRunner.task();

Submission to K2

Preferably you should submit the CID received from IPFS.

import { taskRunner } from "@_koii/taskRunner";
await taskRunner.submitTask(round - 1);

Audit submissions

import { taskRunner } from "@_koii/taskRunner";
await taskRunner.auditTask(round - 1);

Upload distribution list to K2

import { taskRunner } from "@_koii/taskRunner";
await taskRunner.selectAndGenerateDistributionList(10);

Audit distribution list

import { taskRunner } from "@_koii/taskRunner";
await coreLogic.auditDistribution(round - 2);

Payout trigger

const responsePayout = await namespaceWrapper.payoutTrigger();
console.log("RESPONSE TRIGGER", responsePayout);

Logs to be displayed on desktop-node

namespaceWrapper.logger("error", "Internet connection lost");
await namespaceWrapper.logger("warn", "Stakes are running low");
await namespaceWrapper.logger("log", "Task is running");