diff --git a/frontend/bun.lockb b/frontend/bun.lockb index 3a3652f..935f15a 100755 Binary files a/frontend/bun.lockb and b/frontend/bun.lockb differ diff --git a/frontend/package.json b/frontend/package.json index 2a8057b..51035b3 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -25,7 +25,7 @@ "@radix-ui/react-toast": "^1.1.4", "@tailwindcss/aspect-ratio": "^0.4.2", "@vercel/analytics": "^1.0.1", - "@wagmi/cli": "^1.1.0", + "@wagmi/cli": "^1.5.2", "autoprefixer": "^10.4.14", "class-variance-authority": "^0.6.0", "clsx": "^1.2.1", @@ -49,7 +49,7 @@ "tailwindcss-animate": "^1.0.6", "tiled-hexagons": "^1.0.2", "viem": "^1.16.6", - "wagmi": "^1.4.5", + "wagmi": "^1.4.5", "zod": "^3.21.4" }, "devDependencies": { diff --git a/frontend/src/components/tankGame/TankGame.tsx b/frontend/src/components/tankGame/TankGame.tsx index f3c1011..7bdcdbf 100644 --- a/frontend/src/components/tankGame/TankGame.tsx +++ b/frontend/src/components/tankGame/TankGame.tsx @@ -36,9 +36,12 @@ export function TankGame({ address }: { address: `0x${string}` }) { boardSize={settings.data && settings.data!.boardSize} gameAddress={address} /> +
+ +
- {gameState.data === 1 && } + {/* {gameState.data === 1 && } */} {gameState.data === 2 && } {gameState.data !== 2 && }
diff --git a/frontend/src/components/tankGame/Timer.tsx b/frontend/src/components/tankGame/Timer.tsx index 27c1201..07d5d85 100644 --- a/frontend/src/components/tankGame/Timer.tsx +++ b/frontend/src/components/tankGame/Timer.tsx @@ -1,5 +1,6 @@ import { gameViewAddress, + useGameViewGetGameEpoch, useGameViewGetEpoch, useGameViewGetSettings, usePrepareTankGameReveal, @@ -28,6 +29,12 @@ export default function Timer({ address }: { address: `0x${string}` }) { // @ts-ignore address: address, }); + const currentGameEpoch = useGameViewGetGameEpoch({ + watch: true, + // @ts-ignore + address: gameViewAddress[chain?.id as keyof typeof gameViewAddress], + args: [address], + }); const currentEpoch = useGameViewGetEpoch({ watch: true, // @ts-ignore @@ -71,22 +78,25 @@ export default function Timer({ address }: { address: `0x${string}` }) { <> - Current Epoch:{" "} - {currentEpoch.data && - startEpoch.data && - (currentEpoch.data! - startEpoch.data!).toString()} + Current Game Epoch: {currentGameEpoch.data?.toString()} +
+ Current Epoch: {currentEpoch.data?.toString()}
- Time till next epoch:{" "} - {currentEpoch.data && - settings.data && - secondsToHMS( - Number( - getTimeTillNextEpoch( - currentEpoch.data!, - settings.data?.epochSeconds! - ) - ) - )} + {currentGameEpoch ?? currentGameEpoch.data == BigInt(0) ?? ( + <> + Time till next epoch: + {currentEpoch.data && + settings.data && + secondsToHMS( + Number( + getTimeTillNextEpoch( + currentEpoch.data!, + settings.data?.epochSeconds! + ) + ) + )} + + )}
diff --git a/frontend/src/components/treaties/NonAggression.tsx b/frontend/src/components/treaties/NonAggression.tsx index cceed57..9dd7ff4 100644 --- a/frontend/src/components/treaties/NonAggression.tsx +++ b/frontend/src/components/treaties/NonAggression.tsx @@ -3,9 +3,9 @@ import { nonAggressionABI, usePrepareNonAggressionAccept, useNonAggressionAccept, - useGameViewGetEpoch, gameViewAddress, useGameViewGetGameEpoch, + usePrepareITreatyAccept, } from "@/src/generated"; import { useState, useEffect } from "react"; import { Address, BaseError } from "viem"; @@ -94,9 +94,11 @@ export default function NonAggression({ }; getLogs(); }, [hookAddress, blockNumber, epoch]); + + const tankName = useTankNameFromId(gameAddress, tankId); const { config: acceptConfig } = usePrepareNonAggressionAccept({ - args: [tankId, hookAddress], - address: ownerHookAddress, // should be MY hook address + args: [tankId, hookAddress], // the information for the treaty we want to accept + address: ownerHookAddress, // MY hook address }); const { write: accept, data: acceptData } = useNonAggressionAccept(acceptConfig); @@ -119,7 +121,6 @@ export default function NonAggression({ }, }); - const tankName = useTankNameFromId(gameAddress, tankId); return (
{treaties && @@ -186,7 +187,9 @@ function BountyComponent({