Skip to content

Commit 6cdebfa

Browse files
authored
Merge pull request #1733 from webdev403/fix/currency-logo-mismatch-when-supplying-and-adding-liquidity
Fix: Currency logo mismatch when supplying and adding liquidity
2 parents 8ee4bc0 + 9e60a10 commit 6cdebfa

File tree

1 file changed

+8
-8
lines changed
  • src/components/v3/CurrencyInputPanel

1 file changed

+8
-8
lines changed

src/components/v3/CurrencyInputPanel/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React, { useEffect } from 'react';
2-
import { Pair } from '@uniswap/sdk';
2+
import { ETHER, Pair } from '@uniswap/sdk';
33
import { Ether } from '@uniswap/sdk-core';
44
import { Currency, CurrencyAmount, Percent, Token } from '@uniswap/sdk-core';
55
import { ReactNode, useCallback, useMemo, useState } from 'react';
66
import { LockOutlined } from '@material-ui/icons';
77
import { useActiveWeb3React } from 'hooks';
88
import CurrencyLogo from 'components/CurrencyLogo';
9-
import { useCurrencyBalance } from 'state/wallet/v3/hooks';
9+
import { useCurrencyBalance } from 'state/wallet/hooks';
1010
import CurrencySearchModal from 'components/CurrencySearchModal';
1111
import { Box, Typography } from '@material-ui/core';
1212
import NumericalInput from 'components/NumericalInput';
@@ -89,7 +89,7 @@ export default function CurrencyInputPanel({
8989
const [modalOpen, setModalOpen] = useState(false);
9090
const { chainId, account } = useActiveWeb3React();
9191
const { t } = useTranslation();
92-
const nativeCurrency = chainId ? Ether.onChain(chainId) : undefined;
92+
const nativeCurrency = chainId ? ETHER[chainId] : undefined;
9393
const ethBalance = useCurrencyBalance(account ?? undefined, nativeCurrency);
9494
const balance = useCurrencyBalance(
9595
account ?? undefined,
@@ -107,15 +107,15 @@ export default function CurrencyInputPanel({
107107
const latestBlockNumber = useBlockNumber();
108108
useEffect(() => {
109109
if (updatedEthBalance == undefined) {
110-
setUpdatedEthBalance(ethBalance);
110+
setUpdatedEthBalance(ethBalance as any);
111111
} else {
112112
if (!multicallContract || !latestBlockNumber || !account) return;
113113
getCurrencyBalanceImmediately(
114114
multicallContract,
115115
chainId,
116116
latestBlockNumber,
117117
account,
118-
nativeCurrency,
118+
nativeCurrency as any,
119119
).then((value) => {
120120
setUpdatedEthBalance(value);
121121
if (currency?.isNative) {
@@ -124,7 +124,7 @@ export default function CurrencyInputPanel({
124124
});
125125
}
126126
if (updatedBalance == undefined) {
127-
setUpdatedBalance(balance);
127+
setUpdatedBalance(balance as any);
128128
} else {
129129
if (
130130
currency?.isNative ||
@@ -148,8 +148,8 @@ export default function CurrencyInputPanel({
148148
const ethBalanceDependency = JSON.stringify(ethBalance);
149149
const balanceDependency = JSON.stringify(balance);
150150
useEffect(() => {
151-
setUpdatedEthBalance(ethBalance);
152-
setUpdatedBalance(balance);
151+
setUpdatedEthBalance(ethBalance as any);
152+
setUpdatedBalance(balance as any);
153153
// eslint-disable-next-line react-hooks/exhaustive-deps
154154
}, [ethBalanceDependency, balanceDependency]);
155155

0 commit comments

Comments
 (0)