export type * from '../common/types.js'; export type * from './IExecConfig.js'; import IExecConfig from './IExecConfig.js'; import IExecModule from './IExecModule.js'; import { Address, BN, BNish, TxHash } from '../common/types.js'; export interface WorkerpoolDeploymentArgs { /** * the workerpool owner */ owner: Address; /** * a description for the workerpool */ description: string; } /** * IExec workerpool */ export interface Workerpool { /** * the workerpool owner */ owner: Address; /** * a description of the workerpool */ workerpoolDescription: string; schedulerRewardRatioPolicy: BN; workerStakeRatioPolicy: BN; /** * workerpool registry address */ registry: Address; } /** * module exposing workerpool methods */ export default class IExecWorkerpoolModule extends IExecModule { /** * **SIGNER REQUIRED** * * deploy a workerpool contract on the blockchain * * example: * ```js * const { address } = await deployWorkerpool({ * owner: address, * description: 'My workerpool', * }); * console.log('deployed at', address); * ``` */ deployWorkerpool( workerpool: WorkerpoolDeploymentArgs, ): Promise<{ address: Address; txHash: TxHash }>; /** * predict the workerpool contract address given the workerpool deployment arguments * * example: * ```js * const address = await predictWorkerpoolAddress({ * owner: address, * description: 'My workerpool', * }); * console.log('address', address); * ``` */ predictWorkerpoolAddress( workerpool: WorkerpoolDeploymentArgs, ): Promise
; /** * check if an workerpool is deployed at a given address * * example: * ```js * const isDeployed = await checkDeployedWorkerpool(address); * console.log('workerpool deployed', isDeployed); * ``` */ checkDeployedWorkerpool(workerpoolAddress: Address): Promise; /** * show a deployed workerpool details * * example: * ```js * const { workerpool } = await showWorkerpool('0x86F2102532d9d01DA8084c96c1D1Bdb90e12Bf07'); * console.log('workerpool:', workerpool); * ``` */ showWorkerpool( workerpoolAddress: Address, ): Promise<{ objAddress: Address; workerpool: Workerpool }>; /** * count the workerpools owned by an address. * * example: * ```js * const count = await countUserWorkerpools(userAddress); * console.log('workerpool count:', count); * ``` */ countUserWorkerpools(userAddress: Address): Promise; /** * show deployed workerpool details by index for specified user user * * example: * ```js * const { workerpool } = await showUserWorkerpool(0, userAddress); * console.log('workerpool:', workerpool); * ``` */ showUserWorkerpool( index: BNish, address: Address, ): Promise<{ objAddress: Address; workerpool: Workerpool }>; /** * read the workerpool API url on the blockchain * * _NB_: resolve to `undefined` if the workerpool API url was not declared. * * example: * ```js * const url = await getWorkerpoolApiUrl(address); * console.log('workerpool API url:', url); * ``` */ getWorkerpoolApiUrl(workerpoolAddress: Address): Promise; /** * **ONLY WORKERPOOL OWNER** * * transfer the ownership of a workerpool to the specified address * * _NB_: when transferring the ownership to a contract, the receiver contract must implement the ERC721 token receiver interface * * example: * ```js * const { address, to, txHash } = await transferWorkerpool(workerpoolAddress, receiverAddress); * console.log(`workerpool ${address} ownership transferred to ${address} in tx ${txHash}`); * ``` */ transferWorkerpool( workerpoolAddress: Address, to: Address, ): Promise<{ address: Address; to: Address; txHash: TxHash }>; /** * Create an IExecWorkerpoolModule instance using an IExecConfig instance */ static fromConfig(config: IExecConfig): IExecWorkerpoolModule; }