Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
b1c99d4b
Unverified
Commit
b1c99d4b
authored
Aug 09, 2023
by
Jack Short
Committed by
GitHub
Aug 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: moving coned formatting to interface (#7114)
parent
add6df46
Changes
32
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
594 additions
and
35 deletions
+594
-35
craco.config.cjs
craco.config.cjs
+1
-2
AuthenticatedHeader.tsx
src/components/AccountDrawer/AuthenticatedHeader.tsx
+1
-1
parseLocal.ts
...onents/AccountDrawer/MiniPortfolio/Activity/parseLocal.ts
+1
-1
parseRemote.tsx
...ents/AccountDrawer/MiniPortfolio/Activity/parseRemote.tsx
+1
-1
index.tsx
src/components/AccountDrawer/MiniPortfolio/Pools/index.tsx
+1
-1
index.tsx
src/components/AccountDrawer/MiniPortfolio/Tokens/index.tsx
+1
-1
FiatValue.tsx
src/components/CurrencyInputPanel/FiatValue.tsx
+1
-1
SwapCurrencyInputPanel.tsx
src/components/CurrencyInputPanel/SwapCurrencyInputPanel.tsx
+1
-1
SuggestionRow.tsx
src/components/NavBar/SuggestionRow.tsx
+1
-1
BalanceSummary.tsx
src/components/Tokens/TokenDetails/BalanceSummary.tsx
+1
-1
MobileBalanceSummaryFooter.tsx
...onents/Tokens/TokenDetails/MobileBalanceSummaryFooter.tsx
+1
-1
PriceChart.tsx
src/components/Tokens/TokenDetails/PriceChart.tsx
+1
-1
StatsSection.tsx
src/components/Tokens/TokenDetails/StatsSection.tsx
+1
-1
TokenRow.tsx
src/components/Tokens/TokenTable/TokenRow.tsx
+1
-1
AdvancedSwapDetails.tsx
src/components/swap/AdvancedSwapDetails.tsx
+1
-1
ConfirmSwapModal.tsx
src/components/swap/ConfirmSwapModal.tsx
+1
-1
GasBreakdownTooltip.tsx
src/components/swap/GasBreakdownTooltip.tsx
+1
-1
GasEstimateTooltip.tsx
src/components/swap/GasEstimateTooltip.tsx
+1
-1
PriceImpactModal.tsx
src/components/swap/PriceImpactModal.tsx
+1
-1
SwapModalFooter.tsx
src/components/swap/SwapModalFooter.tsx
+1
-1
SwapModalHeader.test.tsx
src/components/swap/SwapModalHeader.test.tsx
+1
-1
SwapModalHeaderAmount.tsx
src/components/swap/SwapModalHeaderAmount.tsx
+1
-1
TradePrice.tsx
src/components/swap/TradePrice.tsx
+1
-1
CarouselCard.tsx
src/nft/components/explore/CarouselCard.tsx
+1
-1
ListPage.tsx
src/nft/components/profile/list/ListPage.tsx
+1
-1
ListModal.tsx
src/nft/components/profile/list/Modal/ListModal.tsx
+1
-1
SuccessScreen.tsx
src/nft/components/profile/list/Modal/SuccessScreen.tsx
+1
-1
PositionPage.tsx
src/pages/Pool/PositionPage.tsx
+1
-1
index.tsx
src/pages/Swap/index.tsx
+1
-1
formatNumbers.test.ts
src/utils/formatNumbers.test.ts
+189
-1
formatNumbers.ts
src/utils/formatNumbers.ts
+375
-3
formatTickPrice.ts
src/utils/formatTickPrice.ts
+1
-1
No files found.
craco.config.cjs
View file @
b1c99d4b
...
@@ -57,9 +57,8 @@ module.exports = {
...
@@ -57,9 +57,8 @@ module.exports = {
'\\.(t|j)sx?$': '@swc/jest',
'\\.(t|j)sx?$': '@swc/jest',
},
},
// Use @uniswap/conedison's build directly, as jest does not support its exports.
// Use @uniswap/conedison's build directly, as jest does not support its exports.
transformIgnorePatterns: ['@uniswap/conedison/
format', '@uniswap/conedison/
provider'],
transformIgnorePatterns: ['@uniswap/conedison/provider'],
moduleNameMapper: {
moduleNameMapper: {
'@uniswap/conedison/format': '@uniswap/conedison/dist/format',
'@uniswap/conedison/provider': '@uniswap/conedison/dist/provider',
'@uniswap/conedison/provider': '@uniswap/conedison/dist/provider',
},
},
})
})
...
...
src/components/AccountDrawer/AuthenticatedHeader.tsx
View file @
b1c99d4b
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
BrowserEvent
,
InterfaceElementName
,
InterfaceEventName
,
SharedEventName
}
from
'
@uniswap/analytics-events
'
import
{
BrowserEvent
,
InterfaceElementName
,
InterfaceEventName
,
SharedEventName
}
from
'
@uniswap/analytics-events
'
import
{
formatNumber
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
CurrencyAmount
,
Token
}
from
'
@uniswap/sdk-core
'
import
{
CurrencyAmount
,
Token
}
from
'
@uniswap/sdk-core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
sendAnalyticsEvent
,
TraceEvent
}
from
'
analytics
'
import
{
sendAnalyticsEvent
,
TraceEvent
}
from
'
analytics
'
...
@@ -24,6 +23,7 @@ import { updateSelectedWallet } from 'state/user/reducer'
...
@@ -24,6 +23,7 @@ import { updateSelectedWallet } from 'state/user/reducer'
import
styled
,
{
useTheme
}
from
'
styled-components
'
import
styled
,
{
useTheme
}
from
'
styled-components
'
import
{
CopyHelper
,
ExternalLink
,
ThemedText
}
from
'
theme
'
import
{
CopyHelper
,
ExternalLink
,
ThemedText
}
from
'
theme
'
import
{
shortenAddress
}
from
'
utils
'
import
{
shortenAddress
}
from
'
utils
'
import
{
formatNumber
,
NumberType
}
from
'
utils/formatNumbers
'
import
{
useCloseModal
,
useFiatOnrampAvailability
,
useOpenModal
,
useToggleModal
}
from
'
../../state/application/hooks
'
import
{
useCloseModal
,
useFiatOnrampAvailability
,
useOpenModal
,
useToggleModal
}
from
'
../../state/application/hooks
'
import
{
ApplicationModal
}
from
'
../../state/application/reducer
'
import
{
ApplicationModal
}
from
'
../../state/application/reducer
'
...
...
src/components/AccountDrawer/MiniPortfolio/Activity/parseLocal.ts
View file @
b1c99d4b
import
{
BigNumber
}
from
'
@ethersproject/bignumber
'
import
{
BigNumber
}
from
'
@ethersproject/bignumber
'
import
{
t
}
from
'
@lingui/macro
'
import
{
t
}
from
'
@lingui/macro
'
import
{
formatCurrencyAmount
}
from
'
@uniswap/conedison/format
'
import
{
ChainId
,
Currency
,
CurrencyAmount
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
{
ChainId
,
Currency
,
CurrencyAmount
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
{
nativeOnChain
}
from
'
@uniswap/smart-order-router
'
import
{
nativeOnChain
}
from
'
@uniswap/smart-order-router
'
import
UniswapXBolt
from
'
assets/svg/bolt.svg
'
import
UniswapXBolt
from
'
assets/svg/bolt.svg
'
...
@@ -24,6 +23,7 @@ import {
...
@@ -24,6 +23,7 @@ import {
TransactionType
,
TransactionType
,
WrapTransactionInfo
,
WrapTransactionInfo
,
}
from
'
state/transactions/types
'
}
from
'
state/transactions/types
'
import
{
formatCurrencyAmount
}
from
'
utils/formatNumbers
'
import
{
CancelledTransactionTitleTable
,
getActivityTitle
,
OrderTextTable
}
from
'
../constants
'
import
{
CancelledTransactionTitleTable
,
getActivityTitle
,
OrderTextTable
}
from
'
../constants
'
import
{
Activity
,
ActivityMap
}
from
'
./types
'
import
{
Activity
,
ActivityMap
}
from
'
./types
'
...
...
src/components/AccountDrawer/MiniPortfolio/Activity/parseRemote.tsx
View file @
b1c99d4b
import
{
t
}
from
'
@lingui/macro
'
import
{
t
}
from
'
@lingui/macro
'
import
{
formatFiatPrice
,
formatNumberOrString
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
ChainId
,
NONFUNGIBLE_POSITION_MANAGER_ADDRESSES
,
UNI_ADDRESSES
}
from
'
@uniswap/sdk-core
'
import
{
ChainId
,
NONFUNGIBLE_POSITION_MANAGER_ADDRESSES
,
UNI_ADDRESSES
}
from
'
@uniswap/sdk-core
'
import
UniswapXBolt
from
'
assets/svg/bolt.svg
'
import
UniswapXBolt
from
'
assets/svg/bolt.svg
'
import
moonpayLogoSrc
from
'
assets/svg/moonpay.svg
'
import
moonpayLogoSrc
from
'
assets/svg/moonpay.svg
'
...
@@ -22,6 +21,7 @@ import { logSentryErrorForUnsupportedChain, supportedChainIdFromGQLChain } from
...
@@ -22,6 +21,7 @@ import { logSentryErrorForUnsupportedChain, supportedChainIdFromGQLChain } from
import
ms
from
'
ms
'
import
ms
from
'
ms
'
import
{
useEffect
,
useState
}
from
'
react
'
import
{
useEffect
,
useState
}
from
'
react
'
import
{
isAddress
}
from
'
utils
'
import
{
isAddress
}
from
'
utils
'
import
{
formatFiatPrice
,
formatNumberOrString
,
NumberType
}
from
'
utils/formatNumbers
'
import
{
MOONPAY_SENDER_ADDRESSES
,
OrderStatusTable
,
OrderTextTable
}
from
'
../constants
'
import
{
MOONPAY_SENDER_ADDRESSES
,
OrderStatusTable
,
OrderTextTable
}
from
'
../constants
'
import
{
Activity
}
from
'
./types
'
import
{
Activity
}
from
'
./types
'
...
...
src/components/AccountDrawer/MiniPortfolio/Pools/index.tsx
View file @
b1c99d4b
import
{
t
}
from
'
@lingui/macro
'
import
{
t
}
from
'
@lingui/macro
'
import
{
BrowserEvent
,
InterfaceElementName
,
SharedEventName
}
from
'
@uniswap/analytics-events
'
import
{
BrowserEvent
,
InterfaceElementName
,
SharedEventName
}
from
'
@uniswap/analytics-events
'
import
{
formatNumber
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
Position
}
from
'
@uniswap/v3-sdk
'
import
{
Position
}
from
'
@uniswap/v3-sdk
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
TraceEvent
}
from
'
analytics
'
import
{
TraceEvent
}
from
'
analytics
'
...
@@ -14,6 +13,7 @@ import { useCallback, useMemo, useReducer } from 'react'
...
@@ -14,6 +13,7 @@ import { useCallback, useMemo, useReducer } from 'react'
import
{
useNavigate
}
from
'
react-router-dom
'
import
{
useNavigate
}
from
'
react-router-dom
'
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
import
{
ThemedText
}
from
'
theme
'
import
{
ThemedText
}
from
'
theme
'
import
{
formatNumber
,
NumberType
}
from
'
utils/formatNumbers
'
import
{
ExpandoRow
}
from
'
../ExpandoRow
'
import
{
ExpandoRow
}
from
'
../ExpandoRow
'
import
{
PortfolioLogo
}
from
'
../PortfolioLogo
'
import
{
PortfolioLogo
}
from
'
../PortfolioLogo
'
...
...
src/components/AccountDrawer/MiniPortfolio/Tokens/index.tsx
View file @
b1c99d4b
import
{
BrowserEvent
,
InterfaceElementName
,
SharedEventName
}
from
'
@uniswap/analytics-events
'
import
{
BrowserEvent
,
InterfaceElementName
,
SharedEventName
}
from
'
@uniswap/analytics-events
'
import
{
formatNumber
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
TraceEvent
}
from
'
analytics
'
import
{
TraceEvent
}
from
'
analytics
'
import
{
useCachedPortfolioBalancesQuery
}
from
'
components/AccountDrawer/PrefetchBalancesWrapper
'
import
{
useCachedPortfolioBalancesQuery
}
from
'
components/AccountDrawer/PrefetchBalancesWrapper
'
import
Row
from
'
components/Row
'
import
Row
from
'
components/Row
'
...
@@ -12,6 +11,7 @@ import { useCallback, useMemo, useState } from 'react'
...
@@ -12,6 +11,7 @@ import { useCallback, useMemo, useState } from 'react'
import
{
useNavigate
}
from
'
react-router-dom
'
import
{
useNavigate
}
from
'
react-router-dom
'
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
import
{
EllipsisStyle
,
ThemedText
}
from
'
theme
'
import
{
EllipsisStyle
,
ThemedText
}
from
'
theme
'
import
{
formatNumber
,
NumberType
}
from
'
utils/formatNumbers
'
import
{
useToggleAccountDrawer
}
from
'
../..
'
import
{
useToggleAccountDrawer
}
from
'
../..
'
import
{
PortfolioArrow
}
from
'
../../AuthenticatedHeader
'
import
{
PortfolioArrow
}
from
'
../../AuthenticatedHeader
'
...
...
src/components/CurrencyInputPanel/FiatValue.tsx
View file @
b1c99d4b
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
formatNumber
,
formatPriceImpact
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
Percent
}
from
'
@uniswap/sdk-core
'
import
{
Percent
}
from
'
@uniswap/sdk-core
'
import
Row
from
'
components/Row
'
import
Row
from
'
components/Row
'
import
{
LoadingBubble
}
from
'
components/Tokens/loading
'
import
{
LoadingBubble
}
from
'
components/Tokens/loading
'
...
@@ -7,6 +6,7 @@ import { MouseoverTooltip } from 'components/Tooltip'
...
@@ -7,6 +6,7 @@ import { MouseoverTooltip } from 'components/Tooltip'
import
{
useMemo
}
from
'
react
'
import
{
useMemo
}
from
'
react
'
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
import
{
ThemedText
}
from
'
theme
'
import
{
ThemedText
}
from
'
theme
'
import
{
formatNumber
,
formatPriceImpact
,
NumberType
}
from
'
utils/formatNumbers
'
import
{
warningSeverity
}
from
'
utils/prices
'
import
{
warningSeverity
}
from
'
utils/prices
'
const
FiatLoadingBubble
=
styled
(
LoadingBubble
)
`
const
FiatLoadingBubble
=
styled
(
LoadingBubble
)
`
...
...
src/components/CurrencyInputPanel/SwapCurrencyInputPanel.tsx
View file @
b1c99d4b
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
BrowserEvent
,
InterfaceElementName
,
SwapEventName
}
from
'
@uniswap/analytics-events
'
import
{
BrowserEvent
,
InterfaceElementName
,
SwapEventName
}
from
'
@uniswap/analytics-events
'
import
{
formatCurrencyAmount
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
Currency
,
CurrencyAmount
,
Percent
}
from
'
@uniswap/sdk-core
'
import
{
Currency
,
CurrencyAmount
,
Percent
}
from
'
@uniswap/sdk-core
'
import
{
Pair
}
from
'
@uniswap/v2-sdk
'
import
{
Pair
}
from
'
@uniswap/v2-sdk
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
...
@@ -15,6 +14,7 @@ import { ReactNode, useCallback, useState } from 'react'
...
@@ -15,6 +14,7 @@ import { ReactNode, useCallback, useState } from 'react'
import
{
Lock
}
from
'
react-feather
'
import
{
Lock
}
from
'
react-feather
'
import
styled
,
{
useTheme
}
from
'
styled-components
'
import
styled
,
{
useTheme
}
from
'
styled-components
'
import
{
flexColumnNoWrap
,
flexRowNoWrap
}
from
'
theme/styles
'
import
{
flexColumnNoWrap
,
flexRowNoWrap
}
from
'
theme/styles
'
import
{
formatCurrencyAmount
,
NumberType
}
from
'
utils/formatNumbers
'
import
{
ReactComponent
as
DropDown
}
from
'
../../assets/images/dropdown.svg
'
import
{
ReactComponent
as
DropDown
}
from
'
../../assets/images/dropdown.svg
'
import
{
useCurrencyBalance
}
from
'
../../state/connection/hooks
'
import
{
useCurrencyBalance
}
from
'
../../state/connection/hooks
'
...
...
src/components/NavBar/SuggestionRow.tsx
View file @
b1c99d4b
import
{
InterfaceEventName
}
from
'
@uniswap/analytics-events
'
import
{
InterfaceEventName
}
from
'
@uniswap/analytics-events
'
import
{
formatUSDPrice
}
from
'
@uniswap/conedison/format
'
import
{
sendAnalyticsEvent
}
from
'
analytics
'
import
{
sendAnalyticsEvent
}
from
'
analytics
'
import
clsx
from
'
clsx
'
import
clsx
from
'
clsx
'
import
QueryTokenLogo
from
'
components/Logo/QueryTokenLogo
'
import
QueryTokenLogo
from
'
components/Logo/QueryTokenLogo
'
...
@@ -19,6 +18,7 @@ import { useCallback, useEffect, useState } from 'react'
...
@@ -19,6 +18,7 @@ import { useCallback, useEffect, useState } from 'react'
import
{
Link
,
useNavigate
}
from
'
react-router-dom
'
import
{
Link
,
useNavigate
}
from
'
react-router-dom
'
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
import
{
ThemedText
}
from
'
theme
'
import
{
ThemedText
}
from
'
theme
'
import
{
formatUSDPrice
}
from
'
utils/formatNumbers
'
import
{
DeltaText
,
getDeltaArrow
}
from
'
../Tokens/TokenDetails/PriceChart
'
import
{
DeltaText
,
getDeltaArrow
}
from
'
../Tokens/TokenDetails/PriceChart
'
import
{
useAddRecentlySearchedAsset
}
from
'
./RecentlySearchedAssets
'
import
{
useAddRecentlySearchedAsset
}
from
'
./RecentlySearchedAssets
'
...
...
src/components/Tokens/TokenDetails/BalanceSummary.tsx
View file @
b1c99d4b
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
formatCurrencyAmount
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
ChainId
,
Currency
}
from
'
@uniswap/sdk-core
'
import
{
ChainId
,
Currency
}
from
'
@uniswap/sdk-core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
CurrencyLogo
from
'
components/Logo/CurrencyLogo
'
import
CurrencyLogo
from
'
components/Logo/CurrencyLogo
'
...
@@ -9,6 +8,7 @@ import { useStablecoinValue } from 'hooks/useStablecoinPrice'
...
@@ -9,6 +8,7 @@ import { useStablecoinValue } from 'hooks/useStablecoinPrice'
import
useCurrencyBalance
from
'
lib/hooks/useCurrencyBalance
'
import
useCurrencyBalance
from
'
lib/hooks/useCurrencyBalance
'
import
styled
,
{
useTheme
}
from
'
styled-components
'
import
styled
,
{
useTheme
}
from
'
styled-components
'
import
{
ThemedText
}
from
'
theme
'
import
{
ThemedText
}
from
'
theme
'
import
{
formatCurrencyAmount
,
NumberType
}
from
'
utils/formatNumbers
'
const
BalancesCard
=
styled
.
div
`
const
BalancesCard
=
styled
.
div
`
box-shadow:
${({
theme
})
=>
theme
.
shallowShadow
}
;
box-shadow:
${({
theme
})
=>
theme
.
shallowShadow
}
;
...
...
src/components/Tokens/TokenDetails/MobileBalanceSummaryFooter.tsx
View file @
b1c99d4b
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
formatCurrencyAmount
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
Currency
}
from
'
@uniswap/sdk-core
'
import
{
Currency
}
from
'
@uniswap/sdk-core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
NATIVE_CHAIN_ID
}
from
'
constants/tokens
'
import
{
NATIVE_CHAIN_ID
}
from
'
constants/tokens
'
...
@@ -8,6 +7,7 @@ import { useStablecoinValue } from 'hooks/useStablecoinPrice'
...
@@ -8,6 +7,7 @@ import { useStablecoinValue } from 'hooks/useStablecoinPrice'
import
useCurrencyBalance
from
'
lib/hooks/useCurrencyBalance
'
import
useCurrencyBalance
from
'
lib/hooks/useCurrencyBalance
'
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
import
{
StyledInternalLink
}
from
'
theme
'
import
{
StyledInternalLink
}
from
'
theme
'
import
{
formatCurrencyAmount
,
NumberType
}
from
'
utils/formatNumbers
'
const
Wrapper
=
styled
.
div
`
const
Wrapper
=
styled
.
div
`
align-content: center;
align-content: center;
...
...
src/components/Tokens/TokenDetails/PriceChart.tsx
View file @
b1c99d4b
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
formatUSDPrice
}
from
'
@uniswap/conedison/format
'
import
{
AxisBottom
,
TickFormatter
}
from
'
@visx/axis
'
import
{
AxisBottom
,
TickFormatter
}
from
'
@visx/axis
'
import
{
localPoint
}
from
'
@visx/event
'
import
{
localPoint
}
from
'
@visx/event
'
import
{
EventType
}
from
'
@visx/event/lib/types
'
import
{
EventType
}
from
'
@visx/event/lib/types
'
...
@@ -24,6 +23,7 @@ import {
...
@@ -24,6 +23,7 @@ import {
monthYearDayFormatter
,
monthYearDayFormatter
,
weekFormatter
,
weekFormatter
,
}
from
'
utils/formatChartTimes
'
}
from
'
utils/formatChartTimes
'
import
{
formatUSDPrice
}
from
'
utils/formatNumbers
'
const
DATA_EMPTY
=
{
value
:
0
,
timestamp
:
0
}
const
DATA_EMPTY
=
{
value
:
0
,
timestamp
:
0
}
...
...
src/components/Tokens/TokenDetails/StatsSection.tsx
View file @
b1c99d4b
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
formatNumber
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
ChainId
}
from
'
@uniswap/sdk-core
'
import
{
ChainId
}
from
'
@uniswap/sdk-core
'
import
{
MouseoverTooltip
}
from
'
components/Tooltip
'
import
{
MouseoverTooltip
}
from
'
components/Tooltip
'
import
{
getChainInfo
}
from
'
constants/chainInfo
'
import
{
getChainInfo
}
from
'
constants/chainInfo
'
...
@@ -7,6 +6,7 @@ import { ReactNode } from 'react'
...
@@ -7,6 +6,7 @@ import { ReactNode } from 'react'
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
import
{
ExternalLink
,
ThemedText
}
from
'
theme
'
import
{
ExternalLink
,
ThemedText
}
from
'
theme
'
import
{
textFadeIn
}
from
'
theme/styles
'
import
{
textFadeIn
}
from
'
theme/styles
'
import
{
formatNumber
,
NumberType
}
from
'
utils/formatNumbers
'
import
{
UNSUPPORTED_METADATA_CHAINS
}
from
'
../constants
'
import
{
UNSUPPORTED_METADATA_CHAINS
}
from
'
../constants
'
import
{
TokenSortMethod
}
from
'
../state
'
import
{
TokenSortMethod
}
from
'
../state
'
...
...
src/components/Tokens/TokenTable/TokenRow.tsx
View file @
b1c99d4b
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
InterfaceEventName
}
from
'
@uniswap/analytics-events
'
import
{
InterfaceEventName
}
from
'
@uniswap/analytics-events
'
import
{
formatNumber
,
formatUSDPrice
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
ParentSize
}
from
'
@visx/responsive
'
import
{
ParentSize
}
from
'
@visx/responsive
'
import
{
sendAnalyticsEvent
}
from
'
analytics
'
import
{
sendAnalyticsEvent
}
from
'
analytics
'
import
SparklineChart
from
'
components/Charts/SparklineChart
'
import
SparklineChart
from
'
components/Charts/SparklineChart
'
...
@@ -15,6 +14,7 @@ import { ArrowDown, ArrowUp, Info } from 'react-feather'
...
@@ -15,6 +14,7 @@ import { ArrowDown, ArrowUp, Info } from 'react-feather'
import
{
Link
,
useParams
}
from
'
react-router-dom
'
import
{
Link
,
useParams
}
from
'
react-router-dom
'
import
styled
,
{
css
,
useTheme
}
from
'
styled-components
'
import
styled
,
{
css
,
useTheme
}
from
'
styled-components
'
import
{
BREAKPOINTS
,
ClickableStyle
}
from
'
theme
'
import
{
BREAKPOINTS
,
ClickableStyle
}
from
'
theme
'
import
{
formatNumber
,
formatUSDPrice
,
NumberType
}
from
'
utils/formatNumbers
'
import
{
import
{
LARGE_MEDIA_BREAKPOINT
,
LARGE_MEDIA_BREAKPOINT
,
...
...
src/components/swap/AdvancedSwapDetails.tsx
View file @
b1c99d4b
import
{
Plural
,
Trans
}
from
'
@lingui/macro
'
import
{
Plural
,
Trans
}
from
'
@lingui/macro
'
import
{
InterfaceElementName
,
SwapEventName
}
from
'
@uniswap/analytics-events
'
import
{
InterfaceElementName
,
SwapEventName
}
from
'
@uniswap/analytics-events
'
import
{
formatCurrencyAmount
,
formatNumber
,
formatPriceImpact
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
Percent
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
{
Percent
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
sendAnalyticsEvent
}
from
'
analytics
'
import
{
sendAnalyticsEvent
}
from
'
analytics
'
...
@@ -9,6 +8,7 @@ import { SUPPORTED_GAS_ESTIMATE_CHAIN_IDS } from 'constants/chains'
...
@@ -9,6 +8,7 @@ import { SUPPORTED_GAS_ESTIMATE_CHAIN_IDS } from 'constants/chains'
import
useNativeCurrency
from
'
lib/hooks/useNativeCurrency
'
import
useNativeCurrency
from
'
lib/hooks/useNativeCurrency
'
import
{
InterfaceTrade
}
from
'
state/routing/types
'
import
{
InterfaceTrade
}
from
'
state/routing/types
'
import
{
getTransactionCount
,
isClassicTrade
}
from
'
state/routing/utils
'
import
{
getTransactionCount
,
isClassicTrade
}
from
'
state/routing/utils
'
import
{
formatCurrencyAmount
,
formatNumber
,
formatPriceImpact
,
NumberType
}
from
'
utils/formatNumbers
'
import
{
Separator
,
ThemedText
}
from
'
../../theme
'
import
{
Separator
,
ThemedText
}
from
'
../../theme
'
import
Column
from
'
../Column
'
import
Column
from
'
../Column
'
...
...
src/components/swap/ConfirmSwapModal.tsx
View file @
b1c99d4b
...
@@ -5,7 +5,6 @@ import {
...
@@ -5,7 +5,6 @@ import {
SwapEventName
,
SwapEventName
,
SwapPriceUpdateUserResponse
,
SwapPriceUpdateUserResponse
,
}
from
'
@uniswap/analytics-events
'
}
from
'
@uniswap/analytics-events
'
import
{
formatCurrencyAmount
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
Currency
,
Percent
}
from
'
@uniswap/sdk-core
'
import
{
Currency
,
Percent
}
from
'
@uniswap/sdk-core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
sendAnalyticsEvent
,
Trace
,
useTrace
}
from
'
analytics
'
import
{
sendAnalyticsEvent
,
Trace
,
useTrace
}
from
'
analytics
'
...
@@ -30,6 +29,7 @@ import styled from 'styled-components'
...
@@ -30,6 +29,7 @@ import styled from 'styled-components'
import
{
ThemedText
}
from
'
theme
'
import
{
ThemedText
}
from
'
theme
'
import
invariant
from
'
tiny-invariant
'
import
invariant
from
'
tiny-invariant
'
import
{
isL2ChainId
}
from
'
utils/chains
'
import
{
isL2ChainId
}
from
'
utils/chains
'
import
{
formatCurrencyAmount
,
NumberType
}
from
'
utils/formatNumbers
'
import
{
formatSwapPriceUpdatedEventProperties
}
from
'
utils/loggingFormatters
'
import
{
formatSwapPriceUpdatedEventProperties
}
from
'
utils/loggingFormatters
'
import
{
didUserReject
}
from
'
utils/swapErrorToUserReadableMessage
'
import
{
didUserReject
}
from
'
utils/swapErrorToUserReadableMessage
'
import
{
tradeMeaningfullyDiffers
}
from
'
utils/tradeMeaningFullyDiffer
'
import
{
tradeMeaningfullyDiffers
}
from
'
utils/tradeMeaningFullyDiffer
'
...
...
src/components/swap/GasBreakdownTooltip.tsx
View file @
b1c99d4b
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
formatNumber
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
AutoColumn
}
from
'
components/Column
'
import
{
AutoColumn
}
from
'
components/Column
'
import
UniswapXRouterLabel
,
{
UniswapXGradient
}
from
'
components/RouterLabel/UniswapXRouterLabel
'
import
UniswapXRouterLabel
,
{
UniswapXGradient
}
from
'
components/RouterLabel/UniswapXRouterLabel
'
import
Row
from
'
components/Row
'
import
Row
from
'
components/Row
'
...
@@ -8,6 +7,7 @@ import { InterfaceTrade } from 'state/routing/types'
...
@@ -8,6 +7,7 @@ import { InterfaceTrade } from 'state/routing/types'
import
{
isClassicTrade
,
isUniswapXTrade
}
from
'
state/routing/utils
'
import
{
isClassicTrade
,
isUniswapXTrade
}
from
'
state/routing/utils
'
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
import
{
Divider
,
ExternalLink
,
ThemedText
}
from
'
theme
'
import
{
Divider
,
ExternalLink
,
ThemedText
}
from
'
theme
'
import
{
formatNumber
,
NumberType
}
from
'
utils/formatNumbers
'
const
Container
=
styled
(
AutoColumn
)
`
const
Container
=
styled
(
AutoColumn
)
`
padding: 4px;
padding: 4px;
...
...
src/components/swap/GasEstimateTooltip.tsx
View file @
b1c99d4b
import
{
InterfaceElementName
,
SwapEventName
}
from
'
@uniswap/analytics-events
'
import
{
InterfaceElementName
,
SwapEventName
}
from
'
@uniswap/analytics-events
'
import
{
formatNumber
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
sendAnalyticsEvent
}
from
'
analytics
'
import
{
sendAnalyticsEvent
}
from
'
analytics
'
import
{
LoadingOpacityContainer
}
from
'
components/Loader/styled
'
import
{
LoadingOpacityContainer
}
from
'
components/Loader/styled
'
...
@@ -11,6 +10,7 @@ import { InterfaceTrade } from 'state/routing/types'
...
@@ -11,6 +10,7 @@ import { InterfaceTrade } from 'state/routing/types'
import
{
isUniswapXTrade
}
from
'
state/routing/utils
'
import
{
isUniswapXTrade
}
from
'
state/routing/utils
'
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
import
{
ThemedText
}
from
'
theme
'
import
{
ThemedText
}
from
'
theme
'
import
{
formatNumber
,
NumberType
}
from
'
utils/formatNumbers
'
import
{
ReactComponent
as
GasIcon
}
from
'
../../assets/images/gas-icon.svg
'
import
{
ReactComponent
as
GasIcon
}
from
'
../../assets/images/gas-icon.svg
'
import
{
GasBreakdownTooltip
}
from
'
./GasBreakdownTooltip
'
import
{
GasBreakdownTooltip
}
from
'
./GasBreakdownTooltip
'
...
...
src/components/swap/PriceImpactModal.tsx
View file @
b1c99d4b
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
formatPriceImpact
}
from
'
@uniswap/conedison/format
'
import
{
Percent
}
from
'
@uniswap/sdk-core
'
import
{
Percent
}
from
'
@uniswap/sdk-core
'
import
{
ButtonEmphasis
,
ButtonSize
,
ThemeButton
}
from
'
components/Button
'
import
{
ButtonEmphasis
,
ButtonSize
,
ThemeButton
}
from
'
components/Button
'
import
{
ColumnCenter
}
from
'
components/Column
'
import
{
ColumnCenter
}
from
'
components/Column
'
...
@@ -7,6 +6,7 @@ import Row from 'components/Row'
...
@@ -7,6 +6,7 @@ import Row from 'components/Row'
import
{
AlertTriangle
}
from
'
react-feather
'
import
{
AlertTriangle
}
from
'
react-feather
'
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
import
{
CloseIcon
,
ThemedText
}
from
'
theme
'
import
{
CloseIcon
,
ThemedText
}
from
'
theme
'
import
{
formatPriceImpact
}
from
'
utils/formatNumbers
'
import
Modal
from
'
../Modal
'
import
Modal
from
'
../Modal
'
...
...
src/components/swap/SwapModalFooter.tsx
View file @
b1c99d4b
import
{
Plural
,
Trans
}
from
'
@lingui/macro
'
import
{
Plural
,
Trans
}
from
'
@lingui/macro
'
import
{
BrowserEvent
,
InterfaceElementName
,
SwapEventName
}
from
'
@uniswap/analytics-events
'
import
{
BrowserEvent
,
InterfaceElementName
,
SwapEventName
}
from
'
@uniswap/analytics-events
'
import
{
formatNumber
,
formatPriceImpact
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
Percent
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
{
Percent
,
TradeType
}
from
'
@uniswap/sdk-core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
TraceEvent
}
from
'
analytics
'
import
{
TraceEvent
}
from
'
analytics
'
...
@@ -16,6 +15,7 @@ import { getTransactionCount, isClassicTrade } from 'state/routing/utils'
...
@@ -16,6 +15,7 @@ import { getTransactionCount, isClassicTrade } from 'state/routing/utils'
import
{
useRouterPreference
,
useUserSlippageTolerance
}
from
'
state/user/hooks
'
import
{
useRouterPreference
,
useUserSlippageTolerance
}
from
'
state/user/hooks
'
import
styled
,
{
useTheme
}
from
'
styled-components
'
import
styled
,
{
useTheme
}
from
'
styled-components
'
import
{
ThemedText
}
from
'
theme
'
import
{
ThemedText
}
from
'
theme
'
import
{
formatNumber
,
formatPriceImpact
,
NumberType
}
from
'
utils/formatNumbers
'
import
{
formatTransactionAmount
,
priceToPreciseFloat
}
from
'
utils/formatNumbers
'
import
{
formatTransactionAmount
,
priceToPreciseFloat
}
from
'
utils/formatNumbers
'
import
getRoutingDiagramEntries
from
'
utils/getRoutingDiagramEntries
'
import
getRoutingDiagramEntries
from
'
utils/getRoutingDiagramEntries
'
import
{
formatSwapButtonClickEventProperties
}
from
'
utils/loggingFormatters
'
import
{
formatSwapButtonClickEventProperties
}
from
'
utils/loggingFormatters
'
...
...
src/components/swap/SwapModalHeader.test.tsx
View file @
b1c99d4b
import
{
formatCurrencyAmount
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
import
{
ETH_MAINNET
,
ETH_MAINNET
,
TEST_ALLOWED_SLIPPAGE
,
TEST_ALLOWED_SLIPPAGE
,
...
@@ -7,6 +6,7 @@ import {
...
@@ -7,6 +6,7 @@ import {
TEST_TRADE_EXACT_OUTPUT
,
TEST_TRADE_EXACT_OUTPUT
,
}
from
'
test-utils/constants
'
}
from
'
test-utils/constants
'
import
{
render
,
screen
}
from
'
test-utils/render
'
import
{
render
,
screen
}
from
'
test-utils/render
'
import
{
formatCurrencyAmount
,
NumberType
}
from
'
utils/formatNumbers
'
import
SwapModalHeader
from
'
./SwapModalHeader
'
import
SwapModalHeader
from
'
./SwapModalHeader
'
...
...
src/components/swap/SwapModalHeaderAmount.tsx
View file @
b1c99d4b
import
{
formatNumber
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
Currency
,
CurrencyAmount
}
from
'
@uniswap/sdk-core
'
import
{
Currency
,
CurrencyAmount
}
from
'
@uniswap/sdk-core
'
import
Column
from
'
components/Column
'
import
Column
from
'
components/Column
'
import
CurrencyLogo
from
'
components/Logo/CurrencyLogo
'
import
CurrencyLogo
from
'
components/Logo/CurrencyLogo
'
...
@@ -10,6 +9,7 @@ import { TextProps } from 'rebass'
...
@@ -10,6 +9,7 @@ import { TextProps } from 'rebass'
import
{
Field
}
from
'
state/swap/actions
'
import
{
Field
}
from
'
state/swap/actions
'
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
import
{
BREAKPOINTS
,
ThemedText
}
from
'
theme
'
import
{
BREAKPOINTS
,
ThemedText
}
from
'
theme
'
import
{
formatNumber
,
NumberType
}
from
'
utils/formatNumbers
'
import
{
formatReviewSwapCurrencyAmount
}
from
'
utils/formatNumbers
'
import
{
formatReviewSwapCurrencyAmount
}
from
'
utils/formatNumbers
'
export
const
Label
=
styled
(
ThemedText
.
BodySmall
)
<
{
cursor
?:
string
}
>
`
export
const
Label
=
styled
(
ThemedText
.
BodySmall
)
<
{
cursor
?:
string
}
>
`
...
...
src/components/swap/TradePrice.tsx
View file @
b1c99d4b
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
formatNumber
,
formatPrice
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
Currency
,
Price
}
from
'
@uniswap/sdk-core
'
import
{
Currency
,
Price
}
from
'
@uniswap/sdk-core
'
import
{
useUSDPrice
}
from
'
hooks/useUSDPrice
'
import
{
useUSDPrice
}
from
'
hooks/useUSDPrice
'
import
tryParseCurrencyAmount
from
'
lib/utils/tryParseCurrencyAmount
'
import
tryParseCurrencyAmount
from
'
lib/utils/tryParseCurrencyAmount
'
import
{
useCallback
,
useMemo
,
useState
}
from
'
react
'
import
{
useCallback
,
useMemo
,
useState
}
from
'
react
'
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
import
{
ThemedText
}
from
'
theme
'
import
{
ThemedText
}
from
'
theme
'
import
{
formatNumber
,
formatPrice
,
NumberType
}
from
'
utils/formatNumbers
'
interface
TradePriceProps
{
interface
TradePriceProps
{
price
:
Price
<
Currency
,
Currency
>
price
:
Price
<
Currency
,
Currency
>
...
...
src/nft/components/explore/CarouselCard.tsx
View file @
b1c99d4b
import
{
formatNumberOrString
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
loadingAnimation
}
from
'
components/Loader/styled
'
import
{
loadingAnimation
}
from
'
components/Loader/styled
'
import
{
LoadingBubble
}
from
'
components/Tokens/loading
'
import
{
LoadingBubble
}
from
'
components/Tokens/loading
'
import
{
useCollection
}
from
'
graphql/data/nft/Collection
'
import
{
useCollection
}
from
'
graphql/data/nft/Collection
'
...
@@ -7,6 +6,7 @@ import { Markets, TrendingCollection } from 'nft/types'
...
@@ -7,6 +6,7 @@ import { Markets, TrendingCollection } from 'nft/types'
import
{
ethNumberStandardFormatter
}
from
'
nft/utils
'
import
{
ethNumberStandardFormatter
}
from
'
nft/utils
'
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
import
{
ThemedText
}
from
'
theme/components/text
'
import
{
ThemedText
}
from
'
theme/components/text
'
import
{
formatNumberOrString
,
NumberType
}
from
'
utils/formatNumbers
'
const
CarouselCardBorder
=
styled
.
div
`
const
CarouselCardBorder
=
styled
.
div
`
width: 100%;
width: 100%;
...
...
src/nft/components/profile/list/ListPage.tsx
View file @
b1c99d4b
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
InterfaceModalName
,
NFTEventName
}
from
'
@uniswap/analytics-events
'
import
{
InterfaceModalName
,
NFTEventName
}
from
'
@uniswap/analytics-events
'
import
{
formatCurrencyAmount
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
sendAnalyticsEvent
,
useTrace
}
from
'
analytics
'
import
{
sendAnalyticsEvent
,
useTrace
}
from
'
analytics
'
import
Column
from
'
components/Column
'
import
Column
from
'
components/Column
'
...
@@ -26,6 +25,7 @@ import { ArrowLeft } from 'react-feather'
...
@@ -26,6 +25,7 @@ import { ArrowLeft } from 'react-feather'
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
import
{
BREAKPOINTS
,
ThemedText
}
from
'
theme
'
import
{
BREAKPOINTS
,
ThemedText
}
from
'
theme
'
import
{
Z_INDEX
}
from
'
theme/zIndex
'
import
{
Z_INDEX
}
from
'
theme/zIndex
'
import
{
formatCurrencyAmount
,
NumberType
}
from
'
utils/formatNumbers
'
import
{
shallow
}
from
'
zustand/shallow
'
import
{
shallow
}
from
'
zustand/shallow
'
import
{
ListModal
}
from
'
./Modal/ListModal
'
import
{
ListModal
}
from
'
./Modal/ListModal
'
...
...
src/nft/components/profile/list/Modal/ListModal.tsx
View file @
b1c99d4b
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
InterfaceModalName
,
NFTEventName
}
from
'
@uniswap/analytics-events
'
import
{
InterfaceModalName
,
NFTEventName
}
from
'
@uniswap/analytics-events
'
import
{
formatCurrencyAmount
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
sendAnalyticsEvent
,
Trace
,
useTrace
}
from
'
analytics
'
import
{
sendAnalyticsEvent
,
Trace
,
useTrace
}
from
'
analytics
'
import
{
useStablecoinValue
}
from
'
hooks/useStablecoinPrice
'
import
{
useStablecoinValue
}
from
'
hooks/useStablecoinPrice
'
...
@@ -16,6 +15,7 @@ import { X } from 'react-feather'
...
@@ -16,6 +15,7 @@ import { X } from 'react-feather'
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
import
{
BREAKPOINTS
,
ThemedText
}
from
'
theme
'
import
{
BREAKPOINTS
,
ThemedText
}
from
'
theme
'
import
{
Z_INDEX
}
from
'
theme/zIndex
'
import
{
Z_INDEX
}
from
'
theme/zIndex
'
import
{
formatCurrencyAmount
,
NumberType
}
from
'
utils/formatNumbers
'
import
{
shallow
}
from
'
zustand/shallow
'
import
{
shallow
}
from
'
zustand/shallow
'
import
{
TitleRow
}
from
'
../shared
'
import
{
TitleRow
}
from
'
../shared
'
...
...
src/nft/components/profile/list/Modal/SuccessScreen.tsx
View file @
b1c99d4b
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
formatCurrencyAmount
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
Column
from
'
components/Column
'
import
Column
from
'
components/Column
'
import
{
ScrollBarStyles
}
from
'
components/Common
'
import
{
ScrollBarStyles
}
from
'
components/Common
'
...
@@ -14,6 +13,7 @@ import { useMemo } from 'react'
...
@@ -14,6 +13,7 @@ import { useMemo } from 'react'
import
{
Twitter
,
X
}
from
'
react-feather
'
import
{
Twitter
,
X
}
from
'
react-feather
'
import
styled
,
{
css
,
useTheme
}
from
'
styled-components
'
import
styled
,
{
css
,
useTheme
}
from
'
styled-components
'
import
{
BREAKPOINTS
,
ThemedText
}
from
'
theme
'
import
{
BREAKPOINTS
,
ThemedText
}
from
'
theme
'
import
{
formatCurrencyAmount
,
NumberType
}
from
'
utils/formatNumbers
'
import
{
TitleRow
}
from
'
../shared
'
import
{
TitleRow
}
from
'
../shared
'
...
...
src/pages/Pool/PositionPage.tsx
View file @
b1c99d4b
...
@@ -2,7 +2,6 @@ import { BigNumber } from '@ethersproject/bignumber'
...
@@ -2,7 +2,6 @@ import { BigNumber } from '@ethersproject/bignumber'
import
type
{
TransactionResponse
}
from
'
@ethersproject/providers
'
import
type
{
TransactionResponse
}
from
'
@ethersproject/providers
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
InterfacePageName
}
from
'
@uniswap/analytics-events
'
import
{
InterfacePageName
}
from
'
@uniswap/analytics-events
'
import
{
formatPrice
,
NumberType
}
from
'
@uniswap/conedison/format
'
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
{
useWeb3React
}
from
'
@web3-react/core
'
...
@@ -38,6 +37,7 @@ import styled, { useTheme } from 'styled-components'
...
@@ -38,6 +37,7 @@ import styled, { useTheme } from 'styled-components'
import
{
ExternalLink
,
HideExtraSmall
,
HideSmall
,
StyledRouterLink
,
ThemedText
}
from
'
theme
'
import
{
ExternalLink
,
HideExtraSmall
,
HideSmall
,
StyledRouterLink
,
ThemedText
}
from
'
theme
'
import
{
currencyId
}
from
'
utils/currencyId
'
import
{
currencyId
}
from
'
utils/currencyId
'
import
{
formatCurrencyAmount
}
from
'
utils/formatCurrencyAmount
'
import
{
formatCurrencyAmount
}
from
'
utils/formatCurrencyAmount
'
import
{
formatPrice
,
NumberType
}
from
'
utils/formatNumbers
'
import
{
formatTickPrice
}
from
'
utils/formatTickPrice
'
import
{
formatTickPrice
}
from
'
utils/formatTickPrice
'
import
{
unwrappedToken
}
from
'
utils/unwrappedToken
'
import
{
unwrappedToken
}
from
'
utils/unwrappedToken
'
...
...
src/pages/Swap/index.tsx
View file @
b1c99d4b
...
@@ -8,7 +8,6 @@ import {
...
@@ -8,7 +8,6 @@ import {
SharedEventName
,
SharedEventName
,
SwapEventName
,
SwapEventName
,
}
from
'
@uniswap/analytics-events
'
}
from
'
@uniswap/analytics-events
'
import
{
formatCurrencyAmount
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
ChainId
,
Currency
,
CurrencyAmount
,
Percent
,
Token
}
from
'
@uniswap/sdk-core
'
import
{
ChainId
,
Currency
,
CurrencyAmount
,
Percent
,
Token
}
from
'
@uniswap/sdk-core
'
import
{
UNIVERSAL_ROUTER_ADDRESS
}
from
'
@uniswap/universal-router-sdk
'
import
{
UNIVERSAL_ROUTER_ADDRESS
}
from
'
@uniswap/universal-router-sdk
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
...
@@ -58,6 +57,7 @@ import swapReducer, { initialState as initialSwapState, SwapState } from 'state/
...
@@ -58,6 +57,7 @@ import swapReducer, { initialState as initialSwapState, SwapState } from 'state/
import
styled
,
{
useTheme
}
from
'
styled-components
'
import
styled
,
{
useTheme
}
from
'
styled-components
'
import
{
LinkStyledButton
,
ThemedText
}
from
'
theme
'
import
{
LinkStyledButton
,
ThemedText
}
from
'
theme
'
import
{
computeFiatValuePriceImpact
}
from
'
utils/computeFiatValuePriceImpact
'
import
{
computeFiatValuePriceImpact
}
from
'
utils/computeFiatValuePriceImpact
'
import
{
formatCurrencyAmount
,
NumberType
}
from
'
utils/formatNumbers
'
import
{
maxAmountSpend
}
from
'
utils/maxAmountSpend
'
import
{
maxAmountSpend
}
from
'
utils/maxAmountSpend
'
import
{
computeRealizedPriceImpact
,
warningSeverity
}
from
'
utils/prices
'
import
{
computeRealizedPriceImpact
,
warningSeverity
}
from
'
utils/prices
'
import
{
didUserReject
}
from
'
utils/swapErrorToUserReadableMessage
'
import
{
didUserReject
}
from
'
utils/swapErrorToUserReadableMessage
'
...
...
src/utils/formatNumbers.test.ts
View file @
b1c99d4b
import
{
CurrencyAmount
,
Price
}
from
'
@uniswap/sdk-core
'
import
{
CurrencyAmount
,
P
ercent
,
P
rice
}
from
'
@uniswap/sdk-core
'
import
{
renBTC
,
USDC_MAINNET
}
from
'
constants/tokens
'
import
{
renBTC
,
USDC_MAINNET
}
from
'
constants/tokens
'
import
{
import
{
currencyAmountToPreciseFloat
,
currencyAmountToPreciseFloat
,
formatNumber
,
formatPriceImpact
,
formatReviewSwapCurrencyAmount
,
formatReviewSwapCurrencyAmount
,
formatSlippage
,
formatTransactionAmount
,
formatTransactionAmount
,
formatUSDPrice
,
NumberType
,
priceToPreciseFloat
,
priceToPreciseFloat
,
}
from
'
./formatNumbers
'
}
from
'
./formatNumbers
'
it
(
'
formats token reference numbers correctly
'
,
()
=>
{
expect
(
formatNumber
(
1234567000000000
,
NumberType
.
TokenNonTx
)).
toBe
(
'
>999T
'
)
expect
(
formatNumber
(
1002345
,
NumberType
.
TokenNonTx
)).
toBe
(
'
1.00M
'
)
expect
(
formatNumber
(
1234
,
NumberType
.
TokenNonTx
)).
toBe
(
'
1,234.00
'
)
expect
(
formatNumber
(
0.00909
,
NumberType
.
TokenNonTx
)).
toBe
(
'
0.009
'
)
expect
(
formatNumber
(
0.09001
,
NumberType
.
TokenNonTx
)).
toBe
(
'
0.090
'
)
expect
(
formatNumber
(
0.00099
,
NumberType
.
TokenNonTx
)).
toBe
(
'
<0.001
'
)
expect
(
formatNumber
(
0
,
NumberType
.
TokenNonTx
)).
toBe
(
'
0
'
)
})
it
(
'
formats token transaction numbers correctly
'
,
()
=>
{
expect
(
formatNumber
(
1234567.8901
,
NumberType
.
TokenTx
)).
toBe
(
'
1,234,567.89
'
)
expect
(
formatNumber
(
765432.1
,
NumberType
.
TokenTx
)).
toBe
(
'
765,432.10
'
)
expect
(
formatNumber
(
7654.321
,
NumberType
.
TokenTx
)).
toBe
(
'
7,654.32
'
)
expect
(
formatNumber
(
765.4321
,
NumberType
.
TokenTx
)).
toBe
(
'
765.432
'
)
expect
(
formatNumber
(
76.54321
,
NumberType
.
TokenTx
)).
toBe
(
'
76.5432
'
)
expect
(
formatNumber
(
7.654321
,
NumberType
.
TokenTx
)).
toBe
(
'
7.65432
'
)
expect
(
formatNumber
(
7.60000054321
,
NumberType
.
TokenTx
)).
toBe
(
'
7.60
'
)
expect
(
formatNumber
(
7.6
,
NumberType
.
TokenTx
)).
toBe
(
'
7.60
'
)
expect
(
formatNumber
(
7
,
NumberType
.
TokenTx
)).
toBe
(
'
7.00
'
)
expect
(
formatNumber
(
0.987654321
,
NumberType
.
TokenTx
)).
toBe
(
'
0.98765
'
)
expect
(
formatNumber
(
0.9
,
NumberType
.
TokenTx
)).
toBe
(
'
0.90
'
)
expect
(
formatNumber
(
0.901000123
,
NumberType
.
TokenTx
)).
toBe
(
'
0.901
'
)
expect
(
formatNumber
(
0.000000001
,
NumberType
.
TokenTx
)).
toBe
(
'
<0.00001
'
)
expect
(
formatNumber
(
0
,
NumberType
.
TokenTx
)).
toBe
(
'
0
'
)
})
it
(
'
formats fiat estimates on token details pages correctly
'
,
()
=>
{
expect
(
formatNumber
(
1234567.891
,
NumberType
.
FiatTokenDetails
)).
toBe
(
'
$1.23M
'
)
expect
(
formatNumber
(
1234.5678
,
NumberType
.
FiatTokenDetails
)).
toBe
(
'
$1,234.57
'
)
expect
(
formatNumber
(
1.048942
,
NumberType
.
FiatTokenDetails
)).
toBe
(
'
$1.049
'
)
expect
(
formatNumber
(
0.001231
,
NumberType
.
FiatTokenDetails
)).
toBe
(
'
$0.00123
'
)
expect
(
formatNumber
(
0.00001231
,
NumberType
.
FiatTokenDetails
)).
toBe
(
'
$0.0000123
'
)
expect
(
formatNumber
(
0.0000001234
,
NumberType
.
FiatTokenDetails
)).
toBe
(
'
$0.000000123
'
)
expect
(
formatNumber
(
0.000000009876
,
NumberType
.
FiatTokenDetails
)).
toBe
(
'
<$0.00000001
'
)
})
it
(
'
formats fiat estimates for tokens correctly
'
,
()
=>
{
expect
(
formatNumber
(
1234567.891
,
NumberType
.
FiatTokenPrice
)).
toBe
(
'
$1.23M
'
)
expect
(
formatNumber
(
1234.5678
,
NumberType
.
FiatTokenPrice
)).
toBe
(
'
$1,234.57
'
)
expect
(
formatNumber
(
0.010235
,
NumberType
.
FiatTokenPrice
)).
toBe
(
'
$0.0102
'
)
expect
(
formatNumber
(
0.001231
,
NumberType
.
FiatTokenPrice
)).
toBe
(
'
$0.00123
'
)
expect
(
formatNumber
(
0.00001231
,
NumberType
.
FiatTokenPrice
)).
toBe
(
'
$0.0000123
'
)
expect
(
formatNumber
(
0.0000001234
,
NumberType
.
FiatTokenPrice
)).
toBe
(
'
$0.000000123
'
)
expect
(
formatNumber
(
0.000000009876
,
NumberType
.
FiatTokenPrice
)).
toBe
(
'
<$0.00000001
'
)
expect
(
formatNumber
(
10000000000000000000000000000000
,
NumberType
.
FiatTokenPrice
)).
toBe
(
'
$1.000000E31
'
)
})
it
(
'
formats fiat estimates for token stats correctly
'
,
()
=>
{
expect
(
formatNumber
(
1234576
,
NumberType
.
FiatTokenStats
)).
toBe
(
'
$1.2M
'
)
expect
(
formatNumber
(
234567
,
NumberType
.
FiatTokenStats
)).
toBe
(
'
$234.6K
'
)
expect
(
formatNumber
(
123.456
,
NumberType
.
FiatTokenStats
)).
toBe
(
'
$123.46
'
)
expect
(
formatNumber
(
1.23
,
NumberType
.
FiatTokenStats
)).
toBe
(
'
$1.23
'
)
expect
(
formatNumber
(
0.123
,
NumberType
.
FiatTokenStats
)).
toBe
(
'
$0.12
'
)
expect
(
formatNumber
(
0.00123
,
NumberType
.
FiatTokenStats
)).
toBe
(
'
<$0.01
'
)
expect
(
formatNumber
(
0
,
NumberType
.
FiatTokenStats
)).
toBe
(
'
-
'
)
})
it
(
'
formats gas USD prices correctly
'
,
()
=>
{
expect
(
formatNumber
(
1234567.891
,
NumberType
.
FiatGasPrice
)).
toBe
(
'
$1.23M
'
)
expect
(
formatNumber
(
18.448
,
NumberType
.
FiatGasPrice
)).
toBe
(
'
$18.45
'
)
expect
(
formatNumber
(
0.0099
,
NumberType
.
FiatGasPrice
)).
toBe
(
'
<$0.01
'
)
expect
(
formatNumber
(
0
,
NumberType
.
FiatGasPrice
)).
toBe
(
'
$0.00
'
)
})
it
(
'
formats USD token quantities prices correctly
'
,
()
=>
{
expect
(
formatNumber
(
1234567.891
,
NumberType
.
FiatTokenQuantity
)).
toBe
(
'
$1.23M
'
)
expect
(
formatNumber
(
18.448
,
NumberType
.
FiatTokenQuantity
)).
toBe
(
'
$18.45
'
)
expect
(
formatNumber
(
0.0099
,
NumberType
.
FiatTokenQuantity
)).
toBe
(
'
<$0.01
'
)
expect
(
formatNumber
(
0
,
NumberType
.
FiatTokenQuantity
)).
toBe
(
'
$0.00
'
)
})
it
(
'
formats Swap text input/output numbers correctly
'
,
()
=>
{
expect
(
formatNumber
(
1234567.8901
,
NumberType
.
SwapTradeAmount
)).
toBe
(
'
1234570
'
)
expect
(
formatNumber
(
765432.1
,
NumberType
.
SwapTradeAmount
)).
toBe
(
'
765432
'
)
expect
(
formatNumber
(
7654.321
,
NumberType
.
SwapTradeAmount
)).
toBe
(
'
7654.32
'
)
expect
(
formatNumber
(
765.4321
,
NumberType
.
SwapTradeAmount
)).
toBe
(
'
765.432
'
)
expect
(
formatNumber
(
76.54321
,
NumberType
.
SwapTradeAmount
)).
toBe
(
'
76.5432
'
)
expect
(
formatNumber
(
7.654321
,
NumberType
.
SwapTradeAmount
)).
toBe
(
'
7.65432
'
)
expect
(
formatNumber
(
7.60000054321
,
NumberType
.
SwapTradeAmount
)).
toBe
(
'
7.60
'
)
expect
(
formatNumber
(
7.6
,
NumberType
.
SwapTradeAmount
)).
toBe
(
'
7.60
'
)
expect
(
formatNumber
(
7
,
NumberType
.
SwapTradeAmount
)).
toBe
(
'
7.00
'
)
expect
(
formatNumber
(
0.987654321
,
NumberType
.
SwapTradeAmount
)).
toBe
(
'
0.98765
'
)
expect
(
formatNumber
(
0.9
,
NumberType
.
SwapTradeAmount
)).
toBe
(
'
0.90
'
)
expect
(
formatNumber
(
0.901000123
,
NumberType
.
SwapTradeAmount
)).
toBe
(
'
0.901
'
)
expect
(
formatNumber
(
0.000000001
,
NumberType
.
SwapTradeAmount
)).
toBe
(
'
0.000000001
'
)
expect
(
formatNumber
(
0
,
NumberType
.
SwapTradeAmount
)).
toBe
(
'
0
'
)
})
it
(
'
formats NFT numbers correctly
'
,
()
=>
{
expect
(
formatNumber
(
1234567000000000
,
NumberType
.
NFTTokenFloorPrice
)).
toBe
(
'
>999T
'
)
expect
(
formatNumber
(
1002345
,
NumberType
.
NFTTokenFloorPrice
)).
toBe
(
'
1M
'
)
expect
(
formatNumber
(
1234
,
NumberType
.
NFTTokenFloorPrice
)).
toBe
(
'
1.23K
'
)
expect
(
formatNumber
(
12.34467
,
NumberType
.
NFTTokenFloorPrice
)).
toBe
(
'
12.34
'
)
expect
(
formatNumber
(
12.1
,
NumberType
.
NFTTokenFloorPrice
)).
toBe
(
'
12.1
'
)
expect
(
formatNumber
(
0.00909
,
NumberType
.
NFTTokenFloorPrice
)).
toBe
(
'
0.009
'
)
expect
(
formatNumber
(
0.09001
,
NumberType
.
NFTTokenFloorPrice
)).
toBe
(
'
0.09
'
)
expect
(
formatNumber
(
0.00099
,
NumberType
.
NFTTokenFloorPrice
)).
toBe
(
'
<0.001
'
)
expect
(
formatNumber
(
0
,
NumberType
.
NFTTokenFloorPrice
)).
toBe
(
'
0
'
)
expect
(
formatNumber
(
12.1
,
NumberType
.
NFTTokenFloorPriceTrailingZeros
)).
toBe
(
'
12.10
'
)
expect
(
formatNumber
(
0.09001
,
NumberType
.
NFTTokenFloorPriceTrailingZeros
)).
toBe
(
'
0.090
'
)
expect
(
formatNumber
(
0.987654321
,
NumberType
.
NFTCollectionStats
)).
toBe
(
'
1
'
)
expect
(
formatNumber
(
0.9
,
NumberType
.
NFTCollectionStats
)).
toBe
(
'
1
'
)
expect
(
formatNumber
(
76543.21
,
NumberType
.
NFTCollectionStats
)).
toBe
(
'
76.5K
'
)
expect
(
formatNumber
(
7.60000054321
,
NumberType
.
NFTCollectionStats
)).
toBe
(
'
8
'
)
expect
(
formatNumber
(
1234567890
,
NumberType
.
NFTCollectionStats
)).
toBe
(
'
1.2B
'
)
expect
(
formatNumber
(
1234567000000000
,
NumberType
.
NFTCollectionStats
)).
toBe
(
'
1234.6T
'
)
})
describe
(
'
formatUSDPrice
'
,
()
=>
{
it
(
'
should correctly format 0.000000009876
'
,
()
=>
{
expect
(
formatUSDPrice
(
0.000000009876
)).
toBe
(
'
<$0.00000001
'
)
})
it
(
'
should correctly format 0.00001231
'
,
()
=>
{
expect
(
formatUSDPrice
(
0.00001231
)).
toBe
(
'
$0.0000123
'
)
})
it
(
'
should correctly format 0.001231
'
,
()
=>
{
expect
(
formatUSDPrice
(
0.001231
)).
toBe
(
'
$0.00123
'
)
})
it
(
'
should correctly format 0.0
'
,
()
=>
{
expect
(
formatUSDPrice
(
0.0
)).
toBe
(
'
$0.00
'
)
})
it
(
'
should correctly format 0
'
,
()
=>
{
expect
(
formatUSDPrice
(
0
)).
toBe
(
'
$0.00
'
)
})
it
(
'
should correctly format 1.048942
'
,
()
=>
{
expect
(
formatUSDPrice
(
1.048942
)).
toBe
(
'
$1.05
'
)
})
it
(
'
should correctly format 0.10235
'
,
()
=>
{
expect
(
formatUSDPrice
(
0.10235
)).
toBe
(
'
$0.102
'
)
})
it
(
'
should correctly format 1234.5678
'
,
()
=>
{
expect
(
formatUSDPrice
(
1
_234
.
5678
)).
toBe
(
'
$1,234.57
'
)
})
it
(
'
should correctly format 1234567.8910
'
,
()
=>
{
expect
(
formatUSDPrice
(
1
_234_567
.
891
)).
toBe
(
'
$1.23M
'
)
})
it
(
'
should correctly format 1000000000000
'
,
()
=>
{
expect
(
formatUSDPrice
(
1
_000_000_000_000
)).
toBe
(
'
$1.00T
'
)
})
it
(
'
should correctly format 1000000000000000
'
,
()
=>
{
expect
(
formatUSDPrice
(
1
_000_000_000_000_000
)).
toBe
(
'
$1000.00T
'
)
})
})
describe
(
'
formatPriceImpact
'
,
()
=>
{
it
(
'
should correctly format undefined
'
,
()
=>
{
expect
(
formatPriceImpact
(
undefined
)).
toBe
(
'
-
'
)
})
it
(
'
correctly formats a percent with 3 significant digits
'
,
()
=>
{
expect
(
formatPriceImpact
(
new
Percent
(
-
1
,
100000
))).
toBe
(
'
0.001%
'
)
expect
(
formatPriceImpact
(
new
Percent
(
-
1
,
1000
))).
toBe
(
'
0.100%
'
)
expect
(
formatPriceImpact
(
new
Percent
(
-
1
,
100
))).
toBe
(
'
1.000%
'
)
expect
(
formatPriceImpact
(
new
Percent
(
-
1
,
10
))).
toBe
(
'
10.000%
'
)
expect
(
formatPriceImpact
(
new
Percent
(
-
1
,
1
))).
toBe
(
'
100.000%
'
)
})
})
describe
(
'
formatSlippage
'
,
()
=>
{
it
(
'
should correctly format undefined
'
,
()
=>
{
expect
(
formatSlippage
(
undefined
)).
toBe
(
'
-
'
)
})
it
(
'
correctly formats a percent with 3 significant digits
'
,
()
=>
{
expect
(
formatSlippage
(
new
Percent
(
1
,
100000
))).
toBe
(
'
0.001%
'
)
expect
(
formatSlippage
(
new
Percent
(
1
,
1000
))).
toBe
(
'
0.100%
'
)
expect
(
formatSlippage
(
new
Percent
(
1
,
100
))).
toBe
(
'
1.000%
'
)
expect
(
formatSlippage
(
new
Percent
(
1
,
10
))).
toBe
(
'
10.000%
'
)
expect
(
formatSlippage
(
new
Percent
(
1
,
1
))).
toBe
(
'
100.000%
'
)
})
})
describe
(
'
currencyAmountToPreciseFloat
'
,
()
=>
{
describe
(
'
currencyAmountToPreciseFloat
'
,
()
=>
{
it
(
'
small number
'
,
()
=>
{
it
(
'
small number
'
,
()
=>
{
const
currencyAmount
=
CurrencyAmount
.
fromFractionalAmount
(
USDC_MAINNET
,
'
20000
'
,
'
7
'
)
const
currencyAmount
=
CurrencyAmount
.
fromFractionalAmount
(
USDC_MAINNET
,
'
20000
'
,
'
7
'
)
...
...
src/utils/formatNumbers.ts
View file @
b1c99d4b
This diff is collapsed.
Click to expand it.
src/utils/formatTickPrice.ts
View file @
b1c99d4b
import
{
formatPrice
,
NumberType
}
from
'
@uniswap/conedison/format
'
import
{
Price
,
Token
}
from
'
@uniswap/sdk-core
'
import
{
Price
,
Token
}
from
'
@uniswap/sdk-core
'
import
{
formatPrice
,
NumberType
}
from
'
utils/formatNumbers
'
import
{
Bound
}
from
'
../state/mint/v3/actions
'
import
{
Bound
}
from
'
../state/mint/v3/actions
'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment