From 97e46108cc7113b16f5a923c0ac302d78e68a1e4 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Thu, 29 Jul 2021 03:05:05 -0300 Subject: [PATCH] Set london hardfork block numbers per network id --- src/special/London.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/special/London.tsx b/src/special/London.tsx index 77b48cc..65e7ba4 100644 --- a/src/special/London.tsx +++ b/src/special/London.tsx @@ -3,22 +3,29 @@ import { useLatestBlock } from "../useLatestBlock"; import { RuntimeContext } from "../useRuntime"; import Countdown from "./Countdown"; -const londonBlockNumber = 12965000; +const londonBlockNumber: { [chainId: string]: number } = { + "1": 12965000, + "3": 10499401, + "4": 8897988, + "5": 5062605, +}; const London: React.FC = () => { const { provider } = useContext(RuntimeContext); const block = useLatestBlock(provider); - if (!block) { + if (!provider || !block) { return <>; } // Display countdown - if (provider && block.number < londonBlockNumber) { + const targetBlockNumber = + londonBlockNumber[provider.network.chainId.toString()]; + if (block.number < targetBlockNumber) { return ( ); }