Skip to content

Commit b0cf30e

Browse files
Merge pull request #186 from iExecBlockchainComputing/Release/dapp-v0.9.0
Release/dapp v0.9.0
2 parents d710227 + afa3a0b commit b0cf30e

16 files changed

+3645
-10661
lines changed

.drone.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ steps:
560560
- npm run check-format
561561

562562
- name: lint
563-
image: node:18.19
563+
image: node:14-alpine3.11
564564
commands:
565565
- cd dapp
566566
- npm run lint
@@ -576,6 +576,8 @@ steps:
576576
from_secret: mj_sender
577577
MAILGUN_APIKEY:
578578
from_secret: mailgun_apikey
579+
WEB3MAIL_WHITELISTED_APPS:
580+
from_secret: web3mail_whitelisted_apps
579581
commands:
580582
- cd dapp
581583
- npm run ctest
@@ -644,6 +646,8 @@ steps:
644646
from_secret: mj_sender
645647
MAILGUN_APIKEY:
646648
from_secret: mailgun_apikey
649+
WEB3MAIL_WHITELISTED_APPS:
650+
from_secret: web3mail_whitelisted_apps
647651
commands:
648652
- cd dapp
649653
- npm run ctest
@@ -714,6 +718,8 @@ steps:
714718
from_secret: mj_sender
715719
MAILGUN_APIKEY:
716720
from_secret: mailgun_apikey
721+
WEB3MAIL_WHITELISTED_APPS:
722+
from_secret: web3mail_whitelisted_apps
717723
commands:
718724
- cd dapp
719725
- npm run ctest
@@ -800,7 +806,7 @@ steps:
800806

801807
- name: get scone fingerprint (prod)
802808
# /!\: maintain the version here
803-
image: iexechub/web3mail-dapp:0.8.0-sconify-5.7.5-v12-production
809+
image: iexechub/web3mail-dapp:0.9.0-sconify-5.7.5-v12-production
804810
commands:
805811
- SCONE_HASH=1 node > deployment-dapp/.scone-fingerprint
806812
when:

dapp/.eslintrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
"env": {
1212
"jest": true
1313
},
14+
"settings": {
15+
"import/resolver": {
16+
"node": {
17+
"extensions": [".js", ".json"]
18+
}
19+
}
20+
},
1421
"overrides": [
1522
{
1623
"files": ["./tests/**/*.js"],

dapp/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.9.0]
6+
7+
### Added
8+
9+
- Implemented a resultsCallback mechanism to persist email verification results on-chain.
10+
- Encoded email verification status (true or false) as 32-byte ABI-compliant binary data in the callback.
11+
- Wrote conditional callback-data to computed.json only when explicitly enabled by the requester.
12+
13+
### Changed
14+
15+
- Made the dApp backward-compatible with previous SDK versions by skipping callback-data when useCallback is not provided.
16+
- Improved email verification logic to reuse prior verification from the PoCo subgraph when available, reducing redundant Mailgun calls.
17+
518
## [0.8.0]
619

720
### Changed

dapp/package-lock.json

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

dapp/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dapp",
3-
"version": "0.8.0",
3+
"version": "0.9.0",
44
"description": "",
55
"main": "index.js",
66
"engines": {
@@ -21,6 +21,8 @@
2121
"license": "ISC",
2222
"dependencies": {
2323
"@iexec/dataprotector-deserializer": "^0.1.0",
24+
"graphql": "^16.11.0",
25+
"graphql-request": "^3.7.0",
2426
"joi": "^17.9.2",
2527
"jszip": "^3.10.1",
2628
"node-fetch": "^2.7.0",
@@ -38,4 +40,4 @@
3840
"jest": "^29.7.0",
3941
"prettier": "^2.8.8"
4042
}
41-
}
43+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
const { request, gql } = require('graphql-request');
2+
3+
async function checkEmailPreviousValidation({ datasetAddress, dappAddresses }) {
4+
const pocoSubgraphUrl =
5+
'https://thegraph.bellecour.iex.ec/subgraphs/name/bellecour/poco-v5';
6+
7+
const query = gql`
8+
query checkSuccessfulTaskQuery($apps: [String!], $dataset: String!) {
9+
tasks(
10+
where: {
11+
resultsCallback_not: "0x"
12+
status: "COMPLETED"
13+
deal_: { dataset: $dataset, app_in: $apps }
14+
}
15+
) {
16+
resultsCallback
17+
}
18+
}
19+
`;
20+
21+
const variables = {
22+
apps: dappAddresses,
23+
dataset: datasetAddress.toLowerCase(),
24+
};
25+
26+
try {
27+
const data = await request(pocoSubgraphUrl, query, variables);
28+
const tasks = data?.tasks || [];
29+
30+
return tasks.some((task) => {
31+
const callback = task.resultsCallback?.toLowerCase();
32+
return (
33+
callback &&
34+
callback.startsWith('0x') &&
35+
callback.endsWith(
36+
'0000000000000000000000000000000000000000000000000000000000000001'
37+
)
38+
);
39+
});
40+
} catch (error) {
41+
console.error(
42+
'GraphQL error:',
43+
error.response?.errors || error.message || error
44+
);
45+
return false;
46+
}
47+
}
48+
49+
module.exports = {
50+
checkEmailPreviousValidation,
51+
};

0 commit comments

Comments
 (0)