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
85217452
Unverified
Commit
85217452
authored
Aug 27, 2020
by
Moody Salem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improvement(ts): strict everywhere
parent
f7a1a2ab
Changes
48
Hide whitespace changes
Inline
Side-by-side
Showing
48 changed files
with
169 additions
and
221 deletions
+169
-221
Transaction.tsx
src/components/AccountDetails/Transaction.tsx
+6
-5
index.tsx
src/components/AccountDetails/index.tsx
+34
-30
index.tsx
src/components/AddressInputPanel/index.tsx
+1
-1
index.tsx
src/components/CurrencyInputPanel/index.tsx
+5
-5
index.tsx
src/components/Header/index.tsx
+2
-2
index.tsx
src/components/Identicon/index.tsx
+3
-2
index.tsx
src/components/Loader/index.tsx
+1
-1
index.tsx
src/components/Menu/index.tsx
+2
-1
index.tsx
src/components/Modal/index.tsx
+1
-1
index.tsx
src/components/Popover/index.tsx
+11
-8
PopupItem.tsx
src/components/Popups/PopupItem.tsx
+5
-1
TransactionPopup.tsx
src/components/Popups/TransactionPopup.tsx
+3
-1
V1.tsx
src/components/PositionCard/V1.tsx
+1
-1
index.tsx
src/components/PositionCard/index.tsx
+2
-2
CommonBases.tsx
src/components/SearchModal/CommonBases.tsx
+1
-1
CurrencyList.tsx
src/components/SearchModal/CurrencyList.tsx
+2
-2
CurrencySearch.tsx
src/components/SearchModal/CurrencySearch.tsx
+2
-2
CurrencySearchModal.tsx
src/components/SearchModal/CurrencySearchModal.tsx
+2
-2
filtering.ts
src/components/SearchModal/filtering.ts
+1
-1
tsconfig.json
src/components/SearchModal/tsconfig.json
+0
-4
index.tsx
src/components/Settings/index.tsx
+2
-1
index.tsx
src/components/TokenWarningModal/index.tsx
+6
-4
index.tsx
src/components/TransactionConfirmationModal/index.tsx
+7
-5
tsconfig.json
src/components/TransactionConfirmationModal/tsconfig.json
+0
-4
index.tsx
src/components/TransactionSettings/index.tsx
+16
-19
Option.tsx
src/components/WalletModal/Option.tsx
+2
-2
PendingView.tsx
src/components/WalletModal/PendingView.tsx
+1
-1
index.tsx
src/components/WalletModal/index.tsx
+9
-8
index.tsx
src/components/Web3ReactManager/index.tsx
+1
-1
index.tsx
src/components/Web3Status/index.tsx
+4
-4
tsconfig.json
src/components/swap/tsconfig.json
+0
-4
tsconfig.json
src/connectors/tsconfig.json
+0
-4
tsconfig.json
src/constants/tsconfig.json
+0
-4
tsconfig.json
src/data/tsconfig.json
+0
-4
tsconfig.json
src/hooks/tsconfig.json
+0
-4
tsconfig.json
src/pages/AddLiquidity/tsconfig.json
+0
-7
MigrateV1Exchange.tsx
src/pages/MigrateV1/MigrateV1Exchange.tsx
+15
-13
RemoveV1Exchange.tsx
src/pages/MigrateV1/RemoveV1Exchange.tsx
+7
-7
index.tsx
src/pages/MigrateV1/index.tsx
+11
-12
tsconfig.json
src/pages/Pool/tsconfig.json
+0
-4
tsconfig.json
src/pages/PoolFinder/tsconfig.json
+0
-4
tsconfig.json
src/pages/RemoveLiquidity/tsconfig.json
+0
-7
tsconfig.json
src/pages/Swap/tsconfig.json
+0
-4
tsconfig.json
src/state/tsconfig.json
+0
-4
tsconfig.json
src/theme/tsconfig.json
+0
-4
tsconfig.json
src/utils/tsconfig.json
+0
-4
tsconfig.json
tsconfig.json
+3
-1
tsconfig.strict.json
tsconfig.strict.json
+0
-8
No files found.
src/components/AccountDetails/Transaction.tsx
View file @
85217452
...
@@ -40,11 +40,12 @@ export default function Transaction({ hash }: { hash: string }) {
...
@@ -40,11 +40,12 @@ export default function Transaction({ hash }: { hash: string }) {
const
{
chainId
}
=
useActiveWeb3React
()
const
{
chainId
}
=
useActiveWeb3React
()
const
allTransactions
=
useAllTransactions
()
const
allTransactions
=
useAllTransactions
()
const
summary
=
allTransactions
?.[
hash
]?.
summary
const
tx
=
allTransactions
?.[
hash
]
const
pending
=
!
allTransactions
?.[
hash
]?.
receipt
const
summary
=
tx
?.
summary
const
success
=
const
pending
=
!
tx
?.
receipt
!
pending
&&
const
success
=
!
pending
&&
tx
&&
(
tx
.
receipt
?.
status
===
1
||
typeof
tx
.
receipt
?.
status
===
'
undefined
'
)
(
allTransactions
[
hash
].
receipt
.
status
===
1
||
typeof
allTransactions
[
hash
].
receipt
.
status
===
'
undefined
'
)
if
(
!
chainId
)
return
null
return
(
return
(
<
TransactionWrapper
>
<
TransactionWrapper
>
...
...
src/components/AccountDetails/index.tsx
View file @
85217452
...
@@ -285,13 +285,9 @@ export default function AccountDetails({
...
@@ -285,13 +285,9 @@ export default function AccountDetails({
return
null
return
null
}
}
const
clearAllTransactionsCallback
=
useCallback
(
const
clearAllTransactionsCallback
=
useCallback
(()
=>
{
(
event
:
React
.
MouseEvent
)
=>
{
if
(
chainId
)
dispatch
(
clearAllTransactions
({
chainId
}))
event
.
preventDefault
()
},
[
dispatch
,
chainId
])
dispatch
(
clearAllTransactions
({
chainId
}))
},
[
dispatch
,
chainId
]
)
return
(
return
(
<>
<>
...
@@ -339,7 +335,7 @@ export default function AccountDetails({
...
@@ -339,7 +335,7 @@ export default function AccountDetails({
<>
<>
<
div
>
<
div
>
{
getStatusIcon
()
}
{
getStatusIcon
()
}
<
p
>
{
shortenAddress
(
account
)
}
</
p
>
<
p
>
{
account
&&
shortenAddress
(
account
)
}
</
p
>
</
div
>
</
div
>
</>
</>
)
}
)
}
...
@@ -350,17 +346,21 @@ export default function AccountDetails({
...
@@ -350,17 +346,21 @@ export default function AccountDetails({
<>
<>
<
AccountControl
>
<
AccountControl
>
<
div
>
<
div
>
<
Copy
toCopy=
{
account
}
>
{
account
&&
(
<
span
style=
{
{
marginLeft
:
'
4px
'
}
}
>
Copy Address
</
span
>
<
Copy
toCopy=
{
account
}
>
</
Copy
>
<
span
style=
{
{
marginLeft
:
'
4px
'
}
}
>
Copy Address
</
span
>
<
AddressLink
</
Copy
>
hasENS=
{
!!
ENSName
}
)
}
isENS=
{
true
}
{
chainId
&&
account
&&
(
href=
{
getEtherscanLink
(
chainId
,
ENSName
,
'
address
'
)
}
<
AddressLink
>
hasENS=
{
!!
ENSName
}
<
LinkIcon
size=
{
16
}
/>
isENS=
{
true
}
<
span
style=
{
{
marginLeft
:
'
4px
'
}
}
>
View on Etherscan
</
span
>
href=
{
chainId
&&
getEtherscanLink
(
chainId
,
ENSName
,
'
address
'
)
}
</
AddressLink
>
>
<
LinkIcon
size=
{
16
}
/>
<
span
style=
{
{
marginLeft
:
'
4px
'
}
}
>
View on Etherscan
</
span
>
</
AddressLink
>
)
}
</
div
>
</
div
>
</
AccountControl
>
</
AccountControl
>
</>
</>
...
@@ -368,17 +368,21 @@ export default function AccountDetails({
...
@@ -368,17 +368,21 @@ export default function AccountDetails({
<>
<>
<
AccountControl
>
<
AccountControl
>
<
div
>
<
div
>
<
Copy
toCopy=
{
account
}
>
{
account
&&
(
<
span
style=
{
{
marginLeft
:
'
4px
'
}
}
>
Copy Address
</
span
>
<
Copy
toCopy=
{
account
}
>
</
Copy
>
<
span
style=
{
{
marginLeft
:
'
4px
'
}
}
>
Copy Address
</
span
>
<
AddressLink
</
Copy
>
hasENS=
{
!!
ENSName
}
)
}
isENS=
{
false
}
{
chainId
&&
account
&&
(
href=
{
getEtherscanLink
(
chainId
,
account
,
'
address
'
)
}
<
AddressLink
>
hasENS=
{
!!
ENSName
}
<
LinkIcon
size=
{
16
}
/>
isENS=
{
false
}
<
span
style=
{
{
marginLeft
:
'
4px
'
}
}
>
View on Etherscan
</
span
>
href=
{
getEtherscanLink
(
chainId
,
account
,
'
address
'
)
}
</
AddressLink
>
>
<
LinkIcon
size=
{
16
}
/>
<
span
style=
{
{
marginLeft
:
'
4px
'
}
}
>
View on Etherscan
</
span
>
</
AddressLink
>
)
}
</
div
>
</
div
>
</
AccountControl
>
</
AccountControl
>
</>
</>
...
...
src/components/AddressInputPanel/index.tsx
View file @
85217452
...
@@ -101,7 +101,7 @@ export default function AddressInputPanel({
...
@@ -101,7 +101,7 @@ export default function AddressInputPanel({
<
TYPE
.
black
color=
{
theme
.
text2
}
fontWeight=
{
500
}
fontSize=
{
14
}
>
<
TYPE
.
black
color=
{
theme
.
text2
}
fontWeight=
{
500
}
fontSize=
{
14
}
>
Recipient
Recipient
</
TYPE
.
black
>
</
TYPE
.
black
>
{
address
&&
(
{
address
&&
chainId
&&
(
<
ExternalLink
href=
{
getEtherscanLink
(
chainId
,
name
??
address
,
'
address
'
)
}
style=
{
{
fontSize
:
'
14px
'
}
}
>
<
ExternalLink
href=
{
getEtherscanLink
(
chainId
,
name
??
address
,
'
address
'
)
}
style=
{
{
fontSize
:
'
14px
'
}
}
>
(View on Etherscan)
(View on Etherscan)
</
ExternalLink
>
</
ExternalLink
>
...
...
src/components/CurrencyInputPanel/index.tsx
View file @
85217452
...
@@ -137,13 +137,13 @@ export default function CurrencyInputPanel({
...
@@ -137,13 +137,13 @@ export default function CurrencyInputPanel({
onMax
,
onMax
,
showMaxButton
,
showMaxButton
,
label
=
'
Input
'
,
label
=
'
Input
'
,
onCurrencySelect
=
null
,
onCurrencySelect
,
currency
=
null
,
currency
,
disableCurrencySelect
=
false
,
disableCurrencySelect
=
false
,
hideBalance
=
false
,
hideBalance
=
false
,
pair
=
null
,
// used for double token logo
pair
=
null
,
// used for double token logo
hideInput
=
false
,
hideInput
=
false
,
otherCurrency
=
null
,
otherCurrency
,
id
,
id
,
showCommonBases
showCommonBases
}:
CurrencyInputPanelProps
)
{
}:
CurrencyInputPanelProps
)
{
...
@@ -151,7 +151,7 @@ export default function CurrencyInputPanel({
...
@@ -151,7 +151,7 @@ export default function CurrencyInputPanel({
const
[
modalOpen
,
setModalOpen
]
=
useState
(
false
)
const
[
modalOpen
,
setModalOpen
]
=
useState
(
false
)
const
{
account
}
=
useActiveWeb3React
()
const
{
account
}
=
useActiveWeb3React
()
const
selectedCurrencyBalance
=
useCurrencyBalance
(
account
,
currency
)
const
selectedCurrencyBalance
=
useCurrencyBalance
(
account
??
undefined
,
currency
??
undefined
)
const
theme
=
useContext
(
ThemeContext
)
const
theme
=
useContext
(
ThemeContext
)
const
handleDismissSearch
=
useCallback
(()
=>
{
const
handleDismissSearch
=
useCallback
(()
=>
{
...
@@ -231,7 +231,7 @@ export default function CurrencyInputPanel({
...
@@ -231,7 +231,7 @@ export default function CurrencyInputPanel({
</
CurrencySelect
>
</
CurrencySelect
>
</
InputRow
>
</
InputRow
>
</
Container
>
</
Container
>
{
!
disableCurrencySelect
&&
(
{
!
disableCurrencySelect
&&
onCurrencySelect
&&
(
<
CurrencySearchModal
<
CurrencySearchModal
isOpen=
{
modalOpen
}
isOpen=
{
modalOpen
}
onDismiss=
{
handleDismissSearch
}
onDismiss=
{
handleDismissSearch
}
...
...
src/components/Header/index.tsx
View file @
85217452
...
@@ -137,7 +137,7 @@ const NETWORK_LABELS: { [chainId in ChainId]: string | null } = {
...
@@ -137,7 +137,7 @@ const NETWORK_LABELS: { [chainId in ChainId]: string | null } = {
export
default
function
Header
()
{
export
default
function
Header
()
{
const
{
account
,
chainId
}
=
useActiveWeb3React
()
const
{
account
,
chainId
}
=
useActiveWeb3React
()
const
userEthBalance
=
useETHBalances
(
[
account
])[
account
]
const
userEthBalance
=
useETHBalances
(
account
?
[
account
]
:
[])?.[
account
??
''
]
const
[
isDark
]
=
useDarkModeManager
()
const
[
isDark
]
=
useDarkModeManager
()
return
(
return
(
...
@@ -156,7 +156,7 @@ export default function Header() {
...
@@ -156,7 +156,7 @@ export default function Header() {
<
HeaderControls
>
<
HeaderControls
>
<
HeaderElement
>
<
HeaderElement
>
<
TestnetWrapper
>
<
TestnetWrapper
>
{
!
isMobile
&&
NETWORK_LABELS
[
chainId
]
&&
<
NetworkCard
>
{
NETWORK_LABELS
[
chainId
]
}
</
NetworkCard
>
}
{
!
isMobile
&&
chainId
&&
NETWORK_LABELS
[
chainId
]
&&
<
NetworkCard
>
{
NETWORK_LABELS
[
chainId
]
}
</
NetworkCard
>
}
</
TestnetWrapper
>
</
TestnetWrapper
>
<
AccountElement
active=
{
!!
account
}
style=
{
{
pointerEvents
:
'
auto
'
}
}
>
<
AccountElement
active=
{
!!
account
}
style=
{
{
pointerEvents
:
'
auto
'
}
}
>
{
account
&&
userEthBalance
?
(
{
account
&&
userEthBalance
?
(
...
...
src/components/Identicon/index.tsx
View file @
85217452
...
@@ -5,7 +5,7 @@ import styled from 'styled-components'
...
@@ -5,7 +5,7 @@ import styled from 'styled-components'
import
{
useActiveWeb3React
}
from
'
../../hooks
'
import
{
useActiveWeb3React
}
from
'
../../hooks
'
import
Jazzicon
from
'
jazzicon
'
import
Jazzicon
from
'
jazzicon
'
const
StyledIdenticon
=
styled
.
div
`
const
StyledIdenticon
Container
=
styled
.
div
`
height: 1rem;
height: 1rem;
width: 1rem;
width: 1rem;
border-radius: 1.125rem;
border-radius: 1.125rem;
...
@@ -24,5 +24,6 @@ export default function Identicon() {
...
@@ -24,5 +24,6 @@ export default function Identicon() {
}
}
},
[
account
])
},
[
account
])
return
<
StyledIdenticon
ref=
{
ref
}
/>
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/30451
return
<
StyledIdenticonContainer
ref=
{
ref
as
any
}
/>
}
}
src/components/Loader/index.tsx
View file @
85217452
...
@@ -24,7 +24,7 @@ const StyledSVG = styled.svg<{ size: string; stroke?: string }>`
...
@@ -24,7 +24,7 @@ const StyledSVG = styled.svg<{ size: string; stroke?: string }>`
* Takes in custom size and stroke for circle color, default to primary color as fill,
* Takes in custom size and stroke for circle color, default to primary color as fill,
* need ...rest for layered styles on top
* need ...rest for layered styles on top
*/
*/
export default function Loader({ size = '16px', stroke
= null
, ...rest }: { size?: string; stroke?: string }) {
export default function Loader({ size = '16px', stroke, ...rest }: { size?: string; stroke?: string }) {
return (
return (
<StyledSVG viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" size={size} stroke={stroke} {...rest}>
<StyledSVG viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" size={size} stroke={stroke} {...rest}>
<path
<path
...
...
src/components/Menu/index.tsx
View file @
85217452
...
@@ -87,7 +87,8 @@ export default function Menu() {
...
@@ -87,7 +87,8 @@ export default function Menu() {
useOnClickOutside
(
node
,
open
?
toggle
:
undefined
)
useOnClickOutside
(
node
,
open
?
toggle
:
undefined
)
return
(
return
(
<
StyledMenu
ref=
{
node
}
>
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/30451
<
StyledMenu
ref=
{
node
as
any
}
>
<
StyledMenuButton
onClick=
{
toggle
}
>
<
StyledMenuButton
onClick=
{
toggle
}
>
<
StyledMenuIcon
/>
<
StyledMenuIcon
/>
</
StyledMenuButton
>
</
StyledMenuButton
>
...
...
src/components/Modal/index.tsx
View file @
85217452
...
@@ -86,7 +86,7 @@ export default function Modal({
...
@@ -86,7 +86,7 @@ export default function Modal({
onDismiss
,
onDismiss
,
minHeight
=
false
,
minHeight
=
false
,
maxHeight
=
50
,
maxHeight
=
50
,
initialFocusRef
=
null
,
initialFocusRef
,
children
children
}:
ModalProps
)
{
}:
ModalProps
)
{
const
fadeTransition
=
useTransition
(
isOpen
,
null
,
{
const
fadeTransition
=
useTransition
(
isOpen
,
null
,
{
...
...
src/components/Popover/index.tsx
View file @
85217452
import
{
Placement
}
from
'
@popperjs/core
'
import
{
Placement
}
from
'
@popperjs/core
'
import
{
transparentize
}
from
'
polished
'
import
{
transparentize
}
from
'
polished
'
import
React
,
{
useState
}
from
'
react
'
import
React
,
{
use
Callback
,
use
State
}
from
'
react
'
import
{
usePopper
}
from
'
react-popper
'
import
{
usePopper
}
from
'
react-popper
'
import
styled
from
'
styled-components
'
import
styled
from
'
styled-components
'
import
useInterval
from
'
../../hooks/useInterval
'
import
useInterval
from
'
../../hooks/useInterval
'
...
@@ -83,9 +83,9 @@ export interface PopoverProps {
...
@@ -83,9 +83,9 @@ export interface PopoverProps {
}
}
export
default
function
Popover
({
content
,
show
,
children
,
placement
=
'
auto
'
}:
PopoverProps
)
{
export
default
function
Popover
({
content
,
show
,
children
,
placement
=
'
auto
'
}:
PopoverProps
)
{
const
[
referenceElement
,
setReferenceElement
]
=
useState
<
HTMLDivElement
>
(
null
)
const
[
referenceElement
,
setReferenceElement
]
=
useState
<
HTMLDivElement
|
null
>
(
null
)
const
[
popperElement
,
setPopperElement
]
=
useState
<
HTMLDivElement
>
(
null
)
const
[
popperElement
,
setPopperElement
]
=
useState
<
HTMLDivElement
|
null
>
(
null
)
const
[
arrowElement
,
setArrowElement
]
=
useState
<
HTMLDivElement
>
(
null
)
const
[
arrowElement
,
setArrowElement
]
=
useState
<
HTMLDivElement
|
null
>
(
null
)
const
{
styles
,
update
,
attributes
}
=
usePopper
(
referenceElement
,
popperElement
,
{
const
{
styles
,
update
,
attributes
}
=
usePopper
(
referenceElement
,
popperElement
,
{
placement
,
placement
,
strategy
:
'
fixed
'
,
strategy
:
'
fixed
'
,
...
@@ -94,17 +94,20 @@ export default function Popover({ content, show, children, placement = 'auto' }:
...
@@ -94,17 +94,20 @@ export default function Popover({ content, show, children, placement = 'auto' }:
{
name
:
'
arrow
'
,
options
:
{
element
:
arrowElement
}
}
{
name
:
'
arrow
'
,
options
:
{
element
:
arrowElement
}
}
]
]
})
})
useInterval
(
update
,
show
?
100
:
null
)
const
updateCallback
=
useCallback
(()
=>
{
update
&&
update
()
},
[
update
])
useInterval
(
updateCallback
,
show
?
100
:
null
)
return
(
return
(
<>
<>
<
ReferenceElement
ref=
{
setReferenceElement
}
>
{
children
}
</
ReferenceElement
>
<
ReferenceElement
ref=
{
setReferenceElement
as
any
}
>
{
children
}
</
ReferenceElement
>
<
Portal
>
<
Portal
>
<
PopoverContainer
show=
{
show
}
ref=
{
setPopperElement
}
style=
{
styles
.
popper
}
{
...
attributes
.
popper
}
>
<
PopoverContainer
show=
{
show
}
ref=
{
setPopperElement
as
any
}
style=
{
styles
.
popper
}
{
...
attributes
.
popper
}
>
{
content
}
{
content
}
<
Arrow
<
Arrow
className=
{
`arrow-${attributes.popper?.['data-popper-placement'] ?? ''}`
}
className=
{
`arrow-${attributes.popper?.['data-popper-placement'] ?? ''}`
}
ref=
{
setArrowElement
}
ref=
{
setArrowElement
as
any
}
style=
{
styles
.
arrow
}
style=
{
styles
.
arrow
}
{
...
attributes
.
arrow
}
{
...
attributes
.
arrow
}
/>
/>
...
...
src/components/Popups/PopupItem.tsx
View file @
85217452
...
@@ -81,7 +81,11 @@ export default function PopupItem({
...
@@ -81,7 +81,11 @@ export default function PopupItem({
popupContent
=
<
ListUpdatePopup
popKey=
{
popKey
}
listUrl=
{
listUrl
}
oldList=
{
oldList
}
newList=
{
newList
}
auto=
{
auto
}
/>
popupContent
=
<
ListUpdatePopup
popKey=
{
popKey
}
listUrl=
{
listUrl
}
oldList=
{
oldList
}
newList=
{
newList
}
auto=
{
auto
}
/>
}
}
const
faderStyle
=
useSpring
({
from
:
{
width
:
'
100%
'
},
to
:
{
width
:
'
0%
'
},
config
:
{
duration
:
removeAfterMs
}
})
const
faderStyle
=
useSpring
({
from
:
{
width
:
'
100%
'
},
to
:
{
width
:
'
0%
'
},
config
:
{
duration
:
removeAfterMs
??
undefined
}
})
return
(
return
(
<
Popup
>
<
Popup
>
...
...
src/components/Popups/TransactionPopup.tsx
View file @
85217452
...
@@ -32,7 +32,9 @@ export default function TransactionPopup({
...
@@ -32,7 +32,9 @@ export default function TransactionPopup({
</
div
>
</
div
>
<
AutoColumn
gap=
"8px"
>
<
AutoColumn
gap=
"8px"
>
<
TYPE
.
body
fontWeight=
{
500
}
>
{
summary
??
'
Hash:
'
+
hash
.
slice
(
0
,
8
)
+
'
...
'
+
hash
.
slice
(
58
,
65
)
}
</
TYPE
.
body
>
<
TYPE
.
body
fontWeight=
{
500
}
>
{
summary
??
'
Hash:
'
+
hash
.
slice
(
0
,
8
)
+
'
...
'
+
hash
.
slice
(
58
,
65
)
}
</
TYPE
.
body
>
<
ExternalLink
href=
{
getEtherscanLink
(
chainId
,
hash
,
'
transaction
'
)
}
>
View on Etherscan
</
ExternalLink
>
{
chainId
&&
(
<
ExternalLink
href=
{
getEtherscanLink
(
chainId
,
hash
,
'
transaction
'
)
}
>
View on Etherscan
</
ExternalLink
>
)
}
</
AutoColumn
>
</
AutoColumn
>
</
RowNoFlex
>
</
RowNoFlex
>
)
)
...
...
src/components/PositionCard/V1.tsx
View file @
85217452
...
@@ -28,7 +28,7 @@ function V1PositionCard({ token, V1LiquidityBalance }: PositionCardProps) {
...
@@ -28,7 +28,7 @@ function V1PositionCard({ token, V1LiquidityBalance }: PositionCardProps) {
<
RowFixed
>
<
RowFixed
>
<
DoubleCurrencyLogo
currency0=
{
token
}
margin=
{
true
}
size=
{
20
}
/>
<
DoubleCurrencyLogo
currency0=
{
token
}
margin=
{
true
}
size=
{
20
}
/>
<
Text
fontWeight=
{
500
}
fontSize=
{
20
}
style=
{
{
marginLeft
:
''
}
}
>
<
Text
fontWeight=
{
500
}
fontSize=
{
20
}
style=
{
{
marginLeft
:
''
}
}
>
{
`${token.equals(WETH[chainId]) ? 'WETH' : token.symbol}/ETH`
}
{
`${
chainId &&
token.equals(WETH[chainId]) ? 'WETH' : token.symbol}/ETH`
}
</
Text
>
</
Text
>
<
Text
<
Text
fontSize=
{
12
}
fontSize=
{
12
}
...
...
src/components/PositionCard/index.tsx
View file @
85217452
...
@@ -46,7 +46,7 @@ export function MinimalPositionCard({ pair, showUnwrapped = false, border }: Pos
...
@@ -46,7 +46,7 @@ export function MinimalPositionCard({ pair, showUnwrapped = false, border }: Pos
const
[
showMore
,
setShowMore
]
=
useState
(
false
)
const
[
showMore
,
setShowMore
]
=
useState
(
false
)
const
userPoolBalance
=
useTokenBalance
(
account
,
pair
.
liquidityToken
)
const
userPoolBalance
=
useTokenBalance
(
account
??
undefined
,
pair
.
liquidityToken
)
const
totalPoolTokens
=
useTotalSupply
(
pair
.
liquidityToken
)
const
totalPoolTokens
=
useTotalSupply
(
pair
.
liquidityToken
)
const
[
token0Deposited
,
token1Deposited
]
=
const
[
token0Deposited
,
token1Deposited
]
=
...
@@ -131,7 +131,7 @@ export default function FullPositionCard({ pair, border }: PositionCardProps) {
...
@@ -131,7 +131,7 @@ export default function FullPositionCard({ pair, border }: PositionCardProps) {
const
[
showMore
,
setShowMore
]
=
useState
(
false
)
const
[
showMore
,
setShowMore
]
=
useState
(
false
)
const
userPoolBalance
=
useTokenBalance
(
account
,
pair
.
liquidityToken
)
const
userPoolBalance
=
useTokenBalance
(
account
??
undefined
,
pair
.
liquidityToken
)
const
totalPoolTokens
=
useTotalSupply
(
pair
.
liquidityToken
)
const
totalPoolTokens
=
useTotalSupply
(
pair
.
liquidityToken
)
const
poolTokenPercentage
=
const
poolTokenPercentage
=
...
...
src/components/SearchModal/CommonBases.tsx
View file @
85217452
...
@@ -31,7 +31,7 @@ export default function CommonBases({
...
@@ -31,7 +31,7 @@ export default function CommonBases({
selectedCurrency
selectedCurrency
}:
{
}:
{
chainId
?:
ChainId
chainId
?:
ChainId
selectedCurrency
?:
Currency
selectedCurrency
?:
Currency
|
null
onSelect
:
(
currency
:
Currency
)
=>
void
onSelect
:
(
currency
:
Currency
)
=>
void
})
{
})
{
return
(
return
(
...
...
src/components/SearchModal/CurrencyList.tsx
View file @
85217452
...
@@ -163,9 +163,9 @@ export default function CurrencyList({
...
@@ -163,9 +163,9 @@ export default function CurrencyList({
}:
{
}:
{
height
:
number
height
:
number
currencies
:
Currency
[]
currencies
:
Currency
[]
selectedCurrency
:
Currency
|
undefined
selectedCurrency
?:
Currency
|
null
onCurrencySelect
:
(
currency
:
Currency
)
=>
void
onCurrencySelect
:
(
currency
:
Currency
)
=>
void
otherCurrency
:
Currency
|
undefined
otherCurrency
?:
Currency
|
null
fixedListRef
?:
MutableRefObject
<
FixedSizeList
|
undefined
>
fixedListRef
?:
MutableRefObject
<
FixedSizeList
|
undefined
>
showETH
:
boolean
showETH
:
boolean
})
{
})
{
...
...
src/components/SearchModal/CurrencySearch.tsx
View file @
85217452
...
@@ -26,9 +26,9 @@ import AutoSizer from 'react-virtualized-auto-sizer'
...
@@ -26,9 +26,9 @@ import AutoSizer from 'react-virtualized-auto-sizer'
interface
CurrencySearchProps
{
interface
CurrencySearchProps
{
isOpen
:
boolean
isOpen
:
boolean
onDismiss
:
()
=>
void
onDismiss
:
()
=>
void
selectedCurrency
?:
Currency
selectedCurrency
?:
Currency
|
null
onCurrencySelect
:
(
currency
:
Currency
)
=>
void
onCurrencySelect
:
(
currency
:
Currency
)
=>
void
otherSelectedCurrency
?:
Currency
otherSelectedCurrency
?:
Currency
|
null
showCommonBases
?:
boolean
showCommonBases
?:
boolean
onChangeList
:
()
=>
void
onChangeList
:
()
=>
void
}
}
...
...
src/components/SearchModal/CurrencySearchModal.tsx
View file @
85217452
...
@@ -11,9 +11,9 @@ import { ListSelect } from './ListSelect'
...
@@ -11,9 +11,9 @@ import { ListSelect } from './ListSelect'
interface
CurrencySearchModalProps
{
interface
CurrencySearchModalProps
{
isOpen
:
boolean
isOpen
:
boolean
onDismiss
:
()
=>
void
onDismiss
:
()
=>
void
selectedCurrency
?:
Currency
selectedCurrency
?:
Currency
|
null
onCurrencySelect
:
(
currency
:
Currency
)
=>
void
onCurrencySelect
:
(
currency
:
Currency
)
=>
void
otherSelectedCurrency
?:
Currency
otherSelectedCurrency
?:
Currency
|
null
showCommonBases
?:
boolean
showCommonBases
?:
boolean
}
}
...
...
src/components/SearchModal/filtering.ts
View file @
85217452
...
@@ -31,6 +31,6 @@ export function filterTokens(tokens: Token[], search: string): Token[] {
...
@@ -31,6 +31,6 @@ export function filterTokens(tokens: Token[], search: string): Token[] {
return
tokens
.
filter
(
token
=>
{
return
tokens
.
filter
(
token
=>
{
const
{
symbol
,
name
}
=
token
const
{
symbol
,
name
}
=
token
return
matchesSearch
(
symbol
)
||
matchesSearch
(
name
)
return
(
symbol
&&
matchesSearch
(
symbol
))
||
(
name
&&
matchesSearch
(
name
)
)
})
})
}
}
src/components/SearchModal/tsconfig.json
deleted
100644 → 0
View file @
f7a1a2ab
{
"extends"
:
"../../../tsconfig.strict.json"
,
"include"
:
[
"**/*"
]
}
\ No newline at end of file
src/components/Settings/index.tsx
View file @
85217452
...
@@ -141,7 +141,8 @@ export default function SettingsTab() {
...
@@ -141,7 +141,8 @@ export default function SettingsTab() {
useOnClickOutside
(
node
,
open
?
toggle
:
undefined
)
useOnClickOutside
(
node
,
open
?
toggle
:
undefined
)
return
(
return
(
<
StyledMenu
ref=
{
node
}
>
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/30451
<
StyledMenu
ref=
{
node
as
any
}
>
<
Modal
isOpen=
{
showConfirmation
}
onDismiss=
{
()
=>
setShowConfirmation
(
false
)
}
maxHeight=
{
100
}
>
<
Modal
isOpen=
{
showConfirmation
}
onDismiss=
{
()
=>
setShowConfirmation
(
false
)
}
maxHeight=
{
100
}
>
<
ModalContentWrapper
>
<
ModalContentWrapper
>
<
AutoColumn
gap=
"lg"
>
<
AutoColumn
gap=
"lg"
>
...
...
src/components/TokenWarningModal/index.tsx
View file @
85217452
...
@@ -53,7 +53,7 @@ function TokenWarningCard({ token }: TokenWarningCardProps) {
...
@@ -53,7 +53,7 @@ function TokenWarningCard({ token }: TokenWarningCardProps) {
if
(
userToken
.
equals
(
token
))
{
if
(
userToken
.
equals
(
token
))
{
return
false
return
false
}
}
return
userToken
.
symbol
.
toLowerCase
()
===
tokenSymbol
||
userToken
.
name
.
toLowerCase
()
===
tokenName
return
userToken
.
symbol
?.
toLowerCase
()
===
tokenSymbol
||
userToken
.
name
?
.
toLowerCase
()
===
tokenName
})
})
},
[
token
,
chainId
,
allTokens
,
tokenSymbol
,
tokenName
])
},
[
token
,
chainId
,
allTokens
,
tokenSymbol
,
tokenName
])
...
@@ -72,9 +72,11 @@ function TokenWarningCard({ token }: TokenWarningCardProps) {
...
@@ -72,9 +72,11 @@ function TokenWarningCard({ token }: TokenWarningCardProps) {
?
`${token.name} (${token.symbol})`
?
`${token.name} (${token.symbol})`
:
token
.
name
||
token
.
symbol
}{
'
'
}
:
token
.
name
||
token
.
symbol
}{
'
'
}
</
TYPE
.
main
>
</
TYPE
.
main
>
<
ExternalLink
style=
{
{
fontWeight
:
400
}
}
href=
{
getEtherscanLink
(
chainId
,
token
.
address
,
'
token
'
)
}
>
{
chainId
&&
(
<
TYPE
.
blue
title=
{
token
.
address
}
>
{
shortenAddress
(
token
.
address
)
}
(View on Etherscan)
</
TYPE
.
blue
>
<
ExternalLink
style=
{
{
fontWeight
:
400
}
}
href=
{
getEtherscanLink
(
chainId
,
token
.
address
,
'
token
'
)
}
>
</
ExternalLink
>
<
TYPE
.
blue
title=
{
token
.
address
}
>
{
shortenAddress
(
token
.
address
)
}
(View on Etherscan)
</
TYPE
.
blue
>
</
ExternalLink
>
)
}
</
AutoColumn
>
</
AutoColumn
>
</
AutoRow
>
</
AutoRow
>
</
Wrapper
>
</
Wrapper
>
...
...
src/components/TransactionConfirmationModal/index.tsx
View file @
85217452
...
@@ -91,11 +91,13 @@ function TransactionSubmittedContent({
...
@@ -91,11 +91,13 @@ function TransactionSubmittedContent({
Transaction Submitted
Transaction Submitted
</
Text
>
</
Text
>
<
ExternalLink
href=
{
getEtherscanLink
(
chainId
,
hash
,
'
transaction
'
)
}
>
{
chainId
&&
hash
&&
(
<
Text
fontWeight=
{
500
}
fontSize=
{
14
}
color=
{
theme
.
primary1
}
>
<
ExternalLink
href=
{
getEtherscanLink
(
chainId
,
hash
,
'
transaction
'
)
}
>
View on Etherscan
<
Text
fontWeight=
{
500
}
fontSize=
{
14
}
color=
{
theme
.
primary1
}
>
</
Text
>
View on Etherscan
</
ExternalLink
>
</
Text
>
</
ExternalLink
>
)
}
<
ButtonPrimary
onClick=
{
onDismiss
}
style=
{
{
margin
:
'
20px 0 0 0
'
}
}
>
<
ButtonPrimary
onClick=
{
onDismiss
}
style=
{
{
margin
:
'
20px 0 0 0
'
}
}
>
<
Text
fontWeight=
{
500
}
fontSize=
{
20
}
>
<
Text
fontWeight=
{
500
}
fontSize=
{
20
}
>
Close
Close
...
...
src/components/TransactionConfirmationModal/tsconfig.json
deleted
100644 → 0
View file @
f7a1a2ab
{
"extends"
:
"../../../tsconfig.strict.json"
,
"include"
:
[
"**/*"
]
}
\ No newline at end of file
src/components/TransactionSettings/index.tsx
View file @
85217452
...
@@ -104,48 +104,44 @@ export default function SlippageTabs({ rawSlippage, setRawSlippage, deadline, se
...
@@ -104,48 +104,44 @@ export default function SlippageTabs({ rawSlippage, setRawSlippage, deadline, se
slippageInput
===
''
||
(
rawSlippage
/
100
).
toFixed
(
2
)
===
Number
.
parseFloat
(
slippageInput
).
toFixed
(
2
)
slippageInput
===
''
||
(
rawSlippage
/
100
).
toFixed
(
2
)
===
Number
.
parseFloat
(
slippageInput
).
toFixed
(
2
)
const
deadlineInputIsValid
=
deadlineInput
===
''
||
(
deadline
/
60
).
toString
()
===
deadlineInput
const
deadlineInputIsValid
=
deadlineInput
===
''
||
(
deadline
/
60
).
toString
()
===
deadlineInput
let
slippageError
:
SlippageError
let
slippageError
:
SlippageError
|
undefined
if
(
slippageInput
!==
''
&&
!
slippageInputIsValid
)
{
if
(
slippageInput
!==
''
&&
!
slippageInputIsValid
)
{
slippageError
=
SlippageError
.
InvalidInput
slippageError
=
SlippageError
.
InvalidInput
}
else
if
(
slippageInputIsValid
&&
rawSlippage
<
50
)
{
}
else
if
(
slippageInputIsValid
&&
rawSlippage
<
50
)
{
slippageError
=
SlippageError
.
RiskyLow
slippageError
=
SlippageError
.
RiskyLow
}
else
if
(
slippageInputIsValid
&&
rawSlippage
>
500
)
{
}
else
if
(
slippageInputIsValid
&&
rawSlippage
>
500
)
{
slippageError
=
SlippageError
.
RiskyHigh
slippageError
=
SlippageError
.
RiskyHigh
}
else
{
slippageError
=
undefined
}
}
let
deadlineError
:
DeadlineError
let
deadlineError
:
DeadlineError
|
undefined
if
(
deadlineInput
!==
''
&&
!
deadlineInputIsValid
)
{
if
(
deadlineInput
!==
''
&&
!
deadlineInputIsValid
)
{
deadlineError
=
DeadlineError
.
InvalidInput
deadlineError
=
DeadlineError
.
InvalidInput
}
else
{
deadlineError
=
undefined
}
}
function
parseCustomSlippage
(
value
:
string
)
{
function
parseCustomSlippage
(
value
:
string
)
{
setSlippageInput
(
value
)
setSlippageInput
(
value
)
let
valueAsIntFromRoundedFloat
:
number
try
{
try
{
valueAsIntFromRoundedFloat
=
Number
.
parseInt
((
Number
.
parseFloat
(
value
)
*
100
).
toString
())
const
valueAsIntFromRoundedFloat
=
Number
.
parseInt
((
Number
.
parseFloat
(
value
)
*
100
).
toString
())
if
(
!
Number
.
isNaN
(
valueAsIntFromRoundedFloat
)
&&
valueAsIntFromRoundedFloat
<
5000
)
{
setRawSlippage
(
valueAsIntFromRoundedFloat
)
}
}
catch
{}
}
catch
{}
if
(
typeof
valueAsIntFromRoundedFloat
===
'
number
'
&&
!
Number
.
isNaN
(
valueAsIntFromRoundedFloat
)
&&
valueAsIntFromRoundedFloat
<
5000
)
{
setRawSlippage
(
valueAsIntFromRoundedFloat
)
}
}
}
function
parseCustomDeadline
(
value
:
string
)
{
function
parseCustomDeadline
(
value
:
string
)
{
setDeadlineInput
(
value
)
setDeadlineInput
(
value
)
let
valueAsInt
:
number
try
{
try
{
valueAsInt
=
Number
.
parseInt
(
value
)
*
60
const
valueAsInt
:
number
=
Number
.
parseInt
(
value
)
*
60
if
(
!
Number
.
isNaN
(
valueAsInt
)
&&
valueAsInt
>
0
)
{
setDeadline
(
valueAsInt
)
}
}
catch
{}
}
catch
{}
if
(
typeof
valueAsInt
===
'
number
'
&&
!
Number
.
isNaN
(
valueAsInt
)
&&
valueAsInt
>
0
)
{
setDeadline
(
valueAsInt
)
}
}
}
return
(
return
(
...
@@ -195,8 +191,9 @@ export default function SlippageTabs({ rawSlippage, setRawSlippage, deadline, se
...
@@ -195,8 +191,9 @@ export default function SlippageTabs({ rawSlippage, setRawSlippage, deadline, se
</
span
>
</
span
>
</
SlippageEmojiContainer
>
</
SlippageEmojiContainer
>
)
:
null
}
)
:
null
}
{
/* https://github.com/DefinitelyTyped/DefinitelyTyped/issues/30451 */
}
<
Input
<
Input
ref=
{
inputRef
}
ref=
{
inputRef
as
any
}
placeholder=
{
(
rawSlippage
/
100
).
toFixed
(
2
)
}
placeholder=
{
(
rawSlippage
/
100
).
toFixed
(
2
)
}
value=
{
slippageInput
}
value=
{
slippageInput
}
onBlur=
{
()
=>
{
onBlur=
{
()
=>
{
...
...
src/components/WalletModal/Option.tsx
View file @
85217452
...
@@ -73,7 +73,7 @@ const SubHeader = styled.div`
...
@@ -73,7 +73,7 @@ const SubHeader = styled.div`
font-size: 12px;
font-size: 12px;
`
`
const
IconWrapper
=
styled
.
div
<
{
size
?:
number
}
>
`
const
IconWrapper
=
styled
.
div
<
{
size
?:
number
|
null
}
>
`
${({
theme
})
=>
theme
.
flexColumnNoWrap
}
;
${({
theme
})
=>
theme
.
flexColumnNoWrap
}
;
align-items: center;
align-items: center;
justify-content: center;
justify-content: center;
...
@@ -90,7 +90,7 @@ const IconWrapper = styled.div<{ size?: number }>`
...
@@ -90,7 +90,7 @@ const IconWrapper = styled.div<{ size?: number }>`
export
default
function
Option
({
export
default
function
Option
({
link
=
null
,
link
=
null
,
clickable
=
true
,
clickable
=
true
,
size
=
null
,
size
,
onClick
=
null
,
onClick
=
null
,
color
,
color
,
header
,
header
,
...
...
src/components/WalletModal/PendingView.tsx
View file @
85217452
...
@@ -86,7 +86,7 @@ export default function PendingView({
...
@@ -86,7 +86,7 @@ export default function PendingView({
<
ErrorButton
<
ErrorButton
onClick=
{
()
=>
{
onClick=
{
()
=>
{
setPendingError
(
false
)
setPendingError
(
false
)
tryActivation
(
connector
)
connector
&&
tryActivation
(
connector
)
}
}
}
}
>
>
Try Again
Try Again
...
...
src/components/WalletModal/index.tsx
View file @
85217452
...
@@ -184,13 +184,14 @@ export default function WalletModal({
...
@@ -184,13 +184,14 @@ export default function WalletModal({
connector
.
walletConnectProvider
=
undefined
connector
.
walletConnectProvider
=
undefined
}
}
activate
(
connector
,
undefined
,
true
).
catch
(
error
=>
{
connector
&&
if
(
error
instanceof
UnsupportedChainIdError
)
{
activate
(
connector
,
undefined
,
true
).
catch
(
error
=>
{
activate
(
connector
)
// a little janky...can't use setError because the connector isn't set
if
(
error
instanceof
UnsupportedChainIdError
)
{
}
else
{
activate
(
connector
)
// a little janky...can't use setError because the connector isn't set
setPendingError
(
true
)
}
else
{
}
setPendingError
(
true
)
})
}
})
}
}
// close wallet modal if fortmatic modal is active
// close wallet modal if fortmatic modal is active
...
@@ -359,7 +360,7 @@ export default function WalletModal({
...
@@ -359,7 +360,7 @@ export default function WalletModal({
}
}
return
(
return
(
<
Modal
isOpen=
{
walletModalOpen
}
onDismiss=
{
toggleWalletModal
}
minHeight=
{
null
}
maxHeight=
{
90
}
>
<
Modal
isOpen=
{
walletModalOpen
}
onDismiss=
{
toggleWalletModal
}
minHeight=
{
false
}
maxHeight=
{
90
}
>
<
Wrapper
>
{
getModalContent
()
}
</
Wrapper
>
<
Wrapper
>
{
getModalContent
()
}
</
Wrapper
>
</
Modal
>
</
Modal
>
)
)
...
...
src/components/Web3ReactManager/index.tsx
View file @
85217452
...
@@ -19,7 +19,7 @@ const Message = styled.h2`
...
@@ -19,7 +19,7 @@ const Message = styled.h2`
color:
${({
theme
})
=>
theme
.
secondary1
}
;
color:
${({
theme
})
=>
theme
.
secondary1
}
;
`
`
export
default
function
Web3ReactManager
({
children
}:
{
children
:
JSX
.
Element
})
:
JSX
.
Element
{
export
default
function
Web3ReactManager
({
children
}:
{
children
:
JSX
.
Element
})
{
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
const
{
active
}
=
useWeb3React
()
const
{
active
}
=
useWeb3React
()
const
{
active
:
networkActive
,
error
:
networkError
,
activate
:
activateNetwork
}
=
useWeb3React
(
NetworkContextName
)
const
{
active
:
networkActive
,
error
:
networkError
,
activate
:
activateNetwork
}
=
useWeb3React
(
NetworkContextName
)
...
...
src/components/Web3Status/index.tsx
View file @
85217452
...
@@ -169,7 +169,7 @@ function Web3StatusInner() {
...
@@ -169,7 +169,7 @@ function Web3StatusInner() {
const
{
t
}
=
useTranslation
()
const
{
t
}
=
useTranslation
()
const
{
account
,
connector
,
error
}
=
useWeb3React
()
const
{
account
,
connector
,
error
}
=
useWeb3React
()
const
{
ENSName
}
=
useENSName
(
account
)
const
{
ENSName
}
=
useENSName
(
account
??
undefined
)
const
allTransactions
=
useAllTransactions
()
const
allTransactions
=
useAllTransactions
()
...
@@ -197,7 +197,7 @@ function Web3StatusInner() {
...
@@ -197,7 +197,7 @@ function Web3StatusInner() {
<
Text
>
{
ENSName
||
shortenAddress
(
account
)
}
</
Text
>
<
Text
>
{
ENSName
||
shortenAddress
(
account
)
}
</
Text
>
</>
</>
)
}
)
}
{
!
hasPendingTransactions
&&
<
StatusIcon
connector=
{
connector
}
/>
}
{
!
hasPendingTransactions
&&
connector
&&
<
StatusIcon
connector=
{
connector
}
/>
}
</
Web3StatusConnected
>
</
Web3StatusConnected
>
)
)
}
else
if
(
error
)
{
}
else
if
(
error
)
{
...
@@ -220,7 +220,7 @@ export default function Web3Status() {
...
@@ -220,7 +220,7 @@ export default function Web3Status() {
const
{
active
,
account
}
=
useWeb3React
()
const
{
active
,
account
}
=
useWeb3React
()
const
contextNetwork
=
useWeb3React
(
NetworkContextName
)
const
contextNetwork
=
useWeb3React
(
NetworkContextName
)
const
{
ENSName
}
=
useENSName
(
account
)
const
{
ENSName
}
=
useENSName
(
account
??
undefined
)
const
allTransactions
=
useAllTransactions
()
const
allTransactions
=
useAllTransactions
()
...
@@ -239,7 +239,7 @@ export default function Web3Status() {
...
@@ -239,7 +239,7 @@ export default function Web3Status() {
return
(
return
(
<>
<>
<
Web3StatusInner
/>
<
Web3StatusInner
/>
<
WalletModal
ENSName=
{
ENSName
}
pendingTransactions=
{
pending
}
confirmedTransactions=
{
confirmed
}
/>
<
WalletModal
ENSName=
{
ENSName
??
undefined
}
pendingTransactions=
{
pending
}
confirmedTransactions=
{
confirmed
}
/>
</>
</>
)
)
}
}
src/components/swap/tsconfig.json
deleted
100644 → 0
View file @
f7a1a2ab
{
"extends"
:
"../../../tsconfig.strict.json"
,
"include"
:
[
"**/*"
]
}
\ No newline at end of file
src/connectors/tsconfig.json
deleted
100644 → 0
View file @
f7a1a2ab
{
"extends"
:
"../../tsconfig.strict.json"
,
"include"
:
[
"**/*"
]
}
\ No newline at end of file
src/constants/tsconfig.json
deleted
100644 → 0
View file @
f7a1a2ab
{
"extends"
:
"../../tsconfig.strict.json"
,
"include"
:
[
"**/*"
]
}
\ No newline at end of file
src/data/tsconfig.json
deleted
100644 → 0
View file @
f7a1a2ab
{
"extends"
:
"../../tsconfig.strict.json"
,
"include"
:
[
"**/*"
]
}
\ No newline at end of file
src/hooks/tsconfig.json
deleted
100644 → 0
View file @
f7a1a2ab
{
"extends"
:
"../../tsconfig.strict.json"
,
"include"
:
[
"**/*"
]
}
\ No newline at end of file
src/pages/AddLiquidity/tsconfig.json
deleted
100644 → 0
View file @
f7a1a2ab
{
"extends"
:
"../../../tsconfig.strict.json"
,
"include"
:
[
"**/*"
,
"../../../node_modules/eslint-plugin-react/lib/types.d.ts"
]
}
\ No newline at end of file
src/pages/MigrateV1/MigrateV1Exchange.tsx
View file @
85217452
...
@@ -67,14 +67,14 @@ export function V1LiquidityInfo({
...
@@ -67,14 +67,14 @@ export function V1LiquidityInfo({
<
div
style=
{
{
marginLeft
:
'
.75rem
'
}
}
>
<
div
style=
{
{
marginLeft
:
'
.75rem
'
}
}
>
<
TYPE
.
mediumHeader
>
<
TYPE
.
mediumHeader
>
{
<
FormattedPoolCurrencyAmount
currencyAmount=
{
liquidityTokenAmount
}
/>
}{
'
'
}
{
<
FormattedPoolCurrencyAmount
currencyAmount=
{
liquidityTokenAmount
}
/>
}{
'
'
}
{
token
.
equals
(
WETH
[
chainId
])
?
'
WETH
'
:
token
.
symbol
}
/ETH
{
chainId
&&
token
.
equals
(
WETH
[
chainId
])
?
'
WETH
'
:
token
.
symbol
}
/ETH
</
TYPE
.
mediumHeader
>
</
TYPE
.
mediumHeader
>
</
div
>
</
div
>
</
AutoRow
>
</
AutoRow
>
<
RowBetween
my=
"1rem"
>
<
RowBetween
my=
"1rem"
>
<
Text
fontSize=
{
16
}
fontWeight=
{
500
}
>
<
Text
fontSize=
{
16
}
fontWeight=
{
500
}
>
Pooled
{
token
.
equals
(
WETH
[
chainId
])
?
'
WETH
'
:
token
.
symbol
}
:
Pooled
{
chainId
&&
token
.
equals
(
WETH
[
chainId
])
?
'
WETH
'
:
token
.
symbol
}
:
</
Text
>
</
Text
>
<
RowFixed
>
<
RowFixed
>
<
Text
fontSize=
{
16
}
fontWeight=
{
500
}
marginLeft=
{
'
6px
'
}
>
<
Text
fontSize=
{
16
}
fontWeight=
{
500
}
marginLeft=
{
'
6px
'
}
>
...
@@ -107,7 +107,7 @@ function V1PairMigration({ liquidityTokenAmount, token }: { liquidityTokenAmount
...
@@ -107,7 +107,7 @@ function V1PairMigration({ liquidityTokenAmount, token }: { liquidityTokenAmount
const
[
v2PairState
,
v2Pair
]
=
usePair
(
chainId
?
WETH
[
chainId
]
:
undefined
,
token
)
const
[
v2PairState
,
v2Pair
]
=
usePair
(
chainId
?
WETH
[
chainId
]
:
undefined
,
token
)
const
isFirstLiquidityProvider
:
boolean
=
v2PairState
===
PairState
.
NOT_EXISTS
const
isFirstLiquidityProvider
:
boolean
=
v2PairState
===
PairState
.
NOT_EXISTS
const
v2SpotPrice
=
v2Pair
?.
reserveOf
(
token
)?.
divide
(
v2Pair
?.
reserveOf
(
WETH
[
chainId
]))
const
v2SpotPrice
=
chainId
&&
v2Pair
?
v2Pair
.
reserveOf
(
token
).
divide
(
v2Pair
.
reserveOf
(
WETH
[
chainId
]))
:
undefined
const
[
confirmingMigration
,
setConfirmingMigration
]
=
useState
<
boolean
>
(
false
)
const
[
confirmingMigration
,
setConfirmingMigration
]
=
useState
<
boolean
>
(
false
)
const
[
pendingMigrationHash
,
setPendingMigrationHash
]
=
useState
<
string
|
null
>
(
null
)
const
[
pendingMigrationHash
,
setPendingMigrationHash
]
=
useState
<
string
|
null
>
(
null
)
...
@@ -158,11 +158,11 @@ function V1PairMigration({ liquidityTokenAmount, token }: { liquidityTokenAmount
...
@@ -158,11 +158,11 @@ function V1PairMigration({ liquidityTokenAmount, token }: { liquidityTokenAmount
:
tokenWorth
?.
numerator
:
tokenWorth
?.
numerator
const
addTransaction
=
useTransactionAdder
()
const
addTransaction
=
useTransactionAdder
()
const
isMigrationPending
=
useIsTransactionPending
(
pendingMigrationHash
)
const
isMigrationPending
=
useIsTransactionPending
(
pendingMigrationHash
??
undefined
)
const
migrator
=
useV2MigratorContract
()
const
migrator
=
useV2MigratorContract
()
const
migrate
=
useCallback
(()
=>
{
const
migrate
=
useCallback
(()
=>
{
if
(
!
minAmountToken
||
!
minAmountETH
)
return
if
(
!
minAmountToken
||
!
minAmountETH
||
!
migrator
)
return
setConfirmingMigration
(
true
)
setConfirmingMigration
(
true
)
migrator
migrator
...
@@ -194,16 +194,18 @@ function V1PairMigration({ liquidityTokenAmount, token }: { liquidityTokenAmount
...
@@ -194,16 +194,18 @@ function V1PairMigration({ liquidityTokenAmount, token }: { liquidityTokenAmount
const
largePriceDifference
=
!!
priceDifferenceAbs
&&
!
priceDifferenceAbs
.
lessThan
(
JSBI
.
BigInt
(
5
))
const
largePriceDifference
=
!!
priceDifferenceAbs
&&
!
priceDifferenceAbs
.
lessThan
(
JSBI
.
BigInt
(
5
))
const
isSuccessfullyMigrated
=
!!
pendingMigrationHash
&&
!!
noLiquidityTokens
const
isSuccessfullyMigrated
=
!!
pendingMigrationHash
&&
noLiquidityTokens
return
(
return
(
<
AutoColumn
gap=
"20px"
>
<
AutoColumn
gap=
"20px"
>
<
TYPE
.
body
my=
{
9
}
style=
{
{
fontWeight
:
400
}
}
>
<
TYPE
.
body
my=
{
9
}
style=
{
{
fontWeight
:
400
}
}
>
This tool will safely migrate your V1 liquidity to V2 with minimal price risk. The process is completely
This tool will safely migrate your V1 liquidity to V2 with minimal price risk. The process is completely
trustless thanks to the
{
'
'
}
trustless thanks to the
{
'
'
}
<
ExternalLink
href=
{
getEtherscanLink
(
chainId
,
MIGRATOR_ADDRESS
,
'
address
'
)
}
>
{
chainId
&&
(
<
TYPE
.
blue
display=
"inline"
>
Uniswap migration contract↗
</
TYPE
.
blue
>
<
ExternalLink
href=
{
getEtherscanLink
(
chainId
,
MIGRATOR_ADDRESS
,
'
address
'
)
}
>
</
ExternalLink
>
<
TYPE
.
blue
display=
"inline"
>
Uniswap migration contract↗
</
TYPE
.
blue
>
</
ExternalLink
>
)
}
.
.
</
TYPE
.
body
>
</
TYPE
.
body
>
...
@@ -242,7 +244,7 @@ function V1PairMigration({ liquidityTokenAmount, token }: { liquidityTokenAmount
...
@@ -242,7 +244,7 @@ function V1PairMigration({ liquidityTokenAmount, token }: { liquidityTokenAmount
<
RowBetween
>
<
RowBetween
>
<
TYPE
.
body
color=
"inherit"
>
Price Difference:
</
TYPE
.
body
>
<
TYPE
.
body
color=
"inherit"
>
Price Difference:
</
TYPE
.
body
>
<
TYPE
.
black
color=
"inherit"
>
{
priceDifferenceAbs
.
toSignificant
(
4
)
}
%
</
TYPE
.
black
>
<
TYPE
.
black
color=
"inherit"
>
{
priceDifferenceAbs
?
.
toSignificant
(
4
)
}
%
</
TYPE
.
black
>
</
RowBetween
>
</
RowBetween
>
</
AutoColumn
>
</
AutoColumn
>
</
YellowCard
>
</
YellowCard
>
...
@@ -336,12 +338,12 @@ export default function MigrateV1Exchange({
...
@@ -336,12 +338,12 @@ export default function MigrateV1Exchange({
const
liquidityToken
:
Token
|
undefined
=
useMemo
(
const
liquidityToken
:
Token
|
undefined
=
useMemo
(
()
=>
()
=>
validatedAddress
&&
token
validatedAddress
&&
chainId
&&
token
?
new
Token
(
chainId
,
validatedAddress
,
18
,
`UNI-V1-
${
token
.
symbol
}
`
,
'
Uniswap V1
'
)
?
new
Token
(
chainId
,
validatedAddress
,
18
,
`UNI-V1-
${
token
.
symbol
}
`
,
'
Uniswap V1
'
)
:
undefined
,
:
undefined
,
[
chainId
,
validatedAddress
,
token
]
[
chainId
,
validatedAddress
,
token
]
)
)
const
userLiquidityBalance
=
useTokenBalance
(
account
,
liquidityToken
)
const
userLiquidityBalance
=
useTokenBalance
(
account
??
undefined
,
liquidityToken
)
// redirect for invalid url params
// redirect for invalid url params
if
(
!
validatedAddress
||
tokenAddress
===
AddressZero
)
{
if
(
!
validatedAddress
||
tokenAddress
===
AddressZero
)
{
...
@@ -362,7 +364,7 @@ export default function MigrateV1Exchange({
...
@@ -362,7 +364,7 @@ export default function MigrateV1Exchange({
{
!
account
?
(
{
!
account
?
(
<
TYPE
.
largeHeader
>
You must connect an account.
</
TYPE
.
largeHeader
>
<
TYPE
.
largeHeader
>
You must connect an account.
</
TYPE
.
largeHeader
>
)
:
validatedAddress
&&
token
?.
equals
(
WETH
[
chainId
])
?
(
)
:
validatedAddress
&&
chainId
&&
token
?.
equals
(
WETH
[
chainId
])
?
(
<>
<>
<
TYPE
.
body
my=
{
9
}
style=
{
{
fontWeight
:
400
}
}
>
<
TYPE
.
body
my=
{
9
}
style=
{
{
fontWeight
:
400
}
}
>
Because Uniswap V2 uses WETH under the hood, your Uniswap V1 WETH/ETH liquidity cannot be migrated. You
Because Uniswap V2 uses WETH under the hood, your Uniswap V1 WETH/ETH liquidity cannot be migrated. You
...
...
src/pages/MigrateV1/RemoveV1Exchange.tsx
View file @
85217452
...
@@ -58,7 +58,7 @@ function V1PairRemoval({
...
@@ -58,7 +58,7 @@ function V1PairRemoval({
:
new
TokenAmount
(
token
,
ZERO
)
:
new
TokenAmount
(
token
,
ZERO
)
const
addTransaction
=
useTransactionAdder
()
const
addTransaction
=
useTransactionAdder
()
const
isRemovalPending
=
useIsTransactionPending
(
pendingRemovalHash
)
const
isRemovalPending
=
useIsTransactionPending
(
pendingRemovalHash
??
undefined
)
const
remove
=
useCallback
(()
=>
{
const
remove
=
useCallback
(()
=>
{
if
(
!
liquidityTokenAmount
)
return
if
(
!
liquidityTokenAmount
)
return
...
@@ -79,7 +79,7 @@ function V1PairRemoval({
...
@@ -79,7 +79,7 @@ function V1PairRemoval({
})
})
addTransaction
(
response
,
{
addTransaction
(
response
,
{
summary
:
`Remove
${
token
.
equals
(
WETH
[
chainId
])
?
'
WETH
'
:
token
.
symbol
}
/ETH V1 liquidity`
summary
:
`Remove
${
chainId
&&
token
.
equals
(
WETH
[
chainId
])
?
'
WETH
'
:
token
.
symbol
}
/ETH V1 liquidity`
})
})
setPendingRemovalHash
(
response
.
hash
)
setPendingRemovalHash
(
response
.
hash
)
})
})
...
@@ -91,7 +91,7 @@ function V1PairRemoval({
...
@@ -91,7 +91,7 @@ function V1PairRemoval({
const
noLiquidityTokens
=
!!
liquidityTokenAmount
&&
liquidityTokenAmount
.
equalTo
(
ZERO
)
const
noLiquidityTokens
=
!!
liquidityTokenAmount
&&
liquidityTokenAmount
.
equalTo
(
ZERO
)
const
isSuccessfullyRemoved
=
!!
pendingRemovalHash
&&
!!
noLiquidityTokens
const
isSuccessfullyRemoved
=
!!
pendingRemovalHash
&&
noLiquidityTokens
return
(
return
(
<
AutoColumn
gap=
"20px"
>
<
AutoColumn
gap=
"20px"
>
...
@@ -119,7 +119,7 @@ function V1PairRemoval({
...
@@ -119,7 +119,7 @@ function V1PairRemoval({
</
LightCard
>
</
LightCard
>
<
TYPE
.
darkGray
style=
{
{
textAlign
:
'
center
'
}
}
>
<
TYPE
.
darkGray
style=
{
{
textAlign
:
'
center
'
}
}
>
{
`Your Uniswap V1 ${
{
`Your Uniswap V1 ${
token.equals(WETH[chainId]) ? 'WETH' : token.symbol
chainId &&
token.equals(WETH[chainId]) ? 'WETH' : token.symbol
}/ETH liquidity will be redeemed for underlying assets.`
}
}/ETH liquidity will be redeemed for underlying assets.`
}
</
TYPE
.
darkGray
>
</
TYPE
.
darkGray
>
</
AutoColumn
>
</
AutoColumn
>
...
@@ -140,12 +140,12 @@ export default function RemoveV1Exchange({
...
@@ -140,12 +140,12 @@ export default function RemoveV1Exchange({
const
liquidityToken
:
Token
|
undefined
=
useMemo
(
const
liquidityToken
:
Token
|
undefined
=
useMemo
(
()
=>
()
=>
validatedAddress
&&
token
validatedAddress
&&
chainId
&&
token
?
new
Token
(
chainId
,
validatedAddress
,
18
,
`UNI-V1-
${
token
.
symbol
}
`
,
'
Uniswap V1
'
)
?
new
Token
(
chainId
,
validatedAddress
,
18
,
`UNI-V1-
${
token
.
symbol
}
`
,
'
Uniswap V1
'
)
:
undefined
,
:
undefined
,
[
chainId
,
validatedAddress
,
token
]
[
chainId
,
validatedAddress
,
token
]
)
)
const
userLiquidityBalance
=
useTokenBalance
(
account
,
liquidityToken
)
const
userLiquidityBalance
=
useTokenBalance
(
account
??
undefined
,
liquidityToken
)
// redirect for invalid url params
// redirect for invalid url params
if
(
!
validatedAddress
||
tokenAddress
===
AddressZero
)
{
if
(
!
validatedAddress
||
tokenAddress
===
AddressZero
)
{
...
@@ -166,7 +166,7 @@ export default function RemoveV1Exchange({
...
@@ -166,7 +166,7 @@ export default function RemoveV1Exchange({
{
!
account
?
(
{
!
account
?
(
<
TYPE
.
largeHeader
>
You must connect an account.
</
TYPE
.
largeHeader
>
<
TYPE
.
largeHeader
>
You must connect an account.
</
TYPE
.
largeHeader
>
)
:
userLiquidityBalance
&&
token
?
(
)
:
userLiquidityBalance
&&
token
&&
exchangeContract
?
(
<
V1PairRemoval
<
V1PairRemoval
exchangeContract=
{
exchangeContract
}
exchangeContract=
{
exchangeContract
}
liquidityTokenAmount=
{
userLiquidityBalance
}
liquidityTokenAmount=
{
userLiquidityBalance
}
...
...
src/pages/MigrateV1/index.tsx
View file @
85217452
...
@@ -29,7 +29,7 @@ export default function MigrateV1() {
...
@@ -29,7 +29,7 @@ export default function MigrateV1() {
// automatically add the search token
// automatically add the search token
const
token
=
useToken
(
tokenSearch
)
const
token
=
useToken
(
tokenSearch
)
const
selectedTokenListTokens
=
useSelectedTokenList
()
const
selectedTokenListTokens
=
useSelectedTokenList
()
const
isOnSelectedList
=
isTokenOnList
(
selectedTokenListTokens
,
token
)
const
isOnSelectedList
=
isTokenOnList
(
selectedTokenListTokens
,
token
??
undefined
)
const
allTokens
=
useAllTokens
()
const
allTokens
=
useAllTokens
()
const
addToken
=
useAddUserToken
()
const
addToken
=
useAddUserToken
()
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -41,27 +41,26 @@ export default function MigrateV1() {
...
@@ -41,27 +41,26 @@ export default function MigrateV1() {
// get V1 LP balances
// get V1 LP balances
const
V1Exchanges
=
useAllTokenV1Exchanges
()
const
V1Exchanges
=
useAllTokenV1Exchanges
()
const
V1LiquidityTokens
:
Token
[]
=
useMemo
(()
=>
{
const
V1LiquidityTokens
:
Token
[]
=
useMemo
(()
=>
{
return
Object
.
keys
(
V1Exchanges
).
map
(
return
chainId
exchangeAddress
=>
new
Token
(
chainId
,
exchangeAddress
,
18
,
'
UNI-V1
'
,
'
Uniswap V1
'
)
?
Object
.
keys
(
V1Exchanges
).
map
(
exchangeAddress
=>
new
Token
(
chainId
,
exchangeAddress
,
18
,
'
UNI-V1
'
,
'
Uniswap V1
'
)
)
)
:
[]
},
[
chainId
,
V1Exchanges
])
},
[
chainId
,
V1Exchanges
])
const
[
V1LiquidityBalances
,
V1LiquidityBalancesLoading
]
=
useTokenBalancesWithLoadingIndicator
(
const
[
V1LiquidityBalances
,
V1LiquidityBalancesLoading
]
=
useTokenBalancesWithLoadingIndicator
(
account
,
account
??
undefined
,
V1LiquidityTokens
V1LiquidityTokens
)
)
const
allV1PairsWithLiquidity
=
V1LiquidityTokens
.
filter
(
V1LiquidityToken
=>
{
const
allV1PairsWithLiquidity
=
V1LiquidityTokens
.
filter
(
V1LiquidityToken
=>
{
return
(
const
balance
=
V1LiquidityBalances
?.[
V1LiquidityToken
.
address
]
V1LiquidityBalances
?.[
V1LiquidityToken
.
address
]
&&
return
balance
&&
JSBI
.
greaterThan
(
balance
.
raw
,
JSBI
.
BigInt
(
0
))
JSBI
.
greaterThan
(
V1LiquidityBalances
[
V1LiquidityToken
.
address
].
raw
,
JSBI
.
BigInt
(
0
))
)
}).
map
(
V1LiquidityToken
=>
{
}).
map
(
V1LiquidityToken
=>
{
return
(
const
balance
=
V1LiquidityBalances
[
V1LiquidityToken
.
address
]
return
balance
?
(
<
V1PositionCard
<
V1PositionCard
key=
{
V1LiquidityToken
.
address
}
key=
{
V1LiquidityToken
.
address
}
token=
{
V1Exchanges
[
V1LiquidityToken
.
address
]
}
token=
{
V1Exchanges
[
V1LiquidityToken
.
address
]
}
V1LiquidityBalance=
{
V1LiquidityBalances
[
V1LiquidityToken
.
address
]
}
V1LiquidityBalance=
{
balance
}
/>
/>
)
)
:
null
})
})
// should never always be false, because a V1 exhchange exists for WETH on all testnets
// should never always be false, because a V1 exhchange exists for WETH on all testnets
...
...
src/pages/Pool/tsconfig.json
deleted
100644 → 0
View file @
f7a1a2ab
{
"extends"
:
"../../../tsconfig.strict.json"
,
"include"
:
[
"**/*"
]
}
\ No newline at end of file
src/pages/PoolFinder/tsconfig.json
deleted
100644 → 0
View file @
f7a1a2ab
{
"extends"
:
"../../../tsconfig.strict.json"
,
"include"
:
[
"**/*"
]
}
\ No newline at end of file
src/pages/RemoveLiquidity/tsconfig.json
deleted
100644 → 0
View file @
f7a1a2ab
{
"extends"
:
"../../../tsconfig.strict.json"
,
"include"
:
[
"**/*"
,
"../../../node_modules/eslint-plugin-react/lib/types.d.ts"
]
}
\ No newline at end of file
src/pages/Swap/tsconfig.json
deleted
100644 → 0
View file @
f7a1a2ab
{
"extends"
:
"../../../tsconfig.strict.json"
,
"include"
:
[
"**/*"
]
}
\ No newline at end of file
src/state/tsconfig.json
deleted
100644 → 0
View file @
f7a1a2ab
{
"extends"
:
"../../tsconfig.strict.json"
,
"include"
:
[
"**/*"
]
}
\ No newline at end of file
src/theme/tsconfig.json
deleted
100644 → 0
View file @
f7a1a2ab
{
"extends"
:
"../../tsconfig.strict.json"
,
"include"
:
[
"**/*"
]
}
\ No newline at end of file
src/utils/tsconfig.json
deleted
100644 → 0
View file @
f7a1a2ab
{
"extends"
:
"../../tsconfig.strict.json"
,
"include"
:
[
"**/*"
]
}
\ No newline at end of file
tsconfig.json
View file @
85217452
...
@@ -8,11 +8,13 @@
...
@@ -8,11 +8,13 @@
],
],
"allowJs"
:
true
,
"allowJs"
:
true
,
"skipLibCheck"
:
true
,
"skipLibCheck"
:
true
,
"strict"
:
false
,
"forceConsistentCasingInFileNames"
:
true
,
"forceConsistentCasingInFileNames"
:
true
,
"noEmit"
:
true
,
"noEmit"
:
true
,
"esModuleInterop"
:
true
,
"esModuleInterop"
:
true
,
"module"
:
"esnext"
,
"module"
:
"esnext"
,
"strict"
:
true
,
"alwaysStrict"
:
true
,
"strictNullChecks"
:
true
,
"noUnusedLocals"
:
true
,
"noUnusedLocals"
:
true
,
"noFallthroughCasesInSwitch"
:
true
,
"noFallthroughCasesInSwitch"
:
true
,
"noImplicitAny"
:
true
,
"noImplicitAny"
:
true
,
...
...
tsconfig.strict.json
deleted
100644 → 0
View file @
f7a1a2ab
{
"extends"
:
"./tsconfig.json"
,
"compilerOptions"
:
{
"strict"
:
true
,
"alwaysStrict"
:
true
,
"strictNullChecks"
:
true
}
}
\ No newline at end of file
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