Skip to content

Commit

Permalink
fixed quest chain proof submission
Browse files Browse the repository at this point in the history
  • Loading branch information
dan13ram committed Feb 29, 2024
1 parent 73ce815 commit c169e0b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/web/components/QuestChain/UploadProof.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ export const UploadProof: React.FC<{
files.length ? await metadataUploader.uploadFiles(files) : '',
imageFile ? await metadataUploader.uploadFiles([imageFile]) : '',
]);

const quest = questChain.quests.find((q) => q.id === questId);

if (!quest) {
throw new Error('Quest not found');
}

const metadata: Metadata = {
name: `Submission - QuestChain - ${questChain.name} - Quest - ${questId}. ${name} User - ${address}`,
description: proofDescRef.current,
Expand All @@ -111,9 +118,10 @@ export const UploadProof: React.FC<{
questChain.version,
provider.getSigner(),
);

const tx = await (questChain.version === '0'
? (contract as contracts.V0.QuestChain).submitProof(questId, details)
: (contract as contracts.V1.QuestChain).submitProofs([0], [details]));
? (contract as contracts.V0.QuestChain).submitProof(quest.questId, details)
: (contract as contracts.V1.QuestChain).submitProofs([quest.questId], [details]));
addToast({
description: 'Transaction submitted. Waiting for 1 block confirmation',
duration: null,
Expand Down

0 comments on commit c169e0b

Please sign in to comment.