From 6edc788492b7d60eac7d56b9d4e2af4d44fc4976 Mon Sep 17 00:00:00 2001 From: Andros Date: Tue, 23 Jan 2024 11:47:19 -0800 Subject: [PATCH] fix: add fragment types --- .../src/components/CreateTemplate/helpers.ts | 2 +- wondrous-bot-admin/src/graphql/fragments/quest.ts | 1 + .../src/utils/transformQuestConfig.ts | 14 +++++++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/wondrous-bot-admin/src/components/CreateTemplate/helpers.ts b/wondrous-bot-admin/src/components/CreateTemplate/helpers.ts index 630a1ad7c..e2d43b239 100644 --- a/wondrous-bot-admin/src/components/CreateTemplate/helpers.ts +++ b/wondrous-bot-admin/src/components/CreateTemplate/helpers.ts @@ -115,7 +115,7 @@ const processSteps = (steps) => next.type === TYPES.VERIFY_FHENIX_FAUCET_INTERACTION || next.type === TYPES.VERIFY_FHENIX_WALLET_GAS_USAGE ) { - step.prompt = next.value?.prompt; + step.prompt = next.value; step["additionalData"] = { chain: "fhenix", }; diff --git a/wondrous-bot-admin/src/graphql/fragments/quest.ts b/wondrous-bot-admin/src/graphql/fragments/quest.ts index 651511a38..5c8ee6974 100644 --- a/wondrous-bot-admin/src/graphql/fragments/quest.ts +++ b/wondrous-bot-admin/src/graphql/fragments/quest.ts @@ -240,6 +240,7 @@ export const QuestFragment = gql` discordEventId minDuration usdValue + gitcoinPassportMinimumScoreThreshold } } } diff --git a/wondrous-bot-admin/src/utils/transformQuestConfig.ts b/wondrous-bot-admin/src/utils/transformQuestConfig.ts index bae465a6a..726c07461 100644 --- a/wondrous-bot-admin/src/utils/transformQuestConfig.ts +++ b/wondrous-bot-admin/src/utils/transformQuestConfig.ts @@ -46,7 +46,7 @@ type InputQuestStep = { discordEventId?: string; minDuration?: number; usdValue?: number; - minimumThreshold?: number; + gitcoinPassportMinimumScoreThreshold?: number; }; }; @@ -135,7 +135,7 @@ type OutputQuestStep = { } | { prompt?: string; - minimumThreshold?: number; + gitcoinPassportMinimumScoreThreshold?: number; }; }; @@ -256,10 +256,18 @@ export function transformQuestConfig(obj: InputQuestStep[]): OutputQuestStep[] { } else if (step.type === TYPES.REFERRAL) { outputStep.value = step?.prompt; } else if (step.type === TYPES.VERIFY_GITCOIN_PASSPORT_SCORE) { + console.log("step", step); outputStep.value = { prompt: step?.prompt, - minimumThreshold: step?.additionalData?.minimumThreshold, + gitcoinPassportMinimumScoreThreshold: step?.additionalData?.gitcoinPassportMinimumScoreThreshold, }; + } else if ( + step.type === TYPES.VERIFY_FHENIX_ACTIVE_WALLET || + step.type === TYPES.VERIFY_FHENIX_CONTRACTS_CREATED || + step.type === TYPES.VERIFY_FHENIX_FAUCET_INTERACTION || + step.type === TYPES.VERIFY_FHENIX_WALLET_GAS_USAGE + ) { + outputStep.value = step?.prompt; } else if (step.type === TYPES.DATA_COLLECTION) { const dataCollectionType = step?.additionalData?.dataCollectionType; outputStep.value = {