From 73cda93f1e9169674e139a9b034e7b5a4c3fcb01 Mon Sep 17 00:00:00 2001 From: Avelous Ujiri <86206128+Avelous@users.noreply.github.com> Date: Sat, 2 Mar 2024 15:09:28 +0100 Subject: [PATCH 1/4] Merge from main (#31) From 9d9883a42c0d78b048d361e113cae330e770661e Mon Sep 17 00:00:00 2001 From: Avelous Ujiri <86206128+Avelous@users.noreply.github.com> Date: Thu, 14 Mar 2024 22:40:26 +0100 Subject: [PATCH 2/4] Fixed sweeping gas handling following EIP-4844 upgrades on optimism (#35) * Fixed gas issues following EIP-4844 upgrade on optimism --- packages/nextjs/hooks/useSweepWallet.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/nextjs/hooks/useSweepWallet.tsx b/packages/nextjs/hooks/useSweepWallet.tsx index 5aad943..fedefe4 100644 --- a/packages/nextjs/hooks/useSweepWallet.tsx +++ b/packages/nextjs/hooks/useSweepWallet.tsx @@ -43,8 +43,8 @@ const useSweepWallet = ({ game, token }: { game?: Game; token?: string }) => { const gasPrice = await provider.getGasPrice(); - const gasLimit = 21000000; - let gasCost = gasPrice.mul(42000000); // gasLimit * 2 + const gasLimit = 21000; + let gasCost = gasPrice.mul(42000); // gasLimit * 2 let totalToSend = balance.sub(gasCost); @@ -90,7 +90,7 @@ const useSweepWallet = ({ game, token }: { game?: Game; token?: string }) => { setIsSweeping(false); } catch (error: any) { try { - gasCost = gasPrice.mul(84000000); // gasLimit * 4 + gasCost = gasPrice.mul(84000); // gasLimit * 4 totalToSend = balance.sub(gasCost); @@ -124,7 +124,7 @@ const useSweepWallet = ({ game, token }: { game?: Game; token?: string }) => { setIsSweeping(false); } catch (error: any) { try { - gasCost = gasPrice.mul(168000000); // gasLimit * 8 + gasCost = gasPrice.mul(168000); // gasLimit * 8 totalToSend = balance.sub(gasCost); From 57bc9431edad2f84fa510751c154b2a9776ff4eb Mon Sep 17 00:00:00 2001 From: Avelous Ujiri <86206128+Avelous@users.noreply.github.com> Date: Tue, 19 Mar 2024 19:51:17 +0100 Subject: [PATCH 3/4] Pk dice updates (#36) * Added a welcome roll section to home screen, set theme to light mode only, removed ai background & responsive UI updates --- packages/nextjs/components/Footer.tsx | 21 +-- packages/nextjs/components/Header.tsx | 8 +- packages/nextjs/components/SwitchTheme.tsx | 2 +- packages/nextjs/components/Wallet.tsx | 4 +- .../components/dicedemo/GameCreateForm.tsx | 6 +- .../components/dicedemo/GameJoinForm.tsx | 17 +-- .../{Congrats.tsx => PlayerAnnoucement.tsx} | 4 +- .../components/dicedemo/WelcomeRoll.tsx | 143 ++++++++++++++++++ .../RainbowKitCustomConnectButton.tsx | 4 +- packages/nextjs/pages/_app.tsx | 12 +- packages/nextjs/pages/game/[id].tsx | 86 ++++------- packages/nextjs/pages/index.tsx | 77 +++++----- packages/nextjs/tailwind.config.js | 20 ++- packages/nextjs/utils/diceDemo/gameUtils.ts | 15 ++ 14 files changed, 270 insertions(+), 149 deletions(-) rename packages/nextjs/components/dicedemo/{Congrats.tsx => PlayerAnnoucement.tsx} (97%) create mode 100644 packages/nextjs/components/dicedemo/WelcomeRoll.tsx create mode 100644 packages/nextjs/utils/diceDemo/gameUtils.ts diff --git a/packages/nextjs/components/Footer.tsx b/packages/nextjs/components/Footer.tsx index f15f646..7b8cf2d 100644 --- a/packages/nextjs/components/Footer.tsx +++ b/packages/nextjs/components/Footer.tsx @@ -1,21 +1,22 @@ -import { hardhat } from "wagmi/chains"; -import { CurrencyDollarIcon } from "@heroicons/react/24/outline"; +// import { hardhat } from "wagmi/chains"; +// import { CurrencyDollarIcon } from "@heroicons/react/24/outline"; import { HeartIcon } from "@heroicons/react/24/outline"; -import { SwitchTheme } from "~~/components/SwitchTheme"; -import { Faucet } from "~~/components/scaffold-eth"; -import { useGlobalState } from "~~/services/store/store"; -import { getTargetNetwork } from "~~/utils/scaffold-eth"; + +// import { SwitchTheme } from "~~/components/SwitchTheme"; +// import { Faucet } from "~~/components/scaffold-eth"; +// import { useGlobalState } from "~~/services/store/store"; +// import { getTargetNetwork } from "~~/utils/scaffold-eth"; /** * Site footer */ export const Footer = () => { - const nativeCurrencyPrice = useGlobalState(state => state.nativeCurrencyPrice); + // const nativeCurrencyPrice = useGlobalState(state => state.nativeCurrencyPrice); const codeLink = "https://github.com/BuidlGuidl/private-key-dice"; return ( -