Skip to content

Commit 061f1d2

Browse files
docs: add bulkOnly parameter to getGrantedAccess and fix documentation inconsistencies
- Add bulkOnly parameter to getGrantedAccess method documentation - Fix onStatusUpdate type in prepareBulkRequest (PrepareBulkRequestStatuses) - Fix workerpoolAddressOrEns type in sendEmailCampaign (AddressOrENS) - Fix tasks array property order in sendEmailCampaign response (taskId, dealId, bulkIndex) - Remove unnecessary code in sendEmailCampaign examples - Ensure all parameter types and return values match SDK implementations
1 parent 603b80b commit 061f1d2

File tree

10 files changed

+263
-788
lines changed

10 files changed

+263
-788
lines changed

package-lock.json

Lines changed: 38 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"@wagmi/vue": "^0.1.24",
2424
"clsx": "^2.1.1",
2525
"figlet": "^1.8.2",
26-
"iexec": "^8.22.0",
26+
"iexec": "^8.22.2",
2727
"pinia": "^3.0.3",
2828
"reka-ui": "^2.4.1",
2929
"tailwind-merge": "^3.3.1",

src/references/dataProtector/methods/getGrantedAccess.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,30 @@ const listGrantedAccess = await dataProtectorCore.getGrantedAccess({
191191
});
192192
```
193193

194+
### bulkOnly <OptionalBadge />
195+
196+
**Type:** `boolean`
197+
**Default:** `false`
198+
199+
Filter to retrieve only bulk orders. When set to `true`, only granted accesses
200+
that have been created with `allowBulk: true` in
201+
[`grantAccess`](/references/dataProtector/methods/grantAccess) will be returned.
202+
This is useful when preparing bulk requests using
203+
[`prepareBulkRequest`](/references/dataProtector/methods/prepareBulkRequest).
204+
205+
**Usage example:**
206+
207+
```ts twoslash
208+
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
209+
210+
const web3Provider = getWeb3Provider('PRIVATE_KEY');
211+
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);
212+
// ---cut---
213+
const { grantedAccess } = await dataProtectorCore.getGrantedAccess({
214+
bulkOnly: true, // [!code focus]
215+
});
216+
```
217+
194218
## Return Value
195219

196220
```ts twoslash

src/references/dataProtector/methods/grantAccess.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,10 @@ const grantedAccess = await dataProtectorCore.grantAccess({
213213
**Default:** `false`
214214

215215
When set to `true`, enables bulk processing for this access grant. This allows
216-
multiple protected data items to be processed together in a single task, which
217-
is more efficient for bulk operations like sending campaigns to multiple
218-
recipients.
216+
multiple protected data items to be processed together.
219217

220-
When `allowBulk: true` is set, the following parameters are automatically
221-
configured:
222-
223-
- **Price per access**: Set to `0` (no price per access)
224-
- **Number of accesses**: Set to `Number.MAX_SAFE_INTEGER` (maximum number of
225-
accesses)
218+
When `allowBulk: true` is set, the price per access is automatically set to `0`
219+
and the number of accesses is unlimited.
226220

227221
```ts twoslash
228222
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';

src/references/dataProtector/methods/prepareBulkRequest.md

Lines changed: 19 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ description:
99
# prepareBulkRequest
1010

1111
This method prepares a bulk request by grouping multiple protected data items
12-
that can be processed together in a single task. The prepared bulk request can
13-
then be processed using the
12+
that can be processed together efficiently. The prepared bulk request can then
13+
be processed using the
1414
[`processBulkRequest`](/references/dataProtector/methods/processBulkRequest)
1515
method.
1616

@@ -93,17 +93,7 @@ obtain bulk accesses. Each `GrantedAccess` must have been created with
9393
[`grantAccess`](/references/dataProtector/methods/grantAccess).
9494

9595
```ts twoslash
96-
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
97-
98-
const web3Provider = getWeb3Provider('PRIVATE_KEY');
99-
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);
100-
// ---cut---
101-
// First, get granted accesses with bulk capability
102-
const { grantedAccess } = await dataProtectorCore.getGrantedAccess({
103-
bulkOnly: true,
104-
});
105-
106-
// Then prepare the bulk request
96+
// @errors: 2304 7034 7005
10797
const { bulkRequest } = await dataProtectorCore.prepareBulkRequest({
10898
bulkAccesses: grantedAccess, // [!code focus]
10999
app: '0x456def...',
@@ -118,15 +108,7 @@ The ETH address or Ethereum Name Service (ENS) address for the iExec application
118108
that will process the protected data items in the bulk request.
119109

120110
```ts twoslash
121-
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
122-
123-
const web3Provider = getWeb3Provider('PRIVATE_KEY');
124-
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);
125-
// ---cut---
126-
const { grantedAccess } = await dataProtectorCore.getGrantedAccess({
127-
bulkOnly: true,
128-
});
129-
111+
// @errors: 2304 7034 7005
130112
const { bulkRequest } = await dataProtectorCore.prepareBulkRequest({
131113
bulkAccesses: grantedAccess,
132114
app: '0x456def...', // [!code focus]
@@ -143,15 +125,7 @@ Limits the number of protected data items processed per task. If you have more
143125
protected data items than this limit, multiple tasks will be created.
144126

145127
```ts twoslash
146-
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
147-
148-
const web3Provider = getWeb3Provider('PRIVATE_KEY');
149-
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);
150-
// ---cut---
151-
const { grantedAccess } = await dataProtectorCore.getGrantedAccess({
152-
bulkOnly: true,
153-
});
154-
128+
// @errors: 2304 7034 7005
155129
const { bulkRequest } = await dataProtectorCore.prepareBulkRequest({
156130
bulkAccesses: grantedAccess,
157131
app: '0x456def...',
@@ -177,15 +151,7 @@ confidential computations on the iExec platform.
177151
You can specify this during preparation or when processing the bulk request.
178152

179153
```ts twoslash
180-
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
181-
182-
const web3Provider = getWeb3Provider('PRIVATE_KEY');
183-
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);
184-
// ---cut---
185-
const { grantedAccess } = await dataProtectorCore.getGrantedAccess({
186-
bulkOnly: true,
187-
});
188-
154+
// @errors: 2304 7034 7005
189155
const { bulkRequest } = await dataProtectorCore.prepareBulkRequest({
190156
bulkAccesses: grantedAccess,
191157
app: '0x456def...',
@@ -204,15 +170,7 @@ using their infrastructure to run the application. You can specify this during
204170
preparation or when processing the bulk request.
205171

206172
```ts twoslash
207-
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
208-
209-
const web3Provider = getWeb3Provider('PRIVATE_KEY');
210-
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);
211-
// ---cut---
212-
const { grantedAccess } = await dataProtectorCore.getGrantedAccess({
213-
bulkOnly: true,
214-
});
215-
173+
// @errors: 2304 7034 7005
216174
const { bulkRequest } = await dataProtectorCore.prepareBulkRequest({
217175
bulkAccesses: grantedAccess,
218176
app: '0x456def...',
@@ -230,15 +188,7 @@ The maximum amount (in nRLC) you are willing to pay the application provider for
230188
using the application.
231189

232190
```ts twoslash
233-
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
234-
235-
const web3Provider = getWeb3Provider('PRIVATE_KEY');
236-
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);
237-
// ---cut---
238-
const { grantedAccess } = await dataProtectorCore.getGrantedAccess({
239-
bulkOnly: true,
240-
});
241-
191+
// @errors: 2304 7034 7005
242192
const { bulkRequest } = await dataProtectorCore.prepareBulkRequest({
243193
bulkAccesses: grantedAccess,
244194
app: '0x456def...',
@@ -254,15 +204,7 @@ Set of execution arguments for the application that will be used for all tasks
254204
in the bulk request.
255205

256206
```ts twoslash
257-
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
258-
259-
const web3Provider = getWeb3Provider('PRIVATE_KEY');
260-
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);
261-
// ---cut---
262-
const { grantedAccess } = await dataProtectorCore.getGrantedAccess({
263-
bulkOnly: true,
264-
});
265-
207+
// @errors: 2304 7034 7005
266208
const { bulkRequest } = await dataProtectorCore.prepareBulkRequest({
267209
bulkAccesses: grantedAccess,
268210
app: '0x456def...',
@@ -286,15 +228,7 @@ A set of URLs representing the input files required for application execution.
286228
These files will be used for all tasks in the bulk request.
287229

288230
```ts twoslash
289-
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
290-
291-
const web3Provider = getWeb3Provider('PRIVATE_KEY');
292-
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);
293-
// ---cut---
294-
const { grantedAccess } = await dataProtectorCore.getGrantedAccess({
295-
bulkOnly: true,
296-
});
297-
231+
// @errors: 2304 7034 7005
298232
const { bulkRequest } = await dataProtectorCore.prepareBulkRequest({
299233
bulkAccesses: grantedAccess,
300234
app: '0x456def...',
@@ -315,15 +249,7 @@ variables. For more details, see
315249
[Access requester secrets](/guides/build-iapp/advanced/access-confidential-assets).
316250

317251
```ts twoslash
318-
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
319-
320-
const web3Provider = getWeb3Provider('PRIVATE_KEY');
321-
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);
322-
// ---cut---
323-
const { grantedAccess } = await dataProtectorCore.getGrantedAccess({
324-
bulkOnly: true,
325-
});
326-
252+
// @errors: 2304 7034 7005
327253
const { bulkRequest } = await dataProtectorCore.prepareBulkRequest({
328254
bulkAccesses: grantedAccess,
329255
app: '0x456def...',
@@ -346,15 +272,7 @@ provide the `pemPrivateKey` when processing the bulk request to decrypt the
346272
results.
347273

348274
```ts twoslash
349-
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
350-
351-
const web3Provider = getWeb3Provider('PRIVATE_KEY');
352-
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);
353-
// ---cut---
354-
const { grantedAccess } = await dataProtectorCore.getGrantedAccess({
355-
bulkOnly: true,
356-
});
357-
275+
// @errors: 2304 7034 7005
358276
const { bulkRequest, pemPrivateKey } =
359277
await dataProtectorCore.prepareBulkRequest({
360278
bulkAccesses: grantedAccess,
@@ -372,15 +290,7 @@ Private key in PEM format for result encryption/decryption. If not provided and
372290
response.
373291

374292
```ts twoslash
375-
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
376-
377-
const web3Provider = getWeb3Provider('PRIVATE_KEY');
378-
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);
379-
// ---cut---
380-
const { grantedAccess } = await dataProtectorCore.getGrantedAccess({
381-
bulkOnly: true,
382-
});
383-
293+
// @errors: 2304 7034 7005
384294
const { bulkRequest, pemPrivateKey } =
385295
await dataProtectorCore.prepareBulkRequest({
386296
bulkAccesses: grantedAccess,
@@ -393,9 +303,11 @@ const { bulkRequest, pemPrivateKey } =
393303

394304
### onStatusUpdate <OptionalBadge />
395305

396-
**Type:** `OnStatusUpdateFn<ProcessBulkRequestStatuses>` Callback function to be
397-
notified at intermediate steps during bulk request preparation. You can expect
398-
this callback function to be called with the following titles:
306+
**Type:** `OnStatusUpdateFn<PrepareBulkRequestStatuses>`
307+
308+
Callback function to be notified at intermediate steps during bulk request
309+
preparation. You can expect this callback function to be called with the
310+
following titles:
399311

400312
- `'PUSH_REQUESTER_SECRET'` - Pushing requester secrets to the SMS
401313
- `'GENERATE_ENCRYPTION_KEY'` - Generating encryption key pair (if
@@ -408,15 +320,7 @@ this callback function to be called with the following titles:
408320
Each status is called once with `isDone: false`, and then with `isDone: true`.
409321

410322
```ts twoslash
411-
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
412-
413-
const web3Provider = getWeb3Provider('PRIVATE_KEY');
414-
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);
415-
// ---cut---
416-
const { grantedAccess } = await dataProtectorCore.getGrantedAccess({
417-
bulkOnly: true,
418-
});
419-
323+
// @errors: 2304 7034 7005 7031
420324
const { bulkRequest } = await dataProtectorCore.prepareBulkRequest({
421325
bulkAccesses: grantedAccess,
422326
app: '0x456def...',

0 commit comments

Comments
 (0)