Set london hardfork block numbers per network id
This commit is contained in:
parent
49315ec7e7
commit
97e46108cc
|
@ -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 (
|
||||
<Countdown
|
||||
provider={provider}
|
||||
currentBlock={block}
|
||||
targetBlock={londonBlockNumber}
|
||||
targetBlock={targetBlockNumber}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue