iexec / IExecOrderModule
module exposing order methods
new IExecOrderModule(
configOrArgs,options?):IExecOrderModule
Create an IExecModule instance
IExecOrderModule
config:
IExecConfig
current IExecConfig
cancelApporder(
apporder):Promise<{order:SignedApporder;txHash:string; }>
SIGNER REQUIRED, ONLY APP OWNER
cancel an apporder on the blockchain making it invalid
example:
const { txHash } = await cancelApporder(apporder);
console.log('cancel tx:', txHash);Promise<{ order: SignedApporder; txHash: string; }>
cancelDatasetorder(
datasetorder):Promise<{order:SignedDatasetorder;txHash:string; }>
SIGNER REQUIRED, ONLY DATASET OWNER
cancel a datasetorder on the blockchain making it invalid
example:
const { txHash } = await cancelDatasetorder(datasetorder);
console.log('cancel tx:', txHash);Promise<{ order: SignedDatasetorder; txHash: string; }>
cancelRequestorder(
requestorder):Promise<{order:SignedRequestorder;txHash:string; }>
SIGNER REQUIRED, ONLY REQUESTER
cancel a requestorder on the blockchain making it invalid
example:
const { txHash } = await cancelRequestorder(requestorder);
console.log('cancel tx:', txHash);Promise<{ order: SignedRequestorder; txHash: string; }>
cancelWorkerpoolorder(
workerpoolorder):Promise<{order:SignedWorkerpoolorder;txHash:string; }>
SIGNER REQUIRED, ONLY WORKERPOOL OWNER
cancel a workerpoolorder on the blockchain making it invalid
example:
const { txHash } = await cancelWorkerpoolorder(workerpoolorder);
console.log('cancel tx:', txHash);Promise<{ order: SignedWorkerpoolorder; txHash: string; }>
createApporder(
overrides):Promise<ApporderTemplate>
create an apporder template with specified parameters
example:
const apporderTemplate = await createApporder({app: appAddress});string
price per task
default 0
string
restrict usage to a specific dataset
default no restrict
string
restrict usage to a specific requester
default no restrict
Tag | string[]
restrict usage to runtime with specified tags
default []
volume of tasks executable with the order
default 1
string
restrict usage to a specific workerpool
default no restrict
Promise<ApporderTemplate>
createDatasetorder(
overrides):Promise<DatasetorderTemplate>
create a datasetorder template with specified parameters
example:
const datasetorderTemplate = await createDatasetorder({dataset: datasetAddress});string
restrict usage to a specific app
default no restrict
string
price per task
default 0
string
restrict usage to a specific requester
default no restrict
Tag | string[]
restrict usage to runtime with specified tags
default []
volume of tasks executable with the order
default 1
string
restrict usage to a specific workerpool
default no restrict
Promise<DatasetorderTemplate>
createRequestorder(
overrides):Promise<RequestorderTemplate>
create a requestorder template with specified parameters
example:
const requestorderTemplate = await createRequestorder({
app: appAddress,
category: 0,
params: { iexec_args: 'hello world'}
});string
app to run
app max price per task
default 0
string
beneficiary
default connected wallet address
string
address of the smart contract for on-chain callback with the execution result
computation category
string
dataset to use
default none
dataset max price per task
default 0
string | RequestorderParams
execution parameters
string
requester
default connected wallet address
Tag | string[]
restrict usage to runtime with specified tags
default []
required trust
default 0
volume of tasks executable with the order
default 1
string
run one specified workerpool
default run on any workerpool
workerpool max price per task
default 0
Promise<RequestorderTemplate>
createWorkerpoolorder(
overrides):Promise<WorkerpoolorderTemplate>
create a workerpoolorder template with specified parameters
example:
const workerpoolorderTemplate = await createWorkerpoolorder({workerpool: workerpoolAddress, category: 0});string
restrict usage to a specific app
default no restrict
computation category
string
restrict usage to a specific dataset
default no restrict
string
restrict usage to a specific requester
default no restrict
Tag | string[]
proposed tags
default []
proposed trust
default 0
volume of tasks executable with the order
default 1
string
price per task
default 0
Promise<WorkerpoolorderTemplate>
estimateMatchOrders(
orders,options?):Promise<{sponsored:BN;total:BN;volume:BN; }>
estimates the cost of matching the provided orders
example:
const orders = {
apporder,
datasetorder
workerpoolorder,
requestorder,
};
const result = await estimateMatchOrders(orders, {useVoucher: true});
console.log(`executable volume: ${result.volume} tasks`);
console.log(`total cost for matching orders: ${result.total} nRLC`);
console.log(`sponsored cost covered by voucher: ${result.sponsored} nRLC`);boolean
use a voucher contract to sponsor the deal
string
override the voucher contract to use, must be combined with useVoucher: true
the user must be authorized by the voucher's owner to use it
Promise<{ sponsored: BN; total: BN; volume: BN; }>
hashApporder(
apporder):Promise<string>
compute the hash of an apporder
example:
const orderHash = await hashApporder(apporder);
console.log('order hash:', orderHash);Promise<string>
hashDatasetorder(
datasetorder):Promise<string>
compute the hash of a datasetorder
example:
const orderHash = await hashDatasetorder(datasetorder);
console.log('order hash:', orderHash);Promise<string>
hashRequestorder(
requestorder):Promise<string>
compute the hash of a requestorder
example:
const orderHash = await hashRequestorder(requestorder);
console.log('order hash:', orderHash);Promise<string>
hashWorkerpoolorder(
workerpoolorder):Promise<string>
compute the hash of a workerpoolorder
example:
const orderHash = await hashWorkerpoolorder(workerpoolorder);
console.log('order hash:', orderHash);Promise<string>
matchOrders(
orders,options?):Promise<{dealid:string;txHash:string;volume:BN; }>
SIGNER REQUIRED
make a deal on-chain with compatible orders to trigger the off-chain computation.
NB: preflight checks are performed on the orders before signing (this helps detecting inconsistencies and prevent creating always failing tasks). these checks can be disabled by passing the option preflightCheck: false
const { dealid, txHash } = await matchOrders({
apporder,
workerpoolorder,
requestorder,
});
console.log(`created deal ${dealid} in tx ${txHash}`);boolean
boolean
use a voucher contract to sponsor the deal
string
override the voucher contract to use, must be combined with useVoucher: true
the user must be authorized by the voucher's owner to use it
Promise<{ dealid: string; txHash: string; volume: BN; }>
prepareDatasetBulk(
datasetorders,options?):Promise<{cid:string;volume:number; }>
Prepare a bulk from datasetorders to process multiple datasets with a single requestorder
NB:
- datasetorders used must authorize the requester to use the dataset in for free with an infinite volume (
utils.DATASET_INFINITE_VOLUME) - depending on the number of datasetorders provided and the
maxDatasetPerTaskoption, the bulk might require be splitted into multiple tasks to respect the max dataset per task limit, the returnedvolumeis the number of tasks required to process the bulk
example:
const { bulkCid, volume } = await prepareDatasetBulk(datasetorders, { maxDatasetPerTask: 5 });
console.log(`bulk_cid: ${bulkCid}, volume: ${volume}`);
const requestorderTemplate = await createRequestorder({
app: appAddress,
category: 0,
volume: volume, // set the volume
params: { bulk_cid: bulkCid } // set the bulk cid in the requestorder params
});number
Maximum number of datasets to include in a single task
Default
100Promise<{ cid: string; volume: number; }>
publishApporder(
apporder,options?):Promise<string>
SIGNER REQUIRED, ONLY APP OWNER
publish an apporder on the off-chain marketplace making it available for other users
NB: preflight checks are performed on the order before signing (this helps detecting inconsistencies and prevent creating always failing tasks). these checks can be disabled by passing the option preflightCheck: false
example:
const orderHash = await publishApporder(apporder);
console.log('published order hash:', orderHash);boolean
Promise<string>
publishDatasetorder(
datasetorder,options?):Promise<string>
SIGNER REQUIRED, ONLY DATASET OWNER
publish a datasetorder on the off-chain marketplace making it available for other users
NB: preflight checks are performed on the order before signing (this helps detecting inconsistencies and prevent creating always failing tasks). these checks can be disabled by passing the option preflightCheck: false
example:
const orderHash = await publishDatasetorder(datasetorder);
console.log('published order hash:', orderHash);boolean
Promise<string>
publishRequestorder(
requestorder,options?):Promise<string>
SIGNER REQUIRED, ONLY REQUESTER
publish a requestorder on the off-chain marketplace making it available for other users
NB: preflight checks are performed on the order before signing (this helps detecting inconsistencies and prevent creating always failing tasks). these checks can be disabled by passing the option preflightCheck: false
example:
const orderHash = await publishRequestorder(requestorder);
console.log('published order hash:', orderHash);boolean
Promise<string>
publishWorkerpoolorder(
workerpoolorder):Promise<string>
SIGNER REQUIRED, ONLY WORKERPOOL OWNER
publish a workerpoolorder on the off-chain marketplace making it available for other users
example:
const orderHash = await publishWorkerpoolorder(workerpoolorder);
console.log('published order hash:', orderHash);Promise<string>
signApporder(
apporder,options?):Promise<SignedApporder>
ONLY APP OWNER
sign an apporder template to create a valid order
NB: preflight checks are performed on the order before signing (this helps detecting inconsistencies and prevent creating always failing tasks). these checks can be disabled by passing the option preflightCheck: false
example:
const apporderTemplate = await createApporder({app: appAddress});
const apporder = await signApporder(apporderTemplate);boolean
Promise<SignedApporder>
signDatasetorder(
datasetorder,options?):Promise<SignedDatasetorder>
SIGNER REQUIRED, ONLY DATASET OWNER
sign a datasetorder template to create a valid order
NB: preflight checks are performed on the order before signing (this helps detecting inconsistencies and prevent creating always failing tasks). these checks can be disabled by passing the option preflightCheck: false
example:
const datasetorderTemplate = await createDatasetorder({dataset: datasetAddress});
const datasetorder = await signDatasetorder(datasetorderTemplate);boolean
Promise<SignedDatasetorder>
signRequestorder(
requestorder,options?):Promise<SignedRequestorder>
SIGNER REQUIRED, ONLY REQUESTER
sign a requestorder template to create a valid order
NB: preflight checks are performed on the order before signing (this helps detecting inconsistencies and prevent creating always failing tasks). these checks can be disabled by passing the option preflightCheck: false
example:
const requestorderTemplate = await createRequestorder({
app: appAddress,
category: 0,
params: { iexec_args: 'hello world'}
});
const requestorder = await signRequestorder(requestorderTemplate);boolean
Promise<SignedRequestorder>
signWorkerpoolorder(
workerpoolorder):Promise<SignedWorkerpoolorder>
SIGNER REQUIRED, ONLY WORKERPOOL OWNER
sign a workerpoolorder template to create a valid order
const workerpoolorderTemplate = await createWorkerpoolorder({workerpool: workerpoolAddress, category: 0});
const workerpoolorder = await signWorkerpoolorder(workerpoolorderTemplate);Promise<SignedWorkerpoolorder>
unpublishAllApporders(
appAddress):Promise<string[]>
SIGNER REQUIRED, ONLY APPORDER SIGNER
unpublish all the published app's apporders from the off-chain marketplace
NB: this is a transaction free off-chain operation, unpublished orders are no longer exposed to other users but are still valid, use the cancel method if you want to invalidate them
example:
const orderHashes = await unpublishAllApporders(appAddress);
console.log('published orders count:', orderHashes.length);string
Promise<string[]>
unpublishAllDatasetorders(
datasetAddress):Promise<string[]>
SIGNER REQUIRED, ONLY DATASETORDER SIGNER
unpublish all the published dataset's datasetorders from the off-chain marketplace
NB: this is a transaction free off-chain operation, unpublished orders are no longer exposed to other users but are still valid, use the cancel method if you want to invalidate them
example:
const orderHashes = await unpublishAllDatasetorders(datasetAddress);
console.log('unpublished orders count:', orderHashes.length);string
Promise<string[]>
unpublishAllRequestorders():
Promise<string[]>
SIGNER REQUIRED, ONLY REQUESTER
unpublish all the published requester's requestorders from the off-chain marketplace
NB: this is a transaction free off-chain operation, unpublished orders are no longer exposed to other users but are still valid, use the cancel method if you want to invalidate them
example:
const orderHashes = await unpublishAllRequestorders();
console.log('unpublished orders count:', orderHashes.length);Promise<string[]>
unpublishAllWorkerpoolorders(
workerpoolAddress):Promise<string[]>
SIGNER REQUIRED, ONLY WORKERPOOLORDER SIGNER
unpublish all the published workerpool's workerpoolorders from the off-chain marketplace
NB: this is a transaction free off-chain operation, unpublished orders are no longer exposed to other users but are still valid, use the cancel method if you want to invalidate them
example:
const orderHashes = await unpublishAllWorkerpoolorders(workerpoolAddress);
console.log('unpublished orders count:', orderHashes.length);string
Promise<string[]>
unpublishApporder(
apporderHash):Promise<string>
SIGNER REQUIRED, ONLY APPORDER SIGNER
unpublish an apporder from the off-chain marketplace
NB: this is a transaction free off-chain operation, unpublished orders are no longer exposed to other users but are still valid, use the cancel method if you want to invalidate them
example:
const orderHash = await unpublishApporder(apporderHash);
console.log(unpublished order hash:', orderHash);string
Promise<string>
unpublishDatasetorder(
datasetorderHash):Promise<string>
SIGNER REQUIRED, ONLY DATASETORDER SIGNER
unpublish a datasetorder from the off-chain marketplace
NB: this is a transaction free off-chain operation, unpublished orders are no longer exposed to other users but are still valid, use the cancel method if you want to invalidate them
example:
const orderHash = await unpublishDatasetorder(datasetorderHash);
console.log('unpublished order hash:', orderHash);string
Promise<string>
unpublishLastApporder(
appAddress):Promise<string>
SIGNER REQUIRED, ONLY APPORDER SIGNER
unpublish the last published app's apporder from the off-chain marketplace
NB: this is a transaction free off-chain operation, unpublished orders are no longer exposed to other users but are still valid, use the cancel method if you want to invalidate them
example:
const orderHash = await unpublishLastApporder(appAddress);
console.log('published order hash:', orderHash);string
Promise<string>
unpublishLastDatasetorder(
datasetAddress):Promise<string>
SIGNER REQUIRED, ONLY DATASETORDER SIGNER
unpublish the last published dataset's datasetorder from the off-chain marketplace
NB: this is a transaction free off-chain operation, unpublished orders are no longer exposed to other users but are still valid, use the cancel method if you want to invalidate them
example:
const orderHash = await unpublishLastDatasetorder(datasetAddress);
console.log('unpublished order hash:', orderHash);string
Promise<string>
unpublishLastRequestorder():
Promise<string>
SIGNER REQUIRED, ONLY REQUESTER
unpublish the last published requester's requestorder from the off-chain marketplace
NB: this is a transaction free off-chain operation, unpublished orders are no longer exposed to other users but are still valid, use the cancel method if you want to invalidate them
example:
const orderHash = await unpublishLastRequestorder();
console.log('unpublished order hash:', orderHash);Promise<string>
unpublishLastWorkerpoolorder(
workerpoolAddress):Promise<string>
**SIGNER REQUIRED, ONLY WORKERPOOLORDER SIGNER
unpublish the last published workerpool's workerpoolorder from the off-chain marketplace
NB: this is a transaction free off-chain operation, unpublished orders are no longer exposed to other users but are still valid, use the cancel method if you want to invalidate them
example:
const orderHash = await unpublishLastWorkerpoolorder(workerpoolAddress);
console.log('unpublished order hash:', orderHash);string
Promise<string>
unpublishRequestorder(
requestorderHash):Promise<string>
SIGNER REQUIRED, ONLY REQUESTER
unpublish a requestorder from the off-chain marketplace
NB: this is a transaction free off-chain operation, unpublished orders are no longer exposed to other users but are still valid, use the cancel method if you want to invalidate them
example:
const orderHash = await unpublishRequestorder(requestorderHash);
console.log('unpublished order hash:', orderHash);string
Promise<string>
unpublishWorkerpoolorder(
workerpoolorderHash):Promise<string>
SIGNER REQUIRED, ONLY WORKERPOOLORDER SIGNER
unpublish a workerpoolorder from the off-chain marketplace
NB: this is a transaction free off-chain operation, unpublished orders are no longer exposed to other users but are still valid, use the cancel method if you want to invalidate them
example:
const orderHash = await unpublishWorkerpoolorder(workerpoolorderHash);
console.log('unpublished order hash:', orderHash);string
Promise<string>
staticfromConfig(config):IExecOrderModule
Create an IExecOrderModule instance using an IExecConfig instance
IExecOrderModule