diff --git a/src/components/AccountModule/connection-hooks.js b/src/components/AccountModule/connection-hooks.js index 21718cf4e..299ce4795 100644 --- a/src/components/AccountModule/connection-hooks.js +++ b/src/components/AccountModule/connection-hooks.js @@ -63,7 +63,6 @@ export function useWalletConnectionDetails( ) { const { walletNetworkName, hasNetworkMismatch } = useNetworkConnectionData() const theme = useTheme() - let connectionDetails = {} const isWalletAndClientSynced = Math.abs(walletSyncDelay - clientSyncDelay) <= OK_PROVIDER_SYNC_DELAY const networkSlowdown = @@ -71,6 +70,16 @@ export function useWalletConnectionDetails( clientSyncDelay >= MILD_PROVIDER_SYNC_DELAY && isWalletAndClientSynced + const connectionDetails = { + connectionMessage: `Connected to ${walletNetworkName}`, + connectionMessageLong: `Connected to Ethereum ${walletNetworkName} Network`, + connectionColor: theme.positive, + } + + if (clientListening && !network.live) { + return connectionDetails + } + if ( !clientListening || !walletListening || @@ -80,7 +89,7 @@ export function useWalletConnectionDetails( clientSyncDelay >= MAX_PROVIDER_SYNC_DELAY || walletSyncDelay >= MAX_PROVIDER_SYNC_DELAY ) { - connectionDetails = { + return { connectionMessage: 'No connection', connectionMessageLong: 'No connection', connectionColor: theme.negative, @@ -89,24 +98,19 @@ export function useWalletConnectionDetails( walletSyncDelay >= OK_PROVIDER_SYNC_DELAY || clientSyncDelay >= OK_PROVIDER_SYNC_DELAY ) { - connectionDetails = { + return { connectionMessage: 'Syncing issues', connectionMessageLong: 'Syncing issues', connectionColor: theme.warning, } } else if (hasNetworkMismatch) { - connectionDetails = { + return { connectionMessage: 'Wrong network', connectionMessageLong: 'Wrong network', connectionColor: theme.warning, } - } else { - connectionDetails = { - connectionMessage: `Connected to ${walletNetworkName}`, - connectionMessageLong: `Connected to Ethereum ${walletNetworkName} Network`, - connectionColor: theme.positive, - } } + return connectionDetails } @@ -215,6 +219,16 @@ export function useSyncState( const minimumTransactionBalance = new BN(0.005) + const syncedStatus = { + header: 'Synced', + info: currentBlock ? `: current block ${currentBlock}` : '', + status: STATUS_CONNECTION_OK, + } + + if (clientListening && !network.live) { + return syncedStatus + } + if (!clientOnline || !clientListening) { return { header: '', @@ -255,9 +269,5 @@ export function useSyncState( } } - return { - header: 'Synced', - info: currentBlock ? `: current block ${currentBlock}` : '', - status: STATUS_CONNECTION_OK, - } + return syncedStatus } diff --git a/src/network-config.js b/src/network-config.js index db106f6dc..aa0cd5def 100644 --- a/src/network-config.js +++ b/src/network-config.js @@ -23,6 +23,7 @@ export const networkConfigs = { name: 'Mainnet', shortName: 'Mainnet', type: 'main', // as returned by web3.eth.net.getNetworkType() + live: true, }, providers: [ { id: 'provided' }, @@ -44,6 +45,7 @@ export const networkConfigs = { name: 'Rinkeby testnet', shortName: 'Rinkeby', type: 'rinkeby', // as returned by web3.eth.net.getNetworkType() + live: true, }, // providers: ['injected', 'frame'], providers: [ @@ -66,6 +68,7 @@ export const networkConfigs = { name: 'Ropsten testnet', shortName: 'Ropsten', type: 'ropsten', // as returned by web3.eth.net.getNetworkType() + live: true, }, providers: [{ id: 'provided' }, { id: 'frame' }], }, @@ -84,6 +87,7 @@ export const networkConfigs = { name: 'local testnet', shortName: 'Local', type: 'private', + live: false, }, providers: [{ id: 'provided' }, { id: 'frame' }], }, @@ -102,6 +106,7 @@ export const networkConfigs = { name: 'xDai', shortName: 'xdai', type: 'private', + live: true, }, providers: [ { id: 'provided' }, @@ -120,6 +125,7 @@ export const networkConfigs = { name: `Unknown network`, shortName: 'Unknown', type: 'unknown', + live: false, }, providers: [{ id: 'provided' }, { id: 'frame' }], },