Skip to content

Commit a5f1a65

Browse files
fix(docs): remove @errors annotations and fix TypeScript errors in code samples
1 parent 325cd1f commit a5f1a65

File tree

12 files changed

+10307
-4405
lines changed

12 files changed

+10307
-4405
lines changed

package-lock.json

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

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
"format": "prettier --ignore-path .gitignore --write ."
1212
},
1313
"dependencies": {
14-
"@iexec/dataprotector": "^2.0.0-beta.20",
14+
"@iexec/dataprotector": "^2.0.0-beta.21",
1515
"@iexec/dataprotector-deserializer": "^0.1.1",
16-
"@iexec/web3mail": "^1.6.0",
17-
"@iexec/web3telegram": "^0.1.0-alpha.4",
16+
"@iexec/web3mail": "^1.7.0",
17+
"@iexec/web3telegram": "^0.1.0-alpha.7",
1818
"@reown/appkit": "^1.7.17",
1919
"@reown/appkit-adapter-wagmi": "^1.7.17",
2020
"@tailwindcss/vite": "^4.1.11",
@@ -23,7 +23,7 @@
2323
"@wagmi/vue": "^0.1.24",
2424
"clsx": "^2.1.1",
2525
"figlet": "^1.8.2",
26-
"iexec": "^8.18.0",
26+
"iexec": "^8.22.0",
2727
"pinia": "^3.0.3",
2828
"reka-ui": "^2.4.1",
2929
"tailwind-merge": "^3.3.1",

src/guides/use-iapp/integrate-web3-messaging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const grantedAccess = await dataProtectorCore.grantAccess({
9191
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
9292
const web3Provider = getWeb3Provider('PRIVATE_KEY');
9393
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);
94-
94+
// ---cut---
9595
// For bulk campaigns, recipients must grant access with allowBulk: true
9696
const grantedAccess = await dataProtectorCore.grantAccess({
9797
protectedData: '0x123abc...',

src/references/dataProtector/methods/grantAccess.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ configured:
225225
accesses)
226226

227227
```ts twoslash
228+
import { IExecDataProtectorCore, getWeb3Provider } from '@iexec/dataprotector';
229+
230+
const web3Provider = getWeb3Provider('PRIVATE_KEY');
231+
const dataProtectorCore = new IExecDataProtectorCore(web3Provider);
232+
// ---cut---
228233
const grantedAccess = await dataProtectorCore.grantAccess({
229234
protectedData: '0x123abc...',
230235
authorizedApp: '0x456def...',

src/references/web3mail/methods/fetchMyContacts.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ the Data Protector SDK.
7575
:::
7676

7777
```ts twoslash
78+
import { IExecWeb3mail, getWeb3Provider } from '@iexec/web3mail';
79+
80+
const web3Provider = getWeb3Provider('PRIVATE_KEY');
81+
const web3mail = new IExecWeb3mail(web3Provider);
7882
// Fetch contacts with bulk access
7983
const bulkContacts = await web3mail.fetchMyContacts({
8084
bulkOnly: true, // [!code focus]

src/references/web3mail/methods/fetchUserContacts.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,14 @@ the Data Protector SDK.
9595
:::
9696

9797
```ts twoslash
98+
import { IExecWeb3mail, getWeb3Provider } from '@iexec/web3mail';
99+
100+
const web3Provider = getWeb3Provider('PRIVATE_KEY');
101+
const web3mail = new IExecWeb3mail(web3Provider);
102+
// ---cut---
98103
// Fetch contacts with bulk access for a specific user
99104
const bulkContacts = await web3mail.fetchUserContacts({
105+
userAddress: '0x789cba...',
100106
bulkOnly: true, // [!code focus]
101107
});
102108
```

src/references/web3mail/methods/prepareEmailCampaign.md

Lines changed: 96 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ This method is part of a two-step bulk campaign process:
3030
```ts twoslash [Browser]
3131
import { IExecWeb3mail } from '@iexec/web3mail';
3232

33-
const web3Provider = window.ethereum;
33+
const web3Provider = (window as any).ethereum;
3434
const web3mail = new IExecWeb3mail(web3Provider);
3535

3636
// Fetch contacts with bulk access
@@ -81,6 +81,14 @@ An array of `GrantedAccess` objects representing contacts who have granted you
8181
access to their protected data with bulk processing capability.
8282

8383
```ts twoslash
84+
import { IExecWeb3mail } from '@iexec/web3mail';
85+
86+
const web3Provider = (window as any).ethereum;
87+
const web3mail = new IExecWeb3mail(web3Provider);
88+
// Fetch contacts with bulk access
89+
const contacts = await web3mail.fetchMyContacts({ bulkOnly: true });
90+
const grantedAccessArray = contacts.map((contact) => contact.grantedAccess);
91+
8492
const emailCampaign = await web3mail.prepareEmailCampaign({
8593
grantedAccesses: grantedAccessArray, // [!code focus]
8694
emailSubject: 'My subject',
@@ -95,6 +103,14 @@ const emailCampaign = await web3mail.prepareEmailCampaign({
95103
The email subject that will be sent to all recipients.
96104

97105
```ts twoslash
106+
import { IExecWeb3mail } from '@iexec/web3mail';
107+
108+
const web3Provider = (window as any).ethereum;
109+
const web3mail = new IExecWeb3mail(web3Provider);
110+
// Fetch contacts with bulk access
111+
const contacts = await web3mail.fetchMyContacts({ bulkOnly: true });
112+
const grantedAccessArray = contacts.map((contact) => contact.grantedAccess);
113+
98114
const emailCampaign = await web3mail.prepareEmailCampaign({
99115
grantedAccesses: grantedAccessArray,
100116
emailSubject: 'My email subject', // [!code focus]
@@ -112,6 +128,14 @@ The email content that will be sent to all recipients. The content is encrypted
112128
and stored in IPFS.
113129

114130
```ts twoslash
131+
import { IExecWeb3mail } from '@iexec/web3mail';
132+
133+
const web3Provider = (window as any).ethereum;
134+
const web3mail = new IExecWeb3mail(web3Provider);
135+
// Fetch contacts with bulk access
136+
const contacts = await web3mail.fetchMyContacts({ bulkOnly: true });
137+
const grantedAccessArray = contacts.map((contact) => contact.grantedAccess);
138+
115139
const emailCampaign = await web3mail.prepareEmailCampaign({
116140
grantedAccesses: grantedAccessArray,
117141
emailSubject: 'My email subject',
@@ -128,6 +152,14 @@ const emailCampaign = await web3mail.prepareEmailCampaign({
128152
The MIME type of the email content (e.g., `'text/plain'`, `'text/html'`).
129153

130154
```ts twoslash
155+
import { IExecWeb3mail } from '@iexec/web3mail';
156+
157+
const web3Provider = (window as any).ethereum;
158+
const web3mail = new IExecWeb3mail(web3Provider);
159+
// Fetch contacts with bulk access
160+
const contacts = await web3mail.fetchMyContacts({ bulkOnly: true });
161+
const grantedAccessArray = contacts.map((contact) => contact.grantedAccess);
162+
131163
const emailCampaign = await web3mail.prepareEmailCampaign({
132164
grantedAccesses: grantedAccessArray,
133165
emailSubject: 'My email subject',
@@ -145,6 +177,14 @@ const emailCampaign = await web3mail.prepareEmailCampaign({
145177
Limits the number of protected data items processed per task.
146178

147179
```ts twoslash
180+
import { IExecWeb3mail } from '@iexec/web3mail';
181+
182+
const web3Provider = (window as any).ethereum;
183+
const web3mail = new IExecWeb3mail(web3Provider);
184+
// Fetch contacts with bulk access
185+
const contacts = await web3mail.fetchMyContacts({ bulkOnly: true });
186+
const grantedAccessArray = contacts.map((contact) => contact.grantedAccess);
187+
148188
const emailCampaign = await web3mail.prepareEmailCampaign({
149189
grantedAccesses: grantedAccessArray,
150190
emailSubject: 'My email subject',
@@ -163,6 +203,14 @@ The workerpool address or ENS name that will execute the bulk campaign tasks.
163203
You can specify this during preparation or when sending the campaign.
164204

165205
```ts twoslash
206+
import { IExecWeb3mail } from '@iexec/web3mail';
207+
208+
const web3Provider = (window as any).ethereum;
209+
const web3mail = new IExecWeb3mail(web3Provider);
210+
// Fetch contacts with bulk access
211+
const contacts = await web3mail.fetchMyContacts({ bulkOnly: true });
212+
const grantedAccessArray = contacts.map((contact) => contact.grantedAccess);
213+
166214
const emailCampaign = await web3mail.prepareEmailCampaign({
167215
grantedAccesses: grantedAccessArray,
168216
emailSubject: 'My email subject',
@@ -182,6 +230,14 @@ using their infrastructure to run the Web3Mail app. You can specify this during
182230
preparation or when sending the campaign.
183231

184232
```ts twoslash
233+
import { IExecWeb3mail } from '@iexec/web3mail';
234+
235+
const web3Provider = (window as any).ethereum;
236+
const web3mail = new IExecWeb3mail(web3Provider);
237+
// Fetch contacts with bulk access
238+
const contacts = await web3mail.fetchMyContacts({ bulkOnly: true });
239+
const grantedAccessArray = contacts.map((contact) => contact.grantedAccess);
240+
185241
const emailCampaign = await web3mail.prepareEmailCampaign({
186242
grantedAccesses: grantedAccessArray,
187243
emailSubject: 'My email subject',
@@ -197,6 +253,14 @@ const emailCampaign = await web3mail.prepareEmailCampaign({
197253
An optional label to identify or categorize the campaign.
198254

199255
```ts twoslash
256+
import { IExecWeb3mail } from '@iexec/web3mail';
257+
258+
const web3Provider = (window as any).ethereum;
259+
const web3mail = new IExecWeb3mail(web3Provider);
260+
// Fetch contacts with bulk access
261+
const contacts = await web3mail.fetchMyContacts({ bulkOnly: true });
262+
const grantedAccessArray = contacts.map((contact) => contact.grantedAccess);
263+
200264
const emailCampaign = await web3mail.prepareEmailCampaign({
201265
grantedAccesses: grantedAccessArray,
202266
emailSubject: 'My email subject',
@@ -215,6 +279,14 @@ The maximum amount (in nRLC) you are willing to pay for accessing the protected
215279
data.
216280

217281
```ts twoslash
282+
import { IExecWeb3mail } from '@iexec/web3mail';
283+
284+
const web3Provider = (window as any).ethereum;
285+
const web3mail = new IExecWeb3mail(web3Provider);
286+
// Fetch contacts with bulk access
287+
const contacts = await web3mail.fetchMyContacts({ bulkOnly: true });
288+
const grantedAccessArray = contacts.map((contact) => contact.grantedAccess);
289+
218290
const emailCampaign = await web3mail.prepareEmailCampaign({
219291
grantedAccesses: grantedAccessArray,
220292
emailSubject: 'My email subject',
@@ -233,6 +305,14 @@ The maximum amount (in nRLC) you are willing to pay the Web3Mail app provider
233305
for using the Web3Mail application.
234306

235307
```ts twoslash
308+
import { IExecWeb3mail } from '@iexec/web3mail';
309+
310+
const web3Provider = (window as any).ethereum;
311+
const web3mail = new IExecWeb3mail(web3Provider);
312+
// Fetch contacts with bulk access
313+
const contacts = await web3mail.fetchMyContacts({ bulkOnly: true });
314+
const grantedAccessArray = contacts.map((contact) => contact.grantedAccess);
315+
236316
const emailCampaign = await web3mail.prepareEmailCampaign({
237317
grantedAccesses: grantedAccessArray,
238318
emailSubject: 'My email subject',
@@ -255,7 +335,20 @@ The prepared bulk request object that contains all the necessary information to
255335
process the bulk campaign. This object should be passed to `sendEmailCampaign`
256336
to execute the campaign.
257337

258-
```ts
338+
```ts twoslash
339+
import { IExecWeb3mail } from '@iexec/web3mail';
340+
341+
const web3Provider = (window as any).ethereum;
342+
const web3mail = new IExecWeb3mail(web3Provider);
343+
// Fetch contacts and prepare campaign
344+
const contacts = await web3mail.fetchMyContacts({ bulkOnly: true });
345+
const grantedAccessArray = contacts.map((contact) => contact.grantedAccess);
346+
const emailCampaign = await web3mail.prepareEmailCampaign({
347+
grantedAccesses: grantedAccessArray,
348+
emailSubject: 'My email subject',
349+
emailContent: 'My email content',
350+
});
351+
259352
// Use the campaignRequest to send the campaign
260353
const result = await web3mail.sendEmailCampaign({
261354
campaignRequest: emailCampaign.campaignRequest, // [!code focus]
@@ -271,7 +364,7 @@ Here's a complete example showing the two-step campaign process:
271364
```ts twoslash [Browser]
272365
import { IExecWeb3mail } from '@iexec/web3mail';
273366

274-
const web3Provider = window.ethereum;
367+
const web3Provider = (window as any).ethereum;
275368
const web3mail = new IExecWeb3mail(web3Provider);
276369

277370
// Step 1: Fetch contacts with bulk access

src/references/web3mail/methods/sendEmailCampaign.md

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,13 @@ Before using this method, make sure you have:
3434
```ts twoslash [Browser]
3535
import { IExecWeb3mail } from '@iexec/web3mail';
3636

37-
const web3Provider = window.ethereum;
37+
const web3Provider = (window as any).ethereum;
3838
const web3mail = new IExecWeb3mail(web3Provider);
3939

40-
// Step 1: Prepare the campaign
40+
// Step 1: Fetch contacts and prepare the campaign
41+
const contacts = await web3mail.fetchMyContacts({ bulkOnly: true });
42+
const grantedAccessArray = contacts.map((contact) => contact.grantedAccess);
43+
4144
const emailCampaign = await web3mail.prepareEmailCampaign({
4245
grantedAccesses: grantedAccessArray,
4346
emailSubject: 'My email subject',
@@ -57,7 +60,10 @@ import { IExecWeb3mail, getWeb3Provider } from '@iexec/web3mail';
5760
const web3Provider = getWeb3Provider('PRIVATE_KEY');
5861
const web3mail = new IExecWeb3mail(web3Provider);
5962

60-
// Step 1: Prepare the campaign
63+
// Step 1: Fetch contacts and prepare the campaign
64+
const contacts = await web3mail.fetchMyContacts({ bulkOnly: true });
65+
const grantedAccessArray = contacts.map((contact) => contact.grantedAccess);
66+
6167
const emailCampaign = await web3mail.prepareEmailCampaign({
6268
grantedAccesses: grantedAccessArray,
6369
emailSubject: 'My email subject',
@@ -88,6 +94,19 @@ the necessary information to process the bulk campaign, including the grouped
8894
protected data and campaign metadata.
8995

9096
```ts twoslash
97+
import { IExecWeb3mail } from '@iexec/web3mail';
98+
99+
const web3Provider = (window as any).ethereum;
100+
const web3mail = new IExecWeb3mail(web3Provider);
101+
// Fetch contacts and prepare campaign
102+
const contacts = await web3mail.fetchMyContacts({ bulkOnly: true });
103+
const grantedAccessArray = contacts.map((contact) => contact.grantedAccess);
104+
const emailCampaign = await web3mail.prepareEmailCampaign({
105+
grantedAccesses: grantedAccessArray,
106+
emailSubject: 'My email subject',
107+
emailContent: 'My email content',
108+
});
109+
91110
const result = await web3mail.sendEmailCampaign({
92111
campaignRequest: emailCampaign.campaignRequest, // [!code focus]
93112
});
@@ -102,6 +121,19 @@ const result = await web3mail.sendEmailCampaign({
102121
The workerpool address or ENS name that will execute the bulk campaign tasks.
103122

104123
```ts twoslash
124+
import { IExecWeb3mail } from '@iexec/web3mail';
125+
126+
const web3Provider = (window as any).ethereum;
127+
const web3mail = new IExecWeb3mail(web3Provider);
128+
// Fetch contacts and prepare campaign
129+
const contacts = await web3mail.fetchMyContacts({ bulkOnly: true });
130+
const grantedAccessArray = contacts.map((contact) => contact.grantedAccess);
131+
const emailCampaign = await web3mail.prepareEmailCampaign({
132+
grantedAccesses: grantedAccessArray,
133+
emailSubject: 'My email subject',
134+
emailContent: 'My email content',
135+
});
136+
105137
const result = await web3mail.sendEmailCampaign({
106138
campaignRequest: emailCampaign.campaignRequest,
107139
workerpoolAddressOrEns: '0xa5de76...', // [!code focus]
@@ -129,12 +161,25 @@ Each task may process multiple protected data items depending on the bulk
129161
request configuration.
130162

131163
```ts twoslash
164+
import { IExecWeb3mail } from '@iexec/web3mail';
165+
166+
const web3Provider = (window as any).ethereum;
167+
const web3mail = new IExecWeb3mail(web3Provider);
168+
// Fetch contacts and prepare campaign
169+
const contacts = await web3mail.fetchMyContacts({ bulkOnly: true });
170+
const grantedAccessArray = contacts.map((contact) => contact.grantedAccess);
171+
const emailCampaign = await web3mail.prepareEmailCampaign({
172+
grantedAccesses: grantedAccessArray,
173+
emailSubject: 'My email subject',
174+
emailContent: 'My email content',
175+
});
176+
132177
const result = await web3mail.sendEmailCampaign({
133178
campaignRequest: emailCampaign.campaignRequest,
134179
});
135180

136181
console.log(`Created ${result.tasks.length} tasks`);
137-
result.tasks.forEach((task, index) => {
182+
result.tasks.forEach((task: { taskId: string; dealId: string; bulkIndex: number }, index: number) => {
138183
console.log(
139184
`Task ${index + 1}: ${task.taskId} (Deal: ${task.dealId}, Bulk Index: ${task.bulkIndex})`
140185
);
@@ -149,10 +194,9 @@ sending the campaign:
149194
::: code-group
150195

151196
```ts twoslash [Browser]
152-
// ---cut---
153197
import { IExecWeb3mail } from '@iexec/web3mail';
154198

155-
const web3Provider = window.ethereum;
199+
const web3Provider = (window as any).ethereum;
156200
const web3mail = new IExecWeb3mail(web3Provider);
157201

158202
// Step 1: Fetch contacts with bulk access capability
@@ -196,7 +240,7 @@ if (contacts.length === 0) {
196240
console.log('No contacts with bulk access found.');
197241
// Recipients need to grant access with bulk processing enabled
198242
// See: grantAccess method in Data Protector SDK
199-
return;
243+
// Note: In a real application, you would handle this case appropriately
200244
}
201245

202246
// Step 2: Extract grantedAccess from contacts

src/references/web3telegram/methods/fetchMyContacts.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ and
6969
for bulk campaigns.
7070

7171
```ts twoslash
72+
import { IExecWeb3telegram, getWeb3Provider } from '@iexec/web3telegram';
73+
74+
const web3Provider = getWeb3Provider('PRIVATE_KEY');
75+
const web3telegram = new IExecWeb3telegram(web3Provider);
76+
// ---cut---
7277
const contactsList = await web3telegram.fetchMyContacts({
7378
bulkOnly: true, // [!code focus]
7479
});

0 commit comments

Comments
 (0)