iexec / Exports / IExecOrderModule
module exposing order methods
-
↳
IExecOrderModule
- cancelApporder
- cancelDatasetorder
- cancelRequestorder
- cancelWorkerpoolorder
- createApporder
- createDatasetorder
- createRequestorder
- createWorkerpoolorder
- estimateMatchOrders
- hashApporder
- hashDatasetorder
- hashRequestorder
- hashWorkerpoolorder
- matchOrders
- publishApporder
- publishDatasetorder
- publishRequestorder
- publishWorkerpoolorder
- signApporder
- signDatasetorder
- signRequestorder
- signWorkerpoolorder
- unpublishAllApporders
- unpublishAllDatasetorders
- unpublishAllRequestorders
- unpublishAllWorkerpoolorders
- unpublishApporder
- unpublishDatasetorder
- unpublishLastApporder
- unpublishLastDatasetorder
- unpublishLastRequestorder
- unpublishLastWorkerpoolorder
- unpublishRequestorder
- unpublishWorkerpoolorder
- fromConfig
• new IExecOrderModule(configOrArgs
, options?
): IExecOrderModule
Create an IExecModule instance
Name | Type |
---|---|
configOrArgs |
IExecConfig | IExecConfigArgs |
options? |
IExecConfigOptions |
• 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);
Name | Type |
---|---|
apporder |
ConsumableApporder |
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);
Name | Type |
---|---|
datasetorder |
ConsumableDatasetorder |
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);
Name | Type |
---|---|
requestorder |
ConsumableRequestorder |
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);
Name | Type |
---|---|
workerpoolorder |
ConsumableWorkerpoolorder |
Promise
<{ order
: SignedWorkerpoolorder
; txHash
: string
}>
▸ createApporder(overrides
): Promise
<ApporderTemplate
>
create an apporder template with specified parameters
example:
const apporderTemplate = await createApporder({app: appAddress});
Name | Type | Description |
---|---|---|
overrides |
Object |
- |
overrides.app |
string |
- |
overrides.appprice? |
NRLCAmount |
price per task default 0 |
overrides.datasetrestrict? |
string |
restrict usage to a specific dataset default no restrict |
overrides.requesterrestrict? |
string |
restrict usage to a specific requester default no restrict |
overrides.tag? |
Tag | string [] |
restrict usage to runtime with specified tags default [] |
overrides.volume? |
BNish |
volume of tasks executable with the order default 1 |
overrides.workerpoolrestrict? |
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});
Name | Type | Description |
---|---|---|
overrides |
Object |
- |
overrides.apprestrict? |
string |
restrict usage to a specific app default no restrict |
overrides.dataset |
string |
- |
overrides.datasetprice? |
NRLCAmount |
price per task default 0 |
overrides.requesterrestrict? |
string |
restrict usage to a specific requester default no restrict |
overrides.tag? |
Tag | string [] |
restrict usage to runtime with specified tags default [] |
overrides.volume? |
BNish |
volume of tasks executable with the order default 1 |
overrides.workerpoolrestrict? |
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'}
});
Name | Type | Description |
---|---|---|
overrides |
Object |
- |
overrides.app |
string |
app to run |
overrides.appmaxprice? |
NRLCAmount |
app max price per task default 0 |
overrides.beneficiary? |
string |
beneficiary default connected wallet address |
overrides.callback? |
string |
address of the smart contract for on-chain callback with the execution result |
overrides.category |
BNish |
computation category |
overrides.dataset? |
string |
dataset to use default none |
overrides.datasetmaxprice? |
NRLCAmount |
dataset max price per task default 0 |
overrides.params? |
string | RequestorderParams |
execution parameters |
overrides.requester? |
string |
requester default connected wallet address |
overrides.tag? |
Tag | string [] |
restrict usage to runtime with specified tags default [] |
overrides.trust? |
BNish |
required trust default 0 |
overrides.volume? |
BNish |
volume of tasks executable with the order default 1 |
overrides.workerpool? |
string |
run one specified workerpool default run on any workerpool |
overrides.workerpoolmaxprice? |
NRLCAmount |
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});
Name | Type | Description |
---|---|---|
overrides |
Object |
- |
overrides.apprestrict? |
string |
restrict usage to a specific app default no restrict |
overrides.category |
BNish |
computation category |
overrides.datasetrestrict? |
string |
restrict usage to a specific dataset default no restrict |
overrides.requesterrestrict? |
string |
restrict usage to a specific requester default no restrict |
overrides.tag? |
Tag | string [] |
proposed tags default [] |
overrides.trust? |
BNish |
proposed trust default 0 |
overrides.volume? |
BNish |
volume of tasks executable with the order default 1 |
overrides.workerpool |
string |
- |
overrides.workerpoolprice? |
NRLCAmount |
price per task default 0 |
Promise
<WorkerpoolorderTemplate
>
▸ estimateMatchOrders(orders
, options?
): Promise
<{ sponsored
: NRlcAmount
; total
: NRlcAmount
}>
estimates the cost of matching the provided orders
example:
const orders = {
apporder,
datasetorder
workerpoolorder,
requestorder,
};
const result = await estimateMatchOrders(orders, {useVoucher: true});
console.log(`total cost for matching orders: ${result.total} nRLC`);
console.log(`sponsored cost covered by voucher: ${result.sponsored} nRLC`);
Name | Type |
---|---|
orders |
Object |
orders.apporder |
ConsumableApporder |
orders.datasetorder? |
ConsumableDatasetorder |
orders.requestorder |
ConsumableRequestorder |
orders.workerpoolorder |
ConsumableWorkerpoolorder |
options? |
Object |
options.useVoucher? |
boolean |
Promise
<{ sponsored
: NRlcAmount
; total
: NRlcAmount
}>
▸ hashApporder(apporder
): Promise
<string
>
compute the hash of an apporder
example:
const orderHash = await hashApporder(apporder);
console.log('order hash:', orderHash);
Name | Type |
---|---|
apporder |
HashableApporder |
Promise
<string
>
▸ hashDatasetorder(datasetorder
): Promise
<string
>
compute the hash of a datasetorder
example:
const orderHash = await hashDatasetorder(datasetorder);
console.log('order hash:', orderHash);
Name | Type |
---|---|
datasetorder |
HashableDatasetorder |
Promise
<string
>
▸ hashRequestorder(requestorder
): Promise
<string
>
compute the hash of a requestorder
example:
const orderHash = await hashRequestorder(requestorder);
console.log('order hash:', orderHash);
Name | Type |
---|---|
requestorder |
HashableRequestorder |
Promise
<string
>
▸ hashWorkerpoolorder(workerpoolorder
): Promise
<string
>
compute the hash of a workerpoolorder
example:
const orderHash = await hashWorkerpoolorder(workerpoolorder);
console.log('order hash:', orderHash);
Name | Type |
---|---|
workerpoolorder |
HashableWorkerpoolorder |
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}`);
Name | Type |
---|---|
orders |
Object |
orders.apporder |
ConsumableApporder |
orders.datasetorder? |
ConsumableDatasetorder |
orders.requestorder |
ConsumableRequestorder |
orders.workerpoolorder |
ConsumableWorkerpoolorder |
options? |
Object |
options.preflightCheck? |
boolean |
options.useVoucher? |
boolean |
Promise
<{ dealid
: string
; txHash
: string
; volume
: BN
}>
▸ 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);
Name | Type |
---|---|
apporder |
ConsumableApporder |
options? |
Object |
options.preflightCheck? |
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);
Name | Type |
---|---|
datasetorder |
ConsumableDatasetorder |
options? |
Object |
options.preflightCheck? |
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);
Name | Type |
---|---|
requestorder |
ConsumableRequestorder |
options? |
Object |
options.preflightCheck? |
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);
Name | Type |
---|---|
workerpoolorder |
ConsumableWorkerpoolorder |
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);
Name | Type |
---|---|
apporder |
SignableApporder |
options? |
Object |
options.preflightCheck? |
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);
Name | Type |
---|---|
datasetorder |
SignableDatasetorder |
options? |
Object |
options.preflightCheck? |
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);
Name | Type |
---|---|
requestorder |
SignableRequestorder |
options? |
Object |
options.preflightCheck? |
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);
Name | Type |
---|---|
workerpoolorder |
SignableWorkerpoolorder |
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);
Name | Type |
---|---|
appAddress |
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);
Name | Type |
---|---|
datasetAddress |
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);
Name | Type |
---|---|
workerpoolAddress |
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);
Name | Type |
---|---|
apporderHash |
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);
Name | Type |
---|---|
datasetorderHash |
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);
Name | Type |
---|---|
appAddress |
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);
Name | Type |
---|---|
datasetAddress |
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);
Name | Type |
---|---|
workerpoolAddress |
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);
Name | Type |
---|---|
requestorderHash |
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);
Name | Type |
---|---|
workerpoolorderHash |
string |
Promise
<string
>
▸ fromConfig(config
): IExecOrderModule
Create an IExecOrderModule instance using an IExecConfig instance
Name | Type |
---|---|
config |
IExecConfig |