Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed quest chain proof submission #1738

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading