Skip to content

Commit 6b505a1

Browse files
feat(sendEmail): add missing parameters to processProtectedData
- Add defaultWorkerpool parameter - Add workerpoolMaxPrice, dataMaxPrice, appMaxPrice parameters - Add useVoucher parameter - Add dataMaxPrice validation
1 parent 22d36cc commit 6b505a1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/web3mail/sendEmail.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ export const sendEmail = async ({
100100
const vAppMaxPrice = positiveNumberSchema()
101101
.label('appMaxPrice')
102102
.validateSync(appMaxPrice);
103+
const vDataMaxPrice = positiveNumberSchema()
104+
.label('dataMaxPrice')
105+
.validateSync(dataMaxPrice);
103106
const vWorkerpoolMaxPrice = positiveNumberSchema()
104107
.label('workerpoolMaxPrice')
105108
.validateSync(workerpoolMaxPrice);
@@ -194,13 +197,19 @@ export const sendEmail = async ({
194197
// Use processProtectedData from dataprotector
195198
// Note: Some parameters may need to be adjusted based on actual dataprotector SDK API
196199
const result = await dataProtector.processProtectedData({
200+
defaultWorkerpool: vWorkerpoolAddressOrEns,
197201
protectedData: vDatasetAddress,
198202
app: vDappAddressOrENS,
199203
// userWhitelist: vDappWhitelistAddress, // Removed due to bug in dataprotector v2.0.0-beta.20
200204
workerpool: vWorkerpoolAddressOrEns,
205+
workerpoolMaxPrice: vWorkerpoolMaxPrice,
206+
dataMaxPrice: vDataMaxPrice,
207+
appMaxPrice: vAppMaxPrice,
201208
args: vLabel,
202209
inputFiles: [],
203210
secrets,
211+
useVoucher: vUseVoucher,
212+
waitForResult: false,
204213
});
205214

206215
return {
@@ -216,8 +225,6 @@ export const sendEmail = async ({
216225
// handleIfProtocolError transforms ApiCallError into a WorkflowError with isProtocolError=true
217226
handleIfProtocolError(error);
218227

219-
// If we reach here, it's not a protocol error
220-
// Check if it's a WorkflowError from processProtectedData by checking the message
221228
const isProcessProtectedDataError =
222229
error instanceof Error &&
223230
error.message === 'Failed to process protected data';

0 commit comments

Comments
 (0)