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/2] 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/2] 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);