Set london hardfork block numbers per network id

This commit is contained in:
Willian Mitsuda 2021-07-29 03:05:05 -03:00
parent 49315ec7e7
commit 97e46108cc
1 changed files with 11 additions and 4 deletions

View File

@ -3,22 +3,29 @@ import { useLatestBlock } from "../useLatestBlock";
import { RuntimeContext } from "../useRuntime"; import { RuntimeContext } from "../useRuntime";
import Countdown from "./Countdown"; 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 London: React.FC = () => {
const { provider } = useContext(RuntimeContext); const { provider } = useContext(RuntimeContext);
const block = useLatestBlock(provider); const block = useLatestBlock(provider);
if (!block) { if (!provider || !block) {
return <></>; return <></>;
} }
// Display countdown // Display countdown
if (provider && block.number < londonBlockNumber) { const targetBlockNumber =
londonBlockNumber[provider.network.chainId.toString()];
if (block.number < targetBlockNumber) {
return ( return (
<Countdown <Countdown
provider={provider} provider={provider}
currentBlock={block} currentBlock={block}
targetBlock={londonBlockNumber} targetBlock={targetBlockNumber}
/> />
); );
} }