mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
38 lines
817 B
TypeScript
38 lines
817 B
TypeScript
import type { Feature } from './types';
|
|
|
|
import { getEnvValue } from '../utils';
|
|
import megaEthFeature from './mega-eth';
|
|
|
|
const title = 'Flashblocks';
|
|
|
|
const socketUrl = getEnvValue('NEXT_PUBLIC_FLASHBLOCKS_SOCKET_URL');
|
|
|
|
const config: Feature<{ socketUrl: string; type: 'optimism' | 'megaEth'; name: string }> = (() => {
|
|
if (megaEthFeature.isEnabled && megaEthFeature.socketUrl.rpc) {
|
|
return Object.freeze({
|
|
title,
|
|
isEnabled: true,
|
|
socketUrl: megaEthFeature.socketUrl.rpc,
|
|
type: 'megaEth',
|
|
name: 'mini-block',
|
|
});
|
|
}
|
|
|
|
if (socketUrl) {
|
|
return Object.freeze({
|
|
title,
|
|
isEnabled: true,
|
|
socketUrl,
|
|
type: 'optimism',
|
|
name: 'flashblock',
|
|
});
|
|
}
|
|
|
|
return Object.freeze({
|
|
title,
|
|
isEnabled: false,
|
|
});
|
|
})();
|
|
|
|
export default config;
|