Commit 322cdaf8 authored by Vignesh Mohankumar's avatar Vignesh Mohankumar Committed by GitHub

refactor: rm useActiveWeb3React (#4004)

* rm activeweb3react

* wrap in web3provider?
parent edcdbfd8
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { CheckCircle, Triangle } from 'react-feather' import { CheckCircle, Triangle } from 'react-feather'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
...@@ -35,7 +35,7 @@ const IconWrapper = styled.div<{ pending: boolean; success?: boolean }>` ...@@ -35,7 +35,7 @@ const IconWrapper = styled.div<{ pending: boolean; success?: boolean }>`
` `
export default function Transaction({ hash }: { hash: string }) { export default function Transaction({ hash }: { hash: string }) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const allTransactions = useAllTransactions() const allTransactions = useAllTransactions()
const tx = allTransactions?.[hash] const tx = allTransactions?.[hash]
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { useWeb3React } from '@web3-react/core'
import { Connector } from '@web3-react/types' import { Connector } from '@web3-react/types'
import CopyHelper from 'components/AccountDetails/Copy' import CopyHelper from 'components/AccountDetails/Copy'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useCallback, useContext } from 'react' import { useCallback, useContext } from 'react'
import { ExternalLink as LinkIcon } from 'react-feather' import { ExternalLink as LinkIcon } from 'react-feather'
import { useAppDispatch } from 'state/hooks' import { useAppDispatch } from 'state/hooks'
...@@ -226,7 +226,7 @@ export default function AccountDetails({ ...@@ -226,7 +226,7 @@ export default function AccountDetails({
ENSName, ENSName,
openOptions, openOptions,
}: AccountDetailsProps) { }: AccountDetailsProps) {
const { chainId, account, connector } = useActiveWeb3React() const { chainId, account, connector } = useWeb3React()
const theme = useContext(ThemeContext) const theme = useContext(ThemeContext)
const dispatch = useAppDispatch() const dispatch = useAppDispatch()
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
// eslint-disable-next-line no-restricted-imports // eslint-disable-next-line no-restricted-imports
import { t } from '@lingui/macro' import { t } from '@lingui/macro'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { ReactNode, useCallback, useContext } from 'react' import { ReactNode, useCallback, useContext } from 'react'
import styled, { ThemeContext } from 'styled-components/macro' import styled, { ThemeContext } from 'styled-components/macro'
...@@ -86,7 +86,7 @@ export default function AddressInputPanel({ ...@@ -86,7 +86,7 @@ export default function AddressInputPanel({
// triggers whenever the typed value changes // triggers whenever the typed value changes
onChange: (value: string) => void onChange: (value: string) => void
}) { }) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const theme = useContext(ThemeContext) const theme = useContext(ThemeContext)
const { address, loading, name } = useENS(value) const { address, loading, name } = useENS(value)
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { ReactNode, useMemo } from 'react' import { ReactNode, useMemo } from 'react'
const BLOCKED_ADDRESSES: string[] = [ const BLOCKED_ADDRESSES: string[] = [
...@@ -38,7 +38,7 @@ const BLOCKED_ADDRESSES: string[] = [ ...@@ -38,7 +38,7 @@ const BLOCKED_ADDRESSES: string[] = [
] ]
export default function Blocklist({ children }: { children: ReactNode }) { export default function Blocklist({ children }: { children: ReactNode }) {
const { account } = useActiveWeb3React() const { account } = useWeb3React()
const blocked: boolean = useMemo(() => Boolean(account && BLOCKED_ADDRESSES.indexOf(account) !== -1), [account]) const blocked: boolean = useMemo(() => Boolean(account && BLOCKED_ADDRESSES.indexOf(account) !== -1), [account])
if (blocked) { if (blocked) {
return ( return (
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Currency, CurrencyAmount, Percent, Token } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Percent, Token } from '@uniswap/sdk-core'
import { Pair } from '@uniswap/v2-sdk' import { Pair } from '@uniswap/v2-sdk'
import { useWeb3React } from '@web3-react/core'
import { AutoColumn } from 'components/Column' import { AutoColumn } from 'components/Column'
import { LoadingOpacityContainer, loadingOpacityMixin } from 'components/Loader/styled' import { LoadingOpacityContainer, loadingOpacityMixin } from 'components/Loader/styled'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { darken } from 'polished' import { darken } from 'polished'
import { ReactNode, useCallback, useState } from 'react' import { ReactNode, useCallback, useState } from 'react'
import { Lock } from 'react-feather' import { Lock } from 'react-feather'
...@@ -201,7 +201,7 @@ export default function CurrencyInputPanel({ ...@@ -201,7 +201,7 @@ export default function CurrencyInputPanel({
...rest ...rest
}: CurrencyInputPanelProps) { }: CurrencyInputPanelProps) {
const [modalOpen, setModalOpen] = useState(false) const [modalOpen, setModalOpen] = useState(false)
const { account } = useActiveWeb3React() const { account } = useWeb3React()
const selectedCurrencyBalance = useCurrencyBalance(account ?? undefined, currency ?? undefined) const selectedCurrencyBalance = useCurrencyBalance(account ?? undefined, currency ?? undefined)
const theme = useTheme() const theme = useTheme()
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { useWeb3React } from '@web3-react/core'
import { SupportedChainId } from 'constants/chains' import { SupportedChainId } from 'constants/chains'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { AlertOctagon } from 'react-feather' import { AlertOctagon } from 'react-feather'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { ExternalLink } from 'theme' import { ExternalLink } from 'theme'
...@@ -42,7 +42,7 @@ function Wrapper({ children }: { children: React.ReactNode }) { ...@@ -42,7 +42,7 @@ function Wrapper({ children }: { children: React.ReactNode }) {
* Shows a downtime warning for the network if it's relevant * Shows a downtime warning for the network if it's relevant
*/ */
export default function DowntimeWarning() { export default function DowntimeWarning() {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
if (!isL2ChainId(chainId)) { if (!isL2ChainId(chainId)) {
return null return null
} }
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Currency } from '@uniswap/sdk-core' import { Currency } from '@uniswap/sdk-core'
import { FeeAmount } from '@uniswap/v3-sdk' import { FeeAmount } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core'
import { sendEvent } from 'components/analytics' import { sendEvent } from 'components/analytics'
import { ButtonGray } from 'components/Button' import { ButtonGray } from 'components/Button'
import Card from 'components/Card' import Card from 'components/Card'
import { AutoColumn } from 'components/Column' import { AutoColumn } from 'components/Column'
import { RowBetween } from 'components/Row' import { RowBetween } from 'components/Row'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useFeeTierDistribution } from 'hooks/useFeeTierDistribution' import { useFeeTierDistribution } from 'hooks/useFeeTierDistribution'
import { PoolState, usePools } from 'hooks/usePools' import { PoolState, usePools } from 'hooks/usePools'
import usePrevious from 'hooks/usePrevious' import usePrevious from 'hooks/usePrevious'
...@@ -59,7 +59,7 @@ export default function FeeSelector({ ...@@ -59,7 +59,7 @@ export default function FeeSelector({
currencyA?: Currency | undefined currencyA?: Currency | undefined
currencyB?: Currency | undefined currencyB?: Currency | undefined
}) { }) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const { isLoading, isError, largestUsageFeeTier, distributions } = useFeeTierDistribution(currencyA, currencyB) const { isLoading, isError, largestUsageFeeTier, distributions } = useFeeTierDistribution(currencyA, currencyB)
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { useWeb3React } from '@web3-react/core'
import { CHAIN_INFO, L2ChainInfo } from 'constants/chainInfo' import { CHAIN_INFO, L2ChainInfo } from 'constants/chainInfo'
import { SupportedChainId } from 'constants/chains' import { SupportedChainId } from 'constants/chains'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { AlertOctagon } from 'react-feather' import { AlertOctagon } from 'react-feather'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { ExternalLink, MEDIA_WIDTHS } from 'theme' import { ExternalLink, MEDIA_WIDTHS } from 'theme'
...@@ -45,7 +45,7 @@ const Wrapper = styled.div` ...@@ -45,7 +45,7 @@ const Wrapper = styled.div`
` `
export function ChainConnectivityWarning() { export function ChainConnectivityWarning() {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const info = CHAIN_INFO[chainId ?? SupportedChainId.MAINNET] const info = CHAIN_INFO[chainId ?? SupportedChainId.MAINNET]
const label = info?.label const label = info?.label
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { useWeb3React } from '@web3-react/core'
import { getWalletForConnector } from 'connectors' import { getWalletForConnector } from 'connectors'
import { CHAIN_INFO } from 'constants/chainInfo' import { CHAIN_INFO } from 'constants/chainInfo'
import { CHAIN_IDS_TO_NAMES, SupportedChainId } from 'constants/chains' import { CHAIN_IDS_TO_NAMES, SupportedChainId } from 'constants/chains'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useOnClickOutside } from 'hooks/useOnClickOutside' import { useOnClickOutside } from 'hooks/useOnClickOutside'
import useParsedQueryString from 'hooks/useParsedQueryString' import useParsedQueryString from 'hooks/useParsedQueryString'
import usePrevious from 'hooks/usePrevious' import usePrevious from 'hooks/usePrevious'
...@@ -185,7 +185,7 @@ function Row({ ...@@ -185,7 +185,7 @@ function Row({
targetChain: SupportedChainId targetChain: SupportedChainId
onSelectChain: (targetChain: number) => void onSelectChain: (targetChain: number) => void
}) { }) {
const { provider, chainId } = useActiveWeb3React() const { provider, chainId } = useWeb3React()
if (!provider || !chainId) { if (!provider || !chainId) {
return null return null
} }
...@@ -267,7 +267,7 @@ const NETWORK_SELECTOR_CHAINS = [ ...@@ -267,7 +267,7 @@ const NETWORK_SELECTOR_CHAINS = [
export default function NetworkSelector() { export default function NetworkSelector() {
const dispatch = useAppDispatch() const dispatch = useAppDispatch()
const { chainId, provider, connector } = useActiveWeb3React() const { chainId, provider, connector } = useWeb3React()
const previousChainId = usePrevious(chainId) const previousChainId = usePrevious(chainId)
const parsedQs = useParsedQueryString() const parsedQs = useParsedQueryString()
const { urlChain, urlChainId } = getParsedChainId(parsedQs) const { urlChain, urlChainId } = getParsedChainId(parsedQs)
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { useWeb3React } from '@web3-react/core'
import { RowFixed } from 'components/Row' import { RowFixed } from 'components/Row'
import { CHAIN_INFO } from 'constants/chainInfo' import { CHAIN_INFO } from 'constants/chainInfo'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import useCurrentBlockTimestamp from 'hooks/useCurrentBlockTimestamp' import useCurrentBlockTimestamp from 'hooks/useCurrentBlockTimestamp'
import useGasPrice from 'hooks/useGasPrice' import useGasPrice from 'hooks/useGasPrice'
import useMachineTimeMs from 'hooks/useMachineTime' import useMachineTimeMs from 'hooks/useMachineTime'
...@@ -100,7 +100,7 @@ const DEFAULT_MS_BEFORE_WARNING = ms`10m` ...@@ -100,7 +100,7 @@ const DEFAULT_MS_BEFORE_WARNING = ms`10m`
const NETWORK_HEALTH_CHECK_MS = ms`10s` const NETWORK_HEALTH_CHECK_MS = ms`10s`
export default function Polling() { export default function Polling() {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const blockNumber = useBlockNumber() const blockNumber = useBlockNumber()
const [isMounting, setIsMounting] = useState(false) const [isMounting, setIsMounting] = useState(false)
const [isHover, setIsHover] = useState(false) const [isHover, setIsHover] = useState(false)
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import useScrollPosition from '@react-hook/window-scroll' import useScrollPosition from '@react-hook/window-scroll'
import { useWeb3React } from '@web3-react/core'
import { CHAIN_INFO } from 'constants/chainInfo' import { CHAIN_INFO } from 'constants/chainInfo'
import { SupportedChainId } from 'constants/chains' import { SupportedChainId } from 'constants/chains'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import useTheme from 'hooks/useTheme' import useTheme from 'hooks/useTheme'
import { darken } from 'polished' import { darken } from 'polished'
import { NavLink } from 'react-router-dom' import { NavLink } from 'react-router-dom'
...@@ -247,7 +247,7 @@ const StyledExternalLink = styled(ExternalLink).attrs({ ...@@ -247,7 +247,7 @@ const StyledExternalLink = styled(ExternalLink).attrs({
` `
export default function Header() { export default function Header() {
const { account, chainId, connector } = useActiveWeb3React() const { account, chainId, connector } = useWeb3React()
const chainAllowed = chainId && isChainAllowed(connector, chainId) const chainAllowed = chainId && isChainAllowed(connector, chainId)
......
import jazzicon from '@metamask/jazzicon' import jazzicon from '@metamask/jazzicon'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import useENSAvatar from 'hooks/useENSAvatar' import useENSAvatar from 'hooks/useENSAvatar'
import { useLayoutEffect, useMemo, useRef, useState } from 'react' import { useLayoutEffect, useMemo, useRef, useState } from 'react'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
...@@ -19,7 +19,7 @@ const StyledAvatar = styled.img` ...@@ -19,7 +19,7 @@ const StyledAvatar = styled.img`
` `
export default function Identicon() { export default function Identicon() {
const { account } = useActiveWeb3React() const { account } = useWeb3React()
const { avatar } = useENSAvatar(account ?? undefined) const { avatar } = useENSAvatar(account ?? undefined)
const [fetchable, setFetchable] = useState(true) const [fetchable, setFetchable] = useState(true)
......
// eslint-disable-next-line no-restricted-imports // eslint-disable-next-line no-restricted-imports
import { t, Trans } from '@lingui/macro' import { t, Trans } from '@lingui/macro'
import { useWeb3React } from '@web3-react/core'
import { PrivacyPolicyModal } from 'components/PrivacyPolicy' import { PrivacyPolicyModal } from 'components/PrivacyPolicy'
import { L2_CHAIN_IDS } from 'constants/chains' import { L2_CHAIN_IDS } from 'constants/chains'
import { LOCALE_LABEL, SUPPORTED_LOCALES, SupportedLocale } from 'constants/locales' import { LOCALE_LABEL, SUPPORTED_LOCALES, SupportedLocale } from 'constants/locales'
import { useActiveLocale } from 'hooks/useActiveLocale' import { useActiveLocale } from 'hooks/useActiveLocale'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useLocationLinkProps } from 'hooks/useLocationLinkProps' import { useLocationLinkProps } from 'hooks/useLocationLinkProps'
import React, { useEffect, useRef, useState } from 'react' import React, { useEffect, useRef, useState } from 'react'
import { import {
...@@ -207,7 +207,7 @@ function LanguageMenu({ close }: { close: () => void }) { ...@@ -207,7 +207,7 @@ function LanguageMenu({ close }: { close: () => void }) {
} }
export default function Menu() { export default function Menu() {
const { account, chainId } = useActiveWeb3React() const { account, chainId } = useWeb3React()
const node = useRef<HTMLDivElement>() const node = useRef<HTMLDivElement>()
const open = useModalOpen(ApplicationModal.MENU) const open = useModalOpen(ApplicationModal.MENU)
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { useContext } from 'react' import { useContext } from 'react'
import { ArrowUpCircle } from 'react-feather' import { ArrowUpCircle } from 'react-feather'
import styled, { ThemeContext } from 'styled-components/macro' import styled, { ThemeContext } from 'styled-components/macro'
...@@ -50,7 +50,7 @@ export function SubmittedView({ ...@@ -50,7 +50,7 @@ export function SubmittedView({
hash: string | undefined hash: string | undefined
}) { }) {
const theme = useContext(ThemeContext) const theme = useContext(ThemeContext)
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
return ( return (
<ConfirmOrLoadingWrapper> <ConfirmOrLoadingWrapper>
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { useWeb3React } from '@web3-react/core'
import { CHAIN_INFO } from 'constants/chainInfo' import { CHAIN_INFO } from 'constants/chainInfo'
import { SupportedChainId } from 'constants/chains' import { SupportedChainId } from 'constants/chains'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { ArrowUpRight } from 'react-feather' import { ArrowUpRight } from 'react-feather'
import { useDarkModeManager } from 'state/user/hooks' import { useDarkModeManager } from 'state/user/hooks'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
...@@ -140,7 +140,7 @@ function shouldShowAlert(chainId: number | undefined): chainId is NetworkAlertCh ...@@ -140,7 +140,7 @@ function shouldShowAlert(chainId: number | undefined): chainId is NetworkAlertCh
} }
export function NetworkAlert() { export function NetworkAlert() {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const [darkMode] = useDarkModeManager() const [darkMode] = useDarkModeManager()
if (!shouldShowAlert(chainId)) { if (!shouldShowAlert(chainId)) {
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { CurrencyAmount, Token } from '@uniswap/sdk-core' import { CurrencyAmount, Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { sendEvent } from 'components/analytics' import { sendEvent } from 'components/analytics'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useCallback, useEffect } from 'react' import { useCallback, useEffect } from 'react'
import { Heart, X } from 'react-feather' import { Heart, X } from 'react-feather'
import styled, { keyframes } from 'styled-components/macro' import styled, { keyframes } from 'styled-components/macro'
...@@ -55,7 +55,7 @@ const UniToken = styled.img` ...@@ -55,7 +55,7 @@ const UniToken = styled.img`
` `
export default function ClaimPopup() { export default function ClaimPopup() {
const { account } = useActiveWeb3React() const { account } = useWeb3React()
// dont store these in persisted state yet // dont store these in persisted state yet
const showClaimPopup: boolean = useShowClaimPopup() const showClaimPopup: boolean = useShowClaimPopup()
......
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { useContext } from 'react' import { useContext } from 'react'
import { AlertCircle, CheckCircle } from 'react-feather' import { AlertCircle, CheckCircle } from 'react-feather'
import styled, { ThemeContext } from 'styled-components/macro' import styled, { ThemeContext } from 'styled-components/macro'
...@@ -16,7 +16,7 @@ const RowNoFlex = styled(AutoRow)` ...@@ -16,7 +16,7 @@ const RowNoFlex = styled(AutoRow)`
` `
export default function TransactionPopup({ hash }: { hash: string }) { export default function TransactionPopup({ hash }: { hash: string }) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const tx = useTransaction(hash) const tx = useTransaction(hash)
const theme = useContext(ThemeContext) const theme = useContext(ThemeContext)
......
import { useWeb3React } from '@web3-react/core'
import { SupportedChainId } from 'constants/chains' import { SupportedChainId } from 'constants/chains'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { MEDIA_WIDTHS } from 'theme' import { MEDIA_WIDTHS } from 'theme'
...@@ -63,7 +63,7 @@ export default function Popups() { ...@@ -63,7 +63,7 @@ export default function Popups() {
const urlWarningActive = useURLWarningVisible() const urlWarningActive = useURLWarningVisible()
// need extra padding if network is not L1 Ethereum // need extra padding if network is not L1 Ethereum
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const isNotOnMainnet = Boolean(chainId && chainId !== SupportedChainId.MAINNET) const isNotOnMainnet = Boolean(chainId && chainId !== SupportedChainId.MAINNET)
return ( return (
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { CurrencyAmount, Percent, Token } from '@uniswap/sdk-core' import { CurrencyAmount, Percent, Token } from '@uniswap/sdk-core'
import { Pair } from '@uniswap/v2-sdk' import { Pair } from '@uniswap/v2-sdk'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import { transparentize } from 'polished' import { transparentize } from 'polished'
import { useState } from 'react' import { useState } from 'react'
...@@ -42,7 +42,7 @@ interface PositionCardProps { ...@@ -42,7 +42,7 @@ interface PositionCardProps {
} }
export default function V2PositionCard({ pair, border, stakedBalance }: PositionCardProps) { export default function V2PositionCard({ pair, border, stakedBalance }: PositionCardProps) {
const { account } = useActiveWeb3React() const { account } = useWeb3React()
const currency0 = unwrappedToken(pair.token0) const currency0 = unwrappedToken(pair.token0)
const currency1 = unwrappedToken(pair.token1) const currency1 = unwrappedToken(pair.token1)
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { CurrencyAmount, Percent, Token } from '@uniswap/sdk-core' import { CurrencyAmount, Percent, Token } from '@uniswap/sdk-core'
import { Pair } from '@uniswap/v2-sdk' import { Pair } from '@uniswap/v2-sdk'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import { transparentize } from 'polished' import { transparentize } from 'polished'
import { useState } from 'react' import { useState } from 'react'
...@@ -46,7 +46,7 @@ interface PositionCardProps { ...@@ -46,7 +46,7 @@ interface PositionCardProps {
} }
export function MinimalPositionCard({ pair, showUnwrapped = false, border }: PositionCardProps) { export function MinimalPositionCard({ pair, showUnwrapped = false, border }: PositionCardProps) {
const { account } = useActiveWeb3React() const { account } = useWeb3React()
const currency0 = showUnwrapped ? pair.token0 : unwrappedToken(pair.token0) const currency0 = showUnwrapped ? pair.token0 : unwrappedToken(pair.token0)
const currency1 = showUnwrapped ? pair.token1 : unwrappedToken(pair.token1) const currency1 = showUnwrapped ? pair.token1 : unwrappedToken(pair.token1)
...@@ -158,7 +158,7 @@ export function MinimalPositionCard({ pair, showUnwrapped = false, border }: Pos ...@@ -158,7 +158,7 @@ export function MinimalPositionCard({ pair, showUnwrapped = false, border }: Pos
} }
export default function FullPositionCard({ pair, border, stakedBalance }: PositionCardProps) { export default function FullPositionCard({ pair, border, stakedBalance }: PositionCardProps) {
const { account } = useActiveWeb3React() const { account } = useWeb3React()
const currency0 = unwrappedToken(pair.token0) const currency0 = unwrappedToken(pair.token0)
const currency1 = unwrappedToken(pair.token1) const currency1 = unwrappedToken(pair.token1)
......
// eslint-disable-next-line no-restricted-imports // eslint-disable-next-line no-restricted-imports
import { t, Trans } from '@lingui/macro' import { t, Trans } from '@lingui/macro'
import { Currency, Token } from '@uniswap/sdk-core' import { Currency, Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { sendEvent } from 'components/analytics' import { sendEvent } from 'components/analytics'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import useDebounce from 'hooks/useDebounce' import useDebounce from 'hooks/useDebounce'
import { useOnClickOutside } from 'hooks/useOnClickOutside' import { useOnClickOutside } from 'hooks/useOnClickOutside'
import useTheme from 'hooks/useTheme' import useTheme from 'hooks/useTheme'
...@@ -71,7 +71,7 @@ export function CurrencySearch({ ...@@ -71,7 +71,7 @@ export function CurrencySearch({
showImportView, showImportView,
setImportToken, setImportToken,
}: CurrencySearchProps) { }: CurrencySearchProps) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const theme = useTheme() const theme = useTheme()
const [tokenLoaderTimerElapsed, setTokenLoaderTimerElapsed] = useState(false) const [tokenLoaderTimerElapsed, setTokenLoaderTimerElapsed] = useState(false)
......
// eslint-disable-next-line no-restricted-imports // eslint-disable-next-line no-restricted-imports
import { t, Trans } from '@lingui/macro' import { t, Trans } from '@lingui/macro'
import { TokenList } from '@uniswap/token-lists' import { TokenList } from '@uniswap/token-lists'
import { useWeb3React } from '@web3-react/core'
import { sendEvent } from 'components/analytics' import { sendEvent } from 'components/analytics'
import Card from 'components/Card' import Card from 'components/Card'
import { UNSUPPORTED_LIST_URLS } from 'constants/lists' import { UNSUPPORTED_LIST_URLS } from 'constants/lists'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useListColor } from 'hooks/useColor' import { useListColor } from 'hooks/useColor'
import parseENSAddress from 'lib/utils/parseENSAddress' import parseENSAddress from 'lib/utils/parseENSAddress'
import uriToHttp from 'lib/utils/uriToHttp' import uriToHttp from 'lib/utils/uriToHttp'
...@@ -95,7 +95,7 @@ function listUrlRowHTMLId(listUrl: string) { ...@@ -95,7 +95,7 @@ function listUrlRowHTMLId(listUrl: string) {
} }
const ListRow = memo(function ListRow({ listUrl }: { listUrl: string }) { const ListRow = memo(function ListRow({ listUrl }: { listUrl: string }) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const listsByUrl = useAppSelector((state) => state.lists.byUrl) const listsByUrl = useAppSelector((state) => state.lists.byUrl)
const dispatch = useAppDispatch() const dispatch = useAppDispatch()
const { current: list, pendingUpdate: pending } = listsByUrl[listUrl] const { current: list, pendingUpdate: pending } = listsByUrl[listUrl]
...@@ -242,7 +242,7 @@ export function ManageLists({ ...@@ -242,7 +242,7 @@ export function ManageLists({
setImportList: (list: TokenList) => void setImportList: (list: TokenList) => void
setListUrl: (url: string) => void setListUrl: (url: string) => void
}) { }) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const theme = useTheme() const theme = useTheme()
const [listUrlInput, setListUrlInput] = useState<string>('') const [listUrlInput, setListUrlInput] = useState<string>('')
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Token } from '@uniswap/sdk-core' import { Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import Card from 'components/Card' import Card from 'components/Card'
import Column from 'components/Column' import Column from 'components/Column'
import CurrencyLogo from 'components/CurrencyLogo' import CurrencyLogo from 'components/CurrencyLogo'
import Row, { RowBetween, RowFixed } from 'components/Row' import Row, { RowBetween, RowFixed } from 'components/Row'
import { useToken } from 'hooks/Tokens' import { useToken } from 'hooks/Tokens'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { RefObject, useCallback, useMemo, useRef, useState } from 'react' import { RefObject, useCallback, useMemo, useRef, useState } from 'react'
import { useRemoveUserAddedToken, useUserAddedTokens } from 'state/user/hooks' import { useRemoveUserAddedToken, useUserAddedTokens } from 'state/user/hooks'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
...@@ -44,7 +44,7 @@ export default function ManageTokens({ ...@@ -44,7 +44,7 @@ export default function ManageTokens({
setModalView: (view: CurrencyModalView) => void setModalView: (view: CurrencyModalView) => void
setImportToken: (token: Token) => void setImportToken: (token: Token) => void
}) { }) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const [searchQuery, setSearchQuery] = useState<string>('') const [searchQuery, setSearchQuery] = useState<string>('')
const theme = useTheme() const theme = useTheme()
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Token } from '@uniswap/sdk-core' import { Token } from '@uniswap/sdk-core'
import { TokenList } from '@uniswap/token-lists' import { TokenList } from '@uniswap/token-lists'
import { useWeb3React } from '@web3-react/core'
import Card from 'components/Card' import Card from 'components/Card'
import { AutoColumn } from 'components/Column' import { AutoColumn } from 'components/Column'
import CurrencyLogo from 'components/CurrencyLogo' import CurrencyLogo from 'components/CurrencyLogo'
import ListLogo from 'components/ListLogo' import ListLogo from 'components/ListLogo'
import { RowFixed } from 'components/Row' import { RowFixed } from 'components/Row'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { transparentize } from 'polished' import { transparentize } from 'polished'
import { AlertCircle } from 'react-feather' import { AlertCircle } from 'react-feather'
import styled, { useTheme } from 'styled-components/macro' import styled, { useTheme } from 'styled-components/macro'
...@@ -33,7 +33,7 @@ interface TokenImportCardProps { ...@@ -33,7 +33,7 @@ interface TokenImportCardProps {
} }
const TokenImportCard = ({ list, token }: TokenImportCardProps) => { const TokenImportCard = ({ list, token }: TokenImportCardProps) => {
const theme = useTheme() const theme = useTheme()
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
return ( return (
<Card backgroundColor={theme.bg2} padding="2rem"> <Card backgroundColor={theme.bg2} padding="2rem">
<AutoColumn gap="10px" justify="center"> <AutoColumn gap="10px" justify="center">
......
// eslint-disable-next-line no-restricted-imports // eslint-disable-next-line no-restricted-imports
import { t, Trans } from '@lingui/macro' import { t, Trans } from '@lingui/macro'
import { Percent } from '@uniswap/sdk-core' import { Percent } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { sendEvent } from 'components/analytics' import { sendEvent } from 'components/analytics'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { AUTO_ROUTER_SUPPORTED_CHAINS } from 'lib/hooks/routing/clientSideSmartOrderRouter' import { AUTO_ROUTER_SUPPORTED_CHAINS } from 'lib/hooks/routing/clientSideSmartOrderRouter'
import { useContext, useRef, useState } from 'react' import { useContext, useRef, useState } from 'react'
import { Settings, X } from 'react-feather' import { Settings, X } from 'react-feather'
...@@ -119,7 +119,7 @@ const ModalContentWrapper = styled.div` ...@@ -119,7 +119,7 @@ const ModalContentWrapper = styled.div`
` `
export default function SettingsTab({ placeholderSlippage }: { placeholderSlippage: Percent }) { export default function SettingsTab({ placeholderSlippage }: { placeholderSlippage: Percent }) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const node = useRef<HTMLDivElement>() const node = useRef<HTMLDivElement>()
const open = useModalOpen(ApplicationModal.SETTINGS) const open = useModalOpen(ApplicationModal.SETTINGS)
......
import { useWeb3React } from '@web3-react/core'
import AddressClaimModal from 'components/claim/AddressClaimModal' import AddressClaimModal from 'components/claim/AddressClaimModal'
import ConnectedAccountBlocked from 'components/ConnectedAccountBlocked' import ConnectedAccountBlocked from 'components/ConnectedAccountBlocked'
import useAccountRiskCheck from 'hooks/useAccountRiskCheck' import useAccountRiskCheck from 'hooks/useAccountRiskCheck'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useModalOpen, useToggleModal } from 'state/application/hooks' import { useModalOpen, useToggleModal } from 'state/application/hooks'
import { ApplicationModal } from 'state/application/reducer' import { ApplicationModal } from 'state/application/reducer'
...@@ -10,7 +10,7 @@ export default function TopLevelModals() { ...@@ -10,7 +10,7 @@ export default function TopLevelModals() {
const addressClaimToggle = useToggleModal(ApplicationModal.ADDRESS_CLAIM) const addressClaimToggle = useToggleModal(ApplicationModal.ADDRESS_CLAIM)
const blockedAccountModalOpen = useModalOpen(ApplicationModal.BLOCKED_ACCOUNT) const blockedAccountModalOpen = useModalOpen(ApplicationModal.BLOCKED_ACCOUNT)
const { account } = useActiveWeb3React() const { account } = useWeb3React()
useAccountRiskCheck(account) useAccountRiskCheck(account)
const open = Boolean(blockedAccountModalOpen && account) const open = Boolean(blockedAccountModalOpen && account)
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Currency } from '@uniswap/sdk-core' import { Currency } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import Badge from 'components/Badge' import Badge from 'components/Badge'
import { CHAIN_INFO } from 'constants/chainInfo' import { CHAIN_INFO } from 'constants/chainInfo'
import { L2_CHAIN_IDS, SupportedL2ChainId } from 'constants/chains' import { L2_CHAIN_IDS, SupportedL2ChainId } from 'constants/chains'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import useCurrencyLogoURIs from 'lib/hooks/useCurrencyLogoURIs' import useCurrencyLogoURIs from 'lib/hooks/useCurrencyLogoURIs'
import { ReactNode, useCallback, useContext, useState } from 'react' import { ReactNode, useCallback, useContext, useState } from 'react'
import { AlertCircle, AlertTriangle, ArrowUpCircle, CheckCircle } from 'react-feather' import { AlertCircle, AlertTriangle, ArrowUpCircle, CheckCircle } from 'react-feather'
...@@ -96,7 +96,7 @@ function TransactionSubmittedContent({ ...@@ -96,7 +96,7 @@ function TransactionSubmittedContent({
}) { }) {
const theme = useContext(ThemeContext) const theme = useContext(ThemeContext)
const { connector } = useActiveWeb3React() const { connector } = useWeb3React()
const token = currencyToAdd?.wrapped const token = currencyToAdd?.wrapped
const logoURL = useCurrencyLogoURIs(token)[0] const logoURL = useCurrencyLogoURIs(token)[0]
...@@ -342,7 +342,7 @@ export default function TransactionConfirmationModal({ ...@@ -342,7 +342,7 @@ export default function TransactionConfirmationModal({
content, content,
currencyToAdd, currencyToAdd,
}: ConfirmationModalProps) { }: ConfirmationModalProps) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const isL2 = Boolean(chainId && L2_CHAIN_IDS.includes(chainId)) const isL2 = Boolean(chainId && L2_CHAIN_IDS.includes(chainId))
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Percent } from '@uniswap/sdk-core' import { Percent } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { L2_CHAIN_IDS } from 'constants/chains' import { L2_CHAIN_IDS } from 'constants/chains'
import { DEFAULT_DEADLINE_FROM_NOW } from 'constants/misc' import { DEFAULT_DEADLINE_FROM_NOW } from 'constants/misc'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import ms from 'ms.macro' import ms from 'ms.macro'
import { darken } from 'polished' import { darken } from 'polished'
import { useContext, useState } from 'react' import { useContext, useState } from 'react'
...@@ -97,7 +97,7 @@ interface TransactionSettingsProps { ...@@ -97,7 +97,7 @@ interface TransactionSettingsProps {
const THREE_DAYS_IN_SECONDS = ms`3 days` / 1000 const THREE_DAYS_IN_SECONDS = ms`3 days` / 1000
export default function TransactionSettings({ placeholderSlippage }: TransactionSettingsProps) { export default function TransactionSettings({ placeholderSlippage }: TransactionSettingsProps) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const theme = useContext(ThemeContext) const theme = useContext(ThemeContext)
const userSlippageTolerance = useUserSlippageTolerance() const userSlippageTolerance = useUserSlippageTolerance()
......
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { useEffect } from 'react' import { useEffect } from 'react'
import { UaEventOptions } from 'react-ga4/types/ga4' import { UaEventOptions } from 'react-ga4/types/ga4'
import { RouteComponentProps } from 'react-router-dom' import { RouteComponentProps } from 'react-router-dom'
...@@ -71,7 +71,7 @@ export function useAnalyticsReporter({ pathname, search }: RouteComponentProps[' ...@@ -71,7 +71,7 @@ export function useAnalyticsReporter({ pathname, search }: RouteComponentProps['
getCLS(reportWebVitals) getCLS(reportWebVitals)
}, []) }, [])
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
useEffect(() => { useEffect(() => {
// cd1 - custom dimension 1 - chainId // cd1 - custom dimension 1 - chainId
googleAnalytics.set({ cd1: chainId ?? 0 }) googleAnalytics.set({ cd1: chainId ?? 0 })
......
import { isAddress } from '@ethersproject/address' import { isAddress } from '@ethersproject/address'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { CurrencyAmount, Token } from '@uniswap/sdk-core' import { CurrencyAmount, Token } from '@uniswap/sdk-core'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { useState } from 'react' import { useState } from 'react'
import { Text } from 'rebass' import { Text } from 'rebass'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
...@@ -46,7 +46,7 @@ const ConfirmedIcon = styled(ColumnCenter)` ...@@ -46,7 +46,7 @@ const ConfirmedIcon = styled(ColumnCenter)`
` `
export default function AddressClaimModal({ isOpen, onDismiss }: { isOpen: boolean; onDismiss: () => void }) { export default function AddressClaimModal({ isOpen, onDismiss }: { isOpen: boolean; onDismiss: () => void }) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
// state for smart contract input // state for smart contract input
const [typed, setTyped] = useState('') const [typed, setTyped] = useState('')
......
import { isAddress } from '@ethersproject/address' import { isAddress } from '@ethersproject/address'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { CurrencyAmount, Token } from '@uniswap/sdk-core' import { CurrencyAmount, Token } from '@uniswap/sdk-core'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { Text } from 'rebass' import { Text } from 'rebass'
...@@ -51,7 +51,7 @@ export default function ClaimModal() { ...@@ -51,7 +51,7 @@ export default function ClaimModal() {
const isOpen = useModalOpen(ApplicationModal.SELF_CLAIM) const isOpen = useModalOpen(ApplicationModal.SELF_CLAIM)
const toggleClaimModal = useToggleSelfClaimModal() const toggleClaimModal = useToggleSelfClaimModal()
const { account, chainId } = useActiveWeb3React() const { account, chainId } = useWeb3React()
// used for UI loading states // used for UI loading states
const [attempting, setAttempting] = useState<boolean>(false) const [attempting, setAttempting] = useState<boolean>(false)
......
import { TransactionResponse } from '@ethersproject/providers' import { TransactionResponse } from '@ethersproject/providers'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import StakingRewardsJson from '@uniswap/liquidity-staker/build/StakingRewards.json' import StakingRewardsJson from '@uniswap/liquidity-staker/build/StakingRewards.json'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { ReactNode, useState } from 'react' import { ReactNode, useState } from 'react'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
...@@ -34,7 +34,7 @@ interface StakingModalProps { ...@@ -34,7 +34,7 @@ interface StakingModalProps {
} }
export default function ClaimRewardModal({ isOpen, onDismiss, stakingInfo }: StakingModalProps) { export default function ClaimRewardModal({ isOpen, onDismiss, stakingInfo }: StakingModalProps) {
const { account } = useActiveWeb3React() const { account } = useWeb3React()
// monitor call to help UI loading state // monitor call to help UI loading state
const addTransaction = useTransactionAdder() const addTransaction = useTransactionAdder()
......
...@@ -3,7 +3,7 @@ import { Trans } from '@lingui/macro' ...@@ -3,7 +3,7 @@ import { Trans } from '@lingui/macro'
import StakingRewardsJson from '@uniswap/liquidity-staker/build/StakingRewards.json' import StakingRewardsJson from '@uniswap/liquidity-staker/build/StakingRewards.json'
import { CurrencyAmount, Token } from '@uniswap/sdk-core' import { CurrencyAmount, Token } from '@uniswap/sdk-core'
import { Pair } from '@uniswap/v2-sdk' import { Pair } from '@uniswap/v2-sdk'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { useV2LiquidityTokenPermit } from 'hooks/useV2LiquidityTokenPermit' import { useV2LiquidityTokenPermit } from 'hooks/useV2LiquidityTokenPermit'
import { useCallback, useState } from 'react' import { useCallback, useState } from 'react'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
...@@ -53,7 +53,7 @@ interface StakingModalProps { ...@@ -53,7 +53,7 @@ interface StakingModalProps {
} }
export default function StakingModal({ isOpen, onDismiss, stakingInfo, userLiquidityUnstaked }: StakingModalProps) { export default function StakingModal({ isOpen, onDismiss, stakingInfo, userLiquidityUnstaked }: StakingModalProps) {
const { provider } = useActiveWeb3React() const { provider } = useWeb3React()
// track and parse user input // track and parse user input
const [typedValue, setTypedValue] = useState('') const [typedValue, setTypedValue] = useState('')
......
import { TransactionResponse } from '@ethersproject/providers' import { TransactionResponse } from '@ethersproject/providers'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import StakingRewardsJson from '@uniswap/liquidity-staker/build/StakingRewards.json' import StakingRewardsJson from '@uniswap/liquidity-staker/build/StakingRewards.json'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { ReactNode, useState } from 'react' import { ReactNode, useState } from 'react'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
...@@ -35,7 +35,7 @@ interface StakingModalProps { ...@@ -35,7 +35,7 @@ interface StakingModalProps {
} }
export default function UnstakingModal({ isOpen, onDismiss, stakingInfo }: StakingModalProps) { export default function UnstakingModal({ isOpen, onDismiss, stakingInfo }: StakingModalProps) {
const { account } = useActiveWeb3React() const { account } = useWeb3React()
// monitor call to help UI loading state // monitor call to help UI loading state
const addTransaction = useTransactionAdder() const addTransaction = useTransactionAdder()
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Currency, Percent, TradeType } from '@uniswap/sdk-core' import { Currency, Percent, TradeType } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import Card from 'components/Card' import Card from 'components/Card'
import { LoadingRows } from 'components/Loader/styled' import { LoadingRows } from 'components/Loader/styled'
import { SUPPORTED_GAS_ESTIMATE_CHAIN_IDS } from 'constants/chains' import { SUPPORTED_GAS_ESTIMATE_CHAIN_IDS } from 'constants/chains'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import useNativeCurrency from 'lib/hooks/useNativeCurrency' import useNativeCurrency from 'lib/hooks/useNativeCurrency'
import { useContext, useMemo } from 'react' import { useContext, useMemo } from 'react'
import { InterfaceTrade } from 'state/routing/types' import { InterfaceTrade } from 'state/routing/types'
...@@ -53,7 +53,7 @@ export function AdvancedSwapDetails({ ...@@ -53,7 +53,7 @@ export function AdvancedSwapDetails({
hideInfoTooltips = false, hideInfoTooltips = false,
}: AdvancedSwapDetailsProps) { }: AdvancedSwapDetailsProps) {
const theme = useContext(ThemeContext) const theme = useContext(ThemeContext)
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const nativeCurrency = useNativeCurrency() const nativeCurrency = useNativeCurrency()
const { expectedOutputAmount, priceImpact } = useMemo(() => { const { expectedOutputAmount, priceImpact } = useMemo(() => {
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Currency, Percent, TradeType } from '@uniswap/sdk-core' import { Currency, Percent, TradeType } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import AnimatedDropdown from 'components/AnimatedDropdown' import AnimatedDropdown from 'components/AnimatedDropdown'
import Card, { OutlineCard } from 'components/Card' import Card, { OutlineCard } from 'components/Card'
import { AutoColumn } from 'components/Column' import { AutoColumn } from 'components/Column'
...@@ -7,7 +8,6 @@ import { LoadingOpacityContainer } from 'components/Loader/styled' ...@@ -7,7 +8,6 @@ import { LoadingOpacityContainer } from 'components/Loader/styled'
import Row, { RowBetween, RowFixed } from 'components/Row' import Row, { RowBetween, RowFixed } from 'components/Row'
import { MouseoverTooltipContent } from 'components/Tooltip' import { MouseoverTooltipContent } from 'components/Tooltip'
import { SUPPORTED_GAS_ESTIMATE_CHAIN_IDS } from 'constants/chains' import { SUPPORTED_GAS_ESTIMATE_CHAIN_IDS } from 'constants/chains'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { darken } from 'polished' import { darken } from 'polished'
import { useState } from 'react' import { useState } from 'react'
import { ChevronDown, Info } from 'react-feather' import { ChevronDown, Info } from 'react-feather'
...@@ -126,7 +126,7 @@ export default function SwapDetailsDropdown({ ...@@ -126,7 +126,7 @@ export default function SwapDetailsDropdown({
allowedSlippage, allowedSlippage,
}: SwapDetailsInlineProps) { }: SwapDetailsInlineProps) {
const theme = useTheme() const theme = useTheme()
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const [showDetails, setShowDetails] = useState(false) const [showDetails, setShowDetails] = useState(false)
return ( return (
......
...@@ -3,13 +3,13 @@ import { Protocol } from '@uniswap/router-sdk' ...@@ -3,13 +3,13 @@ import { Protocol } from '@uniswap/router-sdk'
import { Currency, Percent, TradeType } from '@uniswap/sdk-core' import { Currency, Percent, TradeType } from '@uniswap/sdk-core'
import { Pair } from '@uniswap/v2-sdk' import { Pair } from '@uniswap/v2-sdk'
import { FeeAmount } from '@uniswap/v3-sdk' import { FeeAmount } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core'
import AnimatedDropdown from 'components/AnimatedDropdown' import AnimatedDropdown from 'components/AnimatedDropdown'
import { AutoColumn } from 'components/Column' import { AutoColumn } from 'components/Column'
import { LoadingRows } from 'components/Loader/styled' import { LoadingRows } from 'components/Loader/styled'
import RoutingDiagram from 'components/RoutingDiagram/RoutingDiagram' import RoutingDiagram from 'components/RoutingDiagram/RoutingDiagram'
import { AutoRow, RowBetween } from 'components/Row' import { AutoRow, RowBetween } from 'components/Row'
import { SUPPORTED_GAS_ESTIMATE_CHAIN_IDS } from 'constants/chains' import { SUPPORTED_GAS_ESTIMATE_CHAIN_IDS } from 'constants/chains'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import useAutoRouterSupported from 'hooks/useAutoRouterSupported' import useAutoRouterSupported from 'hooks/useAutoRouterSupported'
import { memo, useState } from 'react' import { memo, useState } from 'react'
import { Plus } from 'react-feather' import { Plus } from 'react-feather'
...@@ -50,7 +50,7 @@ export default memo(function SwapRoute({ trade, syncing, fixedOpen = false, ...r ...@@ -50,7 +50,7 @@ export default memo(function SwapRoute({ trade, syncing, fixedOpen = false, ...r
const autoRouterSupported = useAutoRouterSupported() const autoRouterSupported = useAutoRouterSupported()
const routes = getTokenPath(trade) const routes = getTokenPath(trade)
const [open, setOpen] = useState(false) const [open, setOpen] = useState(false)
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const [darkMode] = useDarkModeManager() const [darkMode] = useDarkModeManager()
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Currency } from '@uniswap/sdk-core' import { Currency } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { ButtonEmpty } from 'components/Button' import { ButtonEmpty } from 'components/Button'
import Card, { OutlineCard } from 'components/Card' import Card, { OutlineCard } from 'components/Card'
import { AutoColumn } from 'components/Column' import { AutoColumn } from 'components/Column'
import CurrencyLogo from 'components/CurrencyLogo' import CurrencyLogo from 'components/CurrencyLogo'
import Modal from 'components/Modal' import Modal from 'components/Modal'
import { AutoRow, RowBetween } from 'components/Row' import { AutoRow, RowBetween } from 'components/Row'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useState } from 'react' import { useState } from 'react'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { CloseIcon, ExternalLink, ThemedText, Z_INDEX } from 'theme' import { CloseIcon, ExternalLink, ThemedText, Z_INDEX } from 'theme'
...@@ -52,7 +52,7 @@ export default function UnsupportedCurrencyFooter({ ...@@ -52,7 +52,7 @@ export default function UnsupportedCurrencyFooter({
show: boolean show: boolean
currencies: (Currency | undefined | null)[] currencies: (Currency | undefined | null)[]
}) { }) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const [showDetails, setShowDetails] = useState(false) const [showDetails, setShowDetails] = useState(false)
const tokens = const tokens =
......
import { isAddress } from '@ethersproject/address' import { isAddress } from '@ethersproject/address'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { ReactNode, useState } from 'react' import { ReactNode, useState } from 'react'
import { X } from 'react-feather' import { X } from 'react-feather'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
...@@ -42,7 +42,7 @@ interface VoteModalProps { ...@@ -42,7 +42,7 @@ interface VoteModalProps {
} }
export default function DelegateModal({ isOpen, onDismiss, title }: VoteModalProps) { export default function DelegateModal({ isOpen, onDismiss, title }: VoteModalProps) {
const { account, chainId } = useActiveWeb3React() const { account, chainId } = useWeb3React()
// state for delegate input // state for delegate input
const [usingDelegate, setUsingDelegate] = useState(false) const [usingDelegate, setUsingDelegate] = useState(false)
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { useContext, useState } from 'react' import { useContext, useState } from 'react'
import { ArrowUpCircle, X } from 'react-feather' import { ArrowUpCircle, X } from 'react-feather'
import styled, { ThemeContext } from 'styled-components/macro' import styled, { ThemeContext } from 'styled-components/macro'
...@@ -41,7 +41,7 @@ interface ExecuteModalProps { ...@@ -41,7 +41,7 @@ interface ExecuteModalProps {
} }
export default function ExecuteModal({ isOpen, onDismiss, proposalId }: ExecuteModalProps) { export default function ExecuteModal({ isOpen, onDismiss, proposalId }: ExecuteModalProps) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const executeCallback = useExecuteCallback() const executeCallback = useExecuteCallback()
// monitor call to help UI loading state // monitor call to help UI loading state
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { useWeb3React } from '@web3-react/core'
import { SupportedChainId } from 'constants/chains' import { SupportedChainId } from 'constants/chains'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { ThemedText } from 'theme' import { ThemedText } from 'theme'
...@@ -37,7 +37,7 @@ const EmptyState = ({ HeaderContent, SubHeaderContent }: EmptyStateProps) => ( ...@@ -37,7 +37,7 @@ const EmptyState = ({ HeaderContent, SubHeaderContent }: EmptyStateProps) => (
) )
export default function ProposalEmptyState() { export default function ProposalEmptyState() {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
if (chainId && chainId !== SupportedChainId.MAINNET) { if (chainId && chainId !== SupportedChainId.MAINNET) {
return ( return (
<EmptyState <EmptyState
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { useContext, useState } from 'react' import { useContext, useState } from 'react'
import { ArrowUpCircle, X } from 'react-feather' import { ArrowUpCircle, X } from 'react-feather'
import styled, { ThemeContext } from 'styled-components/macro' import styled, { ThemeContext } from 'styled-components/macro'
...@@ -41,7 +41,7 @@ interface QueueModalProps { ...@@ -41,7 +41,7 @@ interface QueueModalProps {
} }
export default function QueueModal({ isOpen, onDismiss, proposalId }: QueueModalProps) { export default function QueueModal({ isOpen, onDismiss, proposalId }: QueueModalProps) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const queueCallback = useQueueCallback() const queueCallback = useQueueCallback()
// monitor call to help UI loading state // monitor call to help UI loading state
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { useContext, useState } from 'react' import { useContext, useState } from 'react'
import { ArrowUpCircle, X } from 'react-feather' import { ArrowUpCircle, X } from 'react-feather'
import styled, { ThemeContext } from 'styled-components/macro' import styled, { ThemeContext } from 'styled-components/macro'
...@@ -44,7 +44,7 @@ interface VoteModalProps { ...@@ -44,7 +44,7 @@ interface VoteModalProps {
} }
export default function VoteModal({ isOpen, onDismiss, proposalId, voteOption }: VoteModalProps) { export default function VoteModal({ isOpen, onDismiss, proposalId, voteOption }: VoteModalProps) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const voteCallback = useVoteCallback() const voteCallback = useVoteCallback()
const { votes: availableVotes } = useUserVotes() const { votes: availableVotes } = useUserVotes()
......
import { Currency, Token } from '@uniswap/sdk-core' import { Currency, Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { CHAIN_INFO } from 'constants/chainInfo' import { CHAIN_INFO } from 'constants/chainInfo'
import { L2_CHAIN_IDS, SupportedChainId, SupportedL2ChainId } from 'constants/chains' import { L2_CHAIN_IDS, SupportedChainId, SupportedL2ChainId } from 'constants/chains'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useCurrencyFromMap, useTokenFromMapOrNetwork } from 'lib/hooks/useCurrency' import { useCurrencyFromMap, useTokenFromMapOrNetwork } from 'lib/hooks/useCurrency'
import { getTokenFilter } from 'lib/hooks/useTokenList/filtering' import { getTokenFilter } from 'lib/hooks/useTokenList/filtering'
import { useMemo } from 'react' import { useMemo } from 'react'
...@@ -13,7 +13,7 @@ import { TokenAddressMap, useUnsupportedTokenList } from './../state/lists/hooks ...@@ -13,7 +13,7 @@ import { TokenAddressMap, useUnsupportedTokenList } from './../state/lists/hooks
// reduce token map into standard address <-> Token mapping, optionally include user added tokens // reduce token map into standard address <-> Token mapping, optionally include user added tokens
function useTokensFromMap(tokenMap: TokenAddressMap, includeUserAdded: boolean): { [address: string]: Token } { function useTokensFromMap(tokenMap: TokenAddressMap, includeUserAdded: boolean): { [address: string]: Token } {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const userAddedTokens = useUserAddedTokens() const userAddedTokens = useUserAddedTokens()
return useMemo(() => { return useMemo(() => {
...@@ -63,7 +63,7 @@ type BridgeInfo = Record< ...@@ -63,7 +63,7 @@ type BridgeInfo = Record<
> >
export function useUnsupportedTokens(): { [address: string]: Token } { export function useUnsupportedTokens(): { [address: string]: Token } {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const listsByUrl = useAllLists() const listsByUrl = useAllLists()
const unsupportedTokensMap = useUnsupportedTokenList() const unsupportedTokensMap = useUnsupportedTokenList()
const unsupportedTokens = useTokensFromMap(unsupportedTokensMap, false) const unsupportedTokens = useTokensFromMap(unsupportedTokensMap, false)
...@@ -108,7 +108,7 @@ export function useUnsupportedTokens(): { [address: string]: Token } { ...@@ -108,7 +108,7 @@ export function useUnsupportedTokens(): { [address: string]: Token } {
export function useSearchInactiveTokenLists(search: string | undefined, minResults = 10): WrappedTokenInfo[] { export function useSearchInactiveTokenLists(search: string | undefined, minResults = 10): WrappedTokenInfo[] {
const lists = useAllLists() const lists = useAllLists()
const inactiveUrls = useInactiveListUrls() const inactiveUrls = useInactiveListUrls()
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const activeTokens = useAllTokens() const activeTokens = useAllTokens()
return useMemo(() => { return useMemo(() => {
if (!search || search.trim().length === 0) return [] if (!search || search.trim().length === 0) return []
......
// TODO(vm): Rm this file once #3759 is merged.
import { useWeb3React } from '@web3-react/core'
export default function useActiveWeb3React() {
return useWeb3React()
}
import { Currency } from '@uniswap/sdk-core' import { Currency } from '@uniswap/sdk-core'
import { Pool, Route } from '@uniswap/v3-sdk' import { Pool, Route } from '@uniswap/v3-sdk'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { useMemo } from 'react' import { useMemo } from 'react'
import { useV3SwapPools } from './useV3SwapPools' import { useV3SwapPools } from './useV3SwapPools'
...@@ -63,7 +63,7 @@ export function useAllV3Routes( ...@@ -63,7 +63,7 @@ export function useAllV3Routes(
currencyIn?: Currency, currencyIn?: Currency,
currencyOut?: Currency currencyOut?: Currency
): { loading: boolean; routes: Route<Currency, Currency>[] } { ): { loading: boolean; routes: Route<Currency, Currency>[] } {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const { pools, loading: poolsLoading } = useV3SwapPools(currencyIn, currencyOut) const { pools, loading: poolsLoading } = useV3SwapPools(currencyIn, currencyOut)
return useMemo(() => { return useMemo(() => {
......
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import ArgentWalletContractABI from '../abis/argent-wallet-contract.json' import ArgentWalletContractABI from '../abis/argent-wallet-contract.json'
import { ArgentWalletContract } from '../abis/types' import { ArgentWalletContract } from '../abis/types'
...@@ -6,7 +6,7 @@ import { useContract } from './useContract' ...@@ -6,7 +6,7 @@ import { useContract } from './useContract'
import useIsArgentWallet from './useIsArgentWallet' import useIsArgentWallet from './useIsArgentWallet'
export function useArgentWalletContract(): ArgentWalletContract | null { export function useArgentWalletContract(): ArgentWalletContract | null {
const { account } = useActiveWeb3React() const { account } = useWeb3React()
const isArgentWallet = useIsArgentWallet() const isArgentWallet = useIsArgentWallet()
return useContract( return useContract(
isArgentWallet ? account ?? undefined : undefined, isArgentWallet ? account ?? undefined : undefined,
......
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { AUTO_ROUTER_SUPPORTED_CHAINS } from 'lib/hooks/routing/clientSideSmartOrderRouter' import { AUTO_ROUTER_SUPPORTED_CHAINS } from 'lib/hooks/routing/clientSideSmartOrderRouter'
export default function useAutoRouterSupported(): boolean { export default function useAutoRouterSupported(): boolean {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
return Boolean(chainId && AUTO_ROUTER_SUPPORTED_CHAINS.includes(chainId)) return Boolean(chainId && AUTO_ROUTER_SUPPORTED_CHAINS.includes(chainId))
} }
import { Trade } from '@uniswap/router-sdk' import { Trade } from '@uniswap/router-sdk'
import { Currency, CurrencyAmount, Percent, TradeType } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Percent, TradeType } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { SUPPORTED_GAS_ESTIMATE_CHAIN_IDS } from 'constants/chains' import { SUPPORTED_GAS_ESTIMATE_CHAIN_IDS } from 'constants/chains'
import { L2_CHAIN_IDS } from 'constants/chains' import { L2_CHAIN_IDS } from 'constants/chains'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import useNativeCurrency from 'lib/hooks/useNativeCurrency' import useNativeCurrency from 'lib/hooks/useNativeCurrency'
import { useMemo } from 'react' import { useMemo } from 'react'
...@@ -35,7 +35,7 @@ const MAX_AUTO_SLIPPAGE_TOLERANCE = new Percent(25, 100) // 25% ...@@ -35,7 +35,7 @@ const MAX_AUTO_SLIPPAGE_TOLERANCE = new Percent(25, 100) // 25%
export default function useAutoSlippageTolerance( export default function useAutoSlippageTolerance(
trade: InterfaceTrade<Currency, Currency, TradeType> | undefined trade: InterfaceTrade<Currency, Currency, TradeType> | undefined
): Percent { ): Percent {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const onL2 = chainId && L2_CHAIN_IDS.includes(chainId) const onL2 = chainId && L2_CHAIN_IDS.includes(chainId)
const outputDollarValue = useUSDCValue(trade?.outputAmount) const outputDollarValue = useUSDCValue(trade?.outputAmount)
const nativeGasPrice = useGasPrice() const nativeGasPrice = useGasPrice()
......
import { Currency, CurrencyAmount, TradeType } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, TradeType } from '@uniswap/sdk-core'
import { Route, SwapQuoter } from '@uniswap/v3-sdk' import { Route, SwapQuoter } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core'
import { SupportedChainId } from 'constants/chains' import { SupportedChainId } from 'constants/chains'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import { useSingleContractWithCallData } from 'lib/hooks/multicall' import { useSingleContractWithCallData } from 'lib/hooks/multicall'
import { useMemo } from 'react' import { useMemo } from 'react'
...@@ -35,7 +35,7 @@ export function useClientSideV3Trade<TTradeType extends TradeType>( ...@@ -35,7 +35,7 @@ export function useClientSideV3Trade<TTradeType extends TradeType>(
const { routes, loading: routesLoading } = useAllV3Routes(currencyIn, currencyOut) const { routes, loading: routesLoading } = useAllV3Routes(currencyIn, currencyOut)
const quoter = useV3Quoter() const quoter = useV3Quoter()
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const callData = useMemo( const callData = useMemo(
() => () =>
amountSpecified amountSpecified
......
...@@ -6,6 +6,7 @@ import TickLensJson from '@uniswap/v3-periphery/artifacts/contracts/lens/TickLen ...@@ -6,6 +6,7 @@ import TickLensJson from '@uniswap/v3-periphery/artifacts/contracts/lens/TickLen
import UniswapInterfaceMulticallJson from '@uniswap/v3-periphery/artifacts/contracts/lens/UniswapInterfaceMulticall.sol/UniswapInterfaceMulticall.json' import UniswapInterfaceMulticallJson from '@uniswap/v3-periphery/artifacts/contracts/lens/UniswapInterfaceMulticall.sol/UniswapInterfaceMulticall.json'
import NonfungiblePositionManagerJson from '@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json' import NonfungiblePositionManagerJson from '@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json'
import V3MigratorJson from '@uniswap/v3-periphery/artifacts/contracts/V3Migrator.sol/V3Migrator.json' import V3MigratorJson from '@uniswap/v3-periphery/artifacts/contracts/V3Migrator.sol/V3Migrator.json'
import { useWeb3React } from '@web3-react/core'
import ARGENT_WALLET_DETECTOR_ABI from 'abis/argent-wallet-detector.json' import ARGENT_WALLET_DETECTOR_ABI from 'abis/argent-wallet-detector.json'
import EIP_2612 from 'abis/eip_2612.json' import EIP_2612 from 'abis/eip_2612.json'
import ENS_PUBLIC_RESOLVER_ABI from 'abis/ens-public-resolver.json' import ENS_PUBLIC_RESOLVER_ABI from 'abis/ens-public-resolver.json'
...@@ -27,7 +28,6 @@ import { ...@@ -27,7 +28,6 @@ import {
V3_MIGRATOR_ADDRESSES, V3_MIGRATOR_ADDRESSES,
} from 'constants/addresses' } from 'constants/addresses'
import { WRAPPED_NATIVE_CURRENCY } from 'constants/tokens' import { WRAPPED_NATIVE_CURRENCY } from 'constants/tokens'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useMemo } from 'react' import { useMemo } from 'react'
import { NonfungiblePositionManager, Quoter, TickLens, UniswapInterfaceMulticall } from 'types/v3' import { NonfungiblePositionManager, Quoter, TickLens, UniswapInterfaceMulticall } from 'types/v3'
import { V3Migrator } from 'types/v3/V3Migrator' import { V3Migrator } from 'types/v3/V3Migrator'
...@@ -48,7 +48,7 @@ export function useContract<T extends Contract = Contract>( ...@@ -48,7 +48,7 @@ export function useContract<T extends Contract = Contract>(
ABI: any, ABI: any,
withSignerIfPossible = true withSignerIfPossible = true
): T | null { ): T | null {
const { provider, account, chainId } = useActiveWeb3React() const { provider, account, chainId } = useWeb3React()
return useMemo(() => { return useMemo(() => {
if (!addressOrAddressMap || !ABI || !provider || !chainId) return null if (!addressOrAddressMap || !ABI || !provider || !chainId) return null
...@@ -74,7 +74,7 @@ export function useTokenContract(tokenAddress?: string, withSignerIfPossible?: b ...@@ -74,7 +74,7 @@ export function useTokenContract(tokenAddress?: string, withSignerIfPossible?: b
} }
export function useWETHContract(withSignerIfPossible?: boolean) { export function useWETHContract(withSignerIfPossible?: boolean) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
return useContract<Weth>( return useContract<Weth>(
chainId ? WRAPPED_NATIVE_CURRENCY[chainId]?.address : undefined, chainId ? WRAPPED_NATIVE_CURRENCY[chainId]?.address : undefined,
WETH_ABI, WETH_ABI,
...@@ -135,7 +135,7 @@ export function useV3Quoter() { ...@@ -135,7 +135,7 @@ export function useV3Quoter() {
} }
export function useTickLens(): TickLens | null { export function useTickLens(): TickLens | null {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const address = chainId ? TICK_LENS_ADDRESSES[chainId] : undefined const address = chainId ? TICK_LENS_ADDRESSES[chainId] : undefined
return useContract(address, TickLensABI) as TickLens | null return useContract(address, TickLensABI) as TickLens | null
} }
import { BigNumber } from '@ethersproject/bignumber' import { BigNumber } from '@ethersproject/bignumber'
import { hexZeroPad } from '@ethersproject/bytes' import { hexZeroPad } from '@ethersproject/bytes'
import { namehash } from '@ethersproject/hash' import { namehash } from '@ethersproject/hash'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { useSingleCallResult } from 'lib/hooks/multicall' import { useSingleCallResult } from 'lib/hooks/multicall'
import uriToHttp from 'lib/utils/uriToHttp' import uriToHttp from 'lib/utils/uriToHttp'
import { useEffect, useMemo, useState } from 'react' import { useEffect, useMemo, useState } from 'react'
...@@ -112,7 +112,7 @@ function useERC721Uri( ...@@ -112,7 +112,7 @@ function useERC721Uri(
enforceOwnership: boolean enforceOwnership: boolean
): { uri?: string; loading: boolean } { ): { uri?: string; loading: boolean } {
const idArgument = useMemo(() => [id], [id]) const idArgument = useMemo(() => [id], [id])
const { account } = useActiveWeb3React() const { account } = useWeb3React()
const contract = useERC721Contract(contractAddress) const contract = useERC721Contract(contractAddress)
const owner = useSingleCallResult(contract, 'ownerOf', idArgument) const owner = useSingleCallResult(contract, 'ownerOf', idArgument)
const uri = useSingleCallResult(contract, 'tokenURI', idArgument) const uri = useSingleCallResult(contract, 'tokenURI', idArgument)
...@@ -130,7 +130,7 @@ function useERC1155Uri( ...@@ -130,7 +130,7 @@ function useERC1155Uri(
id: string | undefined, id: string | undefined,
enforceOwnership: boolean enforceOwnership: boolean
): { uri?: string; loading: boolean } { ): { uri?: string; loading: boolean } {
const { account } = useActiveWeb3React() const { account } = useWeb3React()
const idArgument = useMemo(() => [id], [id]) const idArgument = useMemo(() => [id], [id])
const accountArgument = useMemo(() => [account || '', id], [account, id]) const accountArgument = useMemo(() => [account || '', id], [account, id])
const contract = useERC1155Contract(contractAddress) const contract = useERC1155Contract(contractAddress)
......
...@@ -4,7 +4,7 @@ import { Trade } from '@uniswap/router-sdk' ...@@ -4,7 +4,7 @@ import { Trade } from '@uniswap/router-sdk'
import { Currency, CurrencyAmount, Percent, TradeType } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Percent, TradeType } from '@uniswap/sdk-core'
import { Trade as V2Trade } from '@uniswap/v2-sdk' import { Trade as V2Trade } from '@uniswap/v2-sdk'
import { Trade as V3Trade } from '@uniswap/v3-sdk' import { Trade as V3Trade } from '@uniswap/v3-sdk'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import { useSingleCallResult } from 'lib/hooks/multicall' import { useSingleCallResult } from 'lib/hooks/multicall'
import { useMemo, useState } from 'react' import { useMemo, useState } from 'react'
...@@ -126,7 +126,7 @@ export function useERC20Permit( ...@@ -126,7 +126,7 @@ export function useERC20Permit(
state: UseERC20PermitState state: UseERC20PermitState
gatherPermitSignature: null | (() => Promise<void>) gatherPermitSignature: null | (() => Promise<void>)
} { } {
const { account, chainId, provider } = useActiveWeb3React() const { account, chainId, provider } = useWeb3React()
const tokenAddress = currencyAmount?.currency?.isToken ? currencyAmount.currency.address : undefined const tokenAddress = currencyAmount?.currency?.isToken ? currencyAmount.currency.address : undefined
const eip2612Contract = useEIP2612Contract(tokenAddress) const eip2612Contract = useEIP2612Contract(tokenAddress)
const isArgentWallet = useIsArgentWallet() const isArgentWallet = useIsArgentWallet()
...@@ -268,7 +268,7 @@ export function useERC20PermitFromTrade( ...@@ -268,7 +268,7 @@ export function useERC20PermitFromTrade(
allowedSlippage: Percent, allowedSlippage: Percent,
transactionDeadline: BigNumber | undefined transactionDeadline: BigNumber | undefined
) { ) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const swapRouterAddress = chainId const swapRouterAddress = chainId
? // v2 router does not support ? // v2 router does not support
trade instanceof V2Trade trade instanceof V2Trade
......
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { NEVER_RELOAD, useSingleCallResult } from 'lib/hooks/multicall' import { NEVER_RELOAD, useSingleCallResult } from 'lib/hooks/multicall'
import { useMemo } from 'react' import { useMemo } from 'react'
import { useArgentWalletDetectorContract } from './useContract' import { useArgentWalletDetectorContract } from './useContract'
export default function useIsArgentWallet(): boolean { export default function useIsArgentWallet(): boolean {
const { account } = useActiveWeb3React() const { account } = useWeb3React()
const argentWalletDetector = useArgentWalletDetectorContract() const argentWalletDetector = useArgentWalletDetectorContract()
const inputs = useMemo(() => [account ?? undefined], [account]) const inputs = useMemo(() => [account ?? undefined], [account])
const call = useSingleCallResult(argentWalletDetector, 'isArgentWallet', inputs, NEVER_RELOAD) const call = useSingleCallResult(argentWalletDetector, 'isArgentWallet', inputs, NEVER_RELOAD)
......
...@@ -3,7 +3,7 @@ import { BigintIsh, Currency, Token } from '@uniswap/sdk-core' ...@@ -3,7 +3,7 @@ import { BigintIsh, Currency, Token } from '@uniswap/sdk-core'
import { abi as IUniswapV3PoolStateABI } from '@uniswap/v3-core/artifacts/contracts/interfaces/pool/IUniswapV3PoolState.sol/IUniswapV3PoolState.json' import { abi as IUniswapV3PoolStateABI } from '@uniswap/v3-core/artifacts/contracts/interfaces/pool/IUniswapV3PoolState.sol/IUniswapV3PoolState.json'
import { computePoolAddress } from '@uniswap/v3-sdk' import { computePoolAddress } from '@uniswap/v3-sdk'
import { FeeAmount, Pool } from '@uniswap/v3-sdk' import { FeeAmount, Pool } from '@uniswap/v3-sdk'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import { useMultipleContractSingleData } from 'lib/hooks/multicall' import { useMultipleContractSingleData } from 'lib/hooks/multicall'
import { useMemo } from 'react' import { useMemo } from 'react'
...@@ -86,7 +86,7 @@ export enum PoolState { ...@@ -86,7 +86,7 @@ export enum PoolState {
export function usePools( export function usePools(
poolKeys: [Currency | undefined, Currency | undefined, FeeAmount | undefined][] poolKeys: [Currency | undefined, Currency | undefined, FeeAmount | undefined][]
): [PoolState, Pool | null][] { ): [PoolState, Pool | null][] {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const poolTokens: ([Token, Token, FeeAmount] | undefined)[] = useMemo(() => { const poolTokens: ([Token, Token, FeeAmount] | undefined)[] = useMemo(() => {
if (!chainId) return new Array(poolKeys.length) if (!chainId) return new Array(poolKeys.length)
......
import { Token } from '@uniswap/sdk-core' import { Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { SOCKS_CONTROLLER_ADDRESSES } from 'constants/addresses' import { SOCKS_CONTROLLER_ADDRESSES } from 'constants/addresses'
import { SupportedChainId } from 'constants/chains' import { SupportedChainId } from 'constants/chains'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useMemo } from 'react' import { useMemo } from 'react'
import { useTokenBalance } from 'state/wallet/hooks' import { useTokenBalance } from 'state/wallet/hooks'
...@@ -9,7 +9,7 @@ import { useTokenBalance } from 'state/wallet/hooks' ...@@ -9,7 +9,7 @@ import { useTokenBalance } from 'state/wallet/hooks'
const SOCKS = new Token(SupportedChainId.MAINNET, SOCKS_CONTROLLER_ADDRESSES[SupportedChainId.MAINNET], 0) const SOCKS = new Token(SupportedChainId.MAINNET, SOCKS_CONTROLLER_ADDRESSES[SupportedChainId.MAINNET], 0)
export function useHasSocks(): boolean | undefined { export function useHasSocks(): boolean | undefined {
const { account, chainId } = useActiveWeb3React() const { account, chainId } = useWeb3React()
const balance = useTokenBalance(account ?? undefined, chainId === SupportedChainId.MAINNET ? SOCKS : undefined) const balance = useTokenBalance(account ?? undefined, chainId === SupportedChainId.MAINNET ? SOCKS : undefined)
......
...@@ -3,8 +3,8 @@ import { SwapRouter, Trade } from '@uniswap/router-sdk' ...@@ -3,8 +3,8 @@ import { SwapRouter, Trade } from '@uniswap/router-sdk'
import { Currency, Percent, TradeType } from '@uniswap/sdk-core' import { Currency, Percent, TradeType } from '@uniswap/sdk-core'
import { Router as V2SwapRouter, Trade as V2Trade } from '@uniswap/v2-sdk' import { Router as V2SwapRouter, Trade as V2Trade } from '@uniswap/v2-sdk'
import { FeeOptions, SwapRouter as V3SwapRouter, Trade as V3Trade } from '@uniswap/v3-sdk' import { FeeOptions, SwapRouter as V3SwapRouter, Trade as V3Trade } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core'
import { SWAP_ROUTER_ADDRESSES, V3_ROUTER_ADDRESS } from 'constants/addresses' import { SWAP_ROUTER_ADDRESSES, V3_ROUTER_ADDRESS } from 'constants/addresses'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useMemo } from 'react' import { useMemo } from 'react'
import approveAmountCalldata from 'utils/approveAmountCalldata' import approveAmountCalldata from 'utils/approveAmountCalldata'
...@@ -39,7 +39,7 @@ export function useSwapCallArguments( ...@@ -39,7 +39,7 @@ export function useSwapCallArguments(
deadline: BigNumber | undefined, deadline: BigNumber | undefined,
feeOptions: FeeOptions | undefined feeOptions: FeeOptions | undefined
): SwapCall[] { ): SwapCall[] {
const { account, chainId, provider } = useActiveWeb3React() const { account, chainId, provider } = useWeb3React()
const { address: recipientAddress } = useENS(recipientAddressOrName) const { address: recipientAddress } = useENS(recipientAddressOrName)
const recipient = recipientAddressOrName === null ? account : recipientAddress const recipient = recipientAddressOrName === null ? account : recipientAddress
......
// eslint-disable-next-line no-restricted-imports // eslint-disable-next-line no-restricted-imports
import { Percent, TradeType } from '@uniswap/sdk-core' import { Percent, TradeType } from '@uniswap/sdk-core'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { SwapCallbackState, useSwapCallback as useLibSwapCallBack } from 'lib/hooks/swap/useSwapCallback' import { SwapCallbackState, useSwapCallback as useLibSwapCallBack } from 'lib/hooks/swap/useSwapCallback'
import { ReactNode, useMemo } from 'react' import { ReactNode, useMemo } from 'react'
...@@ -20,7 +20,7 @@ export function useSwapCallback( ...@@ -20,7 +20,7 @@ export function useSwapCallback(
recipientAddressOrName: string | null, // the ENS name or address of the recipient of the trade, or null if swap should be returned to sender recipientAddressOrName: string | null, // the ENS name or address of the recipient of the trade, or null if swap should be returned to sender
signatureData: SignatureData | undefined | null signatureData: SignatureData | undefined | null
): { state: SwapCallbackState; callback: null | (() => Promise<string>); error: ReactNode | null } { ): { state: SwapCallbackState; callback: null | (() => Promise<string>); error: ReactNode | null } {
const { account } = useActiveWeb3React() const { account } = useWeb3React()
const deadline = useTransactionDeadline() const deadline = useTransactionDeadline()
......
import { Currency } from '@uniswap/sdk-core' import { Currency } from '@uniswap/sdk-core'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { useMemo } from 'react' import { useMemo } from 'react'
import { useCombinedActiveList } from 'state/lists/hooks' import { useCombinedActiveList } from 'state/lists/hooks'
...@@ -7,7 +7,7 @@ import { useCombinedActiveList } from 'state/lists/hooks' ...@@ -7,7 +7,7 @@ import { useCombinedActiveList } from 'state/lists/hooks'
* Returns a WrappedTokenInfo from the active token lists when possible, * Returns a WrappedTokenInfo from the active token lists when possible,
* or the passed token otherwise. */ * or the passed token otherwise. */
export function useTokenInfoFromActiveList(currency: Currency) { export function useTokenInfoFromActiveList(currency: Currency) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const activeList = useCombinedActiveList() const activeList = useCombinedActiveList()
return useMemo(() => { return useMemo(() => {
......
import { BigNumber } from '@ethersproject/bignumber' import { BigNumber } from '@ethersproject/bignumber'
import { useWeb3React } from '@web3-react/core'
import { L2_CHAIN_IDS } from 'constants/chains' import { L2_CHAIN_IDS } from 'constants/chains'
import { L2_DEADLINE_FROM_NOW } from 'constants/misc' import { L2_DEADLINE_FROM_NOW } from 'constants/misc'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useMemo } from 'react' import { useMemo } from 'react'
import { useAppSelector } from 'state/hooks' import { useAppSelector } from 'state/hooks'
...@@ -9,7 +9,7 @@ import useCurrentBlockTimestamp from './useCurrentBlockTimestamp' ...@@ -9,7 +9,7 @@ import useCurrentBlockTimestamp from './useCurrentBlockTimestamp'
// combines the block timestamp with the user setting to give the deadline that should be used for any submitted transaction // combines the block timestamp with the user setting to give the deadline that should be used for any submitted transaction
export default function useTransactionDeadline(): BigNumber | undefined { export default function useTransactionDeadline(): BigNumber | undefined {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const ttl = useAppSelector((state) => state.user.userDeadline) const ttl = useAppSelector((state) => state.user.userDeadline)
const blockTimestamp = useCurrentBlockTimestamp() const blockTimestamp = useCurrentBlockTimestamp()
return useMemo(() => { return useMemo(() => {
......
import { Currency, CurrencyAmount, Price, Token, TradeType } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Price, Token, TradeType } from '@uniswap/sdk-core'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import tryParseCurrencyAmount from 'lib/utils/tryParseCurrencyAmount' import tryParseCurrencyAmount from 'lib/utils/tryParseCurrencyAmount'
import { useMemo, useRef } from 'react' import { useMemo, useRef } from 'react'
...@@ -80,7 +80,7 @@ export function useUSDCValue(currencyAmount: CurrencyAmount<Currency> | undefine ...@@ -80,7 +80,7 @@ export function useUSDCValue(currencyAmount: CurrencyAmount<Currency> | undefine
* @returns CurrencyAmount where currency is stablecoin on active chain * @returns CurrencyAmount where currency is stablecoin on active chain
*/ */
export function useStablecoinAmountFromFiatValue(fiatValue: string | null | undefined) { export function useStablecoinAmountFromFiatValue(fiatValue: string | null | undefined) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const stablecoin = chainId ? STABLECOIN_AMOUNT_OUT[chainId]?.currency : undefined const stablecoin = chainId ? STABLECOIN_AMOUNT_OUT[chainId]?.currency : undefined
return useMemo(() => { return useMemo(() => {
......
import { Currency, Token } from '@uniswap/sdk-core' import { Currency, Token } from '@uniswap/sdk-core'
import { FeeAmount, Pool } from '@uniswap/v3-sdk' import { FeeAmount, Pool } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core'
import { SupportedChainId } from 'constants/chains' import { SupportedChainId } from 'constants/chains'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useMemo } from 'react' import { useMemo } from 'react'
import { useAllCurrencyCombinations } from './useAllCurrencyCombinations' import { useAllCurrencyCombinations } from './useAllCurrencyCombinations'
...@@ -19,7 +19,7 @@ export function useV3SwapPools( ...@@ -19,7 +19,7 @@ export function useV3SwapPools(
pools: Pool[] pools: Pool[]
loading: boolean loading: boolean
} { } {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const allCurrencyCombinations = useAllCurrencyCombinations(currencyIn, currencyOut) const allCurrencyCombinations = useAllCurrencyCombinations(currencyIn, currencyOut)
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Currency } from '@uniswap/sdk-core' import { Currency } from '@uniswap/sdk-core'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import useNativeCurrency from 'lib/hooks/useNativeCurrency' import useNativeCurrency from 'lib/hooks/useNativeCurrency'
import tryParseCurrencyAmount from 'lib/utils/tryParseCurrencyAmount' import tryParseCurrencyAmount from 'lib/utils/tryParseCurrencyAmount'
import { useMemo } from 'react' import { useMemo } from 'react'
...@@ -57,7 +57,7 @@ export default function useWrapCallback( ...@@ -57,7 +57,7 @@ export default function useWrapCallback(
outputCurrency: Currency | undefined | null, outputCurrency: Currency | undefined | null,
typedValue: string | undefined typedValue: string | undefined
): { wrapType: WrapType; execute?: undefined | (() => Promise<void>); inputError?: WrapInputError } { ): { wrapType: WrapType; execute?: undefined | (() => Promise<void>); inputError?: WrapInputError } {
const { chainId, account } = useActiveWeb3React() const { chainId, account } = useWeb3React()
const wethContract = useWETHContract() const wethContract = useWETHContract()
const balance = useCurrencyBalance(account ?? undefined, inputCurrency ?? undefined) const balance = useCurrencyBalance(account ?? undefined, inputCurrency ?? undefined)
// we can always parse the amount typed as the input currency, since wrapping is 1:1 // we can always parse the amount typed as the input currency, since wrapping is 1:1
......
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import useBlockNumber from 'lib/hooks/useBlockNumber' import useBlockNumber from 'lib/hooks/useBlockNumber'
import multicall from 'lib/state/multicall' import multicall from 'lib/state/multicall'
import { SkipFirst } from 'types/tuple' import { SkipFirst } from 'types/tuple'
...@@ -37,7 +37,7 @@ export function useSingleContractWithCallData( ...@@ -37,7 +37,7 @@ export function useSingleContractWithCallData(
} }
function useCallContext() { function useCallContext() {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const latestBlock = useBlockNumber() const latestBlock = useBlockNumber()
return { chainId, latestBlock } return { chainId, latestBlock }
} }
...@@ -2,8 +2,8 @@ import { Protocol, Trade } from '@uniswap/router-sdk' ...@@ -2,8 +2,8 @@ import { Protocol, Trade } from '@uniswap/router-sdk'
import { Currency, CurrencyAmount, Percent, Token, TradeType } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Percent, Token, TradeType } from '@uniswap/sdk-core'
import { Pair, Route as V2Route, Trade as V2Trade } from '@uniswap/v2-sdk' import { Pair, Route as V2Route, Trade as V2Trade } from '@uniswap/v2-sdk'
import { Pool, Route as V3Route, Trade as V3Trade } from '@uniswap/v3-sdk' import { Pool, Route as V3Route, Trade as V3Trade } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core'
import { SWAP_ROUTER_ADDRESSES, V2_ROUTER_ADDRESS, V3_ROUTER_ADDRESS } from 'constants/addresses' import { SWAP_ROUTER_ADDRESSES, V2_ROUTER_ADDRESS, V3_ROUTER_ADDRESS } from 'constants/addresses'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useMemo } from 'react' import { useMemo } from 'react'
import { getTxOptimizedSwapRouter, SwapRouterVersion } from 'utils/getTxOptimizedSwapRouter' import { getTxOptimizedSwapRouter, SwapRouterVersion } from 'utils/getTxOptimizedSwapRouter'
...@@ -16,7 +16,7 @@ function useSwapApprovalStates( ...@@ -16,7 +16,7 @@ function useSwapApprovalStates(
allowedSlippage: Percent, allowedSlippage: Percent,
useIsPendingApproval: (token?: Token, spender?: string) => boolean useIsPendingApproval: (token?: Token, spender?: string) => boolean
): { v2: ApprovalState; v3: ApprovalState; v2V3: ApprovalState } { ): { v2: ApprovalState; v3: ApprovalState; v2V3: ApprovalState } {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const amountToApprove = useMemo( const amountToApprove = useMemo(
() => (trade && trade.inputAmount.currency.isToken ? trade.maximumAmountIn(allowedSlippage) : undefined), () => (trade && trade.inputAmount.currency.isToken ? trade.maximumAmountIn(allowedSlippage) : undefined),
...@@ -40,7 +40,7 @@ export function useSwapRouterAddress( ...@@ -40,7 +40,7 @@ export function useSwapRouterAddress(
| Trade<Currency, Currency, TradeType> | Trade<Currency, Currency, TradeType>
| undefined | undefined
) { ) {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
return useMemo( return useMemo(
() => () =>
chainId chainId
......
...@@ -4,7 +4,7 @@ import { TransactionResponse } from '@ethersproject/providers' ...@@ -4,7 +4,7 @@ import { TransactionResponse } from '@ethersproject/providers'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Percent } from '@uniswap/sdk-core' import { Percent } from '@uniswap/sdk-core'
import { FeeOptions } from '@uniswap/v3-sdk' import { FeeOptions } from '@uniswap/v3-sdk'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import useENS from 'hooks/useENS' import useENS from 'hooks/useENS'
import { SignatureData } from 'hooks/useERC20Permit' import { SignatureData } from 'hooks/useERC20Permit'
import { AnyTrade, useSwapCallArguments } from 'hooks/useSwapCallArguments' import { AnyTrade, useSwapCallArguments } from 'hooks/useSwapCallArguments'
...@@ -42,7 +42,7 @@ export function useSwapCallback({ ...@@ -42,7 +42,7 @@ export function useSwapCallback({
deadline, deadline,
feeOptions, feeOptions,
}: UseSwapCallbackArgs): UseSwapCallbackReturns { }: UseSwapCallbackArgs): UseSwapCallbackReturns {
const { account, chainId, provider } = useActiveWeb3React() const { account, chainId, provider } = useWeb3React()
const swapCalls = useSwapCallArguments( const swapCalls = useSwapCallArguments(
trade, trade,
......
import { TransactionReceipt } from '@ethersproject/abstract-provider' import { TransactionReceipt } from '@ethersproject/abstract-provider'
import { useWeb3React } from '@web3-react/core'
import { SupportedChainId } from 'constants/chains' import { SupportedChainId } from 'constants/chains'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import useBlockNumber, { useFastForwardBlockNumber } from 'lib/hooks/useBlockNumber' import useBlockNumber, { useFastForwardBlockNumber } from 'lib/hooks/useBlockNumber'
import ms from 'ms.macro' import ms from 'ms.macro'
import { useCallback, useEffect } from 'react' import { useCallback, useEffect } from 'react'
...@@ -45,7 +45,7 @@ interface UpdaterProps { ...@@ -45,7 +45,7 @@ interface UpdaterProps {
} }
export default function Updater({ pendingTransactions, onCheck, onReceipt }: UpdaterProps): null { export default function Updater({ pendingTransactions, onCheck, onReceipt }: UpdaterProps): null {
const { chainId, provider } = useActiveWeb3React() const { chainId, provider } = useWeb3React()
const lastBlockNumber = useBlockNumber() const lastBlockNumber = useBlockNumber()
const fastForwardBlockNumber = useFastForwardBlockNumber() const fastForwardBlockNumber = useFastForwardBlockNumber()
......
import { MaxUint256 } from '@ethersproject/constants' import { MaxUint256 } from '@ethersproject/constants'
import { TransactionResponse } from '@ethersproject/providers' import { TransactionResponse } from '@ethersproject/providers'
import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { useTokenContract } from 'hooks/useContract' import { useTokenContract } from 'hooks/useContract'
import { useTokenAllowance } from 'hooks/useTokenAllowance' import { useTokenAllowance } from 'hooks/useTokenAllowance'
import { useCallback, useMemo } from 'react' import { useCallback, useMemo } from 'react'
...@@ -19,7 +19,7 @@ export function useApprovalStateForSpender( ...@@ -19,7 +19,7 @@ export function useApprovalStateForSpender(
spender: string | undefined, spender: string | undefined,
useIsPendingApproval: (token?: Token, spender?: string) => boolean useIsPendingApproval: (token?: Token, spender?: string) => boolean
): ApprovalState { ): ApprovalState {
const { account } = useActiveWeb3React() const { account } = useWeb3React()
const token = amountToApprove?.currency?.isToken ? amountToApprove.currency : undefined const token = amountToApprove?.currency?.isToken ? amountToApprove.currency : undefined
const currentAllowance = useTokenAllowance(token, account ?? undefined, spender) const currentAllowance = useTokenAllowance(token, account ?? undefined, spender)
...@@ -48,7 +48,7 @@ export function useApproval( ...@@ -48,7 +48,7 @@ export function useApproval(
ApprovalState, ApprovalState,
() => Promise<{ response: TransactionResponse; tokenAddress: string; spenderAddress: string } | undefined> () => Promise<{ response: TransactionResponse; tokenAddress: string; spenderAddress: string } | undefined>
] { ] {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const token = amountToApprove?.currency?.isToken ? amountToApprove.currency : undefined const token = amountToApprove?.currency?.isToken ? amountToApprove.currency : undefined
// check the current approval status // check the current approval status
......
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import useIsWindowVisible from 'hooks/useIsWindowVisible' import useIsWindowVisible from 'hooks/useIsWindowVisible'
import { createContext, ReactNode, useCallback, useContext, useEffect, useMemo, useState } from 'react' import { createContext, ReactNode, useCallback, useContext, useEffect, useMemo, useState } from 'react'
...@@ -29,7 +29,7 @@ export function useFastForwardBlockNumber(): (block: number) => void { ...@@ -29,7 +29,7 @@ export function useFastForwardBlockNumber(): (block: number) => void {
} }
export function BlockNumberProvider({ children }: { children: ReactNode }) { export function BlockNumberProvider({ children }: { children: ReactNode }) {
const { chainId: activeChainId, provider } = useActiveWeb3React() const { chainId: activeChainId, provider } = useWeb3React()
const [{ chainId, block }, setChainBlock] = useState<{ chainId?: number; block?: number }>({ chainId: activeChainId }) const [{ chainId, block }, setChainBlock] = useState<{ chainId?: number; block?: number }>({ chainId: activeChainId })
const onBlock = useCallback( const onBlock = useCallback(
......
import { arrayify } from '@ethersproject/bytes' import { arrayify } from '@ethersproject/bytes'
import { parseBytes32String } from '@ethersproject/strings' import { parseBytes32String } from '@ethersproject/strings'
import { Currency, Token } from '@uniswap/sdk-core' import { Currency, Token } from '@uniswap/sdk-core'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { useBytes32TokenContract, useTokenContract } from 'hooks/useContract' import { useBytes32TokenContract, useTokenContract } from 'hooks/useContract'
import { NEVER_RELOAD, useSingleCallResult } from 'lib/hooks/multicall' import { NEVER_RELOAD, useSingleCallResult } from 'lib/hooks/multicall'
import useNativeCurrency from 'lib/hooks/useNativeCurrency' import useNativeCurrency from 'lib/hooks/useNativeCurrency'
...@@ -30,7 +30,7 @@ function parseStringOrBytes32(str: string | undefined, bytes32: string | undefin ...@@ -30,7 +30,7 @@ function parseStringOrBytes32(str: string | undefined, bytes32: string | undefin
* Returns undefined if tokenAddress is invalid or token does not exist. * Returns undefined if tokenAddress is invalid or token does not exist.
*/ */
export function useTokenFromNetwork(tokenAddress: string | null | undefined): Token | null | undefined { export function useTokenFromNetwork(tokenAddress: string | null | undefined): Token | null | undefined {
const { chainId, connector } = useActiveWeb3React() const { chainId, connector } = useWeb3React()
const chainAllowed = chainId && isChainAllowed(connector, chainId) const chainAllowed = chainId && isChainAllowed(connector, chainId)
const formattedAddress = isAddress(tokenAddress) const formattedAddress = isAddress(tokenAddress)
...@@ -96,7 +96,7 @@ export function useTokenFromMapOrNetwork(tokens: TokenMap, tokenAddress?: string ...@@ -96,7 +96,7 @@ export function useTokenFromMapOrNetwork(tokens: TokenMap, tokenAddress?: string
*/ */
export function useCurrencyFromMap(tokens: TokenMap, currencyId?: string | null): Currency | null | undefined { export function useCurrencyFromMap(tokens: TokenMap, currencyId?: string | null): Currency | null | undefined {
const nativeCurrency = useNativeCurrency() const nativeCurrency = useNativeCurrency()
const { chainId, connector } = useActiveWeb3React() const { chainId, connector } = useWeb3React()
const isNative = Boolean(nativeCurrency && currencyId?.toUpperCase() === 'ETH') const isNative = Boolean(nativeCurrency && currencyId?.toUpperCase() === 'ETH')
const shorthandMatchAddress = useMemo(() => { const shorthandMatchAddress = useMemo(() => {
const chain = supportedChainId(chainId) const chain = supportedChainId(chainId)
......
import { Interface } from '@ethersproject/abi' import { Interface } from '@ethersproject/abi'
import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import ERC20ABI from 'abis/erc20.json' import ERC20ABI from 'abis/erc20.json'
import { Erc20Interface } from 'abis/types/Erc20' import { Erc20Interface } from 'abis/types/Erc20'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import { useMultipleContractSingleData, useSingleContractMultipleData } from 'lib/hooks/multicall' import { useMultipleContractSingleData, useSingleContractMultipleData } from 'lib/hooks/multicall'
import { useMemo } from 'react' import { useMemo } from 'react'
...@@ -17,7 +17,7 @@ import { isAddress } from '../../utils' ...@@ -17,7 +17,7 @@ import { isAddress } from '../../utils'
export function useNativeCurrencyBalances(uncheckedAddresses?: (string | undefined)[]): { export function useNativeCurrencyBalances(uncheckedAddresses?: (string | undefined)[]): {
[address: string]: CurrencyAmount<Currency> | undefined [address: string]: CurrencyAmount<Currency> | undefined
} { } {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const multicallContract = useInterfaceMulticall() const multicallContract = useInterfaceMulticall()
const validAddressInputs: [string][] = useMemo( const validAddressInputs: [string][] = useMemo(
......
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { atomWithImmer } from 'jotai/immer' import { atomWithImmer } from 'jotai/immer'
import { useAtomValue, useUpdateAtom } from 'jotai/utils' import { useAtomValue, useUpdateAtom } from 'jotai/utils'
import { useCallback } from 'react' import { useCallback } from 'react'
...@@ -11,7 +11,7 @@ const oldestBlockMapAtom = atomWithImmer<{ [chainId: number]: number }>({}) ...@@ -11,7 +11,7 @@ const oldestBlockMapAtom = atomWithImmer<{ [chainId: number]: number }>({})
const DEFAULT_MAX_BLOCK_AGE = 10 const DEFAULT_MAX_BLOCK_AGE = 10
export function useSetOldestValidBlock(): (block: number) => void { export function useSetOldestValidBlock(): (block: number) => void {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const updateValidBlock = useUpdateAtom(oldestBlockMapAtom) const updateValidBlock = useUpdateAtom(oldestBlockMapAtom)
return useCallback( return useCallback(
(block: number) => { (block: number) => {
...@@ -25,7 +25,7 @@ export function useSetOldestValidBlock(): (block: number) => void { ...@@ -25,7 +25,7 @@ export function useSetOldestValidBlock(): (block: number) => void {
} }
export function useGetIsValidBlock(maxBlockAge = DEFAULT_MAX_BLOCK_AGE): (block: number) => boolean { export function useGetIsValidBlock(maxBlockAge = DEFAULT_MAX_BLOCK_AGE): (block: number) => boolean {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const currentBlock = useBlockNumber() const currentBlock = useBlockNumber()
const oldestBlockMap = useAtomValue(oldestBlockMapAtom) const oldestBlockMap = useAtomValue(oldestBlockMapAtom)
const oldestBlock = chainId ? oldestBlockMap[chainId] : 0 const oldestBlock = chainId ? oldestBlockMap[chainId] : 0
......
import { NativeCurrency } from '@uniswap/sdk-core' import { NativeCurrency } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { SupportedChainId } from 'constants/chains' import { SupportedChainId } from 'constants/chains'
import { nativeOnChain } from 'constants/tokens' import { nativeOnChain } from 'constants/tokens'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useMemo } from 'react' import { useMemo } from 'react'
export default function useNativeCurrency(): NativeCurrency { export default function useNativeCurrency(): NativeCurrency {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
return useMemo( return useMemo(
() => () =>
chainId chainId
......
import { createMulticall } from '@uniswap/redux-multicall' import { createMulticall } from '@uniswap/redux-multicall'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { useInterfaceMulticall } from 'hooks/useContract' import { useInterfaceMulticall } from 'hooks/useContract'
import useBlockNumber from 'lib/hooks/useBlockNumber' import useBlockNumber from 'lib/hooks/useBlockNumber'
import { combineReducers, createStore } from 'redux' import { combineReducers, createStore } from 'redux'
...@@ -11,7 +11,7 @@ export const store = createStore(reducer) ...@@ -11,7 +11,7 @@ export const store = createStore(reducer)
export default multicall export default multicall
export function MulticallUpdater() { export function MulticallUpdater() {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const latestBlockNumber = useBlockNumber() const latestBlockNumber = useBlockNumber()
const contract = useInterfaceMulticall() const contract = useInterfaceMulticall()
return <multicall.Updater chainId={chainId} latestBlockNumber={latestBlockNumber} contract={contract} /> return <multicall.Updater chainId={chainId} latestBlockNumber={latestBlockNumber} contract={contract} />
......
...@@ -3,9 +3,9 @@ import { TransactionResponse } from '@ethersproject/providers' ...@@ -3,9 +3,9 @@ import { TransactionResponse } from '@ethersproject/providers'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Currency, CurrencyAmount, Percent } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Percent } from '@uniswap/sdk-core'
import { FeeAmount, NonfungiblePositionManager } from '@uniswap/v3-sdk' import { FeeAmount, NonfungiblePositionManager } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core'
import { sendEvent } from 'components/analytics' import { sendEvent } from 'components/analytics'
import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter' import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import useParsedQueryString from 'hooks/useParsedQueryString' import useParsedQueryString from 'hooks/useParsedQueryString'
import { useCallback, useContext, useEffect, useState } from 'react' import { useCallback, useContext, useEffect, useState } from 'react'
import { AlertTriangle } from 'react-feather' import { AlertTriangle } from 'react-feather'
...@@ -81,7 +81,7 @@ export default function AddLiquidity({ ...@@ -81,7 +81,7 @@ export default function AddLiquidity({
}, },
history, history,
}: RouteComponentProps<{ currencyIdA?: string; currencyIdB?: string; feeAmount?: string; tokenId?: string }>) { }: RouteComponentProps<{ currencyIdA?: string; currencyIdB?: string; feeAmount?: string; tokenId?: string }>) {
const { account, chainId, provider } = useActiveWeb3React() const { account, chainId, provider } = useWeb3React()
const theme = useContext(ThemeContext) const theme = useContext(ThemeContext)
const toggleWalletModal = useWalletModalToggle() // toggle wallet when disconnected const toggleWalletModal = useWalletModalToggle() // toggle wallet when disconnected
const expertMode = useIsExpertMode() const expertMode = useIsExpertMode()
......
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import { Redirect, RouteComponentProps } from 'react-router-dom' import { Redirect, RouteComponentProps } from 'react-router-dom'
import { WRAPPED_NATIVE_CURRENCY } from '../../constants/tokens' import { WRAPPED_NATIVE_CURRENCY } from '../../constants/tokens'
...@@ -13,7 +13,7 @@ export function RedirectDuplicateTokenIds( ...@@ -13,7 +13,7 @@ export function RedirectDuplicateTokenIds(
}, },
} = props } = props
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
// prevent weth + eth // prevent weth + eth
const isETHOrWETHA = const isETHOrWETHA =
......
...@@ -2,10 +2,10 @@ import { BigNumber } from '@ethersproject/bignumber' ...@@ -2,10 +2,10 @@ import { BigNumber } from '@ethersproject/bignumber'
import { TransactionResponse } from '@ethersproject/providers' import { TransactionResponse } from '@ethersproject/providers'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Currency, CurrencyAmount, Percent } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Percent } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { sendEvent } from 'components/analytics' import { sendEvent } from 'components/analytics'
import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter' import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter'
import { SwitchLocaleLink } from 'components/SwitchLocaleLink' import { SwitchLocaleLink } from 'components/SwitchLocaleLink'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useCallback, useContext, useState } from 'react' import { useCallback, useContext, useState } from 'react'
import { Plus } from 'react-feather' import { Plus } from 'react-feather'
import { RouteComponentProps } from 'react-router-dom' import { RouteComponentProps } from 'react-router-dom'
...@@ -53,7 +53,7 @@ export default function AddLiquidity({ ...@@ -53,7 +53,7 @@ export default function AddLiquidity({
}, },
history, history,
}: RouteComponentProps<{ currencyIdA?: string; currencyIdB?: string }>) { }: RouteComponentProps<{ currencyIdA?: string; currencyIdB?: string }>) {
const { account, chainId, provider } = useActiveWeb3React() const { account, chainId, provider } = useWeb3React()
const theme = useContext(ThemeContext) const theme = useContext(ThemeContext)
......
...@@ -2,10 +2,10 @@ import { defaultAbiCoder } from '@ethersproject/abi' ...@@ -2,10 +2,10 @@ import { defaultAbiCoder } from '@ethersproject/abi'
import { getAddress, isAddress } from '@ethersproject/address' import { getAddress, isAddress } from '@ethersproject/address'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { ButtonError } from 'components/Button' import { ButtonError } from 'components/Button'
import { BlueCard } from 'components/Card' import { BlueCard } from 'components/Card'
import { AutoColumn } from 'components/Column' import { AutoColumn } from 'components/Column'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import tryParseCurrencyAmount from 'lib/utils/tryParseCurrencyAmount' import tryParseCurrencyAmount from 'lib/utils/tryParseCurrencyAmount'
import { Wrapper } from 'pages/Pool/styleds' import { Wrapper } from 'pages/Pool/styleds'
...@@ -86,7 +86,7 @@ const AutonomousProposalCTA = styled.div` ...@@ -86,7 +86,7 @@ const AutonomousProposalCTA = styled.div`
` `
export default function CreateProposal() { export default function CreateProposal() {
const { account, chainId } = useActiveWeb3React() const { account, chainId } = useWeb3React()
const latestProposalId = useLatestProposalId(account ?? undefined) ?? '0' const latestProposalId = useLatestProposalId(account ?? undefined) ?? '0'
const latestProposalData = useProposalData(LATEST_GOVERNOR_INDEX, latestProposalId) const latestProposalData = useProposalData(LATEST_GOVERNOR_INDEX, latestProposalId)
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { CurrencyAmount, Token } from '@uniswap/sdk-core' import { CurrencyAmount, Token } from '@uniswap/sdk-core'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import { useCallback, useState } from 'react' import { useCallback, useState } from 'react'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
...@@ -91,7 +91,7 @@ export default function Manage({ ...@@ -91,7 +91,7 @@ export default function Manage({
params: { currencyIdA, currencyIdB }, params: { currencyIdA, currencyIdB },
}, },
}: RouteComponentProps<{ currencyIdA: string; currencyIdB: string }>) { }: RouteComponentProps<{ currencyIdA: string; currencyIdB: string }>) {
const { account } = useActiveWeb3React() const { account } = useWeb3React()
// get currencies and pair // get currencies and pair
const [currencyA, currencyB] = [useCurrency(currencyIdA), useCurrency(currencyIdB)] const [currencyA, currencyB] = [useCurrency(currencyIdA), useCurrency(currencyIdB)]
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
...@@ -40,7 +40,7 @@ flex-direction: column; ...@@ -40,7 +40,7 @@ flex-direction: column;
` `
export default function Earn() { export default function Earn() {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
// staking info for connected account // staking info for connected account
const stakingInfos = useStakingInfo() const stakingInfos = useStakingInfo()
......
...@@ -3,6 +3,7 @@ import { TransactionResponse } from '@ethersproject/providers' ...@@ -3,6 +3,7 @@ import { TransactionResponse } from '@ethersproject/providers'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { CurrencyAmount, Fraction, Percent, Price, Token } from '@uniswap/sdk-core' import { CurrencyAmount, Fraction, Percent, Price, Token } from '@uniswap/sdk-core'
import { FeeAmount, Pool, Position, priceToClosestTick, TickMath } from '@uniswap/v3-sdk' import { FeeAmount, Pool, Position, priceToClosestTick, TickMath } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core'
import { sendEvent } from 'components/analytics' import { sendEvent } from 'components/analytics'
import Badge, { BadgeVariant } from 'components/Badge' import Badge, { BadgeVariant } from 'components/Badge'
import { ButtonConfirmed } from 'components/Button' import { ButtonConfirmed } from 'components/Button'
...@@ -13,7 +14,6 @@ import RangeSelector from 'components/RangeSelector' ...@@ -13,7 +14,6 @@ import RangeSelector from 'components/RangeSelector'
import RateToggle from 'components/RateToggle' import RateToggle from 'components/RateToggle'
import SettingsTab from 'components/Settings' import SettingsTab from 'components/Settings'
import { Dots } from 'components/swap/styleds' import { Dots } from 'components/swap/styleds'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { ApprovalState, useApproveCallback } from 'hooks/useApproveCallback' import { ApprovalState, useApproveCallback } from 'hooks/useApproveCallback'
import useCurrentBlockTimestamp from 'hooks/useCurrentBlockTimestamp' import useCurrentBlockTimestamp from 'hooks/useCurrentBlockTimestamp'
import { PoolState, usePool } from 'hooks/usePools' import { PoolState, usePool } from 'hooks/usePools'
...@@ -124,7 +124,7 @@ function V2PairMigration({ ...@@ -124,7 +124,7 @@ function V2PairMigration({
token0: Token token0: Token
token1: Token token1: Token
}) { }) {
const { chainId, account } = useActiveWeb3React() const { chainId, account } = useWeb3React()
const theme = useTheme() const theme = useTheme()
const v2FactoryAddress = chainId ? V2_FACTORY_ADDRESSES[chainId] : undefined const v2FactoryAddress = chainId ? V2_FACTORY_ADDRESSES[chainId] : undefined
...@@ -676,7 +676,7 @@ export default function MigrateV2Pair({ ...@@ -676,7 +676,7 @@ export default function MigrateV2Pair({
} }
}, [dispatch]) }, [dispatch])
const { chainId, account } = useActiveWeb3React() const { chainId, account } = useWeb3React()
// get pair contract // get pair contract
const validatedAddress = isAddress(address) const validatedAddress = isAddress(address)
......
...@@ -3,10 +3,10 @@ import { keccak256, pack } from '@ethersproject/solidity' ...@@ -3,10 +3,10 @@ import { keccak256, pack } from '@ethersproject/solidity'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Token } from '@uniswap/sdk-core' import { Token } from '@uniswap/sdk-core'
import { Pair } from '@uniswap/v2-sdk' import { Pair } from '@uniswap/v2-sdk'
import { useWeb3React } from '@web3-react/core'
import MigrateSushiPositionCard from 'components/PositionCard/Sushi' import MigrateSushiPositionCard from 'components/PositionCard/Sushi'
import MigrateV2PositionCard from 'components/PositionCard/V2' import MigrateV2PositionCard from 'components/PositionCard/V2'
import { SwitchLocaleLink } from 'components/SwitchLocaleLink' import { SwitchLocaleLink } from 'components/SwitchLocaleLink'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { PairState, useV2Pairs } from 'hooks/useV2Pairs' import { PairState, useV2Pairs } from 'hooks/useV2Pairs'
import { ReactNode, useContext, useMemo } from 'react' import { ReactNode, useContext, useMemo } from 'react'
import { Text } from 'rebass' import { Text } from 'rebass'
...@@ -52,7 +52,7 @@ function toSushiLiquidityToken([tokenA, tokenB]: [Token, Token]): Token { ...@@ -52,7 +52,7 @@ function toSushiLiquidityToken([tokenA, tokenB]: [Token, Token]): Token {
export default function MigrateV2() { export default function MigrateV2() {
const theme = useContext(ThemeContext) const theme = useContext(ThemeContext)
const { account, chainId } = useActiveWeb3React() const { account, chainId } = useWeb3React()
const v2FactoryAddress = chainId ? V2_FACTORY_ADDRESSES[chainId] : undefined const v2FactoryAddress = chainId ? V2_FACTORY_ADDRESSES[chainId] : undefined
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { useWeb3React } from '@web3-react/core'
import { AutoColumn } from 'components/Column' import { AutoColumn } from 'components/Column'
import { CHAIN_INFO } from 'constants/chainInfo' import { CHAIN_INFO } from 'constants/chainInfo'
import { SupportedChainId } from 'constants/chains' import { SupportedChainId } from 'constants/chains'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { ThemedText } from 'theme' import { ThemedText } from 'theme'
...@@ -93,7 +93,7 @@ const ResponsiveColumn = styled(AutoColumn)` ...@@ -93,7 +93,7 @@ const ResponsiveColumn = styled(AutoColumn)`
` `
export default function CTACards() { export default function CTACards() {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const { infoLink } = CHAIN_INFO[chainId ? chainId : SupportedChainId.MAINNET] const { infoLink } = CHAIN_INFO[chainId ? chainId : SupportedChainId.MAINNET]
return ( return (
<CTASection> <CTASection>
......
...@@ -3,6 +3,7 @@ import { TransactionResponse } from '@ethersproject/providers' ...@@ -3,6 +3,7 @@ import { TransactionResponse } from '@ethersproject/providers'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Currency, CurrencyAmount, Fraction, Percent, Price, Token } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Fraction, Percent, Price, Token } from '@uniswap/sdk-core'
import { NonfungiblePositionManager, Pool, Position } from '@uniswap/v3-sdk' import { NonfungiblePositionManager, Pool, Position } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core'
import { sendEvent } from 'components/analytics' import { sendEvent } from 'components/analytics'
import Badge from 'components/Badge' import Badge from 'components/Badge'
import { ButtonConfirmed, ButtonGray, ButtonPrimary } from 'components/Button' import { ButtonConfirmed, ButtonGray, ButtonPrimary } from 'components/Button'
...@@ -16,7 +17,6 @@ import { Dots } from 'components/swap/styleds' ...@@ -16,7 +17,6 @@ import { Dots } from 'components/swap/styleds'
import Toggle from 'components/Toggle' import Toggle from 'components/Toggle'
import TransactionConfirmationModal, { ConfirmationModalContent } from 'components/TransactionConfirmationModal' import TransactionConfirmationModal, { ConfirmationModalContent } from 'components/TransactionConfirmationModal'
import { useToken } from 'hooks/Tokens' import { useToken } from 'hooks/Tokens'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useV3NFTPositionManagerContract } from 'hooks/useContract' import { useV3NFTPositionManagerContract } from 'hooks/useContract'
import useIsTickAtLimit from 'hooks/useIsTickAtLimit' import useIsTickAtLimit from 'hooks/useIsTickAtLimit'
import { PoolState, usePool } from 'hooks/usePools' import { PoolState, usePool } from 'hooks/usePools'
...@@ -318,7 +318,7 @@ export function PositionPage({ ...@@ -318,7 +318,7 @@ export function PositionPage({
params: { tokenId: tokenIdFromUrl }, params: { tokenId: tokenIdFromUrl },
}, },
}: RouteComponentProps<{ tokenId?: string }>) { }: RouteComponentProps<{ tokenId?: string }>) {
const { chainId, account, provider } = useActiveWeb3React() const { chainId, account, provider } = useWeb3React()
const theme = useTheme() const theme = useTheme()
const parsedTokenId = tokenIdFromUrl ? BigNumber.from(tokenIdFromUrl) : undefined const parsedTokenId = tokenIdFromUrl ? BigNumber.from(tokenIdFromUrl) : undefined
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { useWeb3React } from '@web3-react/core'
import { ButtonGray, ButtonPrimary, ButtonText } from 'components/Button' import { ButtonGray, ButtonPrimary, ButtonText } from 'components/Button'
import { AutoColumn } from 'components/Column' import { AutoColumn } from 'components/Column'
import { FlyoutAlignment, NewMenu } from 'components/Menu' import { FlyoutAlignment, NewMenu } from 'components/Menu'
...@@ -6,7 +7,6 @@ import { SwapPoolTabs } from 'components/NavigationTabs' ...@@ -6,7 +7,6 @@ import { SwapPoolTabs } from 'components/NavigationTabs'
import PositionList from 'components/PositionList' import PositionList from 'components/PositionList'
import { RowBetween, RowFixed } from 'components/Row' import { RowBetween, RowFixed } from 'components/Row'
import { SwitchLocaleLink } from 'components/SwitchLocaleLink' import { SwitchLocaleLink } from 'components/SwitchLocaleLink'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useV3Positions } from 'hooks/useV3Positions' import { useV3Positions } from 'hooks/useV3Positions'
import { useContext } from 'react' import { useContext } from 'react'
import { BookOpen, ChevronDown, ChevronsRight, Inbox, Layers, PlusCircle } from 'react-feather' import { BookOpen, ChevronDown, ChevronsRight, Inbox, Layers, PlusCircle } from 'react-feather'
...@@ -127,7 +127,7 @@ function PositionsLoadingPlaceholder() { ...@@ -127,7 +127,7 @@ function PositionsLoadingPlaceholder() {
} }
export default function Pool() { export default function Pool() {
const { account, chainId } = useActiveWeb3React() const { account, chainId } = useWeb3React()
const toggleWalletModal = useWalletModalToggle() const toggleWalletModal = useWalletModalToggle()
const theme = useContext(ThemeContext) const theme = useContext(ThemeContext)
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Pair } from '@uniswap/v2-sdk' import { Pair } from '@uniswap/v2-sdk'
import { useWeb3React } from '@web3-react/core'
import { UNSUPPORTED_V2POOL_CHAIN_IDS } from 'constants/chains' import { UNSUPPORTED_V2POOL_CHAIN_IDS } from 'constants/chains'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import { useContext, useMemo } from 'react' import { useContext, useMemo } from 'react'
import { ChevronsRight } from 'react-feather' import { ChevronsRight } from 'react-feather'
...@@ -84,7 +84,7 @@ const Layer2Prompt = styled(EmptyProposals)` ...@@ -84,7 +84,7 @@ const Layer2Prompt = styled(EmptyProposals)`
export default function Pool() { export default function Pool() {
const theme = useContext(ThemeContext) const theme = useContext(ThemeContext)
const { account, chainId } = useActiveWeb3React() const { account, chainId } = useWeb3React()
const unsupportedV2Network = chainId && UNSUPPORTED_V2POOL_CHAIN_IDS.includes(chainId) const unsupportedV2Network = chainId && UNSUPPORTED_V2POOL_CHAIN_IDS.includes(chainId)
// fetch the user's balances of all tracked V2 LP tokens // fetch the user's balances of all tracked V2 LP tokens
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import { useCallback, useEffect, useState } from 'react' import { useCallback, useEffect, useState } from 'react'
import { Plus } from 'react-feather' import { Plus } from 'react-feather'
...@@ -39,7 +39,7 @@ function useQuery() { ...@@ -39,7 +39,7 @@ function useQuery() {
export default function PoolFinder() { export default function PoolFinder() {
const query = useQuery() const query = useQuery()
const { account, chainId } = useActiveWeb3React() const { account, chainId } = useWeb3React()
const [showSearch, setShowSearch] = useState<boolean>(false) const [showSearch, setShowSearch] = useState<boolean>(false)
const [activeField, setActiveField] = useState<number>(Fields.TOKEN1) const [activeField, setActiveField] = useState<number>(Fields.TOKEN1)
......
...@@ -3,6 +3,7 @@ import { TransactionResponse } from '@ethersproject/providers' ...@@ -3,6 +3,7 @@ import { TransactionResponse } from '@ethersproject/providers'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { CurrencyAmount, Percent } from '@uniswap/sdk-core' import { CurrencyAmount, Percent } from '@uniswap/sdk-core'
import { NonfungiblePositionManager } from '@uniswap/v3-sdk' import { NonfungiblePositionManager } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core'
import { sendEvent } from 'components/analytics' import { sendEvent } from 'components/analytics'
import RangeBadge from 'components/Badge/RangeBadge' import RangeBadge from 'components/Badge/RangeBadge'
import { ButtonConfirmed, ButtonPrimary } from 'components/Button' import { ButtonConfirmed, ButtonPrimary } from 'components/Button'
...@@ -17,7 +18,6 @@ import { AddRemoveTabs } from 'components/NavigationTabs' ...@@ -17,7 +18,6 @@ import { AddRemoveTabs } from 'components/NavigationTabs'
import { AutoRow, RowBetween, RowFixed } from 'components/Row' import { AutoRow, RowBetween, RowFixed } from 'components/Row'
import Slider from 'components/Slider' import Slider from 'components/Slider'
import Toggle from 'components/Toggle' import Toggle from 'components/Toggle'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useV3NFTPositionManagerContract } from 'hooks/useContract' import { useV3NFTPositionManagerContract } from 'hooks/useContract'
import useDebouncedChangeHandler from 'hooks/useDebouncedChangeHandler' import useDebouncedChangeHandler from 'hooks/useDebouncedChangeHandler'
import useTheme from 'hooks/useTheme' import useTheme from 'hooks/useTheme'
...@@ -66,7 +66,7 @@ export default function RemoveLiquidityV3({ ...@@ -66,7 +66,7 @@ export default function RemoveLiquidityV3({
function Remove({ tokenId }: { tokenId: BigNumber }) { function Remove({ tokenId }: { tokenId: BigNumber }) {
const { position } = useV3PositionFromTokenId(tokenId) const { position } = useV3PositionFromTokenId(tokenId)
const theme = useTheme() const theme = useTheme()
const { account, chainId, provider } = useActiveWeb3React() const { account, chainId, provider } = useWeb3React()
// flag for receiving WETH // flag for receiving WETH
const [receiveWETH, setReceiveWETH] = useState(false) const [receiveWETH, setReceiveWETH] = useState(false)
......
...@@ -3,8 +3,8 @@ import { Contract } from '@ethersproject/contracts' ...@@ -3,8 +3,8 @@ import { Contract } from '@ethersproject/contracts'
import { TransactionResponse } from '@ethersproject/providers' import { TransactionResponse } from '@ethersproject/providers'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Currency, Percent } from '@uniswap/sdk-core' import { Currency, Percent } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { sendEvent } from 'components/analytics' import { sendEvent } from 'components/analytics'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useV2LiquidityTokenPermit } from 'hooks/useV2LiquidityTokenPermit' import { useV2LiquidityTokenPermit } from 'hooks/useV2LiquidityTokenPermit'
import { useCallback, useContext, useMemo, useState } from 'react' import { useCallback, useContext, useMemo, useState } from 'react'
import { ArrowDown, Plus } from 'react-feather' import { ArrowDown, Plus } from 'react-feather'
...@@ -52,7 +52,7 @@ export default function RemoveLiquidity({ ...@@ -52,7 +52,7 @@ export default function RemoveLiquidity({
}, },
}: RouteComponentProps<{ currencyIdA: string; currencyIdB: string }>) { }: RouteComponentProps<{ currencyIdA: string; currencyIdB: string }>) {
const [currencyA, currencyB] = [useCurrency(currencyIdA) ?? undefined, useCurrency(currencyIdB) ?? undefined] const [currencyA, currencyB] = [useCurrency(currencyIdA) ?? undefined, useCurrency(currencyIdB) ?? undefined]
const { account, chainId, provider } = useActiveWeb3React() const { account, chainId, provider } = useWeb3React()
const [tokenA, tokenB] = useMemo(() => [currencyA?.wrapped, currencyB?.wrapped], [currencyA, currencyB]) const [tokenA, tokenB] = useMemo(() => [currencyA?.wrapped, currencyB?.wrapped], [currencyA, currencyB])
const theme = useContext(ThemeContext) const theme = useContext(ThemeContext)
......
...@@ -3,12 +3,12 @@ import { Trade } from '@uniswap/router-sdk' ...@@ -3,12 +3,12 @@ import { Trade } from '@uniswap/router-sdk'
import { Currency, CurrencyAmount, Token, TradeType } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Token, TradeType } from '@uniswap/sdk-core'
import { Trade as V2Trade } from '@uniswap/v2-sdk' import { Trade as V2Trade } from '@uniswap/v2-sdk'
import { Trade as V3Trade } from '@uniswap/v3-sdk' import { Trade as V3Trade } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core'
import { sendEvent } from 'components/analytics' import { sendEvent } from 'components/analytics'
import { NetworkAlert } from 'components/NetworkAlert/NetworkAlert' import { NetworkAlert } from 'components/NetworkAlert/NetworkAlert'
import SwapDetailsDropdown from 'components/swap/SwapDetailsDropdown' import SwapDetailsDropdown from 'components/swap/SwapDetailsDropdown'
import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter' import UnsupportedCurrencyFooter from 'components/swap/UnsupportedCurrencyFooter'
import { MouseoverTooltip } from 'components/Tooltip' import { MouseoverTooltip } from 'components/Tooltip'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useSwapCallback } from 'hooks/useSwapCallback' import { useSwapCallback } from 'hooks/useSwapCallback'
import useTransactionDeadline from 'hooks/useTransactionDeadline' import useTransactionDeadline from 'hooks/useTransactionDeadline'
import JSBI from 'jsbi' import JSBI from 'jsbi'
...@@ -64,7 +64,7 @@ const AlertWrapper = styled.div` ...@@ -64,7 +64,7 @@ const AlertWrapper = styled.div`
` `
export default function Swap({ history }: RouteComponentProps) { export default function Swap({ history }: RouteComponentProps) {
const { account, chainId } = useActiveWeb3React() const { account, chainId } = useWeb3React()
const loadedUrlParams = useDefaultsFromURLSearch() const loadedUrlParams = useDefaultsFromURLSearch()
// token warning stuff // token warning stuff
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { CurrencyAmount, Token } from '@uniswap/sdk-core' import { CurrencyAmount, Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { ButtonPrimary } from 'components/Button' import { ButtonPrimary } from 'components/Button'
import { AutoColumn } from 'components/Column' import { AutoColumn } from 'components/Column'
import { CardBGImage, CardNoise, CardSection, DataCard } from 'components/earn/styled' import { CardBGImage, CardNoise, CardSection, DataCard } from 'components/earn/styled'
...@@ -10,7 +11,6 @@ import { SwitchLocaleLink } from 'components/SwitchLocaleLink' ...@@ -10,7 +11,6 @@ import { SwitchLocaleLink } from 'components/SwitchLocaleLink'
import Toggle from 'components/Toggle' import Toggle from 'components/Toggle'
import DelegateModal from 'components/vote/DelegateModal' import DelegateModal from 'components/vote/DelegateModal'
import ProposalEmptyState from 'components/vote/ProposalEmptyState' import ProposalEmptyState from 'components/vote/ProposalEmptyState'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import { darken } from 'polished' import { darken } from 'polished'
import { useState } from 'react' import { useState } from 'react'
...@@ -107,7 +107,7 @@ const StyledExternalLink = styled(ExternalLink)` ...@@ -107,7 +107,7 @@ const StyledExternalLink = styled(ExternalLink)`
` `
export default function Landing() { export default function Landing() {
const { account, chainId } = useActiveWeb3React() const { account, chainId } = useWeb3React()
const [hideCancelled, setHideCancelled] = useState(true) const [hideCancelled, setHideCancelled] = useState(true)
......
import { BigNumber } from '@ethersproject/bignumber' import { BigNumber } from '@ethersproject/bignumber'
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { CurrencyAmount, Fraction, Token } from '@uniswap/sdk-core' import { CurrencyAmount, Fraction, Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import ExecuteModal from 'components/vote/ExecuteModal' import ExecuteModal from 'components/vote/ExecuteModal'
import QueueModal from 'components/vote/QueueModal' import QueueModal from 'components/vote/QueueModal'
import { useActiveLocale } from 'hooks/useActiveLocale' import { useActiveLocale } from 'hooks/useActiveLocale'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import useCurrentBlockTimestamp from 'hooks/useCurrentBlockTimestamp' import useCurrentBlockTimestamp from 'hooks/useCurrentBlockTimestamp'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import useBlockNumber from 'lib/hooks/useBlockNumber' import useBlockNumber from 'lib/hooks/useBlockNumber'
...@@ -157,7 +157,7 @@ export default function VotePage({ ...@@ -157,7 +157,7 @@ export default function VotePage({
}: RouteComponentProps<{ governorIndex: string; id: string }>) { }: RouteComponentProps<{ governorIndex: string; id: string }>) {
const parsedGovernorIndex = Number.parseInt(governorIndex) const parsedGovernorIndex = Number.parseInt(governorIndex)
const { chainId, account } = useActiveWeb3React() const { chainId, account } = useWeb3React()
const quorumAmount = useQuorum(parsedGovernorIndex) const quorumAmount = useQuorum(parsedGovernorIndex)
......
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import useDebounce from 'hooks/useDebounce' import useDebounce from 'hooks/useDebounce'
import useIsWindowVisible from 'hooks/useIsWindowVisible' import useIsWindowVisible from 'hooks/useIsWindowVisible'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
...@@ -22,7 +22,7 @@ function useQueryCacheInvalidator() { ...@@ -22,7 +22,7 @@ function useQueryCacheInvalidator() {
} }
export default function Updater(): null { export default function Updater(): null {
const { chainId, provider } = useActiveWeb3React() const { chainId, provider } = useWeb3React()
const dispatch = useAppDispatch() const dispatch = useAppDispatch()
const windowVisible = useIsWindowVisible() const windowVisible = useIsWindowVisible()
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Currency, CurrencyAmount, Percent, Token } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Percent, Token } from '@uniswap/sdk-core'
import { Pair } from '@uniswap/v2-sdk' import { Pair } from '@uniswap/v2-sdk'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import tryParseCurrencyAmount from 'lib/utils/tryParseCurrencyAmount' import tryParseCurrencyAmount from 'lib/utils/tryParseCurrencyAmount'
import { ReactNode, useCallback } from 'react' import { ReactNode, useCallback } from 'react'
...@@ -30,7 +30,7 @@ export function useDerivedBurnInfo( ...@@ -30,7 +30,7 @@ export function useDerivedBurnInfo(
} }
error?: ReactNode error?: ReactNode
} { } {
const { account } = useActiveWeb3React() const { account } = useWeb3React()
const { independentField, typedValue } = useBurnState() const { independentField, typedValue } = useBurnState()
......
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import { Currency, CurrencyAmount, Percent } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, Percent } from '@uniswap/sdk-core'
import { Position } from '@uniswap/v3-sdk' import { Position } from '@uniswap/v3-sdk'
import { useWeb3React } from '@web3-react/core'
import { useToken } from 'hooks/Tokens' import { useToken } from 'hooks/Tokens'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { usePool } from 'hooks/usePools' import { usePool } from 'hooks/usePools'
import { useV3PositionFees } from 'hooks/useV3PositionFees' import { useV3PositionFees } from 'hooks/useV3PositionFees'
import { ReactNode, useCallback, useMemo } from 'react' import { ReactNode, useCallback, useMemo } from 'react'
...@@ -30,7 +30,7 @@ export function useDerivedV3BurnInfo( ...@@ -30,7 +30,7 @@ export function useDerivedV3BurnInfo(
outOfRange: boolean outOfRange: boolean
error?: ReactNode error?: ReactNode
} { } {
const { account } = useActiveWeb3React() const { account } = useWeb3React()
const { percent } = useBurnV3State() const { percent } = useBurnV3State()
const token0 = useToken(position?.token0) const token0 = useToken(position?.token0)
......
import { TransactionResponse } from '@ethersproject/providers' import { TransactionResponse } from '@ethersproject/providers'
import { abi as MERKLE_DISTRIBUTOR_ABI } from '@uniswap/merkle-distributor/build/MerkleDistributor.json' import { abi as MERKLE_DISTRIBUTOR_ABI } from '@uniswap/merkle-distributor/build/MerkleDistributor.json'
import { CurrencyAmount, Token } from '@uniswap/sdk-core' import { CurrencyAmount, Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { MERKLE_DISTRIBUTOR_ADDRESS } from 'constants/addresses' import { MERKLE_DISTRIBUTOR_ADDRESS } from 'constants/addresses'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import { useSingleCallResult } from 'lib/hooks/multicall' import { useSingleCallResult } from 'lib/hooks/multicall'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
...@@ -100,7 +100,7 @@ function fetchClaim(account: string): Promise<UserClaimData> { ...@@ -100,7 +100,7 @@ function fetchClaim(account: string): Promise<UserClaimData> {
// parse distributorContract blob and detect if user has claim data // parse distributorContract blob and detect if user has claim data
// null means we know it does not // null means we know it does not
export function useUserClaimData(account: string | null | undefined): UserClaimData | null { export function useUserClaimData(account: string | null | undefined): UserClaimData | null {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const [claimInfo, setClaimInfo] = useState<{ [account: string]: UserClaimData | null }>({}) const [claimInfo, setClaimInfo] = useState<{ [account: string]: UserClaimData | null }>({})
...@@ -139,7 +139,7 @@ export function useUserHasAvailableClaim(account: string | null | undefined): bo ...@@ -139,7 +139,7 @@ export function useUserHasAvailableClaim(account: string | null | undefined): bo
} }
export function useUserUnclaimedAmount(account: string | null | undefined): CurrencyAmount<Token> | undefined { export function useUserUnclaimedAmount(account: string | null | undefined): CurrencyAmount<Token> | undefined {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const userClaimData = useUserClaimData(account) const userClaimData = useUserClaimData(account)
const canClaim = useUserHasAvailableClaim(account) const canClaim = useUserHasAvailableClaim(account)
...@@ -155,7 +155,7 @@ export function useClaimCallback(account: string | null | undefined): { ...@@ -155,7 +155,7 @@ export function useClaimCallback(account: string | null | undefined): {
claimCallback: () => Promise<string> claimCallback: () => Promise<string>
} { } {
// get claim data for this account // get claim data for this account
const { provider, chainId } = useActiveWeb3React() const { provider, chainId } = useWeb3React()
const claimData = useUserClaimData(account) const claimData = useUserClaimData(account)
// used for popup summary // used for popup summary
......
...@@ -9,6 +9,7 @@ import { t } from '@lingui/macro' ...@@ -9,6 +9,7 @@ import { t } from '@lingui/macro'
import { abi as GOVERNANCE_ABI } from '@uniswap/governance/build/GovernorAlpha.json' import { abi as GOVERNANCE_ABI } from '@uniswap/governance/build/GovernorAlpha.json'
import { abi as UNI_ABI } from '@uniswap/governance/build/Uni.json' import { abi as UNI_ABI } from '@uniswap/governance/build/Uni.json'
import { CurrencyAmount, Token } from '@uniswap/sdk-core' import { CurrencyAmount, Token } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import GOVERNOR_BRAVO_ABI from 'abis/governor-bravo.json' import GOVERNOR_BRAVO_ABI from 'abis/governor-bravo.json'
import { import {
GOVERNANCE_ALPHA_V0_ADDRESSES, GOVERNANCE_ALPHA_V0_ADDRESSES,
...@@ -18,7 +19,6 @@ import { ...@@ -18,7 +19,6 @@ import {
import { LATEST_GOVERNOR_INDEX } from 'constants/governance' import { LATEST_GOVERNOR_INDEX } from 'constants/governance'
import { POLYGON_PROPOSAL_TITLE } from 'constants/proposals/polygon_proposal_title' import { POLYGON_PROPOSAL_TITLE } from 'constants/proposals/polygon_proposal_title'
import { UNISWAP_GRANTS_PROPOSAL_DESCRIPTION } from 'constants/proposals/uniswap_grants_proposal_description' import { UNISWAP_GRANTS_PROPOSAL_DESCRIPTION } from 'constants/proposals/uniswap_grants_proposal_description'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useContract } from 'hooks/useContract' import { useContract } from 'hooks/useContract'
import { useSingleCallResult, useSingleContractMultipleData } from 'lib/hooks/multicall' import { useSingleCallResult, useSingleContractMultipleData } from 'lib/hooks/multicall'
import { useCallback, useMemo } from 'react' import { useCallback, useMemo } from 'react'
...@@ -53,7 +53,7 @@ function useGovernanceBravoContract(): Contract | null { ...@@ -53,7 +53,7 @@ function useGovernanceBravoContract(): Contract | null {
const useLatestGovernanceContract = useGovernanceBravoContract const useLatestGovernanceContract = useGovernanceBravoContract
export function useUniContract() { export function useUniContract() {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const uniAddress = useMemo(() => (chainId ? UNI[chainId]?.address : undefined), [chainId]) const uniAddress = useMemo(() => (chainId ? UNI[chainId]?.address : undefined), [chainId])
return useContract(uniAddress, UNI_ABI, true) return useContract(uniAddress, UNI_ABI, true)
} }
...@@ -227,7 +227,7 @@ function countToIndices(count: number | undefined, skip = 0) { ...@@ -227,7 +227,7 @@ function countToIndices(count: number | undefined, skip = 0) {
// get data for all past and active proposals // get data for all past and active proposals
export function useAllProposalData(): { data: ProposalData[]; loading: boolean } { export function useAllProposalData(): { data: ProposalData[]; loading: boolean } {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const gov0 = useGovernanceV0Contract() const gov0 = useGovernanceV0Contract()
const gov1 = useGovernanceV1Contract() const gov1 = useGovernanceV1Contract()
const gov2 = useGovernanceBravoContract() const gov2 = useGovernanceBravoContract()
...@@ -335,7 +335,7 @@ export function useProposalData(governorIndex: number, id: string): ProposalData ...@@ -335,7 +335,7 @@ export function useProposalData(governorIndex: number, id: string): ProposalData
export function useQuorum(governorIndex: number): CurrencyAmount<Token> | undefined { export function useQuorum(governorIndex: number): CurrencyAmount<Token> | undefined {
const latestGovernanceContract = useLatestGovernanceContract() const latestGovernanceContract = useLatestGovernanceContract()
const quorumVotes = useSingleCallResult(latestGovernanceContract, 'quorumVotes')?.result?.[0] const quorumVotes = useSingleCallResult(latestGovernanceContract, 'quorumVotes')?.result?.[0]
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const uni = useMemo(() => (chainId ? UNI[chainId] : undefined), [chainId]) const uni = useMemo(() => (chainId ? UNI[chainId] : undefined), [chainId])
if ( if (
...@@ -352,7 +352,7 @@ export function useQuorum(governorIndex: number): CurrencyAmount<Token> | undefi ...@@ -352,7 +352,7 @@ export function useQuorum(governorIndex: number): CurrencyAmount<Token> | undefi
// get the users delegatee if it exists // get the users delegatee if it exists
export function useUserDelegatee(): string { export function useUserDelegatee(): string {
const { account } = useActiveWeb3React() const { account } = useWeb3React()
const uniContract = useUniContract() const uniContract = useUniContract()
const { result } = useSingleCallResult(uniContract, 'delegates', [account ?? undefined]) const { result } = useSingleCallResult(uniContract, 'delegates', [account ?? undefined])
return result?.[0] ?? undefined return result?.[0] ?? undefined
...@@ -360,7 +360,7 @@ export function useUserDelegatee(): string { ...@@ -360,7 +360,7 @@ export function useUserDelegatee(): string {
// gets the users current votes // gets the users current votes
export function useUserVotes(): { loading: boolean; votes: CurrencyAmount<Token> | undefined } { export function useUserVotes(): { loading: boolean; votes: CurrencyAmount<Token> | undefined } {
const { account, chainId } = useActiveWeb3React() const { account, chainId } = useWeb3React()
const uniContract = useUniContract() const uniContract = useUniContract()
// check for available votes // check for available votes
...@@ -373,7 +373,7 @@ export function useUserVotes(): { loading: boolean; votes: CurrencyAmount<Token> ...@@ -373,7 +373,7 @@ export function useUserVotes(): { loading: boolean; votes: CurrencyAmount<Token>
// fetch available votes as of block (usually proposal start block) // fetch available votes as of block (usually proposal start block)
export function useUserVotesAsOfBlock(block: number | undefined): CurrencyAmount<Token> | undefined { export function useUserVotesAsOfBlock(block: number | undefined): CurrencyAmount<Token> | undefined {
const { account, chainId } = useActiveWeb3React() const { account, chainId } = useWeb3React()
const uniContract = useUniContract() const uniContract = useUniContract()
// check for available votes // check for available votes
...@@ -384,7 +384,7 @@ export function useUserVotesAsOfBlock(block: number | undefined): CurrencyAmount ...@@ -384,7 +384,7 @@ export function useUserVotesAsOfBlock(block: number | undefined): CurrencyAmount
} }
export function useDelegateCallback(): (delegatee: string | undefined) => undefined | Promise<string> { export function useDelegateCallback(): (delegatee: string | undefined) => undefined | Promise<string> {
const { account, chainId, provider } = useActiveWeb3React() const { account, chainId, provider } = useWeb3React()
const addTransaction = useTransactionAdder() const addTransaction = useTransactionAdder()
const uniContract = useUniContract() const uniContract = useUniContract()
...@@ -414,7 +414,7 @@ export function useVoteCallback(): ( ...@@ -414,7 +414,7 @@ export function useVoteCallback(): (
proposalId: string | undefined, proposalId: string | undefined,
voteOption: VoteOption voteOption: VoteOption
) => undefined | Promise<string> { ) => undefined | Promise<string> {
const { account, chainId } = useActiveWeb3React() const { account, chainId } = useWeb3React()
const latestGovernanceContract = useLatestGovernanceContract() const latestGovernanceContract = useLatestGovernanceContract()
const addTransaction = useTransactionAdder() const addTransaction = useTransactionAdder()
...@@ -442,7 +442,7 @@ export function useVoteCallback(): ( ...@@ -442,7 +442,7 @@ export function useVoteCallback(): (
} }
export function useQueueCallback(): (proposalId: string | undefined) => undefined | Promise<string> { export function useQueueCallback(): (proposalId: string | undefined) => undefined | Promise<string> {
const { account, chainId } = useActiveWeb3React() const { account, chainId } = useWeb3React()
const latestGovernanceContract = useLatestGovernanceContract() const latestGovernanceContract = useLatestGovernanceContract()
const addTransaction = useTransactionAdder() const addTransaction = useTransactionAdder()
...@@ -468,7 +468,7 @@ export function useQueueCallback(): (proposalId: string | undefined) => undefine ...@@ -468,7 +468,7 @@ export function useQueueCallback(): (proposalId: string | undefined) => undefine
} }
export function useExecuteCallback(): (proposalId: string | undefined) => undefined | Promise<string> { export function useExecuteCallback(): (proposalId: string | undefined) => undefined | Promise<string> {
const { account, chainId } = useActiveWeb3React() const { account, chainId } = useWeb3React()
const latestGovernanceContract = useLatestGovernanceContract() const latestGovernanceContract = useLatestGovernanceContract()
const addTransaction = useTransactionAdder() const addTransaction = useTransactionAdder()
...@@ -496,7 +496,7 @@ export function useExecuteCallback(): (proposalId: string | undefined) => undefi ...@@ -496,7 +496,7 @@ export function useExecuteCallback(): (proposalId: string | undefined) => undefi
export function useCreateProposalCallback(): ( export function useCreateProposalCallback(): (
createProposalData: CreateProposalData | undefined createProposalData: CreateProposalData | undefined
) => undefined | Promise<string> { ) => undefined | Promise<string> {
const { account, chainId } = useActiveWeb3React() const { account, chainId } = useWeb3React()
const latestGovernanceContract = useLatestGovernanceContract() const latestGovernanceContract = useLatestGovernanceContract()
const addTransaction = useTransactionAdder() const addTransaction = useTransactionAdder()
...@@ -534,7 +534,7 @@ export function useLatestProposalId(address: string | undefined): string | undef ...@@ -534,7 +534,7 @@ export function useLatestProposalId(address: string | undefined): string | undef
} }
export function useProposalThreshold(): CurrencyAmount<Token> | undefined { export function useProposalThreshold(): CurrencyAmount<Token> | undefined {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const latestGovernanceContract = useLatestGovernanceContract() const latestGovernanceContract = useLatestGovernanceContract()
const res = useSingleCallResult(latestGovernanceContract, 'proposalThreshold') const res = useSingleCallResult(latestGovernanceContract, 'proposalThreshold')
......
import { getVersionUpgrade, minVersionBump, VersionUpgrade } from '@uniswap/token-lists' import { getVersionUpgrade, minVersionBump, VersionUpgrade } from '@uniswap/token-lists'
import { useWeb3React } from '@web3-react/core'
import { SupportedChainId } from 'constants/chains' import { SupportedChainId } from 'constants/chains'
import { ARBITRUM_LIST, OPTIMISM_LIST, UNSUPPORTED_LIST_URLS } from 'constants/lists' import { ARBITRUM_LIST, OPTIMISM_LIST, UNSUPPORTED_LIST_URLS } from 'constants/lists'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import useInterval from 'lib/hooks/useInterval' import useInterval from 'lib/hooks/useInterval'
import { useCallback, useEffect } from 'react' import { useCallback, useEffect } from 'react'
import { useAppDispatch } from 'state/hooks' import { useAppDispatch } from 'state/hooks'
...@@ -13,7 +13,7 @@ import { acceptListUpdate, enableList } from './actions' ...@@ -13,7 +13,7 @@ import { acceptListUpdate, enableList } from './actions'
import { useActiveListUrls } from './hooks' import { useActiveListUrls } from './hooks'
export default function Updater(): null { export default function Updater(): null {
const { chainId, provider } = useActiveWeb3React() const { chainId, provider } = useWeb3React()
const dispatch = useAppDispatch() const dispatch = useAppDispatch()
const isWindowVisible = useIsWindowVisible() const isWindowVisible = useIsWindowVisible()
......
import { Filter } from '@ethersproject/providers' import { Filter } from '@ethersproject/providers'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import useBlockNumber from 'lib/hooks/useBlockNumber' import useBlockNumber from 'lib/hooks/useBlockNumber'
import { useEffect, useMemo } from 'react' import { useEffect, useMemo } from 'react'
...@@ -31,7 +31,7 @@ export interface UseLogsResult { ...@@ -31,7 +31,7 @@ export interface UseLogsResult {
* The filter parameter should _always_ be memoized, or else will trigger constant refetching * The filter parameter should _always_ be memoized, or else will trigger constant refetching
*/ */
export function useLogs(filter: Filter | undefined): UseLogsResult { export function useLogs(filter: Filter | undefined): UseLogsResult {
const { chainId } = useActiveWeb3React() const { chainId } = useWeb3React()
const blockNumber = useBlockNumber() const blockNumber = useBlockNumber()
const logs = useAppSelector((state) => state.logs) const logs = useAppSelector((state) => state.logs)
......
import { Filter } from '@ethersproject/providers' import { Filter } from '@ethersproject/providers'
import useActiveWeb3React from 'hooks/useActiveWeb3React' import { useWeb3React } from '@web3-react/core'
import useBlockNumber from 'lib/hooks/useBlockNumber' import useBlockNumber from 'lib/hooks/useBlockNumber'
import { useEffect, useMemo } from 'react' import { useEffect, useMemo } from 'react'
...@@ -10,7 +10,7 @@ import { isHistoricalLog, keyToFilter } from './utils' ...@@ -10,7 +10,7 @@ import { isHistoricalLog, keyToFilter } from './utils'
export default function Updater(): null { export default function Updater(): null {
const dispatch = useAppDispatch() const dispatch = useAppDispatch()
const state = useAppSelector((state) => state.logs) const state = useAppSelector((state) => state.logs)
const { chainId, provider } = useActiveWeb3React() const { chainId, provider } = useWeb3React()
const blockNumber = useBlockNumber() const blockNumber = useBlockNumber()
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment