@@ -30,7 +30,7 @@ This method is part of a two-step bulk campaign process:
3030``` ts twoslash [Browser]
3131import { IExecWeb3mail } from ' @iexec/web3mail' ;
3232
33- const web3Provider = window .ethereum ;
33+ const web3Provider = ( window as any ) .ethereum ;
3434const 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
8181access 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+
8492const emailCampaign = await web3mail .prepareEmailCampaign ({
8593 grantedAccesses: grantedAccessArray , // [!code focus]
8694 emailSubject: ' My subject' ,
@@ -95,6 +103,14 @@ const emailCampaign = await web3mail.prepareEmailCampaign({
95103The 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+
98114const 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
112128and 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+
115139const emailCampaign = await web3mail .prepareEmailCampaign ({
116140 grantedAccesses: grantedAccessArray ,
117141 emailSubject: ' My email subject' ,
@@ -128,6 +152,14 @@ const emailCampaign = await web3mail.prepareEmailCampaign({
128152The 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+
131163const emailCampaign = await web3mail .prepareEmailCampaign ({
132164 grantedAccesses: grantedAccessArray ,
133165 emailSubject: ' My email subject' ,
@@ -145,6 +177,14 @@ const emailCampaign = await web3mail.prepareEmailCampaign({
145177Limits 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+
148188const 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.
163203You 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+
166214const 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
182230preparation 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+
185241const emailCampaign = await web3mail .prepareEmailCampaign ({
186242 grantedAccesses: grantedAccessArray ,
187243 emailSubject: ' My email subject' ,
@@ -197,6 +253,14 @@ const emailCampaign = await web3mail.prepareEmailCampaign({
197253An 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+
200264const 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
215279data.
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+
218290const 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
233305for 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+
236316const 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
255335process the bulk campaign. This object should be passed to ` sendEmailCampaign `
256336to 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
260353const 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]
272365import { IExecWeb3mail } from ' @iexec/web3mail' ;
273366
274- const web3Provider = window .ethereum ;
367+ const web3Provider = ( window as any ) .ethereum ;
275368const web3mail = new IExecWeb3mail (web3Provider );
276369
277370// Step 1: Fetch contacts with bulk access
0 commit comments