import { Reservation, Batch, Campaign, TasksSettings, InitCampaign, InitBatch, RepsDone } from './../types/campaign'; import { Client } from '../client'; import { TransactResult } from '@wharfkit/session'; export declare class TasksService { private client; constructor(client: Client); /** * Retrieve all campaigns published to Effect Network * @returns {Campaign[]} Promise */ getAllCampaigns(ipfsFetch?: boolean): Promise; /** * Retrieve campaign by id * @param id id of the campaign * @returns {Promise} Campaign */ getCampaign(id: number, fetchIpfs?: boolean): Promise; /** * Create a new campaign * @param campaign InitCampaign */ makeCampaign(campaign: InitCampaign): Promise; /** * Retrieve Batch by id * @param id id of the batch * @returns {Promise} Batch */ getBatch(batchId: number): Promise; /** * Create batch */ makeBatch(initBatch: InitBatch): Promise; /** * Fetch the task data * Load the batch the task is in (get _task_.batch_id from the batch table) * Get the batch IPFS hash from batch.content.value * Load the IPFS object and confirm it is a JSON array. Get the _task_.task_idxth item from the array * Render the campaign template with that task data */ getTaskData(reservation: Reservation): Promise; /** * Task availability * TODO: This is a WIP */ taskAvailable(reservation: Reservation): Promise; /** * Get repitions done for a task in a campaign. */ getAllRepsDone(): Promise; /** * Submit task * Call submittask(camapign_id, task_idx, data, account_id, sig). Note to use _task_.task_idx for the task_idx parameter (not the ID). * sig (for BSC only): to avoid replay attacks, the signature is (mark)(campaign_id)(task_idx)(data). The mark value is 5. */ submitTask(reservation: Reservation, data: any): Promise; /** * */ getAllAccTaskIdx: () => Promise; /** * Retrieve all reservations * @returns {Promise} Reservation[] */ getAllReservations(): Promise; /** * Get Campaign Reservation for user * @param campaignId id of the campaign * @param accountId id of the account * @returns {Promise} Reservation */ getCampaignReservation(campaignId: number, accountId: number): Promise; /** * Get the reservation of logged in user for a campaign. * @param campaignId id of the campaign * @returns {Promise} Reservation */ getMyReservation(campaignId: number): Promise; /** * Reserve a task, will check if the user already has a reservation for this campaign and return it, if not will create a new reservation and return it. * @param campaignId id of the campaign * @param qualiAssets can be null, then the smart contract will search through all the assets of the user. * @returns {Promise} Reservation * * ```mermaid * sequenceDiagram * participant User * participant Client * participant Smart Contract * User->>Client: Login * Client->>Smart Contract: reserveTask(campaignId, qualiAssets) * Smart Contract->>Smart Contract: Check if user already has a reservation for this campaign * Smart Contract->>Smart Contract: If not, create a new reservation * Smart Contract->>Client: Return reservation * Client->>User: Return reservation * ``` */ reserveTask(campaignId: number, qualiAssets?: string[]): Promise; /** * Retrieve Effect Network Qualification NFT for user. * @param accountId id of the account * @returns {Promise} Qualification NFT */ getQualifications(accountId: number): Promise; /** * TODO: Figure out the interface for a Qualification NFT Asset * Retrieve Effect Network Qualification NFT Collection * */ getQualificationCollection(): Promise; /** * Get payout delay * @returns the payout delay in seconds * @throws error if the payout delay is not available */ getForceSettings: () => Promise; }