From 2bdbe20895629480d9d2c1c08d8820ba7aeb349a Mon Sep 17 00:00:00 2001 From: ritik Date: Thu, 20 Jun 2024 15:11:13 +0530 Subject: [PATCH 01/20] Feat: Added LinkedIn Analytics implementation --- CRIP/CRIP-Linkedin.MD | 60 +++++++++++++++++++++++++++++++++ index.js | 2 ++ src/services/linkedinService.js | 24 +++++++++++++ src/services/reclaimService.js | 8 ++++- src/utils/constants.js | 8 +++++ 5 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 CRIP/CRIP-Linkedin.MD create mode 100644 src/services/linkedinService.js diff --git a/CRIP/CRIP-Linkedin.MD b/CRIP/CRIP-Linkedin.MD new file mode 100644 index 0000000..a568903 --- /dev/null +++ b/CRIP/CRIP-Linkedin.MD @@ -0,0 +1,60 @@ +| proposal | title | description | author | discussions-to | status | type | category | created | requires | +|----------|---------------------|---------------------------------|---------------------------------|----------------|--------|-------------|----------|------------|----------| +| CRIP-LinkedIn | LinkedIn Integration | Integration with LinkedIn API to validate user connections and activities | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-20 | | + +## Title + +LinkedIn Integration + +## Introduction + +This proposal outlines the integration of LinkedIn as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process user activity data from LinkedIn, such as connections, post impressions, profile views, and search appearances, to be used within the Catoff platform. This will enable users to validate their LinkedIn activities and use them for various challenges and verifications on Catoff. + +## External APIs Needed + +- LinkedIn API: No External api used + +## Use Cases + +1. **User Verification**: Verify the activity of users on LinkedIn by checking their connection count and other activities. +2. **Challenge Participation**: Allow users to participate in challenges that require proof of LinkedIn activity. +3. **Professional Assessment**: Assess users' professional network and engagement based on their LinkedIn activity. + +## Data Provider + +- **Name**: LinkedIn User Verification +- **Hash Value**: 0xe629105430c1a507cfe5c1f979d55103d967ca84ece2cbf1f233e5b5b22275da + +## Code Snippet + +Below is a code snippet that demonstrates the key parts of the LinkedIn integration. The full implementation should follow the service file template. + +**`services/linkedinService.js`** + +```javascript +const axios = require('axios'); +const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); + +exports.processLinkedInData = async (proof, providerName) => { + const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; + const postImpressions = extractedParameters.Post_Impressions; + const profileViews = extractedParameters.Profile_Views; + const searchAppearances = extractedParameters.Search_Appearances; + const followers = extractedParameters.Followers.replace(/,/g, ''); + const username = proof[0].claimData.owner; + + console.log(`Post Impressions for user ${username}: ${postImpressions}`); + console.log(`Profile Views for user ${username}: ${profileViews}`); + console.log(`Search Appearances for user ${username}: ${searchAppearances}`); + console.log(`Followers for user ${username}: ${followers}`); + + const lastUpdateTimeStamp = proof[0].claimData.timestampS; + + return new ReclaimServiceResponse( + providerName, + lastUpdateTimeStamp, + username, + parseInt(followers, 10), + proof[0] + ); +}; diff --git a/index.js b/index.js index df7fba0..bfbe55b 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,8 @@ const express = require('express') const bodyParser = require('body-parser') const reclaimController = require('./src/controllers/reclaimController') +require('dotenv').config(); + const app = express() app.use(bodyParser.json()) diff --git a/src/services/linkedinService.js b/src/services/linkedinService.js new file mode 100644 index 0000000..78dfee2 --- /dev/null +++ b/src/services/linkedinService.js @@ -0,0 +1,24 @@ +const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); + +exports.processLinkedInData = async (proof, providerName) => { + + const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; + const postImpressions = extractedParameters.Post_Impressions; + const profileViews = extractedParameters.Profile_Views; + const searchAppearances = extractedParameters.Search_Appearances; + const username = proof[0].claimData.owner; + + console.log(`Post Impressions for user ${username} : ${postImpressions}`); + console.log(`Profile Views for user ${username} : ${profileViews}`); + console.log(`Search Appearances for user ${username} : ${searchAppearances}`); + + const lastUpdateTimeStamp = proof[0].claimData.timestampS; + + return new ReclaimServiceResponse( + providerName, + lastUpdateTimeStamp, + username, + profileViews, + proof[0] + ); +}; diff --git a/src/services/reclaimService.js b/src/services/reclaimService.js index b33006f..f096627 100644 --- a/src/services/reclaimService.js +++ b/src/services/reclaimService.js @@ -3,6 +3,7 @@ const { Reclaim } = require('@reclaimprotocol/js-sdk') const { RECLAIM_PROVIDER_ID, RECLAIM_APP_ID } = require('../utils/constants') const { processTwitterData } = require('./twitterService') const { processGitHubData } = require('./githubService') +const { processLinkedInData } = require('./linkedinService') exports.signWithProviderID = async (userId, providerId) => { const providerName = RECLAIM_PROVIDER_ID[providerId] @@ -34,6 +35,7 @@ exports.signWithProviderID = async (userId, providerId) => { } const handleReclaimSession = async (userId, reclaimClient, providerName) => { + console.log('Starting session') await reclaimClient.startSession({ onSuccessCallback: async proof => { console.log( @@ -49,6 +51,9 @@ const handleReclaimSession = async (userId, reclaimClient, providerName) => { case 'GITHUB_ACCOUNT_VERIFICATION': processedData = await processGitHubData(proof, providerName) break + case 'LINKEDIN_ACCOUNT_VERIFICATION': + processedData = await processLinkedInData(proof, providerName); + break default: throw new Error(`No handler for provider: ${providerName}`) } @@ -65,4 +70,5 @@ const handleReclaimSession = async (userId, reclaimClient, providerName) => { console.error(`Verification failed for userId: ${userId}`, error) }, }) -} + console.log('Ended session') +} \ No newline at end of file diff --git a/src/utils/constants.js b/src/utils/constants.js index 1c58669..191fc28 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -1,9 +1,17 @@ exports.RECLAIM_PROVIDER_ID = { twitter: 'TWITTER_ANALYTICS_VIEWS', github: 'GITHUB_ACCOUNT_VERIFICATION', + linkedin: 'LINKEDIN_ACCOUNT_VERIFICATION' } exports.RECLAIM_APP_ID = { TWITTER_ANALYTICS_VIEWS: 'your-twitter-app-id', GITHUB_ACCOUNT_VERIFICATION: 'your-github-app-id', + LINKEDIN_ACCOUNT_VERIFICATION: 'your-linkedin-app-id' } + +exports.PROVIDER_ID = { + twitter: 'twitter-provider-id', + github: 'github-provider-id', + linkedin: 'linkedin-provider-id' +} \ No newline at end of file From 3444924c6b471de95fd64343bd5d42df350872c5 Mon Sep 17 00:00:00 2001 From: ritik Date: Fri, 21 Jun 2024 20:36:22 +0530 Subject: [PATCH 02/20] Feat: Linkedin Post Impressions --- ...CRIP-Linkedin.MD => CRIP-LinkedinPostImp.MD} | 17 ++++++----------- src/services/linkedinService.js | 11 ++++------- 2 files changed, 10 insertions(+), 18 deletions(-) rename CRIP/{CRIP-Linkedin.MD => CRIP-LinkedinPostImp.MD} (63%) diff --git a/CRIP/CRIP-Linkedin.MD b/CRIP/CRIP-LinkedinPostImp.MD similarity index 63% rename from CRIP/CRIP-Linkedin.MD rename to CRIP/CRIP-LinkedinPostImp.MD index a568903..4be234a 100644 --- a/CRIP/CRIP-Linkedin.MD +++ b/CRIP/CRIP-LinkedinPostImp.MD @@ -1,14 +1,14 @@ | proposal | title | description | author | discussions-to | status | type | category | created | requires | |----------|---------------------|---------------------------------|---------------------------------|----------------|--------|-------------|----------|------------|----------| -| CRIP-LinkedIn | LinkedIn Integration | Integration with LinkedIn API to validate user connections and activities | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-20 | | +| CRIP-LinkedIn | LinkedIn Post Impressions Integration | Integration with LinkedIn API to validate impressions on Posts of user | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-20 | | ## Title -LinkedIn Integration +LinkedIn Post Impressions Integration ## Introduction -This proposal outlines the integration of LinkedIn as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process user activity data from LinkedIn, such as connections, post impressions, profile views, and search appearances, to be used within the Catoff platform. This will enable users to validate their LinkedIn activities and use them for various challenges and verifications on Catoff. +This proposal outlines the integration of LinkedIn as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process total impressions on the linkedin posts of a specific user. This will enable users to validate their LinkedIn activities and use them for various challenges and verifications on Catoff. ## External APIs Needed @@ -16,7 +16,7 @@ This proposal outlines the integration of LinkedIn as a data provider for the Ca ## Use Cases -1. **User Verification**: Verify the activity of users on LinkedIn by checking their connection count and other activities. +1. **User Verification**: Verify the activity of users on LinkedIn by checking their post impressions and other activities. 2. **Challenge Participation**: Allow users to participate in challenges that require proof of LinkedIn activity. 3. **Professional Assessment**: Assess users' professional network and engagement based on their LinkedIn activity. @@ -38,15 +38,10 @@ const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); exports.processLinkedInData = async (proof, providerName) => { const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; const postImpressions = extractedParameters.Post_Impressions; - const profileViews = extractedParameters.Profile_Views; - const searchAppearances = extractedParameters.Search_Appearances; - const followers = extractedParameters.Followers.replace(/,/g, ''); + const username = proof[0].claimData.owner; console.log(`Post Impressions for user ${username}: ${postImpressions}`); - console.log(`Profile Views for user ${username}: ${profileViews}`); - console.log(`Search Appearances for user ${username}: ${searchAppearances}`); - console.log(`Followers for user ${username}: ${followers}`); const lastUpdateTimeStamp = proof[0].claimData.timestampS; @@ -54,7 +49,7 @@ exports.processLinkedInData = async (proof, providerName) => { providerName, lastUpdateTimeStamp, username, - parseInt(followers, 10), + parseInt(postImpressions, 10), proof[0] ); }; diff --git a/src/services/linkedinService.js b/src/services/linkedinService.js index 78dfee2..f024d85 100644 --- a/src/services/linkedinService.js +++ b/src/services/linkedinService.js @@ -1,16 +1,13 @@ +const axios = require('axios'); const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); exports.processLinkedInData = async (proof, providerName) => { - const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; const postImpressions = extractedParameters.Post_Impressions; - const profileViews = extractedParameters.Profile_Views; - const searchAppearances = extractedParameters.Search_Appearances; + const username = proof[0].claimData.owner; - console.log(`Post Impressions for user ${username} : ${postImpressions}`); - console.log(`Profile Views for user ${username} : ${profileViews}`); - console.log(`Search Appearances for user ${username} : ${searchAppearances}`); + console.log(`Post Impressions for user ${username}: ${postImpressions}`); const lastUpdateTimeStamp = proof[0].claimData.timestampS; @@ -18,7 +15,7 @@ exports.processLinkedInData = async (proof, providerName) => { providerName, lastUpdateTimeStamp, username, - profileViews, + parseInt(postImpressions, 10), proof[0] ); }; From 8c336040aa5b78f8b183f8725c8f30a75adfa522 Mon Sep 17 00:00:00 2001 From: ritik Date: Fri, 21 Jun 2024 20:54:28 +0530 Subject: [PATCH 03/20] Feat: Added Linkedin Profile views --- CRIP/CRIP-LinkedinProfileViews.MD | 56 +++++++++++++++++++++++++++++++ src/services/linkedinService.js | 6 ++-- 2 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 CRIP/CRIP-LinkedinProfileViews.MD diff --git a/CRIP/CRIP-LinkedinProfileViews.MD b/CRIP/CRIP-LinkedinProfileViews.MD new file mode 100644 index 0000000..f9b8d15 --- /dev/null +++ b/CRIP/CRIP-LinkedinProfileViews.MD @@ -0,0 +1,56 @@ +| proposal | title | description | author | discussions-to | status | type | category | created | requires | +|----------|---------------------|---------------------------------|---------------------------------|----------------|--------|-------------|----------|------------|----------| +| CRIP-LinkedIn | LinkedIn Profile Views Integration | Integration with LinkedIn API to validate total profile views on the account of user | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-20 | | + +## Title + +LinkedIn Profile Views Integration + +## Introduction + +This proposal outlines the integration of LinkedIn as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process total profile views on the linkedin account of a user. This will enable users to validate their LinkedIn activities and use them for various challenges and verifications on Catoff. + +## External APIs Needed + +- LinkedIn API: No External api used + +## Use Cases + +1. **User Verification**: Verify the activity of users on LinkedIn by checking the views on their profile. +2. **Challenge Participation**: Allow users to participate in challenges that require proof of LinkedIn activity. +3. **Professional Assessment**: Assess users' professional network and engagement based on their LinkedIn activity. + +## Data Provider + +- **Name**: LinkedIn User Verification +- **Hash Value**: 0xe629105430c1a507cfe5c1f979d55103d967ca84ece2cbf1f233e5b5b22275da + +## Code Snippet + +Below is a code snippet that demonstrates the key parts of the LinkedIn integration. The full implementation should follow the service file template. + +**`services/linkedinService.js`** + +```javascript +const axios = require('axios'); +const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); + +exports.processLinkedInData = async (proof, providerName) => { + const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; + const profileViews = extractedParameters.Profile_Views; + + const username = proof[0].claimData.owner; + + console.log(`Profile Views for user ${username}: ${profileViews}`); + + const lastUpdateTimeStamp = proof[0].claimData.timestampS; + + return new ReclaimServiceResponse( + providerName, + lastUpdateTimeStamp, + username, + parseInt(profileViews, 10), + proof[0] + ); +}; + diff --git a/src/services/linkedinService.js b/src/services/linkedinService.js index f024d85..9971dcf 100644 --- a/src/services/linkedinService.js +++ b/src/services/linkedinService.js @@ -3,11 +3,11 @@ const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); exports.processLinkedInData = async (proof, providerName) => { const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; - const postImpressions = extractedParameters.Post_Impressions; + const profileViews = extractedParameters.Profile_Views; const username = proof[0].claimData.owner; - console.log(`Post Impressions for user ${username}: ${postImpressions}`); + console.log(`Profile Views for user ${username}: ${profileViews}`); const lastUpdateTimeStamp = proof[0].claimData.timestampS; @@ -15,7 +15,7 @@ exports.processLinkedInData = async (proof, providerName) => { providerName, lastUpdateTimeStamp, username, - parseInt(postImpressions, 10), + parseInt(profileViews, 10), proof[0] ); }; From c2771a4d10fed5645fb78a079525b54ba7b03e65 Mon Sep 17 00:00:00 2001 From: ritik Date: Fri, 21 Jun 2024 20:54:40 +0530 Subject: [PATCH 04/20] =?UTF-8?q?=F0=9F=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CRIP/CRIP-LinkedinPostImp.MD | 55 ------------------------------------ 1 file changed, 55 deletions(-) delete mode 100644 CRIP/CRIP-LinkedinPostImp.MD diff --git a/CRIP/CRIP-LinkedinPostImp.MD b/CRIP/CRIP-LinkedinPostImp.MD deleted file mode 100644 index 4be234a..0000000 --- a/CRIP/CRIP-LinkedinPostImp.MD +++ /dev/null @@ -1,55 +0,0 @@ -| proposal | title | description | author | discussions-to | status | type | category | created | requires | -|----------|---------------------|---------------------------------|---------------------------------|----------------|--------|-------------|----------|------------|----------| -| CRIP-LinkedIn | LinkedIn Post Impressions Integration | Integration with LinkedIn API to validate impressions on Posts of user | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-20 | | - -## Title - -LinkedIn Post Impressions Integration - -## Introduction - -This proposal outlines the integration of LinkedIn as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process total impressions on the linkedin posts of a specific user. This will enable users to validate their LinkedIn activities and use them for various challenges and verifications on Catoff. - -## External APIs Needed - -- LinkedIn API: No External api used - -## Use Cases - -1. **User Verification**: Verify the activity of users on LinkedIn by checking their post impressions and other activities. -2. **Challenge Participation**: Allow users to participate in challenges that require proof of LinkedIn activity. -3. **Professional Assessment**: Assess users' professional network and engagement based on their LinkedIn activity. - -## Data Provider - -- **Name**: LinkedIn User Verification -- **Hash Value**: 0xe629105430c1a507cfe5c1f979d55103d967ca84ece2cbf1f233e5b5b22275da - -## Code Snippet - -Below is a code snippet that demonstrates the key parts of the LinkedIn integration. The full implementation should follow the service file template. - -**`services/linkedinService.js`** - -```javascript -const axios = require('axios'); -const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); - -exports.processLinkedInData = async (proof, providerName) => { - const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; - const postImpressions = extractedParameters.Post_Impressions; - - const username = proof[0].claimData.owner; - - console.log(`Post Impressions for user ${username}: ${postImpressions}`); - - const lastUpdateTimeStamp = proof[0].claimData.timestampS; - - return new ReclaimServiceResponse( - providerName, - lastUpdateTimeStamp, - username, - parseInt(postImpressions, 10), - proof[0] - ); -}; From 8cbb36aaccb1e88e2352dd3dbdc0fff22e61ba41 Mon Sep 17 00:00:00 2001 From: ritik Date: Fri, 21 Jun 2024 21:04:04 +0530 Subject: [PATCH 05/20] Feat: Added Linkedin Followers Int --- ...nProfileViews.MD => CRIP-LinkedinFollowers.MD} | 15 +++++++-------- src/services/linkedinService.js | 6 +++--- 2 files changed, 10 insertions(+), 11 deletions(-) rename CRIP/{CRIP-LinkedinProfileViews.MD => CRIP-LinkedinFollowers.MD} (70%) diff --git a/CRIP/CRIP-LinkedinProfileViews.MD b/CRIP/CRIP-LinkedinFollowers.MD similarity index 70% rename from CRIP/CRIP-LinkedinProfileViews.MD rename to CRIP/CRIP-LinkedinFollowers.MD index f9b8d15..3351bb7 100644 --- a/CRIP/CRIP-LinkedinProfileViews.MD +++ b/CRIP/CRIP-LinkedinFollowers.MD @@ -1,14 +1,14 @@ | proposal | title | description | author | discussions-to | status | type | category | created | requires | |----------|---------------------|---------------------------------|---------------------------------|----------------|--------|-------------|----------|------------|----------| -| CRIP-LinkedIn | LinkedIn Profile Views Integration | Integration with LinkedIn API to validate total profile views on the account of user | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-20 | | +| CRIP-LinkedIn | LinkedIn Follower Count Integration | Integration with LinkedIn API to validate total followers on the account of user | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-20 | | ## Title -LinkedIn Profile Views Integration +LinkedIn Follower Count Integration ## Introduction -This proposal outlines the integration of LinkedIn as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process total profile views on the linkedin account of a user. This will enable users to validate their LinkedIn activities and use them for various challenges and verifications on Catoff. +This proposal outlines the integration of LinkedIn as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process total followers on the linkedin account of a user. This will enable users to validate their LinkedIn activities and use them for various challenges and verifications on Catoff. ## External APIs Needed @@ -16,7 +16,7 @@ This proposal outlines the integration of LinkedIn as a data provider for the Ca ## Use Cases -1. **User Verification**: Verify the activity of users on LinkedIn by checking the views on their profile. +1. **User Verification**: Verify the activity of users on LinkedIn by checking the number of followers on their profile. 2. **Challenge Participation**: Allow users to participate in challenges that require proof of LinkedIn activity. 3. **Professional Assessment**: Assess users' professional network and engagement based on their LinkedIn activity. @@ -37,11 +37,11 @@ const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); exports.processLinkedInData = async (proof, providerName) => { const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; - const profileViews = extractedParameters.Profile_Views; + const followers = extractedParameters.Followers.replace(/,/g, ''); const username = proof[0].claimData.owner; - console.log(`Profile Views for user ${username}: ${profileViews}`); + console.log(`Followers for user ${username}: ${followers}`); const lastUpdateTimeStamp = proof[0].claimData.timestampS; @@ -49,8 +49,7 @@ exports.processLinkedInData = async (proof, providerName) => { providerName, lastUpdateTimeStamp, username, - parseInt(profileViews, 10), + parseInt(followers, 10), proof[0] ); }; - diff --git a/src/services/linkedinService.js b/src/services/linkedinService.js index 9971dcf..c064b40 100644 --- a/src/services/linkedinService.js +++ b/src/services/linkedinService.js @@ -3,11 +3,11 @@ const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); exports.processLinkedInData = async (proof, providerName) => { const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; - const profileViews = extractedParameters.Profile_Views; + const followers = extractedParameters.Followers.replace(/,/g, ''); const username = proof[0].claimData.owner; - console.log(`Profile Views for user ${username}: ${profileViews}`); + console.log(`Followers for user ${username}: ${followers}`); const lastUpdateTimeStamp = proof[0].claimData.timestampS; @@ -15,7 +15,7 @@ exports.processLinkedInData = async (proof, providerName) => { providerName, lastUpdateTimeStamp, username, - parseInt(profileViews, 10), + parseInt(followers, 10), proof[0] ); }; From 1f6578d2347ff3ca673ee0bb7796f80ea2a6b1f7 Mon Sep 17 00:00:00 2001 From: ritik Date: Fri, 21 Jun 2024 21:11:07 +0530 Subject: [PATCH 06/20] Feat: Added linkedin search appearances --- ...wers.MD => CRIP-LinkedinSearchAppearances.MD} | 16 ++++++++-------- src/services/linkedinService.js | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) rename CRIP/{CRIP-LinkedinFollowers.MD => CRIP-LinkedinSearchAppearances.MD} (67%) diff --git a/CRIP/CRIP-LinkedinFollowers.MD b/CRIP/CRIP-LinkedinSearchAppearances.MD similarity index 67% rename from CRIP/CRIP-LinkedinFollowers.MD rename to CRIP/CRIP-LinkedinSearchAppearances.MD index 3351bb7..4041367 100644 --- a/CRIP/CRIP-LinkedinFollowers.MD +++ b/CRIP/CRIP-LinkedinSearchAppearances.MD @@ -1,14 +1,14 @@ | proposal | title | description | author | discussions-to | status | type | category | created | requires | |----------|---------------------|---------------------------------|---------------------------------|----------------|--------|-------------|----------|------------|----------| -| CRIP-LinkedIn | LinkedIn Follower Count Integration | Integration with LinkedIn API to validate total followers on the account of user | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-20 | | +| CRIP-LinkedIn | LinkedIn Search Appearances Integration | Integration with LinkedIn API to validate total searches on the profile of a user | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-20 | | ## Title -LinkedIn Follower Count Integration +LinkedIn Search Appearances Integration ## Introduction -This proposal outlines the integration of LinkedIn as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process total followers on the linkedin account of a user. This will enable users to validate their LinkedIn activities and use them for various challenges and verifications on Catoff. +This proposal outlines the integration of LinkedIn as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process total searches by other users on the linkedin account of a user. This will enable users to validate their LinkedIn activities and use them for various challenges and verifications on Catoff. ## External APIs Needed @@ -16,7 +16,7 @@ This proposal outlines the integration of LinkedIn as a data provider for the Ca ## Use Cases -1. **User Verification**: Verify the activity of users on LinkedIn by checking the number of followers on their profile. +1. **User Verification**: Verify the activity of users on LinkedIn by checking the number of searches on their profile. 2. **Challenge Participation**: Allow users to participate in challenges that require proof of LinkedIn activity. 3. **Professional Assessment**: Assess users' professional network and engagement based on their LinkedIn activity. @@ -37,19 +37,19 @@ const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); exports.processLinkedInData = async (proof, providerName) => { const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; - const followers = extractedParameters.Followers.replace(/,/g, ''); + const searchAppearances = extractedParameters.Search_Appearances; const username = proof[0].claimData.owner; - console.log(`Followers for user ${username}: ${followers}`); + console.log(`Search Appearances for user ${username}: ${searchAppearances}`); const lastUpdateTimeStamp = proof[0].claimData.timestampS; return new ReclaimServiceResponse( providerName, - lastUpdateTimeStamp, + lastUpdateTimeStamp, username, - parseInt(followers, 10), + parseInt(searchAppearances, 10), proof[0] ); }; diff --git a/src/services/linkedinService.js b/src/services/linkedinService.js index c064b40..a65d754 100644 --- a/src/services/linkedinService.js +++ b/src/services/linkedinService.js @@ -3,19 +3,19 @@ const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); exports.processLinkedInData = async (proof, providerName) => { const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; - const followers = extractedParameters.Followers.replace(/,/g, ''); + const searchAppearances = extractedParameters.Search_Appearances; const username = proof[0].claimData.owner; - console.log(`Followers for user ${username}: ${followers}`); + console.log(`Search Appearances for user ${username}: ${searchAppearances}`); const lastUpdateTimeStamp = proof[0].claimData.timestampS; return new ReclaimServiceResponse( providerName, - lastUpdateTimeStamp, + lastUpdateTimeStamp, username, - parseInt(followers, 10), + parseInt(searchAppearances, 10), proof[0] ); }; From 5de7032d5a633864bdf1cf7b9149e4a326ae6471 Mon Sep 17 00:00:00 2001 From: ritik Date: Sun, 23 Jun 2024 19:49:20 +0530 Subject: [PATCH 07/20] Feat: Added Chess Rapid Ratings integration --- CRIP/CRIP-ChessRapidRatings.md | 71 ++++++++++++++++++++++++ CRIP/CRIP-LinkedinSearchAppearances.MD | 55 ------------------ src/services/chessRapidRatingsService.js | 37 ++++++++++++ src/services/linkedinService.js | 21 ------- src/services/reclaimService.js | 12 ++-- src/utils/constants.js | 6 +- 6 files changed, 117 insertions(+), 85 deletions(-) create mode 100644 CRIP/CRIP-ChessRapidRatings.md delete mode 100644 CRIP/CRIP-LinkedinSearchAppearances.MD create mode 100644 src/services/chessRapidRatingsService.js delete mode 100644 src/services/linkedinService.js diff --git a/CRIP/CRIP-ChessRapidRatings.md b/CRIP/CRIP-ChessRapidRatings.md new file mode 100644 index 0000000..d4028fc --- /dev/null +++ b/CRIP/CRIP-ChessRapidRatings.md @@ -0,0 +1,71 @@ +| proposal | title | description | author | discussions-to | status | type | category | created | requires | +|----------|--------------------|-------------------------------|----------------------------|----------------|--------|-------------|----------|------------|----------| +| CRIP-ChessRapidRatings | Chess.com Integration | Integration with Chess.com API to validate user ratings | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-01 | | + +## Title + +Chess Rapid Current and Best Ratings Integration + +## Introduction + +This proposal outlines the integration of Chess.com as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process rapid ratings ie the best and current rating of a user in chess.com Rapid format to be used within the Catoff platform. This will enable users to validate their Chess.com performance and use it for various challenges and verifications on Catoff. + +## External APIs Needed + +- Chess.com API: https://api.chess.com/pub/player/ + +## Use Cases + +1. **User Verification**: Verify the activity of users on Chess.com by checking their current and best ratings. +2. **Challenge Participation**: Allow users to participate in challenges that require proof of Chess.com activity. +3. **Skill Assessment**: Assess users' chess skills based on their rapid ratings and game history on Chess.com. + +## Data Provider + +- **Name**: Chess UserName - Fix +- **Hash Value**: 0x68274d4815b6a7c91170c89d3a8cec3b54f4e21f0faf223e677a9134a31f2b32 + +## Code Snippet + +Below is a code snippet that demonstrates the key parts of the Chess.com integration. The full implementation should follow the service file template. + +**`services/chessRapidRatingsService.js`** + +```javascript +const axios = require('axios'); +const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); + +exports.processChessDotComData = async (proof, providerName) => { + const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; + const username = extractedParameters.user; + console.log('Username is: ', username); + + // Fetch stats from Chess.com API + const apiUrl = `https://api.chess.com/pub/player/${username}/stats`; + try { + const response = await axios.get(apiUrl); + const stats = response.data; + + const { chess_rapid } = stats; + + console.log('Chess Rapid Current and Best Ratings:'); + console.log(` Current Rating: ${chess_rapid?.last?.rating}`); + console.log(` Best Rating: ${chess_rapid?.best?.rating}`); + + const lastUpdateTimeStamp = proof[0].claimData.timestampS; + + return new ReclaimServiceResponse( + providerName, + lastUpdateTimeStamp, + username, + { + currentRating: chess_rapid?.last?.rating, + bestRating: chess_rapid?.best?.rating + }, + proof[0] + ); + } catch (error) { + console.error(`Failed to fetch stats for user ${username}:`, error); + throw new Error(`Failed to fetch stats for user ${username}`); + } +}; diff --git a/CRIP/CRIP-LinkedinSearchAppearances.MD b/CRIP/CRIP-LinkedinSearchAppearances.MD deleted file mode 100644 index 4041367..0000000 --- a/CRIP/CRIP-LinkedinSearchAppearances.MD +++ /dev/null @@ -1,55 +0,0 @@ -| proposal | title | description | author | discussions-to | status | type | category | created | requires | -|----------|---------------------|---------------------------------|---------------------------------|----------------|--------|-------------|----------|------------|----------| -| CRIP-LinkedIn | LinkedIn Search Appearances Integration | Integration with LinkedIn API to validate total searches on the profile of a user | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-20 | | - -## Title - -LinkedIn Search Appearances Integration - -## Introduction - -This proposal outlines the integration of LinkedIn as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process total searches by other users on the linkedin account of a user. This will enable users to validate their LinkedIn activities and use them for various challenges and verifications on Catoff. - -## External APIs Needed - -- LinkedIn API: No External api used - -## Use Cases - -1. **User Verification**: Verify the activity of users on LinkedIn by checking the number of searches on their profile. -2. **Challenge Participation**: Allow users to participate in challenges that require proof of LinkedIn activity. -3. **Professional Assessment**: Assess users' professional network and engagement based on their LinkedIn activity. - -## Data Provider - -- **Name**: LinkedIn User Verification -- **Hash Value**: 0xe629105430c1a507cfe5c1f979d55103d967ca84ece2cbf1f233e5b5b22275da - -## Code Snippet - -Below is a code snippet that demonstrates the key parts of the LinkedIn integration. The full implementation should follow the service file template. - -**`services/linkedinService.js`** - -```javascript -const axios = require('axios'); -const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); - -exports.processLinkedInData = async (proof, providerName) => { - const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; - const searchAppearances = extractedParameters.Search_Appearances; - - const username = proof[0].claimData.owner; - - console.log(`Search Appearances for user ${username}: ${searchAppearances}`); - - const lastUpdateTimeStamp = proof[0].claimData.timestampS; - - return new ReclaimServiceResponse( - providerName, - lastUpdateTimeStamp, - username, - parseInt(searchAppearances, 10), - proof[0] - ); -}; diff --git a/src/services/chessRapidRatingsService.js b/src/services/chessRapidRatingsService.js new file mode 100644 index 0000000..58d1fac --- /dev/null +++ b/src/services/chessRapidRatingsService.js @@ -0,0 +1,37 @@ +const axios = require('axios'); +const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); + +exports.processChessDotComData = async (proof, providerName) => { + const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; + const username = extractedParameters.user; + console.log('Username is: ', username); + + // Fetch stats from Chess.com API + const apiUrl = `https://api.chess.com/pub/player/${username}/stats`; + try { + const response = await axios.get(apiUrl); + const stats = response.data; + + const { chess_rapid } = stats; + + console.log('Chess Rapid Current and Best Ratings:'); + console.log(` Current Rating: ${chess_rapid?.last?.rating}`); + console.log(` Best Rating: ${chess_rapid?.best?.rating}`); + + const lastUpdateTimeStamp = proof[0].claimData.timestampS; + + return new ReclaimServiceResponse( + providerName, + lastUpdateTimeStamp, + username, + { + currentRating: chess_rapid?.last?.rating, + bestRating: chess_rapid?.best?.rating + }, + proof[0] + ); + } catch (error) { + console.error(`Failed to fetch stats for user ${username}:`, error); + throw new Error(`Failed to fetch stats for user ${username}`); + } +}; diff --git a/src/services/linkedinService.js b/src/services/linkedinService.js deleted file mode 100644 index a65d754..0000000 --- a/src/services/linkedinService.js +++ /dev/null @@ -1,21 +0,0 @@ -const axios = require('axios'); -const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); - -exports.processLinkedInData = async (proof, providerName) => { - const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; - const searchAppearances = extractedParameters.Search_Appearances; - - const username = proof[0].claimData.owner; - - console.log(`Search Appearances for user ${username}: ${searchAppearances}`); - - const lastUpdateTimeStamp = proof[0].claimData.timestampS; - - return new ReclaimServiceResponse( - providerName, - lastUpdateTimeStamp, - username, - parseInt(searchAppearances, 10), - proof[0] - ); -}; diff --git a/src/services/reclaimService.js b/src/services/reclaimService.js index f096627..7fa79aa 100644 --- a/src/services/reclaimService.js +++ b/src/services/reclaimService.js @@ -3,7 +3,7 @@ const { Reclaim } = require('@reclaimprotocol/js-sdk') const { RECLAIM_PROVIDER_ID, RECLAIM_APP_ID } = require('../utils/constants') const { processTwitterData } = require('./twitterService') const { processGitHubData } = require('./githubService') -const { processLinkedInData } = require('./linkedinService') +const { processChessDotComData } = require('./chessRapidRatingsService') exports.signWithProviderID = async (userId, providerId) => { const providerName = RECLAIM_PROVIDER_ID[providerId] @@ -15,10 +15,10 @@ exports.signWithProviderID = async (userId, providerId) => { ) try { - const reclaimClient = new Reclaim.ProofRequest(reclaimAppID) - await reclaimClient.buildProofRequest(providerId) + const reclaimClient = new Reclaim.ProofRequest('0xc89D8b05f6F44994326E92dCce0CA7FC00Eb8cEb') + await reclaimClient.buildProofRequest('b0fb8157-4627-4360-9b05-95c236827df3') reclaimClient.setSignature( - await reclaimClient.generateSignature(reclaimAppSecret) + await reclaimClient.generateSignature('0x4911e9d05eecfa926428e202ce21a8728f59b2afb8998e253fd3fb2b36d31c6c') ) const { requestUrl: signedUrl } = await reclaimClient.createVerificationRequest() @@ -51,8 +51,8 @@ const handleReclaimSession = async (userId, reclaimClient, providerName) => { case 'GITHUB_ACCOUNT_VERIFICATION': processedData = await processGitHubData(proof, providerName) break - case 'LINKEDIN_ACCOUNT_VERIFICATION': - processedData = await processLinkedInData(proof, providerName); + case 'CHESSDOTCOM_ACCOUNT_VERIFICATION': + processedData = await processChessDotComData(proof, providerName); break default: throw new Error(`No handler for provider: ${providerName}`) diff --git a/src/utils/constants.js b/src/utils/constants.js index 191fc28..6e414d4 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -1,17 +1,17 @@ exports.RECLAIM_PROVIDER_ID = { twitter: 'TWITTER_ANALYTICS_VIEWS', github: 'GITHUB_ACCOUNT_VERIFICATION', - linkedin: 'LINKEDIN_ACCOUNT_VERIFICATION' + chessDotCom: 'CHESSDOTCOM_ACCOUNT_VERIFICATION' } exports.RECLAIM_APP_ID = { TWITTER_ANALYTICS_VIEWS: 'your-twitter-app-id', GITHUB_ACCOUNT_VERIFICATION: 'your-github-app-id', - LINKEDIN_ACCOUNT_VERIFICATION: 'your-linkedin-app-id' + CHESSDOTCOM_ACCOUNT_VERIFICATION: 'your-chessDotCom-app-id' } exports.PROVIDER_ID = { twitter: 'twitter-provider-id', github: 'github-provider-id', - linkedin: 'linkedin-provider-id' + chessDotCom: 'chessDotCom-provider-id' } \ No newline at end of file From b47051190780c35599aab050e4cc0b69c802fcca Mon Sep 17 00:00:00 2001 From: ritik Date: Sun, 23 Jun 2024 20:28:31 +0530 Subject: [PATCH 08/20] Feat: Added chess Rapid Wins Losses --- ...Ratings.md => CRIP-ChessRapidWinsLoses.md} | 24 +++++++++---------- ...rvice.js => chessRapidWinsLosesService.js} | 12 ++++------ src/services/reclaimService.js | 2 +- 3 files changed, 17 insertions(+), 21 deletions(-) rename CRIP/{CRIP-ChessRapidRatings.md => CRIP-ChessRapidWinsLoses.md} (67%) rename src/services/{chessRapidRatingsService.js => chessRapidWinsLosesService.js} (75%) diff --git a/CRIP/CRIP-ChessRapidRatings.md b/CRIP/CRIP-ChessRapidWinsLoses.md similarity index 67% rename from CRIP/CRIP-ChessRapidRatings.md rename to CRIP/CRIP-ChessRapidWinsLoses.md index d4028fc..2abe35b 100644 --- a/CRIP/CRIP-ChessRapidRatings.md +++ b/CRIP/CRIP-ChessRapidWinsLoses.md @@ -1,14 +1,14 @@ | proposal | title | description | author | discussions-to | status | type | category | created | requires | |----------|--------------------|-------------------------------|----------------------------|----------------|--------|-------------|----------|------------|----------| -| CRIP-ChessRapidRatings | Chess.com Integration | Integration with Chess.com API to validate user ratings | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-01 | | +| CRIP-ChessRapidWinsLoses | Chess.com Integration | Integration with Chess.com API to validate wins and loses of a user in Chess.com Rapid format | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-01 | | ## Title -Chess Rapid Current and Best Ratings Integration +Chess Rapid Wins, Loses and Draws Integration ## Introduction -This proposal outlines the integration of Chess.com as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process rapid ratings ie the best and current rating of a user in chess.com Rapid format to be used within the Catoff platform. This will enable users to validate their Chess.com performance and use it for various challenges and verifications on Catoff. +This proposal outlines the integration of Chess.com as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process the wins, loses and draws of a user in chess.com Rapid format to be used within the Catoff platform. This will enable users to validate their Chess.com performance and use it for various challenges and verifications on Catoff. ## External APIs Needed @@ -16,9 +16,9 @@ This proposal outlines the integration of Chess.com as a data provider for the C ## Use Cases -1. **User Verification**: Verify the activity of users on Chess.com by checking their current and best ratings. +1. **User Verification**: Verify the activity of users on Chess.com by checking their wins, loses and draws. 2. **Challenge Participation**: Allow users to participate in challenges that require proof of Chess.com activity. -3. **Skill Assessment**: Assess users' chess skills based on their rapid ratings and game history on Chess.com. +3. **Skill Assessment**: Assess users' chess skills based on their win/loss ratio and game history on Chess.com. ## Data Provider @@ -29,7 +29,7 @@ This proposal outlines the integration of Chess.com as a data provider for the C Below is a code snippet that demonstrates the key parts of the Chess.com integration. The full implementation should follow the service file template. -**`services/chessRapidRatingsService.js`** +**`services/chessRapidWinsLosesService.js`** ```javascript const axios = require('axios'); @@ -48,9 +48,10 @@ exports.processChessDotComData = async (proof, providerName) => { const { chess_rapid } = stats; - console.log('Chess Rapid Current and Best Ratings:'); - console.log(` Current Rating: ${chess_rapid?.last?.rating}`); - console.log(` Best Rating: ${chess_rapid?.best?.rating}`); + console.log('Chess Rapid Wins, Loses and Draws:'); + console.log(` Wins: ${chess_rapid?.record?.win}`); + console.log(` Losses: ${chess_rapid?.record?.loss}`); + console.log(` Draws: ${chess_rapid?.record?.draw}`); const lastUpdateTimeStamp = proof[0].claimData.timestampS; @@ -58,10 +59,7 @@ exports.processChessDotComData = async (proof, providerName) => { providerName, lastUpdateTimeStamp, username, - { - currentRating: chess_rapid?.last?.rating, - bestRating: chess_rapid?.best?.rating - }, + stats, proof[0] ); } catch (error) { diff --git a/src/services/chessRapidRatingsService.js b/src/services/chessRapidWinsLosesService.js similarity index 75% rename from src/services/chessRapidRatingsService.js rename to src/services/chessRapidWinsLosesService.js index 58d1fac..cc0e6f5 100644 --- a/src/services/chessRapidRatingsService.js +++ b/src/services/chessRapidWinsLosesService.js @@ -14,9 +14,10 @@ exports.processChessDotComData = async (proof, providerName) => { const { chess_rapid } = stats; - console.log('Chess Rapid Current and Best Ratings:'); - console.log(` Current Rating: ${chess_rapid?.last?.rating}`); - console.log(` Best Rating: ${chess_rapid?.best?.rating}`); + console.log('Chess Rapid Wins, Loses and Draws:'); + console.log(` Wins: ${chess_rapid?.record?.win}`); + console.log(` Losses: ${chess_rapid?.record?.loss}`); + console.log(` Draws: ${chess_rapid?.record?.draw}`); const lastUpdateTimeStamp = proof[0].claimData.timestampS; @@ -24,10 +25,7 @@ exports.processChessDotComData = async (proof, providerName) => { providerName, lastUpdateTimeStamp, username, - { - currentRating: chess_rapid?.last?.rating, - bestRating: chess_rapid?.best?.rating - }, + stats, proof[0] ); } catch (error) { diff --git a/src/services/reclaimService.js b/src/services/reclaimService.js index 7fa79aa..9ba6f9d 100644 --- a/src/services/reclaimService.js +++ b/src/services/reclaimService.js @@ -3,7 +3,7 @@ const { Reclaim } = require('@reclaimprotocol/js-sdk') const { RECLAIM_PROVIDER_ID, RECLAIM_APP_ID } = require('../utils/constants') const { processTwitterData } = require('./twitterService') const { processGitHubData } = require('./githubService') -const { processChessDotComData } = require('./chessRapidRatingsService') +const { processChessDotComData } = require('./chessRapidWinsLosesService') exports.signWithProviderID = async (userId, providerId) => { const providerName = RECLAIM_PROVIDER_ID[providerId] From 12b7bbb322e8e804b684d1b9bc467c2900456c42 Mon Sep 17 00:00:00 2001 From: ritik Date: Sun, 23 Jun 2024 20:40:16 +0530 Subject: [PATCH 09/20] Feat: Added Chess Bullet Wins Loses --- ...sLoses.md => CRIP-ChessBulletWinsLoses.md} | 22 +++++++++---------- ...vice.js => chessBulletWinsLosesService.js} | 14 ++++++------ src/services/reclaimService.js | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) rename CRIP/{CRIP-ChessRapidWinsLoses.md => CRIP-ChessBulletWinsLoses.md} (75%) rename src/services/{chessRapidWinsLosesService.js => chessBulletWinsLosesService.js} (76%) diff --git a/CRIP/CRIP-ChessRapidWinsLoses.md b/CRIP/CRIP-ChessBulletWinsLoses.md similarity index 75% rename from CRIP/CRIP-ChessRapidWinsLoses.md rename to CRIP/CRIP-ChessBulletWinsLoses.md index 2abe35b..009b02c 100644 --- a/CRIP/CRIP-ChessRapidWinsLoses.md +++ b/CRIP/CRIP-ChessBulletWinsLoses.md @@ -1,14 +1,14 @@ | proposal | title | description | author | discussions-to | status | type | category | created | requires | |----------|--------------------|-------------------------------|----------------------------|----------------|--------|-------------|----------|------------|----------| -| CRIP-ChessRapidWinsLoses | Chess.com Integration | Integration with Chess.com API to validate wins and loses of a user in Chess.com Rapid format | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-01 | | +| CRIP-ChessRapidWinsLoses | Chess.com Integration | Integration with Chess.com API to validate wins and loses of a user in Chess.com Bullet format | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-01 | | ## Title -Chess Rapid Wins, Loses and Draws Integration +Chess Bullet Wins, Loses and Draws Integration ## Introduction -This proposal outlines the integration of Chess.com as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process the wins, loses and draws of a user in chess.com Rapid format to be used within the Catoff platform. This will enable users to validate their Chess.com performance and use it for various challenges and verifications on Catoff. +This proposal outlines the integration of Chess.com as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process the wins, loses and draws of a user in chess.com Bullet format to be used within the Catoff platform. This will enable users to validate their Chess.com performance and use it for various challenges and verifications on Catoff. ## External APIs Needed @@ -16,7 +16,7 @@ This proposal outlines the integration of Chess.com as a data provider for the C ## Use Cases -1. **User Verification**: Verify the activity of users on Chess.com by checking their wins, loses and draws. +1. **User Verification**: Verify the activity of users on Chess.com by checking their wins, loses and draws in Bullet format. 2. **Challenge Participation**: Allow users to participate in challenges that require proof of Chess.com activity. 3. **Skill Assessment**: Assess users' chess skills based on their win/loss ratio and game history on Chess.com. @@ -29,7 +29,7 @@ This proposal outlines the integration of Chess.com as a data provider for the C Below is a code snippet that demonstrates the key parts of the Chess.com integration. The full implementation should follow the service file template. -**`services/chessRapidWinsLosesService.js`** +**`services/chessBulletWinsLosesService.js`** ```javascript const axios = require('axios'); @@ -46,12 +46,12 @@ exports.processChessDotComData = async (proof, providerName) => { const response = await axios.get(apiUrl); const stats = response.data; - const { chess_rapid } = stats; - - console.log('Chess Rapid Wins, Loses and Draws:'); - console.log(` Wins: ${chess_rapid?.record?.win}`); - console.log(` Losses: ${chess_rapid?.record?.loss}`); - console.log(` Draws: ${chess_rapid?.record?.draw}`); + const { chess_bullet } = stats; + + console.log('Chess Bullet Wins, Loses and Draws Stats:'); + console.log(` Wins: ${chess_bullet?.record?.win}`); + console.log(` Losses: ${chess_bullet?.record?.loss}`); + console.log(` Draws: ${chess_bullet?.record?.draw}`); const lastUpdateTimeStamp = proof[0].claimData.timestampS; diff --git a/src/services/chessRapidWinsLosesService.js b/src/services/chessBulletWinsLosesService.js similarity index 76% rename from src/services/chessRapidWinsLosesService.js rename to src/services/chessBulletWinsLosesService.js index cc0e6f5..fe98c82 100644 --- a/src/services/chessRapidWinsLosesService.js +++ b/src/services/chessBulletWinsLosesService.js @@ -12,12 +12,12 @@ exports.processChessDotComData = async (proof, providerName) => { const response = await axios.get(apiUrl); const stats = response.data; - const { chess_rapid } = stats; - - console.log('Chess Rapid Wins, Loses and Draws:'); - console.log(` Wins: ${chess_rapid?.record?.win}`); - console.log(` Losses: ${chess_rapid?.record?.loss}`); - console.log(` Draws: ${chess_rapid?.record?.draw}`); + const { chess_bullet } = stats; + + console.log('Chess Bullet Wins, Loses and Draws Stats:'); + console.log(` Wins: ${chess_bullet?.record?.win}`); + console.log(` Losses: ${chess_bullet?.record?.loss}`); + console.log(` Draws: ${chess_bullet?.record?.draw}`); const lastUpdateTimeStamp = proof[0].claimData.timestampS; @@ -32,4 +32,4 @@ exports.processChessDotComData = async (proof, providerName) => { console.error(`Failed to fetch stats for user ${username}:`, error); throw new Error(`Failed to fetch stats for user ${username}`); } -}; +}; \ No newline at end of file diff --git a/src/services/reclaimService.js b/src/services/reclaimService.js index 9ba6f9d..36a98c8 100644 --- a/src/services/reclaimService.js +++ b/src/services/reclaimService.js @@ -3,7 +3,7 @@ const { Reclaim } = require('@reclaimprotocol/js-sdk') const { RECLAIM_PROVIDER_ID, RECLAIM_APP_ID } = require('../utils/constants') const { processTwitterData } = require('./twitterService') const { processGitHubData } = require('./githubService') -const { processChessDotComData } = require('./chessRapidWinsLosesService') +const { processChessDotComData } = require('./chessBulletWinsLosesService') exports.signWithProviderID = async (userId, providerId) => { const providerName = RECLAIM_PROVIDER_ID[providerId] From 63d6c97f2fbe2b257dcdbf2b1a5a4dc3c14c219f Mon Sep 17 00:00:00 2001 From: ritik Date: Sun, 23 Jun 2024 20:40:59 +0530 Subject: [PATCH 10/20] Fix --- CRIP/CRIP-ChessBulletWinsLoses.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRIP/CRIP-ChessBulletWinsLoses.md b/CRIP/CRIP-ChessBulletWinsLoses.md index 009b02c..70f5619 100644 --- a/CRIP/CRIP-ChessBulletWinsLoses.md +++ b/CRIP/CRIP-ChessBulletWinsLoses.md @@ -1,6 +1,6 @@ | proposal | title | description | author | discussions-to | status | type | category | created | requires | |----------|--------------------|-------------------------------|----------------------------|----------------|--------|-------------|----------|------------|----------| -| CRIP-ChessRapidWinsLoses | Chess.com Integration | Integration with Chess.com API to validate wins and loses of a user in Chess.com Bullet format | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-01 | | +| CRIP-ChessBulletWinsLoses | Chess.com Integration | Integration with Chess.com API to validate wins and loses of a user in Chess.com Bullet format | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-01 | | ## Title From 67358e4848e629db0fabab246aed7cd6768d29e4 Mon Sep 17 00:00:00 2001 From: ritik Date: Sun, 23 Jun 2024 20:52:01 +0530 Subject: [PATCH 11/20] feat: Added Chess Bullet Ratings --- ...insLoses.md => CRIP-ChessBulletRatings.md} | 19 +++++++++---------- ...ervice.js => chessBulletRatingsService.js} | 5 ++--- src/services/reclaimService.js | 2 +- 3 files changed, 12 insertions(+), 14 deletions(-) rename CRIP/{CRIP-ChessBulletWinsLoses.md => CRIP-ChessBulletRatings.md} (70%) rename src/services/{chessBulletWinsLosesService.js => chessBulletRatingsService.js} (85%) diff --git a/CRIP/CRIP-ChessBulletWinsLoses.md b/CRIP/CRIP-ChessBulletRatings.md similarity index 70% rename from CRIP/CRIP-ChessBulletWinsLoses.md rename to CRIP/CRIP-ChessBulletRatings.md index 70f5619..8c6f9d4 100644 --- a/CRIP/CRIP-ChessBulletWinsLoses.md +++ b/CRIP/CRIP-ChessBulletRatings.md @@ -1,14 +1,14 @@ | proposal | title | description | author | discussions-to | status | type | category | created | requires | |----------|--------------------|-------------------------------|----------------------------|----------------|--------|-------------|----------|------------|----------| -| CRIP-ChessBulletWinsLoses | Chess.com Integration | Integration with Chess.com API to validate wins and loses of a user in Chess.com Bullet format | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-01 | | +| CRIP-ChessBulletRatings | Chess.com Integration | Integration with Chess.com API to validate user ratings in Bullet format | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-01 | | ## Title -Chess Bullet Wins, Loses and Draws Integration +Chess Bullet Current and Best Ratings Integration ## Introduction -This proposal outlines the integration of Chess.com as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process the wins, loses and draws of a user in chess.com Bullet format to be used within the Catoff platform. This will enable users to validate their Chess.com performance and use it for various challenges and verifications on Catoff. +This proposal outlines the integration of Chess.com as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process bullet format ratings ie the best and current rating of a user in chess.com Bullet format to be used within the Catoff platform. This will enable users to validate their Chess.com performance and use it for various challenges and verifications on Catoff. ## External APIs Needed @@ -16,9 +16,9 @@ This proposal outlines the integration of Chess.com as a data provider for the C ## Use Cases -1. **User Verification**: Verify the activity of users on Chess.com by checking their wins, loses and draws in Bullet format. +1. **User Verification**: Verify the activity of users on Chess.com by checking their current and best ratings. 2. **Challenge Participation**: Allow users to participate in challenges that require proof of Chess.com activity. -3. **Skill Assessment**: Assess users' chess skills based on their win/loss ratio and game history on Chess.com. +3. **Skill Assessment**: Assess users' chess skills based on their bullet games ratings and game history on Chess.com. ## Data Provider @@ -29,7 +29,7 @@ This proposal outlines the integration of Chess.com as a data provider for the C Below is a code snippet that demonstrates the key parts of the Chess.com integration. The full implementation should follow the service file template. -**`services/chessBulletWinsLosesService.js`** +**`services/chessBulletRatingsService.js`** ```javascript const axios = require('axios'); @@ -49,9 +49,8 @@ exports.processChessDotComData = async (proof, providerName) => { const { chess_bullet } = stats; console.log('Chess Bullet Wins, Loses and Draws Stats:'); - console.log(` Wins: ${chess_bullet?.record?.win}`); - console.log(` Losses: ${chess_bullet?.record?.loss}`); - console.log(` Draws: ${chess_bullet?.record?.draw}`); + console.log(` Last Rating: ${chess_bullet?.last?.rating}`); + console.log(` Best Rating: ${chess_bullet?.best?.rating}`); const lastUpdateTimeStamp = proof[0].claimData.timestampS; @@ -66,4 +65,4 @@ exports.processChessDotComData = async (proof, providerName) => { console.error(`Failed to fetch stats for user ${username}:`, error); throw new Error(`Failed to fetch stats for user ${username}`); } -}; +}; \ No newline at end of file diff --git a/src/services/chessBulletWinsLosesService.js b/src/services/chessBulletRatingsService.js similarity index 85% rename from src/services/chessBulletWinsLosesService.js rename to src/services/chessBulletRatingsService.js index fe98c82..56fb997 100644 --- a/src/services/chessBulletWinsLosesService.js +++ b/src/services/chessBulletRatingsService.js @@ -15,9 +15,8 @@ exports.processChessDotComData = async (proof, providerName) => { const { chess_bullet } = stats; console.log('Chess Bullet Wins, Loses and Draws Stats:'); - console.log(` Wins: ${chess_bullet?.record?.win}`); - console.log(` Losses: ${chess_bullet?.record?.loss}`); - console.log(` Draws: ${chess_bullet?.record?.draw}`); + console.log(` Last Rating: ${chess_bullet?.last?.rating}`); + console.log(` Best Rating: ${chess_bullet?.best?.rating}`); const lastUpdateTimeStamp = proof[0].claimData.timestampS; diff --git a/src/services/reclaimService.js b/src/services/reclaimService.js index 36a98c8..119b65e 100644 --- a/src/services/reclaimService.js +++ b/src/services/reclaimService.js @@ -3,7 +3,7 @@ const { Reclaim } = require('@reclaimprotocol/js-sdk') const { RECLAIM_PROVIDER_ID, RECLAIM_APP_ID } = require('../utils/constants') const { processTwitterData } = require('./twitterService') const { processGitHubData } = require('./githubService') -const { processChessDotComData } = require('./chessBulletWinsLosesService') +const { processChessDotComData } = require('./chessBulletRatingsService') exports.signWithProviderID = async (userId, providerId) => { const providerName = RECLAIM_PROVIDER_ID[providerId] From d1aea7a83f622f29da6208f776441cb2437c86e9 Mon Sep 17 00:00:00 2001 From: ritik Date: Fri, 28 Jun 2024 09:28:17 +0530 Subject: [PATCH 12/20] Feat: Added Swiggy Last order price integration --- CRIP/CRIP-ChessBulletRatings.md | 68 ----------------------- CRIP/CRIP-SwiggyLastOrder.md | 53 ++++++++++++++++++ src/services/SwiggyLastOrderService.js | 19 +++++++ src/services/chessBulletRatingsService.js | 34 ------------ src/services/reclaimService.js | 12 ++-- src/utils/constants.js | 6 +- 6 files changed, 81 insertions(+), 111 deletions(-) delete mode 100644 CRIP/CRIP-ChessBulletRatings.md create mode 100644 CRIP/CRIP-SwiggyLastOrder.md create mode 100644 src/services/SwiggyLastOrderService.js delete mode 100644 src/services/chessBulletRatingsService.js diff --git a/CRIP/CRIP-ChessBulletRatings.md b/CRIP/CRIP-ChessBulletRatings.md deleted file mode 100644 index 8c6f9d4..0000000 --- a/CRIP/CRIP-ChessBulletRatings.md +++ /dev/null @@ -1,68 +0,0 @@ -| proposal | title | description | author | discussions-to | status | type | category | created | requires | -|----------|--------------------|-------------------------------|----------------------------|----------------|--------|-------------|----------|------------|----------| -| CRIP-ChessBulletRatings | Chess.com Integration | Integration with Chess.com API to validate user ratings in Bullet format | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-01 | | - -## Title - -Chess Bullet Current and Best Ratings Integration - -## Introduction - -This proposal outlines the integration of Chess.com as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process bullet format ratings ie the best and current rating of a user in chess.com Bullet format to be used within the Catoff platform. This will enable users to validate their Chess.com performance and use it for various challenges and verifications on Catoff. - -## External APIs Needed - -- Chess.com API: https://api.chess.com/pub/player/ - -## Use Cases - -1. **User Verification**: Verify the activity of users on Chess.com by checking their current and best ratings. -2. **Challenge Participation**: Allow users to participate in challenges that require proof of Chess.com activity. -3. **Skill Assessment**: Assess users' chess skills based on their bullet games ratings and game history on Chess.com. - -## Data Provider - -- **Name**: Chess UserName - Fix -- **Hash Value**: 0x68274d4815b6a7c91170c89d3a8cec3b54f4e21f0faf223e677a9134a31f2b32 - -## Code Snippet - -Below is a code snippet that demonstrates the key parts of the Chess.com integration. The full implementation should follow the service file template. - -**`services/chessBulletRatingsService.js`** - -```javascript -const axios = require('axios'); -const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); - -exports.processChessDotComData = async (proof, providerName) => { - const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; - const username = extractedParameters.user; - console.log('Username is: ', username); - - // Fetch stats from Chess.com API - const apiUrl = `https://api.chess.com/pub/player/${username}/stats`; - try { - const response = await axios.get(apiUrl); - const stats = response.data; - - const { chess_bullet } = stats; - - console.log('Chess Bullet Wins, Loses and Draws Stats:'); - console.log(` Last Rating: ${chess_bullet?.last?.rating}`); - console.log(` Best Rating: ${chess_bullet?.best?.rating}`); - - const lastUpdateTimeStamp = proof[0].claimData.timestampS; - - return new ReclaimServiceResponse( - providerName, - lastUpdateTimeStamp, - username, - stats, - proof[0] - ); - } catch (error) { - console.error(`Failed to fetch stats for user ${username}:`, error); - throw new Error(`Failed to fetch stats for user ${username}`); - } -}; \ No newline at end of file diff --git a/CRIP/CRIP-SwiggyLastOrder.md b/CRIP/CRIP-SwiggyLastOrder.md new file mode 100644 index 0000000..795d421 --- /dev/null +++ b/CRIP/CRIP-SwiggyLastOrder.md @@ -0,0 +1,53 @@ +| proposal | title | description | author | discussions-to | status | type | category | created | requires | +|----------|-------------------------|-----------------------------------------------------|---------------------------|----------------|--------|-------------|----------|------------|----------| +| CRIP-2 | Swiggy Last Order Price | Integration with Swiggy API to verify the last order price | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-28 | | + +## Title + +Swiggy Last Order Price Integration + +## Introduction + +This proposal outlines the integration of Swiggy as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process the last order price data from Swiggy, allowing users to validate their last order price on the Catoff platform. This will enable users to use their Swiggy order data for various challenges and verifications on Catoff. + +## External APIs Needed + +- Swiggy API: Swiggy doesn't have a public API, so the integration will use data extraction methods from the Swiggy app/web. + +## Use Cases + +1. **User Verification**: Verify the last order price of users on Swiggy. +2. **Challenge Participation**: Allow users to participate in challenges that require proof of their last Swiggy order price. +3. **Purchase History**: Validate users' purchase history based on their Swiggy order data. + +## Data Provider + +- **Name**: Swiggy Last Order Price +- **Hash Value**: 0xead50bf0e5ac604b58060993a9f8f27f6dc1d497be2212111c5582b30de61f7f + +## Code Snippet + +Below is a code snippet that demonstrates the key parts of the Swiggy integration. The full implementation should follow the service file template. + +**`services/swiggyLastOrderService.js`** + +```javascript +const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); + +exports.processSwiggyData = async (proof, providerName) => { + console.log("Proof is: ", proof[0]); + + const lastUpdateTimeStamp = proof[0].claimData.timestampS; + const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; + const lastOrderPrice = extractedParameters.lastOrderPrice; + + console.log('Swiggy Last Order Price:', lastOrderPrice); + + return new ReclaimServiceResponse( + providerName, + lastUpdateTimeStamp, + 'userSwiggy', + lastOrderPrice, + proof[0] + ); +} diff --git a/src/services/SwiggyLastOrderService.js b/src/services/SwiggyLastOrderService.js new file mode 100644 index 0000000..eb39887 --- /dev/null +++ b/src/services/SwiggyLastOrderService.js @@ -0,0 +1,19 @@ +const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); + +exports.processSwiggyData = async (proof, providerName) => { + console.log("Proof is: ", proof[0]); + + const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; + const lastOrderPrice = extractedParameters.lastOrderPrice; + const lastUpdateTimeStamp = proof[0].claimData.timestampS; + + console.log('Last Order Price is: ', lastOrderPrice); + + return new ReclaimServiceResponse( + providerName, + lastUpdateTimeStamp, + 'username', + lastOrderPrice, + proof[0] + ); +}; diff --git a/src/services/chessBulletRatingsService.js b/src/services/chessBulletRatingsService.js deleted file mode 100644 index 56fb997..0000000 --- a/src/services/chessBulletRatingsService.js +++ /dev/null @@ -1,34 +0,0 @@ -const axios = require('axios'); -const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); - -exports.processChessDotComData = async (proof, providerName) => { - const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; - const username = extractedParameters.user; - console.log('Username is: ', username); - - // Fetch stats from Chess.com API - const apiUrl = `https://api.chess.com/pub/player/${username}/stats`; - try { - const response = await axios.get(apiUrl); - const stats = response.data; - - const { chess_bullet } = stats; - - console.log('Chess Bullet Wins, Loses and Draws Stats:'); - console.log(` Last Rating: ${chess_bullet?.last?.rating}`); - console.log(` Best Rating: ${chess_bullet?.best?.rating}`); - - const lastUpdateTimeStamp = proof[0].claimData.timestampS; - - return new ReclaimServiceResponse( - providerName, - lastUpdateTimeStamp, - username, - stats, - proof[0] - ); - } catch (error) { - console.error(`Failed to fetch stats for user ${username}:`, error); - throw new Error(`Failed to fetch stats for user ${username}`); - } -}; \ No newline at end of file diff --git a/src/services/reclaimService.js b/src/services/reclaimService.js index 119b65e..5185bbc 100644 --- a/src/services/reclaimService.js +++ b/src/services/reclaimService.js @@ -3,7 +3,7 @@ const { Reclaim } = require('@reclaimprotocol/js-sdk') const { RECLAIM_PROVIDER_ID, RECLAIM_APP_ID } = require('../utils/constants') const { processTwitterData } = require('./twitterService') const { processGitHubData } = require('./githubService') -const { processChessDotComData } = require('./chessBulletRatingsService') +const { processSwiggyData } = require('./SwiggyLastOrderService') exports.signWithProviderID = async (userId, providerId) => { const providerName = RECLAIM_PROVIDER_ID[providerId] @@ -15,10 +15,10 @@ exports.signWithProviderID = async (userId, providerId) => { ) try { - const reclaimClient = new Reclaim.ProofRequest('0xc89D8b05f6F44994326E92dCce0CA7FC00Eb8cEb') - await reclaimClient.buildProofRequest('b0fb8157-4627-4360-9b05-95c236827df3') + const reclaimClient = new Reclaim.ProofRequest('0xaDdbcC95cC89e0F2eE1beFefD9DEF259FD9F9A28') + await reclaimClient.buildProofRequest('b5614a05-ba19-49c3-a312-250e85fabc55') reclaimClient.setSignature( - await reclaimClient.generateSignature('0x4911e9d05eecfa926428e202ce21a8728f59b2afb8998e253fd3fb2b36d31c6c') + await reclaimClient.generateSignature('0x428658c44b8b3ac201725fb31e7d15123765527d60b7cdffc87843a2659c0e90') ) const { requestUrl: signedUrl } = await reclaimClient.createVerificationRequest() @@ -51,8 +51,8 @@ const handleReclaimSession = async (userId, reclaimClient, providerName) => { case 'GITHUB_ACCOUNT_VERIFICATION': processedData = await processGitHubData(proof, providerName) break - case 'CHESSDOTCOM_ACCOUNT_VERIFICATION': - processedData = await processChessDotComData(proof, providerName); + case 'SWIGGY_ACCOUNT_VERIFICATION': + processedData = await processSwiggyData(proof, providerName); break default: throw new Error(`No handler for provider: ${providerName}`) diff --git a/src/utils/constants.js b/src/utils/constants.js index 6e414d4..4e13e39 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -1,17 +1,17 @@ exports.RECLAIM_PROVIDER_ID = { twitter: 'TWITTER_ANALYTICS_VIEWS', github: 'GITHUB_ACCOUNT_VERIFICATION', - chessDotCom: 'CHESSDOTCOM_ACCOUNT_VERIFICATION' + swiggy: 'SWIGGY_ACCOUNT_VERIFICATION' } exports.RECLAIM_APP_ID = { TWITTER_ANALYTICS_VIEWS: 'your-twitter-app-id', GITHUB_ACCOUNT_VERIFICATION: 'your-github-app-id', - CHESSDOTCOM_ACCOUNT_VERIFICATION: 'your-chessDotCom-app-id' + SWIGGY_ACCOUNT_VERIFICATION: 'your-swiggy-app-id' } exports.PROVIDER_ID = { twitter: 'twitter-provider-id', github: 'github-provider-id', - chessDotCom: 'chessDotCom-provider-id' + swiggy: 'swiggy-provider-id' } \ No newline at end of file From 0c6fe810152da8dc3f916fff6f2be44ce1545f8c Mon Sep 17 00:00:00 2001 From: ritik Date: Sun, 7 Jul 2024 17:28:06 +0530 Subject: [PATCH 13/20] Feat: Added Zomato Total Orders --- CRIP/CRIP-SwiggyLastOrder.md | 53 ------------------- CRIP/CRIP-ZomatoTotalOrders.md | 53 +++++++++++++++++++ package.json | 1 + ...Service.js => ZomatoTotalOrdersService.js} | 8 +-- src/services/reclaimService.js | 14 ++--- src/utils/constants.js | 6 +-- 6 files changed, 68 insertions(+), 67 deletions(-) delete mode 100644 CRIP/CRIP-SwiggyLastOrder.md create mode 100644 CRIP/CRIP-ZomatoTotalOrders.md rename src/services/{SwiggyLastOrderService.js => ZomatoTotalOrdersService.js} (65%) diff --git a/CRIP/CRIP-SwiggyLastOrder.md b/CRIP/CRIP-SwiggyLastOrder.md deleted file mode 100644 index 795d421..0000000 --- a/CRIP/CRIP-SwiggyLastOrder.md +++ /dev/null @@ -1,53 +0,0 @@ -| proposal | title | description | author | discussions-to | status | type | category | created | requires | -|----------|-------------------------|-----------------------------------------------------|---------------------------|----------------|--------|-------------|----------|------------|----------| -| CRIP-2 | Swiggy Last Order Price | Integration with Swiggy API to verify the last order price | Ritik Bhatt | | Draft | Integration | CRIP | 2024-06-28 | | - -## Title - -Swiggy Last Order Price Integration - -## Introduction - -This proposal outlines the integration of Swiggy as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process the last order price data from Swiggy, allowing users to validate their last order price on the Catoff platform. This will enable users to use their Swiggy order data for various challenges and verifications on Catoff. - -## External APIs Needed - -- Swiggy API: Swiggy doesn't have a public API, so the integration will use data extraction methods from the Swiggy app/web. - -## Use Cases - -1. **User Verification**: Verify the last order price of users on Swiggy. -2. **Challenge Participation**: Allow users to participate in challenges that require proof of their last Swiggy order price. -3. **Purchase History**: Validate users' purchase history based on their Swiggy order data. - -## Data Provider - -- **Name**: Swiggy Last Order Price -- **Hash Value**: 0xead50bf0e5ac604b58060993a9f8f27f6dc1d497be2212111c5582b30de61f7f - -## Code Snippet - -Below is a code snippet that demonstrates the key parts of the Swiggy integration. The full implementation should follow the service file template. - -**`services/swiggyLastOrderService.js`** - -```javascript -const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); - -exports.processSwiggyData = async (proof, providerName) => { - console.log("Proof is: ", proof[0]); - - const lastUpdateTimeStamp = proof[0].claimData.timestampS; - const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; - const lastOrderPrice = extractedParameters.lastOrderPrice; - - console.log('Swiggy Last Order Price:', lastOrderPrice); - - return new ReclaimServiceResponse( - providerName, - lastUpdateTimeStamp, - 'userSwiggy', - lastOrderPrice, - proof[0] - ); -} diff --git a/CRIP/CRIP-ZomatoTotalOrders.md b/CRIP/CRIP-ZomatoTotalOrders.md new file mode 100644 index 0000000..bcd44a9 --- /dev/null +++ b/CRIP/CRIP-ZomatoTotalOrders.md @@ -0,0 +1,53 @@ +| proposal | title | description | author | discussions-to | status | type | category | created | requires | +|----------|-------------------------|-----------------------------------------------------|---------------------------|----------------|--------|-------------|----------|------------|----------| +| CRIP-3 | Zomato Total Orders | Integration with Zomato API to verify the total number of orders | Ritik Bhatt | | Draft | Integration | CRIP | 2024-07-07 | | + +## Title + +Zomato Total Orders Integration + +## Introduction + +This proposal outlines the integration of Zomato as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process the total number of orders data from Zomato, allowing users to validate their order history on the Catoff platform. This will enable users to use their Zomato order data for various challenges and verifications on Catoff. + +## External APIs Needed + +- Zomato API: Zomato doesn't have a public API, so the integration will use data extraction methods from the Zomato app/web. + +## Use Cases + +1. **User Verification**: Verify the total number of orders of users on Zomato. +2. **Challenge Participation**: Allow users to participate in challenges that require proof of their total Zomato order count. +3. **Purchase History**: Validate users' purchase history based on their Zomato order data. + +## Data Provider + +- **Name**: Zomato Total Orders +- **Hash Value**: 0xead50bf0e5ac604b58060993a9f8f27f6dc1d497be2212111c5582b30de61f7f + +## Code Snippet + +Below is a code snippet that demonstrates the key parts of the Zomato integration. The full implementation should follow the service file template. + +**`services/ZomatoTotalOrdersService.js`** + +```javascript +const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); + +exports.processZomatoData = async (proof, providerName) => { + console.log("Proof is: ", proof[0]); + + const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; + const numberOfOrders = extractedParameters.ordersCount; + const lastUpdateTimeStamp = proof[0].claimData.timestampS; + + console.log('Total Number of orders are: ', numberOfOrders); + + return new ReclaimServiceResponse( + providerName, + lastUpdateTimeStamp, + 'username', + numberOfOrders, + proof[0] + ); +}; diff --git a/package.json b/package.json index ac9ddd6..dfe69c7 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "@reclaimprotocol/js-sdk": "^1.3.6", "axios": "^1.7.2", "body-parser": "^1.20.2", + "chess-web-api": "^1.2.0", "dotenv": "^16.4.5", "express": "^4.19.2" }, diff --git a/src/services/SwiggyLastOrderService.js b/src/services/ZomatoTotalOrdersService.js similarity index 65% rename from src/services/SwiggyLastOrderService.js rename to src/services/ZomatoTotalOrdersService.js index eb39887..408d13b 100644 --- a/src/services/SwiggyLastOrderService.js +++ b/src/services/ZomatoTotalOrdersService.js @@ -1,19 +1,19 @@ const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); -exports.processSwiggyData = async (proof, providerName) => { +exports.processZomatoData = async (proof, providerName) => { console.log("Proof is: ", proof[0]); const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; - const lastOrderPrice = extractedParameters.lastOrderPrice; + const numberOfOrders = extractedParameters.ordersCount; const lastUpdateTimeStamp = proof[0].claimData.timestampS; - console.log('Last Order Price is: ', lastOrderPrice); + console.log('Total Number of orders are: ', numberOfOrders); return new ReclaimServiceResponse( providerName, lastUpdateTimeStamp, 'username', - lastOrderPrice, + numberOfOrders, proof[0] ); }; diff --git a/src/services/reclaimService.js b/src/services/reclaimService.js index 5185bbc..dbb1d42 100644 --- a/src/services/reclaimService.js +++ b/src/services/reclaimService.js @@ -3,7 +3,7 @@ const { Reclaim } = require('@reclaimprotocol/js-sdk') const { RECLAIM_PROVIDER_ID, RECLAIM_APP_ID } = require('../utils/constants') const { processTwitterData } = require('./twitterService') const { processGitHubData } = require('./githubService') -const { processSwiggyData } = require('./SwiggyLastOrderService') +const { processZomatoData } = require('./ZomatoTotalOrdersService') exports.signWithProviderID = async (userId, providerId) => { const providerName = RECLAIM_PROVIDER_ID[providerId] @@ -14,11 +14,11 @@ exports.signWithProviderID = async (userId, providerId) => { `Sending signature request to Reclaim for userId: ${userId} with providerName: ${providerName}` ) - try { - const reclaimClient = new Reclaim.ProofRequest('0xaDdbcC95cC89e0F2eE1beFefD9DEF259FD9F9A28') - await reclaimClient.buildProofRequest('b5614a05-ba19-49c3-a312-250e85fabc55') + try { + const reclaimClient = new Reclaim.ProofRequest('0xD2bD98049dE5B8b4AD1BD2643a85992e13E4bf34') + await reclaimClient.buildProofRequest('6cadc27b-72cd-4c12-87de-9198fd24456e') reclaimClient.setSignature( - await reclaimClient.generateSignature('0x428658c44b8b3ac201725fb31e7d15123765527d60b7cdffc87843a2659c0e90') + await reclaimClient.generateSignature('0xca30be77c4c2d796fab31489ba7b4388e87377df92621b4505986efd45e7a656') ) const { requestUrl: signedUrl } = await reclaimClient.createVerificationRequest() @@ -51,8 +51,8 @@ const handleReclaimSession = async (userId, reclaimClient, providerName) => { case 'GITHUB_ACCOUNT_VERIFICATION': processedData = await processGitHubData(proof, providerName) break - case 'SWIGGY_ACCOUNT_VERIFICATION': - processedData = await processSwiggyData(proof, providerName); + case 'ZOMATO_ACCOUNT_VERIFICATION': + processedData = await processZomatoData(proof, providerName); break default: throw new Error(`No handler for provider: ${providerName}`) diff --git a/src/utils/constants.js b/src/utils/constants.js index 4e13e39..e58ca71 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -1,17 +1,17 @@ exports.RECLAIM_PROVIDER_ID = { twitter: 'TWITTER_ANALYTICS_VIEWS', github: 'GITHUB_ACCOUNT_VERIFICATION', - swiggy: 'SWIGGY_ACCOUNT_VERIFICATION' + zomato: 'ZOMATO_ACCOUNT_VERIFICATION' } exports.RECLAIM_APP_ID = { TWITTER_ANALYTICS_VIEWS: 'your-twitter-app-id', GITHUB_ACCOUNT_VERIFICATION: 'your-github-app-id', - SWIGGY_ACCOUNT_VERIFICATION: 'your-swiggy-app-id' + ZOMATO_ACCOUNT_VERIFICATION: 'your-zomato-app-id' } exports.PROVIDER_ID = { twitter: 'twitter-provider-id', github: 'github-provider-id', - swiggy: 'swiggy-provider-id' + zomato: 'zomato-provider-id' } \ No newline at end of file From 717cbb58640ee1b151f50bf1d33571d8bbfc7365 Mon Sep 17 00:00:00 2001 From: ritik Date: Tue, 9 Jul 2024 19:50:12 +0530 Subject: [PATCH 14/20] Feat: Added groww account details verification --- CRIP/CRIP-GrowwAccountDetails.md | 64 ++++++++++++++++++++++++ CRIP/CRIP-ZomatoTotalOrders.md | 53 -------------------- src/services/GrowwAccountDataService.js | 30 +++++++++++ src/services/ZomatoTotalOrdersService.js | 19 ------- src/services/reclaimService.js | 12 ++--- src/utils/constants.js | 6 +-- 6 files changed, 103 insertions(+), 81 deletions(-) create mode 100644 CRIP/CRIP-GrowwAccountDetails.md delete mode 100644 CRIP/CRIP-ZomatoTotalOrders.md create mode 100644 src/services/GrowwAccountDataService.js delete mode 100644 src/services/ZomatoTotalOrdersService.js diff --git a/CRIP/CRIP-GrowwAccountDetails.md b/CRIP/CRIP-GrowwAccountDetails.md new file mode 100644 index 0000000..c0ba869 --- /dev/null +++ b/CRIP/CRIP-GrowwAccountDetails.md @@ -0,0 +1,64 @@ +| proposal | title | description | author | discussions-to | status | type | category | created | requires | +|----------|-------------------------|-----------------------------------------------------|---------------------------|----------------|--------|-------------|----------|------------|----------| +| CRIP-4 | Groww Account Data | Integration with Groww to verify user account data | Ritik Bhatt | | Draft | Integration | CRIP | 2024-07-07 | | + +## Title + +Groww Account Data Integration + +## Introduction + +This proposal outlines the integration of Groww as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process user account data from Groww, allowing users to validate their account details on the Catoff platform. This will enable users to use their Groww account data for various challenges and verifications on Catoff. + +## External APIs Needed + +- Groww API: Groww doesn't have a public API, so the integration will use data extraction methods from the Groww app/web. + +## Use Cases + +1. **User Verification**: Verify the user account data on Groww. +2. **Challenge Participation**: Allow users to participate in challenges that require proof of their Groww account details. +3. **Account Status**: Validate users' account status based on their Groww data. + +## Data Provider + +- **Name**: Groww Account Data +- **Hash Value**: 0x8bbe041be479e12ef2efee703fced2f4b605c4a6d69e9957d955bebb92ad30ed + +## Code Snippet + +Below is a code snippet that demonstrates the key parts of the Groww integration. The full implementation should follow the service file template. + +**`services/GrowwAccountDataService.js`** + +```javascript +const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); + +exports.processGrowwAccountData = async (proof, providerName) => { + console.log("Proof is: ", proof[0]); + + const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; + + const lastUpdateTimeStamp = proof[0].claimData.timestampS; + const username = extractedParameters.username; + const email = extractedParameters.email; + const investmentStatus = extractedParameters.investment_status; + const kycStatus = extractedParameters.kyc_status; + const kycVerified = extractedParameters.kyc_verified; + const phoneNo = extractedParameters.phoneNo; + + console.log('Username:', username); + console.log('Email:', email); + console.log('Investment Status:', investmentStatus); + console.log('KYC Status:', kycStatus); + console.log('KYC Verified:', kycVerified); + console.log('Phone Number:', phoneNo); + + return new ReclaimServiceResponse( + providerName, + lastUpdateTimeStamp, + username, + 100, + proof[0] + ); +}; diff --git a/CRIP/CRIP-ZomatoTotalOrders.md b/CRIP/CRIP-ZomatoTotalOrders.md deleted file mode 100644 index bcd44a9..0000000 --- a/CRIP/CRIP-ZomatoTotalOrders.md +++ /dev/null @@ -1,53 +0,0 @@ -| proposal | title | description | author | discussions-to | status | type | category | created | requires | -|----------|-------------------------|-----------------------------------------------------|---------------------------|----------------|--------|-------------|----------|------------|----------| -| CRIP-3 | Zomato Total Orders | Integration with Zomato API to verify the total number of orders | Ritik Bhatt | | Draft | Integration | CRIP | 2024-07-07 | | - -## Title - -Zomato Total Orders Integration - -## Introduction - -This proposal outlines the integration of Zomato as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process the total number of orders data from Zomato, allowing users to validate their order history on the Catoff platform. This will enable users to use their Zomato order data for various challenges and verifications on Catoff. - -## External APIs Needed - -- Zomato API: Zomato doesn't have a public API, so the integration will use data extraction methods from the Zomato app/web. - -## Use Cases - -1. **User Verification**: Verify the total number of orders of users on Zomato. -2. **Challenge Participation**: Allow users to participate in challenges that require proof of their total Zomato order count. -3. **Purchase History**: Validate users' purchase history based on their Zomato order data. - -## Data Provider - -- **Name**: Zomato Total Orders -- **Hash Value**: 0xead50bf0e5ac604b58060993a9f8f27f6dc1d497be2212111c5582b30de61f7f - -## Code Snippet - -Below is a code snippet that demonstrates the key parts of the Zomato integration. The full implementation should follow the service file template. - -**`services/ZomatoTotalOrdersService.js`** - -```javascript -const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); - -exports.processZomatoData = async (proof, providerName) => { - console.log("Proof is: ", proof[0]); - - const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; - const numberOfOrders = extractedParameters.ordersCount; - const lastUpdateTimeStamp = proof[0].claimData.timestampS; - - console.log('Total Number of orders are: ', numberOfOrders); - - return new ReclaimServiceResponse( - providerName, - lastUpdateTimeStamp, - 'username', - numberOfOrders, - proof[0] - ); -}; diff --git a/src/services/GrowwAccountDataService.js b/src/services/GrowwAccountDataService.js new file mode 100644 index 0000000..ebaf46d --- /dev/null +++ b/src/services/GrowwAccountDataService.js @@ -0,0 +1,30 @@ +const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); + +exports.processGrowwAccountData = async (proof, providerName) => { + console.log("Proof is: ", proof[0]); + + const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; + + const lastUpdateTimeStamp = proof[0].claimData.timestampS; + const username = extractedParameters.username; + const email = extractedParameters.email; + const investmentStatus = extractedParameters.investment_status; + const kycStatus = extractedParameters.kyc_status; + const kycVerified = extractedParameters.kyc_verified; + const phoneNo = extractedParameters.phoneNo; + + console.log('Username:', username); + console.log('Email:', email); + console.log('Investment Status:', investmentStatus); + console.log('KYC Status:', kycStatus); + console.log('KYC Verified:', kycVerified); + console.log('Phone Number:', phoneNo); + + return new ReclaimServiceResponse( + providerName, + lastUpdateTimeStamp, + username, + 100, + proof[0] + ); +}; diff --git a/src/services/ZomatoTotalOrdersService.js b/src/services/ZomatoTotalOrdersService.js deleted file mode 100644 index 408d13b..0000000 --- a/src/services/ZomatoTotalOrdersService.js +++ /dev/null @@ -1,19 +0,0 @@ -const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); - -exports.processZomatoData = async (proof, providerName) => { - console.log("Proof is: ", proof[0]); - - const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; - const numberOfOrders = extractedParameters.ordersCount; - const lastUpdateTimeStamp = proof[0].claimData.timestampS; - - console.log('Total Number of orders are: ', numberOfOrders); - - return new ReclaimServiceResponse( - providerName, - lastUpdateTimeStamp, - 'username', - numberOfOrders, - proof[0] - ); -}; diff --git a/src/services/reclaimService.js b/src/services/reclaimService.js index dbb1d42..ef0b48f 100644 --- a/src/services/reclaimService.js +++ b/src/services/reclaimService.js @@ -3,7 +3,7 @@ const { Reclaim } = require('@reclaimprotocol/js-sdk') const { RECLAIM_PROVIDER_ID, RECLAIM_APP_ID } = require('../utils/constants') const { processTwitterData } = require('./twitterService') const { processGitHubData } = require('./githubService') -const { processZomatoData } = require('./ZomatoTotalOrdersService') +const { processGrowwAccountData } = require('./GrowwAccountDataService') exports.signWithProviderID = async (userId, providerId) => { const providerName = RECLAIM_PROVIDER_ID[providerId] @@ -15,10 +15,10 @@ exports.signWithProviderID = async (userId, providerId) => { ) try { - const reclaimClient = new Reclaim.ProofRequest('0xD2bD98049dE5B8b4AD1BD2643a85992e13E4bf34') - await reclaimClient.buildProofRequest('6cadc27b-72cd-4c12-87de-9198fd24456e') + const reclaimClient = new Reclaim.ProofRequest('0x4a5454dD6ff5D5718822251ed27aA797E88c53C9') + await reclaimClient.buildProofRequest('9d4785ab-f71e-4c4c-9b90-32573da992a6') reclaimClient.setSignature( - await reclaimClient.generateSignature('0xca30be77c4c2d796fab31489ba7b4388e87377df92621b4505986efd45e7a656') + await reclaimClient.generateSignature('0x802f4fe1054cee73d042ff7673344075b60cb161e6d0c26fe9cb5568228d496c') ) const { requestUrl: signedUrl } = await reclaimClient.createVerificationRequest() @@ -51,8 +51,8 @@ const handleReclaimSession = async (userId, reclaimClient, providerName) => { case 'GITHUB_ACCOUNT_VERIFICATION': processedData = await processGitHubData(proof, providerName) break - case 'ZOMATO_ACCOUNT_VERIFICATION': - processedData = await processZomatoData(proof, providerName); + case 'GROWW_ACCOUNT_VERIFICATION': + processedData = await processGrowwAccountData(proof, providerName); break default: throw new Error(`No handler for provider: ${providerName}`) diff --git a/src/utils/constants.js b/src/utils/constants.js index e58ca71..8b68b1d 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -1,17 +1,17 @@ exports.RECLAIM_PROVIDER_ID = { twitter: 'TWITTER_ANALYTICS_VIEWS', github: 'GITHUB_ACCOUNT_VERIFICATION', - zomato: 'ZOMATO_ACCOUNT_VERIFICATION' + groww: 'GROWW_ACCOUNT_VERIFICATION' } exports.RECLAIM_APP_ID = { TWITTER_ANALYTICS_VIEWS: 'your-twitter-app-id', GITHUB_ACCOUNT_VERIFICATION: 'your-github-app-id', - ZOMATO_ACCOUNT_VERIFICATION: 'your-zomato-app-id' + GROWW_ACCOUNT_VERIFICATION: 'your-groww-app-id' } exports.PROVIDER_ID = { twitter: 'twitter-provider-id', github: 'github-provider-id', - zomato: 'zomato-provider-id' + groww: 'groww-provider-id' } \ No newline at end of file From 48b223bd2dc98c787d4b250f210c0c00763bc9a9 Mon Sep 17 00:00:00 2001 From: ritik Date: Wed, 24 Jul 2024 14:00:58 +0530 Subject: [PATCH 15/20] Feat: Added Groww Available Balance Verification --- ...tails.md => CRIP-GrowwAvailableBalance.md} | 38 +++++++------------ src/services/GrowwAccountDataService.js | 30 --------------- src/services/GrowwAvailableBalanceService.js | 20 ++++++++++ src/services/reclaimService.js | 8 ++-- 4 files changed, 38 insertions(+), 58 deletions(-) rename CRIP/{CRIP-GrowwAccountDetails.md => CRIP-GrowwAvailableBalance.md} (53%) delete mode 100644 src/services/GrowwAccountDataService.js create mode 100644 src/services/GrowwAvailableBalanceService.js diff --git a/CRIP/CRIP-GrowwAccountDetails.md b/CRIP/CRIP-GrowwAvailableBalance.md similarity index 53% rename from CRIP/CRIP-GrowwAccountDetails.md rename to CRIP/CRIP-GrowwAvailableBalance.md index c0ba869..b5afe53 100644 --- a/CRIP/CRIP-GrowwAccountDetails.md +++ b/CRIP/CRIP-GrowwAvailableBalance.md @@ -1,14 +1,14 @@ | proposal | title | description | author | discussions-to | status | type | category | created | requires | |----------|-------------------------|-----------------------------------------------------|---------------------------|----------------|--------|-------------|----------|------------|----------| -| CRIP-4 | Groww Account Data | Integration with Groww to verify user account data | Ritik Bhatt | | Draft | Integration | CRIP | 2024-07-07 | | +| CRIP-5 | Groww Available Balance | Integration with Groww to verify available balance | Ritik Bhatt | | Draft | Integration | CRIP | 2024-07-07 | | ## Title -Groww Account Data Integration +Groww Available Balance Integration ## Introduction -This proposal outlines the integration of Groww as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process user account data from Groww, allowing users to validate their account details on the Catoff platform. This will enable users to use their Groww account data for various challenges and verifications on Catoff. +This proposal outlines the integration of Groww as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process the available balance data from Groww, allowing users to validate their account balance on the Catoff platform. This will enable users to use their Groww available balance data for various challenges and verifications on Catoff. ## External APIs Needed @@ -16,49 +16,39 @@ This proposal outlines the integration of Groww as a data provider for the Catof ## Use Cases -1. **User Verification**: Verify the user account data on Groww. -2. **Challenge Participation**: Allow users to participate in challenges that require proof of their Groww account details. -3. **Account Status**: Validate users' account status based on their Groww data. +1. **User Verification**: Verify the available balance on a user's Groww account. +2. **Challenge Participation**: Allow users to participate in challenges that require proof of their available balance on Groww. +3. **Financial Status**: Validate users' financial status based on their Groww available balance. ## Data Provider -- **Name**: Groww Account Data +- **Name**: Groww Available Balance - **Hash Value**: 0x8bbe041be479e12ef2efee703fced2f4b605c4a6d69e9957d955bebb92ad30ed ## Code Snippet Below is a code snippet that demonstrates the key parts of the Groww integration. The full implementation should follow the service file template. -**`services/GrowwAccountDataService.js`** +**`services/GrowwAvailableBalanceService.js`** ```javascript const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); -exports.processGrowwAccountData = async (proof, providerName) => { +exports.processGrowwAvailableBalance = async (proof, providerName) => { console.log("Proof is: ", proof[0]); const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; const lastUpdateTimeStamp = proof[0].claimData.timestampS; - const username = extractedParameters.username; - const email = extractedParameters.email; - const investmentStatus = extractedParameters.investment_status; - const kycStatus = extractedParameters.kyc_status; - const kycVerified = extractedParameters.kyc_verified; - const phoneNo = extractedParameters.phoneNo; - - console.log('Username:', username); - console.log('Email:', email); - console.log('Investment Status:', investmentStatus); - console.log('KYC Status:', kycStatus); - console.log('KYC Verified:', kycVerified); - console.log('Phone Number:', phoneNo); + const availableBalance = extractedParameters.availableBalance; + + console.log("The available balance of your Groww account is: ", availableBalance); return new ReclaimServiceResponse( providerName, lastUpdateTimeStamp, - username, - 100, + 'ritikbhatt', + availableBalance, proof[0] ); }; diff --git a/src/services/GrowwAccountDataService.js b/src/services/GrowwAccountDataService.js deleted file mode 100644 index ebaf46d..0000000 --- a/src/services/GrowwAccountDataService.js +++ /dev/null @@ -1,30 +0,0 @@ -const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); - -exports.processGrowwAccountData = async (proof, providerName) => { - console.log("Proof is: ", proof[0]); - - const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; - - const lastUpdateTimeStamp = proof[0].claimData.timestampS; - const username = extractedParameters.username; - const email = extractedParameters.email; - const investmentStatus = extractedParameters.investment_status; - const kycStatus = extractedParameters.kyc_status; - const kycVerified = extractedParameters.kyc_verified; - const phoneNo = extractedParameters.phoneNo; - - console.log('Username:', username); - console.log('Email:', email); - console.log('Investment Status:', investmentStatus); - console.log('KYC Status:', kycStatus); - console.log('KYC Verified:', kycVerified); - console.log('Phone Number:', phoneNo); - - return new ReclaimServiceResponse( - providerName, - lastUpdateTimeStamp, - username, - 100, - proof[0] - ); -}; diff --git a/src/services/GrowwAvailableBalanceService.js b/src/services/GrowwAvailableBalanceService.js new file mode 100644 index 0000000..9bb1b79 --- /dev/null +++ b/src/services/GrowwAvailableBalanceService.js @@ -0,0 +1,20 @@ +const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); + +exports.processGrowwAccountData = async (proof, providerName) => { + console.log("Proof is: ", proof[0]); + + const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; + + const lastUpdateTimeStamp = proof[0].claimData.timestampS; + const availableBalance = extractedParameters.availableBalance; + + console.log("THe available balance of your Groww account is: ", availableBalance); + + return new ReclaimServiceResponse( + providerName, + lastUpdateTimeStamp, + 'ritikbhatt', + availableBalance, + proof[0] + ); +}; diff --git a/src/services/reclaimService.js b/src/services/reclaimService.js index ef0b48f..8617ccb 100644 --- a/src/services/reclaimService.js +++ b/src/services/reclaimService.js @@ -3,7 +3,7 @@ const { Reclaim } = require('@reclaimprotocol/js-sdk') const { RECLAIM_PROVIDER_ID, RECLAIM_APP_ID } = require('../utils/constants') const { processTwitterData } = require('./twitterService') const { processGitHubData } = require('./githubService') -const { processGrowwAccountData } = require('./GrowwAccountDataService') +const { processGrowwAccountData } = require('./GrowwAvailableBalanceService') exports.signWithProviderID = async (userId, providerId) => { const providerName = RECLAIM_PROVIDER_ID[providerId] @@ -15,10 +15,10 @@ exports.signWithProviderID = async (userId, providerId) => { ) try { - const reclaimClient = new Reclaim.ProofRequest('0x4a5454dD6ff5D5718822251ed27aA797E88c53C9') - await reclaimClient.buildProofRequest('9d4785ab-f71e-4c4c-9b90-32573da992a6') + const reclaimClient = new Reclaim.ProofRequest('0xcEb6310D69a18f09bFd2365be833937334Cb424E') + await reclaimClient.buildProofRequest('1faf8c2a-cc18-4150-a7cf-66320971d0fb') reclaimClient.setSignature( - await reclaimClient.generateSignature('0x802f4fe1054cee73d042ff7673344075b60cb161e6d0c26fe9cb5568228d496c') + await reclaimClient.generateSignature('0xf1a58819d01693375e57ee4949adf0eea50b3524ba504e35fd9ea2294045af83') ) const { requestUrl: signedUrl } = await reclaimClient.createVerificationRequest() From 6e599d9addda52c58416a6ce96e772f9c3914c6b Mon Sep 17 00:00:00 2001 From: ritik Date: Wed, 24 Jul 2024 14:35:49 +0530 Subject: [PATCH 16/20] Feat: Integrated Groww Credit Score --- ...bleBalance.md => CRIP-GrowwCreditScore.md} | 26 +++++++++---------- ...eService.js => GrowwCreditScoreService.js} | 8 +++--- src/services/reclaimService.js | 8 +++--- 3 files changed, 21 insertions(+), 21 deletions(-) rename CRIP/{CRIP-GrowwAvailableBalance.md => CRIP-GrowwCreditScore.md} (62%) rename src/services/{GrowwAvailableBalanceService.js => GrowwCreditScoreService.js} (69%) diff --git a/CRIP/CRIP-GrowwAvailableBalance.md b/CRIP/CRIP-GrowwCreditScore.md similarity index 62% rename from CRIP/CRIP-GrowwAvailableBalance.md rename to CRIP/CRIP-GrowwCreditScore.md index b5afe53..c6a18d3 100644 --- a/CRIP/CRIP-GrowwAvailableBalance.md +++ b/CRIP/CRIP-GrowwCreditScore.md @@ -1,14 +1,14 @@ | proposal | title | description | author | discussions-to | status | type | category | created | requires | |----------|-------------------------|-----------------------------------------------------|---------------------------|----------------|--------|-------------|----------|------------|----------| -| CRIP-5 | Groww Available Balance | Integration with Groww to verify available balance | Ritik Bhatt | | Draft | Integration | CRIP | 2024-07-07 | | +| CRIP-6 | Groww Credit Score | Integration with Groww to verify credit score | Ritik Bhatt | | Draft | Integration | CRIP | 2024-07-07 | | ## Title -Groww Available Balance Integration +Groww Credit Score Integration ## Introduction -This proposal outlines the integration of Groww as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process the available balance data from Groww, allowing users to validate their account balance on the Catoff platform. This will enable users to use their Groww available balance data for various challenges and verifications on Catoff. +This proposal outlines the integration of Groww as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process the credit score data from Groww, allowing users to validate their credit scores on the Catoff platform. This will enable users to use their Groww credit score data for various challenges and verifications on Catoff. ## External APIs Needed @@ -16,39 +16,39 @@ This proposal outlines the integration of Groww as a data provider for the Catof ## Use Cases -1. **User Verification**: Verify the available balance on a user's Groww account. -2. **Challenge Participation**: Allow users to participate in challenges that require proof of their available balance on Groww. -3. **Financial Status**: Validate users' financial status based on their Groww available balance. +1. **User Verification**: Verify the credit score on a user's Groww account. +2. **Challenge Participation**: Allow users to participate in challenges that require proof of their credit score on Groww. +3. **Financial Status**: Validate users' financial status based on their Groww credit score. ## Data Provider -- **Name**: Groww Available Balance +- **Name**: Groww Credit Score - **Hash Value**: 0x8bbe041be479e12ef2efee703fced2f4b605c4a6d69e9957d955bebb92ad30ed ## Code Snippet Below is a code snippet that demonstrates the key parts of the Groww integration. The full implementation should follow the service file template. -**`services/GrowwAvailableBalanceService.js`** +**`services/GrowwCreditScoreService.js`** ```javascript const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); -exports.processGrowwAvailableBalance = async (proof, providerName) => { +exports.processGrowwCreditScore = async (proof, providerName) => { console.log("Proof is: ", proof[0]); const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; const lastUpdateTimeStamp = proof[0].claimData.timestampS; - const availableBalance = extractedParameters.availableBalance; + const creditScore = extractedParameters.creditScore; - console.log("The available balance of your Groww account is: ", availableBalance); + console.log("The Credit Score of your Groww account is:", creditScore); return new ReclaimServiceResponse( providerName, lastUpdateTimeStamp, - 'ritikbhatt', - availableBalance, + 'ritikbhatt', + creditScore, proof[0] ); }; diff --git a/src/services/GrowwAvailableBalanceService.js b/src/services/GrowwCreditScoreService.js similarity index 69% rename from src/services/GrowwAvailableBalanceService.js rename to src/services/GrowwCreditScoreService.js index 9bb1b79..8642751 100644 --- a/src/services/GrowwAvailableBalanceService.js +++ b/src/services/GrowwCreditScoreService.js @@ -6,15 +6,15 @@ exports.processGrowwAccountData = async (proof, providerName) => { const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; const lastUpdateTimeStamp = proof[0].claimData.timestampS; - const availableBalance = extractedParameters.availableBalance; + const creditScore = extractedParameters.creditScore; - console.log("THe available balance of your Groww account is: ", availableBalance); + console.log("The Credit Score of your Groww account is:", creditScore); return new ReclaimServiceResponse( providerName, lastUpdateTimeStamp, - 'ritikbhatt', - availableBalance, + 'ritikbhatt', + creditScore, proof[0] ); }; diff --git a/src/services/reclaimService.js b/src/services/reclaimService.js index 8617ccb..cc6a843 100644 --- a/src/services/reclaimService.js +++ b/src/services/reclaimService.js @@ -3,7 +3,7 @@ const { Reclaim } = require('@reclaimprotocol/js-sdk') const { RECLAIM_PROVIDER_ID, RECLAIM_APP_ID } = require('../utils/constants') const { processTwitterData } = require('./twitterService') const { processGitHubData } = require('./githubService') -const { processGrowwAccountData } = require('./GrowwAvailableBalanceService') +const { processGrowwAccountData } = require('./GrowwCreditScoreService') exports.signWithProviderID = async (userId, providerId) => { const providerName = RECLAIM_PROVIDER_ID[providerId] @@ -15,10 +15,10 @@ exports.signWithProviderID = async (userId, providerId) => { ) try { - const reclaimClient = new Reclaim.ProofRequest('0xcEb6310D69a18f09bFd2365be833937334Cb424E') - await reclaimClient.buildProofRequest('1faf8c2a-cc18-4150-a7cf-66320971d0fb') + const reclaimClient = new Reclaim.ProofRequest('0x85f6e6c9C35f5CF960830268361F2153608AE805') + await reclaimClient.buildProofRequest('489bf962-aa43-4ec9-9908-36bb37a5c7e2') reclaimClient.setSignature( - await reclaimClient.generateSignature('0xf1a58819d01693375e57ee4949adf0eea50b3524ba504e35fd9ea2294045af83') + await reclaimClient.generateSignature('0x2616f152a8c3c0ba5c75275b548fa03d39f9546ea9063205c3b8c02ef5430fe9') ) const { requestUrl: signedUrl } = await reclaimClient.createVerificationRequest() From 1c4cd0c35e937cbe32b9aebe0a98a42b28f4e285 Mon Sep 17 00:00:00 2001 From: ritik Date: Wed, 24 Jul 2024 14:59:17 +0530 Subject: [PATCH 17/20] Feat: Integrated Groww Withdrawable Balance --- CRIP/CRIP-GrowwCreditScore.md | 54 ------------------- CRIP/CRIP-GrowwWithdrawableBalance.md | 54 +++++++++++++++++++ ....js => GrowwWithdrawableBalanceService.js} | 6 +-- src/services/reclaimService.js | 8 +-- 4 files changed, 61 insertions(+), 61 deletions(-) delete mode 100644 CRIP/CRIP-GrowwCreditScore.md create mode 100644 CRIP/CRIP-GrowwWithdrawableBalance.md rename src/services/{GrowwCreditScoreService.js => GrowwWithdrawableBalanceService.js} (71%) diff --git a/CRIP/CRIP-GrowwCreditScore.md b/CRIP/CRIP-GrowwCreditScore.md deleted file mode 100644 index c6a18d3..0000000 --- a/CRIP/CRIP-GrowwCreditScore.md +++ /dev/null @@ -1,54 +0,0 @@ -| proposal | title | description | author | discussions-to | status | type | category | created | requires | -|----------|-------------------------|-----------------------------------------------------|---------------------------|----------------|--------|-------------|----------|------------|----------| -| CRIP-6 | Groww Credit Score | Integration with Groww to verify credit score | Ritik Bhatt | | Draft | Integration | CRIP | 2024-07-07 | | - -## Title - -Groww Credit Score Integration - -## Introduction - -This proposal outlines the integration of Groww as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process the credit score data from Groww, allowing users to validate their credit scores on the Catoff platform. This will enable users to use their Groww credit score data for various challenges and verifications on Catoff. - -## External APIs Needed - -- Groww API: Groww doesn't have a public API, so the integration will use data extraction methods from the Groww app/web. - -## Use Cases - -1. **User Verification**: Verify the credit score on a user's Groww account. -2. **Challenge Participation**: Allow users to participate in challenges that require proof of their credit score on Groww. -3. **Financial Status**: Validate users' financial status based on their Groww credit score. - -## Data Provider - -- **Name**: Groww Credit Score -- **Hash Value**: 0x8bbe041be479e12ef2efee703fced2f4b605c4a6d69e9957d955bebb92ad30ed - -## Code Snippet - -Below is a code snippet that demonstrates the key parts of the Groww integration. The full implementation should follow the service file template. - -**`services/GrowwCreditScoreService.js`** - -```javascript -const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); - -exports.processGrowwCreditScore = async (proof, providerName) => { - console.log("Proof is: ", proof[0]); - - const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; - - const lastUpdateTimeStamp = proof[0].claimData.timestampS; - const creditScore = extractedParameters.creditScore; - - console.log("The Credit Score of your Groww account is:", creditScore); - - return new ReclaimServiceResponse( - providerName, - lastUpdateTimeStamp, - 'ritikbhatt', - creditScore, - proof[0] - ); -}; diff --git a/CRIP/CRIP-GrowwWithdrawableBalance.md b/CRIP/CRIP-GrowwWithdrawableBalance.md new file mode 100644 index 0000000..ecd2044 --- /dev/null +++ b/CRIP/CRIP-GrowwWithdrawableBalance.md @@ -0,0 +1,54 @@ +| proposal | title | description | author | discussions-to | status | type | category | created | requires | +|----------|------------------------------|-----------------------------------------------------|---------------------------|----------------|--------|-------------|----------|------------|----------| +| CRIP-7 | Groww Withdrawable Balance | Integration with Groww to verify withdrawable balance | Ritik Bhatt | | Draft | Integration | CRIP | 2024-07-07 | | + +## Title + +Groww Withdrawable Balance Integration + +## Introduction + +This proposal outlines the integration of Groww as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process the withdrawable balance data from Groww, allowing users to validate their available funds on the Catoff platform. This will enable users to use their Groww withdrawable balance data for various challenges and verifications on Catoff. + +## External APIs Needed + +- Groww API: Groww doesn't have a public API, so the integration will use data extraction methods from the Groww app/web. + +## Use Cases + +1. **User Verification**: Verify the withdrawable balance on a user's Groww account. +2. **Challenge Participation**: Allow users to participate in challenges that require proof of their withdrawable balance on Groww. +3. **Financial Status**: Validate users' financial status based on their Groww withdrawable balance. + +## Data Provider + +- **Name**: Groww Withdrawable Balance +- **Hash Value**: 0x8bbe041be479e12ef2efee703fced2f4b605c4a6d69e9957d955bebb92ad30ed + +## Code Snippet + +Below is a code snippet that demonstrates the key parts of the Groww integration. The full implementation should follow the service file template. + +**`services/GrowwWithdrawableBalanceService.js`** + +```javascript +const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); + +exports.processGrowwWithdrawableBalance = async (proof, providerName) => { + console.log("Proof is: ", proof[0]); + + const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; + + const lastUpdateTimeStamp = proof[0].claimData.timestampS; + const withdrawableBalance = extractedParameters.withdrawableBalance; + + console.log("The withdrawable balance of your Groww account is:", withdrawableBalance); + + return new ReclaimServiceResponse( + providerName, + lastUpdateTimeStamp, + 'ritikbhatt', + withdrawableBalance, + proof[0] + ); +}; diff --git a/src/services/GrowwCreditScoreService.js b/src/services/GrowwWithdrawableBalanceService.js similarity index 71% rename from src/services/GrowwCreditScoreService.js rename to src/services/GrowwWithdrawableBalanceService.js index 8642751..5ce9340 100644 --- a/src/services/GrowwCreditScoreService.js +++ b/src/services/GrowwWithdrawableBalanceService.js @@ -6,15 +6,15 @@ exports.processGrowwAccountData = async (proof, providerName) => { const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; const lastUpdateTimeStamp = proof[0].claimData.timestampS; - const creditScore = extractedParameters.creditScore; + const withdrawableBalance = extractedParameters.withdrawableBalance; - console.log("The Credit Score of your Groww account is:", creditScore); + console.log("The Withdrawable Balance of your Groww account is:", withdrawableBalance); return new ReclaimServiceResponse( providerName, lastUpdateTimeStamp, 'ritikbhatt', - creditScore, + withdrawableBalance, proof[0] ); }; diff --git a/src/services/reclaimService.js b/src/services/reclaimService.js index cc6a843..a50eaf8 100644 --- a/src/services/reclaimService.js +++ b/src/services/reclaimService.js @@ -3,7 +3,7 @@ const { Reclaim } = require('@reclaimprotocol/js-sdk') const { RECLAIM_PROVIDER_ID, RECLAIM_APP_ID } = require('../utils/constants') const { processTwitterData } = require('./twitterService') const { processGitHubData } = require('./githubService') -const { processGrowwAccountData } = require('./GrowwCreditScoreService') +const { processGrowwAccountData } = require('./GrowwWithdrawableBalanceService') exports.signWithProviderID = async (userId, providerId) => { const providerName = RECLAIM_PROVIDER_ID[providerId] @@ -15,10 +15,10 @@ exports.signWithProviderID = async (userId, providerId) => { ) try { - const reclaimClient = new Reclaim.ProofRequest('0x85f6e6c9C35f5CF960830268361F2153608AE805') - await reclaimClient.buildProofRequest('489bf962-aa43-4ec9-9908-36bb37a5c7e2') + const reclaimClient = new Reclaim.ProofRequest('0x53202ca25C447ad7c4936C478341BF3d9e6241aD') + await reclaimClient.buildProofRequest('dd6ca178-f01f-4b27-bc5b-473a3bc6937b') reclaimClient.setSignature( - await reclaimClient.generateSignature('0x2616f152a8c3c0ba5c75275b548fa03d39f9546ea9063205c3b8c02ef5430fe9') + await reclaimClient.generateSignature('0x59a726066df60b292a04e7d7d99a951ef34c4357746941c7fbd566c0755c421a') ) const { requestUrl: signedUrl } = await reclaimClient.createVerificationRequest() From b638f49c337ff88886261bf24ba1b2c4f49bc8eb Mon Sep 17 00:00:00 2001 From: ritik Date: Wed, 24 Jul 2024 15:28:15 +0530 Subject: [PATCH 18/20] Feat: Added Groww Ongoing and Closing Balance --- CRIP/CRIP-GrowwOngoingAndClosingBalance.md | 56 +++++++++++++++++++ CRIP/CRIP-GrowwWithdrawableBalance.md | 54 ------------------ ...> GrowwOngoingAndClosingBalanceService.js} | 8 ++- src/services/reclaimService.js | 8 +-- 4 files changed, 65 insertions(+), 61 deletions(-) create mode 100644 CRIP/CRIP-GrowwOngoingAndClosingBalance.md delete mode 100644 CRIP/CRIP-GrowwWithdrawableBalance.md rename src/services/{GrowwWithdrawableBalanceService.js => GrowwOngoingAndClosingBalanceService.js} (59%) diff --git a/CRIP/CRIP-GrowwOngoingAndClosingBalance.md b/CRIP/CRIP-GrowwOngoingAndClosingBalance.md new file mode 100644 index 0000000..1899090 --- /dev/null +++ b/CRIP/CRIP-GrowwOngoingAndClosingBalance.md @@ -0,0 +1,56 @@ +| proposal | title | description | author | discussions-to | status | type | category | created | requires | +|----------|----------------------------------|-------------------------------------------------------------|---------------------------|----------------|--------|-------------|----------|------------|----------| +| CRIP-8 | Groww Ongoing and Closing Balance| Integration with Groww to verify ongoing and closing balances| Ritik Bhatt | | Draft | Integration | CRIP | 2024-07-07 | | + +## Title + +Groww Ongoing and Closing Balance Integration + +## Introduction + +This proposal outlines the integration of Groww as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process the ongoing and closing balance data from Groww, allowing users to validate their financial status on the Catoff platform. This will enable users to use their Groww account balance data for various challenges and verifications on Catoff. + +## External APIs Needed + +- Groww API: Groww doesn't have a public API, so the integration will use data extraction methods from the Groww app/web. + +## Use Cases + +1. **User Verification**: Verify the ongoing and closing balances on a user's Groww account. +2. **Challenge Participation**: Allow users to participate in challenges that require proof of their ongoing and closing balances on Groww. +3. **Financial Status**: Validate users' financial status based on their Groww ongoing and closing balances. + +## Data Provider + +- **Name**: Groww Ongoing and Closing Balance +- **Hash Value**: 0x8bbe041be479e12ef2efee703fced2f4b605c4a6d69e9957d955bebb92ad30ed + +## Code Snippet + +Below is a code snippet that demonstrates the key parts of the Groww integration. The full implementation should follow the service file template. + +**`services/GrowwOngoingAndClosingBalanceService.js`** + +```javascript +const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); + +exports.processGrowwOngoingAndClosingBalance = async (proof, providerName) => { + console.log("Proof is: ", proof[0]); + + const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; + + const lastUpdateTimeStamp = proof[0].claimData.timestampS; + const ongoingBalance = extractedParameters.ongoingTransactionsBalance; + const closingBalance = extractedParameters.closingBalance; + + console.log("The Ongoing Balance of your Groww account is:", ongoingBalance); + console.log("The Closing Balance of your Groww account is:", closingBalance); + + return new ReclaimServiceResponse( + providerName, + lastUpdateTimeStamp, + 'ritikbhatt', + ongoingBalance, + proof[0] + ); +}; diff --git a/CRIP/CRIP-GrowwWithdrawableBalance.md b/CRIP/CRIP-GrowwWithdrawableBalance.md deleted file mode 100644 index ecd2044..0000000 --- a/CRIP/CRIP-GrowwWithdrawableBalance.md +++ /dev/null @@ -1,54 +0,0 @@ -| proposal | title | description | author | discussions-to | status | type | category | created | requires | -|----------|------------------------------|-----------------------------------------------------|---------------------------|----------------|--------|-------------|----------|------------|----------| -| CRIP-7 | Groww Withdrawable Balance | Integration with Groww to verify withdrawable balance | Ritik Bhatt | | Draft | Integration | CRIP | 2024-07-07 | | - -## Title - -Groww Withdrawable Balance Integration - -## Introduction - -This proposal outlines the integration of Groww as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process the withdrawable balance data from Groww, allowing users to validate their available funds on the Catoff platform. This will enable users to use their Groww withdrawable balance data for various challenges and verifications on Catoff. - -## External APIs Needed - -- Groww API: Groww doesn't have a public API, so the integration will use data extraction methods from the Groww app/web. - -## Use Cases - -1. **User Verification**: Verify the withdrawable balance on a user's Groww account. -2. **Challenge Participation**: Allow users to participate in challenges that require proof of their withdrawable balance on Groww. -3. **Financial Status**: Validate users' financial status based on their Groww withdrawable balance. - -## Data Provider - -- **Name**: Groww Withdrawable Balance -- **Hash Value**: 0x8bbe041be479e12ef2efee703fced2f4b605c4a6d69e9957d955bebb92ad30ed - -## Code Snippet - -Below is a code snippet that demonstrates the key parts of the Groww integration. The full implementation should follow the service file template. - -**`services/GrowwWithdrawableBalanceService.js`** - -```javascript -const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); - -exports.processGrowwWithdrawableBalance = async (proof, providerName) => { - console.log("Proof is: ", proof[0]); - - const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; - - const lastUpdateTimeStamp = proof[0].claimData.timestampS; - const withdrawableBalance = extractedParameters.withdrawableBalance; - - console.log("The withdrawable balance of your Groww account is:", withdrawableBalance); - - return new ReclaimServiceResponse( - providerName, - lastUpdateTimeStamp, - 'ritikbhatt', - withdrawableBalance, - proof[0] - ); -}; diff --git a/src/services/GrowwWithdrawableBalanceService.js b/src/services/GrowwOngoingAndClosingBalanceService.js similarity index 59% rename from src/services/GrowwWithdrawableBalanceService.js rename to src/services/GrowwOngoingAndClosingBalanceService.js index 5ce9340..95b22d8 100644 --- a/src/services/GrowwWithdrawableBalanceService.js +++ b/src/services/GrowwOngoingAndClosingBalanceService.js @@ -6,15 +6,17 @@ exports.processGrowwAccountData = async (proof, providerName) => { const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; const lastUpdateTimeStamp = proof[0].claimData.timestampS; - const withdrawableBalance = extractedParameters.withdrawableBalance; + const ongoingBalance = extractedParameters.ongoingTransactionsBalance; + const closingBalance = extractedParameters.closingBalance; - console.log("The Withdrawable Balance of your Groww account is:", withdrawableBalance); + console.log("The Ongoing Balance of your Groww account is:", ongoingBalance); + console.log("The Closing Balance of your Groww account is:", closingBalance); return new ReclaimServiceResponse( providerName, lastUpdateTimeStamp, 'ritikbhatt', - withdrawableBalance, + ongoingBalance, proof[0] ); }; diff --git a/src/services/reclaimService.js b/src/services/reclaimService.js index a50eaf8..cdd4751 100644 --- a/src/services/reclaimService.js +++ b/src/services/reclaimService.js @@ -3,7 +3,7 @@ const { Reclaim } = require('@reclaimprotocol/js-sdk') const { RECLAIM_PROVIDER_ID, RECLAIM_APP_ID } = require('../utils/constants') const { processTwitterData } = require('./twitterService') const { processGitHubData } = require('./githubService') -const { processGrowwAccountData } = require('./GrowwWithdrawableBalanceService') +const { processGrowwAccountData } = require('./GrowwOngoingAndClosingBalanceService') exports.signWithProviderID = async (userId, providerId) => { const providerName = RECLAIM_PROVIDER_ID[providerId] @@ -15,10 +15,10 @@ exports.signWithProviderID = async (userId, providerId) => { ) try { - const reclaimClient = new Reclaim.ProofRequest('0x53202ca25C447ad7c4936C478341BF3d9e6241aD') - await reclaimClient.buildProofRequest('dd6ca178-f01f-4b27-bc5b-473a3bc6937b') + const reclaimClient = new Reclaim.ProofRequest('0xcB19BC6b14DBc09E5837D17e189133f276324497') + await reclaimClient.buildProofRequest('69a25b55-63e2-4fdc-9bb4-d8a1ee8b2ca5') reclaimClient.setSignature( - await reclaimClient.generateSignature('0x59a726066df60b292a04e7d7d99a951ef34c4357746941c7fbd566c0755c421a') + await reclaimClient.generateSignature('0x7b8877b381899bfa1c7da75bc9bef3b8faac5f5fcb17834fa6501bf7665a5f92') ) const { requestUrl: signedUrl } = await reclaimClient.createVerificationRequest() From ea3eeae000f76ed2a1617ade487c5c2fa9f5c672 Mon Sep 17 00:00:00 2001 From: ritik Date: Wed, 24 Jul 2024 17:04:27 +0530 Subject: [PATCH 19/20] Feat: Added Stocks Balance Integration --- CRIP/CRIP-GrowwOngoingAndClosingBalance.md | 56 ------------------- CRIP/CRIP-GrowwStocksBalance.md | 54 ++++++++++++++++++ ...ervice.js => GrowwStocksBalanceService.js} | 8 +-- src/services/reclaimService.js | 8 +-- 4 files changed, 61 insertions(+), 65 deletions(-) delete mode 100644 CRIP/CRIP-GrowwOngoingAndClosingBalance.md create mode 100644 CRIP/CRIP-GrowwStocksBalance.md rename src/services/{GrowwOngoingAndClosingBalanceService.js => GrowwStocksBalanceService.js} (59%) diff --git a/CRIP/CRIP-GrowwOngoingAndClosingBalance.md b/CRIP/CRIP-GrowwOngoingAndClosingBalance.md deleted file mode 100644 index 1899090..0000000 --- a/CRIP/CRIP-GrowwOngoingAndClosingBalance.md +++ /dev/null @@ -1,56 +0,0 @@ -| proposal | title | description | author | discussions-to | status | type | category | created | requires | -|----------|----------------------------------|-------------------------------------------------------------|---------------------------|----------------|--------|-------------|----------|------------|----------| -| CRIP-8 | Groww Ongoing and Closing Balance| Integration with Groww to verify ongoing and closing balances| Ritik Bhatt | | Draft | Integration | CRIP | 2024-07-07 | | - -## Title - -Groww Ongoing and Closing Balance Integration - -## Introduction - -This proposal outlines the integration of Groww as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process the ongoing and closing balance data from Groww, allowing users to validate their financial status on the Catoff platform. This will enable users to use their Groww account balance data for various challenges and verifications on Catoff. - -## External APIs Needed - -- Groww API: Groww doesn't have a public API, so the integration will use data extraction methods from the Groww app/web. - -## Use Cases - -1. **User Verification**: Verify the ongoing and closing balances on a user's Groww account. -2. **Challenge Participation**: Allow users to participate in challenges that require proof of their ongoing and closing balances on Groww. -3. **Financial Status**: Validate users' financial status based on their Groww ongoing and closing balances. - -## Data Provider - -- **Name**: Groww Ongoing and Closing Balance -- **Hash Value**: 0x8bbe041be479e12ef2efee703fced2f4b605c4a6d69e9957d955bebb92ad30ed - -## Code Snippet - -Below is a code snippet that demonstrates the key parts of the Groww integration. The full implementation should follow the service file template. - -**`services/GrowwOngoingAndClosingBalanceService.js`** - -```javascript -const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); - -exports.processGrowwOngoingAndClosingBalance = async (proof, providerName) => { - console.log("Proof is: ", proof[0]); - - const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; - - const lastUpdateTimeStamp = proof[0].claimData.timestampS; - const ongoingBalance = extractedParameters.ongoingTransactionsBalance; - const closingBalance = extractedParameters.closingBalance; - - console.log("The Ongoing Balance of your Groww account is:", ongoingBalance); - console.log("The Closing Balance of your Groww account is:", closingBalance); - - return new ReclaimServiceResponse( - providerName, - lastUpdateTimeStamp, - 'ritikbhatt', - ongoingBalance, - proof[0] - ); -}; diff --git a/CRIP/CRIP-GrowwStocksBalance.md b/CRIP/CRIP-GrowwStocksBalance.md new file mode 100644 index 0000000..ab8e7c8 --- /dev/null +++ b/CRIP/CRIP-GrowwStocksBalance.md @@ -0,0 +1,54 @@ +| proposal | title | description | author | discussions-to | status | type | category | created | requires | +|----------|----------------------------|-----------------------------------------------------------|---------------------------|----------------|--------|-------------|----------|------------|----------| +| CRIP-9 | Groww Stocks Balance | Integration with Groww to verify stocks available balance | Ritik Bhatt | | Draft | Integration | CRIP | 2024-07-07 | | + +## Title + +Groww Stocks Balance Integration + +## Introduction + +This proposal outlines the integration of Groww as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process the stocks available balance data from Groww, allowing users to validate their financial status on the Catoff platform. This will enable users to use their Groww stocks balance data for various challenges and verifications on Catoff. + +## External APIs Needed + +- Groww API: Groww doesn't have a public API, so the integration will use data extraction methods from the Groww app/web. + +## Use Cases + +1. **User Verification**: Verify the stocks available balance on a user's Groww account. +2. **Challenge Participation**: Allow users to participate in challenges that require proof of their stocks available balance on Groww. +3. **Financial Status**: Validate users' financial status based on their Groww stocks available balance. + +## Data Provider + +- **Name**: Groww Stocks Balance +- **Hash Value**: 0x8bbe041be479e12ef2efee703fced2f4b605c4a6d69e9957d955bebb92ad30ed + +## Code Snippet + +Below is a code snippet that demonstrates the key parts of the Groww integration. The full implementation should follow the service file template. + +**`services/GrowwStocksBalanceService.js`** + +```javascript +const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); + +exports.processGrowwStocksBalance = async (proof, providerName) => { + console.log("Proof is: ", proof[0]); + + const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; + + const lastUpdateTimeStamp = proof[0].claimData.timestampS; + const stocksBalance = extractedParameters.stocksAvailableBalance; + + console.log("The Stocks Balance of your Groww account is:", stocksBalance); + + return new ReclaimServiceResponse( + providerName, + lastUpdateTimeStamp, + 'ritikbhatt', + stocksBalance, + proof[0] + ); +}; diff --git a/src/services/GrowwOngoingAndClosingBalanceService.js b/src/services/GrowwStocksBalanceService.js similarity index 59% rename from src/services/GrowwOngoingAndClosingBalanceService.js rename to src/services/GrowwStocksBalanceService.js index 95b22d8..5884e14 100644 --- a/src/services/GrowwOngoingAndClosingBalanceService.js +++ b/src/services/GrowwStocksBalanceService.js @@ -6,17 +6,15 @@ exports.processGrowwAccountData = async (proof, providerName) => { const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; const lastUpdateTimeStamp = proof[0].claimData.timestampS; - const ongoingBalance = extractedParameters.ongoingTransactionsBalance; - const closingBalance = extractedParameters.closingBalance; + const stocksBalance = extractedParameters.stocksAvailableBalance; - console.log("The Ongoing Balance of your Groww account is:", ongoingBalance); - console.log("The Closing Balance of your Groww account is:", closingBalance); + console.log("The Stocks Balance of your Groww account is:", stocksBalance); return new ReclaimServiceResponse( providerName, lastUpdateTimeStamp, 'ritikbhatt', - ongoingBalance, + stocksBalance, proof[0] ); }; diff --git a/src/services/reclaimService.js b/src/services/reclaimService.js index cdd4751..d7e063c 100644 --- a/src/services/reclaimService.js +++ b/src/services/reclaimService.js @@ -3,7 +3,7 @@ const { Reclaim } = require('@reclaimprotocol/js-sdk') const { RECLAIM_PROVIDER_ID, RECLAIM_APP_ID } = require('../utils/constants') const { processTwitterData } = require('./twitterService') const { processGitHubData } = require('./githubService') -const { processGrowwAccountData } = require('./GrowwOngoingAndClosingBalanceService') +const { processGrowwAccountData } = require('./GrowwStocksBalanceService') exports.signWithProviderID = async (userId, providerId) => { const providerName = RECLAIM_PROVIDER_ID[providerId] @@ -15,10 +15,10 @@ exports.signWithProviderID = async (userId, providerId) => { ) try { - const reclaimClient = new Reclaim.ProofRequest('0xcB19BC6b14DBc09E5837D17e189133f276324497') - await reclaimClient.buildProofRequest('69a25b55-63e2-4fdc-9bb4-d8a1ee8b2ca5') + const reclaimClient = new Reclaim.ProofRequest('0xD2790b1e7D3ddaa62A42be567D11b53fd814C662') + await reclaimClient.buildProofRequest('7710692d-12fa-43a3-8807-4268dce2f0ad') reclaimClient.setSignature( - await reclaimClient.generateSignature('0x7b8877b381899bfa1c7da75bc9bef3b8faac5f5fcb17834fa6501bf7665a5f92') + await reclaimClient.generateSignature('0x6b5740e34dd79d58d4b8916a49d74dd6702f46c1df7fce26721cb35b2009a734') ) const { requestUrl: signedUrl } = await reclaimClient.createVerificationRequest() From a23875ba8b566d6bea8b0833f002e5cd618a4538 Mon Sep 17 00:00:00 2001 From: ritik Date: Wed, 24 Jul 2024 21:04:06 +0530 Subject: [PATCH 20/20] Feat: Added Groww Balance on Hold --- CRIP/CRIP-GrowwBalanceOnHold.md | 56 +++++++++++++++++++ CRIP/CRIP-GrowwStocksBalance.md | 54 ------------------ ...ervice.js => GrowwBalanceOnHoldService.js} | 8 ++- src/services/reclaimService.js | 8 +-- 4 files changed, 65 insertions(+), 61 deletions(-) create mode 100644 CRIP/CRIP-GrowwBalanceOnHold.md delete mode 100644 CRIP/CRIP-GrowwStocksBalance.md rename src/services/{GrowwStocksBalanceService.js => GrowwBalanceOnHoldService.js} (58%) diff --git a/CRIP/CRIP-GrowwBalanceOnHold.md b/CRIP/CRIP-GrowwBalanceOnHold.md new file mode 100644 index 0000000..ceb8ac3 --- /dev/null +++ b/CRIP/CRIP-GrowwBalanceOnHold.md @@ -0,0 +1,56 @@ +| proposal | title | description | author | discussions-to | status | type | category | created | requires | +|----------|-----------------------------|-----------------------------------------------------------|---------------------------|----------------|--------|-------------|----------|------------|----------| +| CRIP-10 | Groww Balance On Hold | Integration with Groww to verify balance on hold | Ritik Bhatt | | Draft | Integration | CRIP | 2024-07-07 | | + +## Title + +Groww Balance On Hold Integration + +## Introduction + +This proposal outlines the integration of Groww as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process the balance on hold data from Groww, allowing users to validate their financial status on the Catoff platform. This will enable users to use their Groww balance on hold data for various challenges and verifications on Catoff. + +## External APIs Needed + +- Groww API: Groww doesn't have a public API, so the integration will use data extraction methods from the Groww app/web. + +## Use Cases + +1. **User Verification**: Verify the balance on hold on a user's Groww account. +2. **Challenge Participation**: Allow users to participate in challenges that require proof of their balance on hold on Groww. +3. **Financial Status**: Validate users' financial status based on their Groww balance on hold. + +## Data Provider + +- **Name**: Groww Balance On Hold +- **Hash Value**: 0x8bbe041be479e12ef2efee703fced2f4b605c4a6d69e9957d955bebb92ad30ed + +## Code Snippet + +Below is a code snippet that demonstrates the key parts of the Groww integration. The full implementation should follow the service file template. + +**`services/GrowwBalanceOnHoldService.js`** + +```javascript +const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); + +exports.processGrowwAccountData = async (proof, providerName) => { + console.log("Proof is: ", proof[0]); + + const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; + + const lastUpdateTimeStamp = proof[0].claimData.timestampS; + const balanceOnHold = extractedParameters.balanceOnHold; + const balanceOnHoldForStocks = extractedParameters.balanceOnHoldForStocks; + + console.log("The Balance On Hold of your Groww account is:", balanceOnHold); + console.log("The Balance On Hold For Stocks of your Groww account is:", balanceOnHoldForStocks); + + return new ReclaimServiceResponse( + providerName, + lastUpdateTimeStamp, + 'ritikbhatt', + balanceOnHold, + proof[0] + ); +}; diff --git a/CRIP/CRIP-GrowwStocksBalance.md b/CRIP/CRIP-GrowwStocksBalance.md deleted file mode 100644 index ab8e7c8..0000000 --- a/CRIP/CRIP-GrowwStocksBalance.md +++ /dev/null @@ -1,54 +0,0 @@ -| proposal | title | description | author | discussions-to | status | type | category | created | requires | -|----------|----------------------------|-----------------------------------------------------------|---------------------------|----------------|--------|-------------|----------|------------|----------| -| CRIP-9 | Groww Stocks Balance | Integration with Groww to verify stocks available balance | Ritik Bhatt | | Draft | Integration | CRIP | 2024-07-07 | | - -## Title - -Groww Stocks Balance Integration - -## Introduction - -This proposal outlines the integration of Groww as a data provider for the Catoff-Reclaim integration project. The integration aims to retrieve and process the stocks available balance data from Groww, allowing users to validate their financial status on the Catoff platform. This will enable users to use their Groww stocks balance data for various challenges and verifications on Catoff. - -## External APIs Needed - -- Groww API: Groww doesn't have a public API, so the integration will use data extraction methods from the Groww app/web. - -## Use Cases - -1. **User Verification**: Verify the stocks available balance on a user's Groww account. -2. **Challenge Participation**: Allow users to participate in challenges that require proof of their stocks available balance on Groww. -3. **Financial Status**: Validate users' financial status based on their Groww stocks available balance. - -## Data Provider - -- **Name**: Groww Stocks Balance -- **Hash Value**: 0x8bbe041be479e12ef2efee703fced2f4b605c4a6d69e9957d955bebb92ad30ed - -## Code Snippet - -Below is a code snippet that demonstrates the key parts of the Groww integration. The full implementation should follow the service file template. - -**`services/GrowwStocksBalanceService.js`** - -```javascript -const { ReclaimServiceResponse } = require('../utils/reclaimServiceResponse'); - -exports.processGrowwStocksBalance = async (proof, providerName) => { - console.log("Proof is: ", proof[0]); - - const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; - - const lastUpdateTimeStamp = proof[0].claimData.timestampS; - const stocksBalance = extractedParameters.stocksAvailableBalance; - - console.log("The Stocks Balance of your Groww account is:", stocksBalance); - - return new ReclaimServiceResponse( - providerName, - lastUpdateTimeStamp, - 'ritikbhatt', - stocksBalance, - proof[0] - ); -}; diff --git a/src/services/GrowwStocksBalanceService.js b/src/services/GrowwBalanceOnHoldService.js similarity index 58% rename from src/services/GrowwStocksBalanceService.js rename to src/services/GrowwBalanceOnHoldService.js index 5884e14..fe21d97 100644 --- a/src/services/GrowwStocksBalanceService.js +++ b/src/services/GrowwBalanceOnHoldService.js @@ -6,15 +6,17 @@ exports.processGrowwAccountData = async (proof, providerName) => { const extractedParameters = JSON.parse(proof[0].claimData.context).extractedParameters; const lastUpdateTimeStamp = proof[0].claimData.timestampS; - const stocksBalance = extractedParameters.stocksAvailableBalance; + const balanceOnHold = extractedParameters.balanceOnHold; + const balanceOnHoldForStocks = extractedParameters.balanceOnHoldForStocks; - console.log("The Stocks Balance of your Groww account is:", stocksBalance); + console.log("The Balance On Hold of your Groww account is:", balanceOnHold); + console.log("The Balance On Hold For Stocks of your Groww account is:", balanceOnHoldForStocks); return new ReclaimServiceResponse( providerName, lastUpdateTimeStamp, 'ritikbhatt', - stocksBalance, + balanceOnHold, proof[0] ); }; diff --git a/src/services/reclaimService.js b/src/services/reclaimService.js index d7e063c..ff47517 100644 --- a/src/services/reclaimService.js +++ b/src/services/reclaimService.js @@ -3,7 +3,7 @@ const { Reclaim } = require('@reclaimprotocol/js-sdk') const { RECLAIM_PROVIDER_ID, RECLAIM_APP_ID } = require('../utils/constants') const { processTwitterData } = require('./twitterService') const { processGitHubData } = require('./githubService') -const { processGrowwAccountData } = require('./GrowwStocksBalanceService') +const { processGrowwAccountData } = require('./GrowwBalanceOnHoldService') exports.signWithProviderID = async (userId, providerId) => { const providerName = RECLAIM_PROVIDER_ID[providerId] @@ -15,10 +15,10 @@ exports.signWithProviderID = async (userId, providerId) => { ) try { - const reclaimClient = new Reclaim.ProofRequest('0xD2790b1e7D3ddaa62A42be567D11b53fd814C662') - await reclaimClient.buildProofRequest('7710692d-12fa-43a3-8807-4268dce2f0ad') + const reclaimClient = new Reclaim.ProofRequest('0x8DB7F57E462B89D5392A08dDFFa02cec430974B1') + await reclaimClient.buildProofRequest('3a73fdb0-7a52-4a3b-8df3-21e59bb5c481') reclaimClient.setSignature( - await reclaimClient.generateSignature('0x6b5740e34dd79d58d4b8916a49d74dd6702f46c1df7fce26721cb35b2009a734') + await reclaimClient.generateSignature('0x2028acf98d4529c300cbdc1b7cb52de6e5d45ef48216711a6c3c3a7fe1feec56') ) const { requestUrl: signedUrl } = await reclaimClient.createVerificationRequest()