Skip to content

Commit

Permalink
rm ishardhat
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanmino committed Aug 29, 2024
1 parent 26ac83a commit 88372af
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
9 changes: 0 additions & 9 deletions src/handlers/web3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,6 @@ export const isL2Chain = ({ chainId }: { chainId: ChainId }): boolean => {
return getNetworkObject({ chainId }).networkType === 'layer2';
};

/**
* @desc Checks whether a provider is HardHat.
* @param providerUrl The provider URL.
* @return Whether or not the provider is HardHat.
*/
export const isHardHat = (providerUrl: string): boolean => {
return providerUrl?.startsWith('http://') && providerUrl?.endsWith('8545');
};

/**
* @desc Checks if the given network is a testnet.
* @param network The network to check.
Expand Down
6 changes: 2 additions & 4 deletions src/redux/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { ThunkDispatch } from 'redux-thunk';
import { io, Socket } from 'socket.io-client';
import { getRemoteConfig } from '@/model/remoteConfig';
import { AppGetState, AppState } from './store';
import { getProvider, isHardHat } from '@/handlers/web3';
import { ChainId } from '@/networks/types';
import { useConnectedToHardhatStore } from '@/state/connectedToHardhat';

// -- Constants --------------------------------------- //
const EXPLORER_UPDATE_SOCKETS = 'explorer/EXPLORER_UPDATE_SOCKETS';
Expand Down Expand Up @@ -118,9 +118,7 @@ export const explorerInit = () => (dispatch: ThunkDispatch<AppState, unknown, Ex
dispatch(explorerUnsubscribe());
}

const provider = getProvider({ chainId });
const providerUrl = provider?.connection?.url;
if (isHardHat(providerUrl) || chainId !== ChainId.mainnet) {
if (useConnectedToHardhatStore.getState().connectedToHardhat || chainId !== ChainId.mainnet) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/redux/gas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
} from '@/entities';

import { rainbowMeteorologyGetData } from '@/handlers/gasFees';
import { getProvider, isHardHat, toHex } from '@/handlers/web3';
import { getProvider, toHex } from '@/handlers/web3';
import {
defaultGasParamsFormat,
gweiToWei,
Expand Down

0 comments on commit 88372af

Please sign in to comment.