Skip to content

Commit

Permalink
battle testing dapp
Browse files Browse the repository at this point in the history
  • Loading branch information
sirnicolaz committed Nov 5, 2024
1 parent c122a3b commit 1dba8a6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
9 changes: 9 additions & 0 deletions web/src/Puzzle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ function Puzzle(props: PuzzleProps) {
duration: null,
isClosable: true,
});
} else if (gelatoStatus === "success") {
toast.closeAll();
toast({
title: "Success!",
description: `Transaction finalized. Congrats!`,
status: "success",
duration: 9000,
isClosable: true,
});
}
}, [gelatoStatus]);

Expand Down
8 changes: 5 additions & 3 deletions web/src/hooks/gelato.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export function useSubmitSolution(

function handleTaskStateChange() {
const taskState = taskStatus?.taskState as string;

console.log(taskState);
if (
["CheckPending", "ExecPending", "WaitingForConfirmation"].includes(
taskState
Expand Down Expand Up @@ -110,11 +112,12 @@ export function useSubmitSolution(
status: Status | undefined,
info?: { data?: string; error?: string }
) {
console.log(`status ${status}`);
setStatus(status);
setError(info?.error);
setData(info?.data);
setPolling(false);
if (status == "error") {
if (status == "error" || submitFunctionName === "submitKey") {
setTaskStatus(undefined);
}
}
Expand All @@ -123,7 +126,6 @@ export function useSubmitSolution(
console.log(index);
console.log(solution);
console.log(address);
console.log(taskStatus);
if (
solution !== "" &&
address &&
Expand All @@ -133,7 +135,7 @@ export function useSubmitSolution(
) {
relay();
}
}, [solution, address, signer, taskStatus, index]);
}, [solution, address, signer, index]);

useEffect(() => {
if (taskStatus) {
Expand Down

0 comments on commit 1dba8a6

Please sign in to comment.