From 0ef39019588b8258a12990f3617b8c4812df1ce9 Mon Sep 17 00:00:00 2001 From: Avelous Ujiri <86206128+Avelous@users.noreply.github.com> Date: Thu, 14 Mar 2024 22:42:28 +0100 Subject: [PATCH] Staging (#34) * Merge from main (#31) * 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);