Skip to content

Commit 8175c92

Browse files
feat(evm,chain): add auto-reload when passing hardforks
1 parent 4cdf0dd commit 8175c92

File tree

2 files changed

+53
-52
lines changed

2 files changed

+53
-52
lines changed

apps/evm/src/App/index.tsx

Lines changed: 53 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import { opBnbTestnetFourierForkTimestamp } from '@venusprotocol/chains';
2-
31
import { QueryClientProvider } from '@tanstack/react-query';
42
import { queryClient } from 'clients/api';
53
import config from 'config';
4+
import { useChain } from 'hooks/useChain';
65
import { AnalyticProvider } from 'libs/analytics';
76
import { ErrorBoundary } from 'libs/errors';
87
import { SentryErrorInfo } from 'libs/errors/SentryErrorInfo';
98
import { Web3Wrapper } from 'libs/wallet';
10-
import { Suspense } from 'react';
9+
import { Suspense, useMemo } from 'react';
1110
import { Helmet } from 'react-helmet';
1211
import { HashRouter } from 'react-router';
1312
import { safeLazyLoad } from 'utilities';
@@ -22,61 +21,65 @@ const GaslessChecker = safeLazyLoad(() => import('containers/GaslessChecker'));
2221
const ResendPayingGasModal = safeLazyLoad(() => import('containers/ResendPayingGasModal'));
2322
const ImportPositionsModal = safeLazyLoad(() => import('containers/ImportPositionsModal'));
2423

25-
const App = () => (
26-
<>
27-
{
28-
// Only index production with search engines
29-
config.environment !== 'production' && (
30-
<Helmet>
31-
<meta name="robots" content="noindex" />
32-
</Helmet>
33-
)
34-
}
24+
const App = () => {
25+
const { hardforks } = useChain();
26+
const upgradeTimestamps = useMemo(
27+
() => hardforks?.map(hardfork => new Date(hardfork.startTimestamp)) ?? [],
28+
[hardforks],
29+
);
30+
31+
return (
32+
<>
33+
{
34+
// Only index production with search engines
35+
config.environment !== 'production' && (
36+
<Helmet>
37+
<meta name="robots" content="noindex" />
38+
</Helmet>
39+
)
40+
}
3541

36-
<HashRouter>
37-
<MuiThemeProvider>
38-
<QueryClientProvider client={queryClient}>
39-
<ErrorBoundary>
40-
<Web3Wrapper>
41-
<AnalyticProvider>
42-
<Routes />
42+
<HashRouter>
43+
<MuiThemeProvider>
44+
<QueryClientProvider client={queryClient}>
45+
<ErrorBoundary>
46+
<Web3Wrapper>
47+
<AnalyticProvider>
48+
<Routes />
4349

44-
<Suspense>
45-
<NotificationCenter />
46-
</Suspense>
50+
<Suspense>
51+
<NotificationCenter />
52+
</Suspense>
4753

48-
<Suspense>
49-
<AppVersionChecker />
50-
</Suspense>
54+
<Suspense>
55+
<AppVersionChecker />
56+
</Suspense>
5157

52-
<Suspense>
53-
<GaslessChecker />
54-
</Suspense>
58+
<Suspense>
59+
<GaslessChecker />
60+
</Suspense>
5561

56-
<Suspense>
57-
<ResendPayingGasModal />
58-
</Suspense>
62+
<Suspense>
63+
<ResendPayingGasModal />
64+
</Suspense>
5965

60-
<Suspense>
61-
<ImportPositionsModal />
62-
</Suspense>
66+
<Suspense>
67+
<ImportPositionsModal />
68+
</Suspense>
6369

64-
<ThemeHandler />
70+
<ThemeHandler />
6571

66-
<ChainUpgradeHandler
67-
upgradeTimestamps={
68-
config.network === 'testnet' ? [opBnbTestnetFourierForkTimestamp] : []
69-
}
70-
/>
72+
<ChainUpgradeHandler upgradeTimestamps={upgradeTimestamps} />
7173

72-
<SentryErrorInfo />
73-
</AnalyticProvider>
74-
</Web3Wrapper>
75-
</ErrorBoundary>
76-
</QueryClientProvider>
77-
</MuiThemeProvider>
78-
</HashRouter>
79-
</>
80-
);
74+
<SentryErrorInfo />
75+
</AnalyticProvider>
76+
</Web3Wrapper>
77+
</ErrorBoundary>
78+
</QueryClientProvider>
79+
</MuiThemeProvider>
80+
</HashRouter>
81+
</>
82+
);
83+
};
8184

8285
export default App;

packages/chains/src/chains/chainMetadata/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { iconSrcs } from '../../generated/manifests/chainIcons';
22
import { bnb, eth } from '../../tokens/nativeTokens';
33
import { type Chain, ChainId } from '../../types';
44

5-
export const opBnbTestnetFourierForkTimestamp = new Date('2025-11-06T03:00:00Z');
6-
75
export const chains: Record<ChainId, Chain> = {
86
[ChainId.BSC_MAINNET]: {
97
name: 'BNB Chain',

0 commit comments

Comments
 (0)