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

feat: fix create claim #343

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/components/bounty/ClaimItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export default function ClaimItem({
});
if (accepted) {
bounty.refetch();
return;
}
await new Promise((resolve) => setTimeout(resolve, 1_000));
}
Expand Down
19 changes: 11 additions & 8 deletions src/components/global/FormClaim.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export default function FormClaim({
'image/jpeg': ['.jpg', '.jpeg'],
'image/heic': ['.heic'],
},
disabled: !!imageURI,
});

const handleImageUpload = async (file: File) => {
Expand Down Expand Up @@ -134,13 +133,17 @@ export default function FormClaim({

const log = receipt.logs
.map((log) => {
return decodeEventLog({
abi,
data: log.data,
topics: log.topics,
});
try {
return decodeEventLog({
abi,
data: log.data,
topics: log.topics,
});
} catch (e) {
return null;
}
})
.find((log) => log.eventName === 'ClaimCreated');
.find((log) => log?.eventName === 'ClaimCreated');

if (!log) {
throw new Error('No logs found');
Expand Down Expand Up @@ -183,7 +186,7 @@ export default function FormClaim({
<>
<Loading open={createClaimMutations.isPending} status={status} />
<Dialog
open={open}
open={!createClaimMutations.isPending && open}
onClose={onClose}
maxWidth='xs'
PaperProps={{
Expand Down
Loading