Skip to content

Commit

Permalink
Assorted import fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Leandro committed Mar 4, 2022
1 parent 279130c commit 14dbd8e
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 19 deletions.
3 changes: 2 additions & 1 deletion src/custom/api/gnosisProtocol/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
export type { UnsupportedToken, OrderID, OrderMetaData } from './api'
import * as realApi from './api'
import * as mockApi from './mock'

export type { UnsupportedToken, OrderID, OrderMetaData } from './api'

const useMock = process.env.REACT_APP_MOCK === 'true'

// Re-exporting the result, mocked or not.
Expand Down
2 changes: 1 addition & 1 deletion src/custom/components/WalletModal/WalletModalMod.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Trans } from '@lingui/macro'
import { AbstractConnector } from '@web3-react/abstract-connector'
import { UnsupportedChainIdError, useWeb3React } from '@web3-react/core'
import { UnsupportedChainIdError, useWeb3React } from 'web3-react-core'
import { WalletConnectConnector } from '@web3-react/walletconnect-connector'
import { AutoRow } from 'components/Row'
// import { useWalletConnectMonitoringEventCallback } from 'hooks/useMonitoringEventCallback'
Expand Down
7 changes: 4 additions & 3 deletions src/custom/components/swap/TradePrice/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { useMemo } from 'react'
import TradePriceMod, { TradePriceProps } from './TradePriceMod'
import { useHigherUSDValue /* useUSDCValue */ } from 'hooks/useUSDCPrice'
import { formatSmart } from 'utils/format'
import { tryParseAmount } from 'state/swap/hooks'
import tryParseCurrencyAmount from 'lib/utils/tryParseCurrencyAmount'

import { FIAT_PRECISION } from 'constants/index'

export * from './TradePriceMod'
Expand All @@ -13,8 +14,8 @@ export default function TradePrice(props: Omit<TradePriceProps, 'fiatValue'>) {
const priceSide = useMemo(
() =>
!showInverted
? tryParseAmount(price.invert().toFixed(price.baseCurrency.decimals), price.baseCurrency)
: tryParseAmount(price.toFixed(price.quoteCurrency.decimals), price.quoteCurrency),
? tryParseCurrencyAmount(price.invert().toFixed(price.baseCurrency.decimals), price.baseCurrency)
: tryParseCurrencyAmount(price.toFixed(price.quoteCurrency.decimals), price.quoteCurrency),
[price, showInverted]
)
// const amount = useUSDCValue(priceSide)
Expand Down
3 changes: 2 additions & 1 deletion src/custom/hooks/useApproveCallback/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import { GP_VAULT_RELAYER, V_COW_CONTRACT_ADDRESS } from 'constants/index'
import TradeGp from 'state/swap/TradeGp'

import { ApproveCallbackParams, useApproveCallback } from './useApproveCallbackMod'
export { ApprovalState, useApproveCallback } from './useApproveCallbackMod'

import { ClaimType } from 'state/claim/hooks'
import { supportedChainId } from 'utils/supportedChainId'
import { EnhancedUserClaimData } from 'pages/Claim/types'

export { ApprovalState, useApproveCallback } from './useApproveCallbackMod'

type ApproveCallbackFromTradeParams = Pick<
ApproveCallbackParams,
'openTransactionConfirmationModal' | 'closeModals' | 'amountToCheckAgainstAllowance'
Expand Down
2 changes: 1 addition & 1 deletion src/custom/hooks/useTokenLazy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Contract } from '@ethersproject/contracts'

import { useActiveWeb3React } from 'hooks/web3'
import { getBytes32TokenContract, getTokenContract } from 'hooks/useContract'
import { parseStringOrBytes32 } from 'hooks/Tokens'
import { parseStringOrBytes32 } from 'lib/hooks/useCurrency'
import { useAddUserToken } from 'state/user/hooks'
import { Erc20 } from 'abis/types'
import { retry } from 'utils/retry'
Expand Down
2 changes: 1 addition & 1 deletion src/custom/hooks/useWalletInfo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import WalletConnectProvider from '@walletconnect/web3-provider'
import { WalletConnectConnector } from '@web3-react/walletconnect-connector'
import { useWeb3React } from '@web3-react/core'
import { useWeb3React } from 'web3-react-core'
import { Web3Provider } from '@ethersproject/providers'
import useENSName from '@src/hooks/useENSName'
import { useEffect, useState } from 'react'
Expand Down
8 changes: 4 additions & 4 deletions src/custom/pages/Claim/ClaimAddress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { useMemo } from 'react'
import { Trans } from '@lingui/macro'
import { ButtonSecondary } from 'components/Button'
import Circle from 'assets/images/blue-loader.svg'
import { CustomLightSpinner, TYPE } from 'theme'
import { CustomLightSpinner, ThemedText } from 'theme'
import { CheckAddress, InputField, InputFieldTitle, InputErrorText } from './styled'
import { ClaimCommonTypes } from './types'
import useENS from 'hooks/useENS'
import { useClaimDispatchers, useClaimState } from 'state/claim/hooks'
import { ClaimStatus } from 'state/claim/actions'
import { UnsupportedChainIdError, useWeb3React } from '@web3-react/core'
import { UnsupportedChainIdError, useWeb3React } from 'web3-react-core'

export type ClaimAddressProps = Pick<ClaimCommonTypes, 'account'> & {
toggleWalletModal: () => void
Expand Down Expand Up @@ -56,9 +56,9 @@ export default function ClaimAddress({ account, toggleWalletModal }: ClaimAddres

{showInputError && (
<InputErrorText>
<TYPE.error error={true}>
<ThemedText.Error error={true}>
<Trans>Enter valid address or ENS</Trans>
</TYPE.error>
</ThemedText.Error>
</InputErrorText>
)}

Expand Down
2 changes: 1 addition & 1 deletion src/custom/pages/Claim/FooterNavButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReactNode, useEffect, useRef } from 'react'
import { UnsupportedChainIdError, useWeb3React } from '@web3-react/core'
import { UnsupportedChainIdError, useWeb3React } from 'web3-react-core'
import { Trans } from '@lingui/macro'
import { isAddress } from '@ethersproject/address'
import {
Expand Down
6 changes: 3 additions & 3 deletions src/custom/pages/Claim/InvestmentFlow/InvestOption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { ButtonConfirmed } from 'components/Button'
import { ButtonSize } from 'theme'
import Loader from 'components/Loader'
import { useErrorModal } from 'hooks/useErrorMessageAndModal'
import { tryParseAmount } from 'state/swap/hooks'
import tryParseCurrencyAmount from 'lib/utils/tryParseCurrencyAmount'
import { calculateInvestmentAmounts, calculatePercentage } from 'state/claim/hooks/utils'
import { AMOUNT_PRECISION, PERCENTAGE_PRECISION } from 'constants/index'
import { useGasPrices } from 'state/gas/hooks'
Expand Down Expand Up @@ -233,7 +233,7 @@ export default function InvestOption({ claim, openModal, closeModal }: InvestOpt
useEffect(() => {
let error = null

const parsedAmount = tryParseAmount(typedValue, token)
const parsedAmount = tryParseCurrencyAmount(typedValue, token)

if (!maxCost || !balance) {
return
Expand Down Expand Up @@ -303,7 +303,7 @@ export default function InvestOption({ claim, openModal, closeModal }: InvestOpt
useEffect(() => {
const warnings = []

const parsedAmount = tryParseAmount(typedValue, token)
const parsedAmount = tryParseCurrencyAmount(typedValue, token)

if (!parsedAmount || !maxCost || !balance || inputError) {
setInputWarnings([])
Expand Down
2 changes: 1 addition & 1 deletion src/custom/pages/Claim/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useMemo } from 'react'
import { UnsupportedChainIdError, useWeb3React } from '@web3-react/core'
import { UnsupportedChainIdError, useWeb3React } from 'web3-react-core'

import { useActiveWeb3React } from 'hooks/web3'
import useENS from 'hooks/useENS'
Expand Down
8 changes: 6 additions & 2 deletions src/custom/state/price/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { UnsupportedToken } from 'api/gnosisProtocol'
import { FeeQuoteParams as FeeQuoteParamsFull } from 'utils/price'
import { OrderKind } from '@gnosis.pm/gp-v2-contracts'

import { useSwapState, tryParseAmount } from 'state/swap/hooks'
import { useSwapState } from 'state/swap/hooks'
import tryParseCurrencyAmount from 'lib/utils/tryParseCurrencyAmount'
import { Field } from 'state/swap/actions'
import { useIsUnsupportedTokenGp } from 'state/lists/hooks/hooksMod'

Expand Down Expand Up @@ -160,7 +161,10 @@ export default function FeesUpdater(): null {

// Don't refetch if the amount is missing
const kind = independentField === Field.INPUT ? OrderKind.SELL : OrderKind.BUY
const amount = tryParseAmount(typedValue, (kind === OrderKind.SELL ? sellCurrency : buyCurrency) ?? undefined)
const amount = tryParseCurrencyAmount(
typedValue,
(kind === OrderKind.SELL ? sellCurrency : buyCurrency) ?? undefined
)
if (!amount) return

const fromDecimals = sellCurrency?.decimals ?? DEFAULT_DECIMALS
Expand Down

0 comments on commit 14dbd8e

Please sign in to comment.