iexec / IExecWorkerpoolModule
module exposing workerpool methods
new IExecWorkerpoolModule(
configOrArgs,options?):IExecWorkerpoolModule
Create an IExecModule instance
IExecWorkerpoolModule
config:
IExecConfig
current IExecConfig
checkDeployedWorkerpool(
workerpoolAddress):Promise<Boolean>
check if an workerpool is deployed at a given address
example:
const isDeployed = await checkDeployedWorkerpool(address);
console.log('workerpool deployed', isDeployed);string
Promise<Boolean>
countUserWorkerpools(
userAddress):Promise<BN>
count the workerpools owned by an address.
example:
const count = await countUserWorkerpools(userAddress);
console.log('workerpool count:', count);string
Promise<BN>
deployWorkerpool(
workerpool):Promise<{address:string;txHash:string; }>
SIGNER REQUIRED
deploy a workerpool contract on the blockchain
example:
const { address } = await deployWorkerpool({
owner: address,
description: 'My workerpool',
});
console.log('deployed at', address);Promise<{ address: string; txHash: string; }>
getWorkerpoolApiUrl(
workerpoolAddress):Promise<string|undefined>
read the workerpool API url on the blockchain
NB: resolve to undefined if the workerpool API url was not declared.
example:
const url = await getWorkerpoolApiUrl('my-workerpool.eth');
console.log('workerpool API url:', url);string
Promise<string | undefined>
predictWorkerpoolAddress(
workerpool):Promise<string>
predict the workerpool contract address given the workerpool deployment arguments
example:
const address = await predictWorkerpoolAddress({
owner: address,
description: 'My workerpool',
});
console.log('address', address);Promise<string>
setWorkerpoolApiUrl(
workerpoolAddress,url):Promise<string>
ONLY WORKERPOOL ENS NAME OWNER
declare the workerpool API url on the blockchain
NB: declaring the workerpool API url require an ENS name with a configured reverse resolution on the workerpool address (see: IExecENSModule obsConfigureResolution/configureResolution)
example:
const txHash = await setWorkerpoolApiUrl('my-workerpool.eth', 'my-workerpool.com');
console.log('txHash:', txHash);string
string
Promise<string>
showUserWorkerpool(
index,address):Promise<{objAddress:string;workerpool:Workerpool; }>
show deployed workerpool details by index for specified user user
example:
const { workerpool } = await showUserWorkerpool(0, userAddress);
console.log('workerpool:', workerpool);string
Promise<{ objAddress: string; workerpool: Workerpool; }>
showWorkerpool(
workerpoolAddress):Promise<{objAddress:string;workerpool:Workerpool; }>
show a deployed workerpool details
example:
const { workerpool } = await showWorkerpool('0x86F2102532d9d01DA8084c96c1D1Bdb90e12Bf07');
console.log('workerpool:', workerpool);string
Promise<{ objAddress: string; workerpool: Workerpool; }>
transferWorkerpool(
workerpoolAddress,to):Promise<{address:string;to:string;txHash:string; }>
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:
const { address, to, txHash } = await transferWorkerpool(workerpoolAddress, receiverAddress);
console.log(`workerpool ${address} ownership transferred to ${address} in tx ${txHash}`);string
string
Promise<{ address: string; to: string; txHash: string; }>
staticfromConfig(config):IExecWorkerpoolModule
Create an IExecWorkerpoolModule instance using an IExecConfig instance
IExecWorkerpoolModule