Skip to content

Commit

Permalink
Merge pull request #57 from QuickSwap/issue/fix-mumbai-testnet
Browse files Browse the repository at this point in the history
Fix frontend on mumbai testnet
  • Loading branch information
totop716 authored Jan 27, 2022
2 parents 0b7f35d + 7143a15 commit b790eb8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
9 changes: 4 additions & 5 deletions src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useMemo, useState } from 'react';
import { ChainId } from '@uniswap/sdk';
import { Link, useLocation } from 'react-router-dom';
import { Box, Button, Typography, useMediaQuery } from '@material-ui/core';
import cx from 'classnames';
Expand Down Expand Up @@ -275,9 +276,8 @@ const newTransactionsFirst = (a: TransactionDetails, b: TransactionDetails) => {
const Header: React.FC = () => {
const classes = useStyles();
const { pathname } = useLocation();
const { account } = useActiveWeb3React();
const { account, chainId } = useActiveWeb3React();
const { ENSName } = useENSName(account ?? undefined);
const { ethereum } = window as any;
const [openDetailMenu, setOpenDetailMenu] = useState(false);
const theme = useTheme();
const allTransactions = useAllTransactions();
Expand All @@ -292,8 +292,7 @@ const Header: React.FC = () => {
const confirmed = sortedRecentTransactions
.filter((tx: any) => tx.receipt)
.map((tx: any) => tx.hash);
const isnotMatic =
ethereum && ethereum.isMetaMask && Number(ethereum.chainId) !== 137;
const isnotMatic = chainId !== ChainId.MATIC;
const tabletWindowSize = useMediaQuery(theme.breakpoints.down('sm'));
const mobileWindowSize = useMediaQuery(theme.breakpoints.down('xs'));
const toggleWalletModal = useWalletModalToggle();
Expand Down Expand Up @@ -464,7 +463,7 @@ const Header: React.FC = () => {
>
<LightIcon />
</Box>
{account ? (
{!isnotMatic && account ? (
<Box
id='web3-status-connected'
className={classes.accountDetails}
Expand Down
6 changes: 2 additions & 4 deletions src/pages/LandingPage/LandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
useMediaQuery,
} from '@material-ui/core';
import Skeleton from '@material-ui/lab/Skeleton';
import { Currency } from '@uniswap/sdk';
import { Currency, ChainId } from '@uniswap/sdk';
import { useTheme } from '@material-ui/core/styles';
import Motif from 'assets/images/Motif.svg';
import BuyWithFiat from 'assets/images/featured/BuywithFiat.svg';
Expand Down Expand Up @@ -428,9 +428,7 @@ const LandingPage: React.FC = () => {
const [openStakeModal, setOpenStakeModal] = useState(false);
const { palette, breakpoints } = useTheme();
const { account, chainId } = useActiveWeb3React();
const { ethereum } = window as any;
const isnotMatic =
ethereum && ethereum.isMetaMask && Number(ethereum.chainId) !== 137;
const isnotMatic = chainId !== ChainId.MATIC;
const mobileWindowSize = useMediaQuery(breakpoints.down('sm'));
const { initTransak } = useInitTransak();
const toggleWalletModal = useWalletModalToggle();
Expand Down
6 changes: 3 additions & 3 deletions src/utils/useUSDCPrice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function useUSDCPrice(currency?: Currency): Price | undefined {
[
chainId && wrapped && currencyEquals(WETH[chainId], wrapped)
? undefined
: currency,
: wrapped,
chainId ? WETH[chainId] : undefined,
],
[
Expand All @@ -48,11 +48,11 @@ export default function useUSDCPrice(currency?: Currency): Price | undefined {
chainId === ChainId.MATIC ? returnTokenFromKey('USDC') : undefined,
],
[
chainId ? returnTokenFromKey('QUICK') : undefined,
chainId === ChainId.MATIC ? returnTokenFromKey('QUICK') : undefined,
chainId === ChainId.MATIC ? returnTokenFromKey('USDC') : undefined,
],
],
[chainId, currency, wrapped],
[chainId, wrapped],
);
const [
[ethPairState, ethPair],
Expand Down
2 changes: 1 addition & 1 deletion src/utils/wrappedCurrency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function wrappedCurrency(
): Token | undefined {
return chainId && currency === ETHER
? WETH[chainId]
: currency instanceof Token
: currency instanceof Token && currency.chainId === chainId
? currency
: undefined;
}
Expand Down

0 comments on commit b790eb8

Please sign in to comment.