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
bf1f613a
Unverified
Commit
bf1f613a
authored
Aug 17, 2023
by
eddie
Committed by
GitHub
Aug 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: network connector fix and lists fix (#7185)
parent
49f1acb5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
3 deletions
+37
-3
unconnected.test.ts
cypress/e2e/swap/unconnected.test.ts
+27
-0
useEagerlyConnect.ts
src/hooks/useEagerlyConnect.ts
+3
-2
updater.ts
src/state/lists/updater.ts
+7
-1
No files found.
cypress/e2e/swap/unconnected.test.ts
0 → 100644
View file @
bf1f613a
import
{
SwapEventName
}
from
'
@uniswap/analytics-events
'
import
{
USDC_MAINNET
}
from
'
constants/tokens
'
import
{
getTestSelector
}
from
'
../../utils
'
describe
(
'
Swap inputs with no wallet connected
'
,
()
=>
{
it
(
'
can input and load a quote with no wallet connected
'
,
()
=>
{
cy
.
visit
(
`/swap?inputCurrency=ETH&outputCurrency=
${
USDC_MAINNET
.
address
}
`
)
cy
.
get
(
getTestSelector
(
'
web3-status-connected
'
)).
click
()
// click twice, first time to show confirmation, second to confirm
cy
.
get
(
getTestSelector
(
'
wallet-disconnect
'
)).
click
()
cy
.
get
(
getTestSelector
(
'
wallet-disconnect
'
)).
should
(
'
contain
'
,
'
Disconnect
'
)
cy
.
get
(
getTestSelector
(
'
wallet-disconnect
'
)).
click
()
cy
.
get
(
getTestSelector
(
'
close-account-drawer
'
)).
click
()
// Enter amount to swap
cy
.
get
(
'
#swap-currency-output .token-amount-input
'
).
type
(
'
1
'
).
should
(
'
have.value
'
,
'
1
'
)
cy
.
get
(
'
#swap-currency-input .token-amount-input
'
).
should
(
'
not.have.value
'
,
''
)
// Verify logging
cy
.
waitForAmplitudeEvent
(
SwapEventName
.
SWAP_QUOTE_RECEIVED
).
then
((
event
:
any
)
=>
{
cy
.
wrap
(
event
.
event_properties
).
should
(
'
have.property
'
,
'
quote_latency_milliseconds
'
)
cy
.
wrap
(
event
.
event_properties
.
quote_latency_milliseconds
).
should
(
'
be.a
'
,
'
number
'
)
cy
.
wrap
(
event
.
event_properties
.
quote_latency_milliseconds
).
should
(
'
be.gte
'
,
0
)
})
})
})
src/hooks/useEagerlyConnect.ts
View file @
bf1f613a
...
...
@@ -24,12 +24,13 @@ export default function useEagerlyConnect() {
const
rehydrated
=
useAppSelector
((
state
)
=>
state
.
_persist
.
rehydrated
)
useEffect
(()
=>
{
if
(
!
selectedWallet
)
return
try
{
const
selectedConnection
=
getConnection
(
selectedWallet
)
connect
(
gnosisSafeConnection
.
connector
)
connect
(
networkConnection
.
connector
)
if
(
!
selectedWallet
)
return
const
selectedConnection
=
getConnection
(
selectedWallet
)
if
(
selectedConnection
)
{
connect
(
selectedConnection
.
connector
)
}
...
...
src/state/lists/updater.ts
View file @
bf1f613a
import
{
getVersionUpgrade
,
VersionUpgrade
}
from
'
@uniswap/token-lists
'
import
{
useWeb3React
}
from
'
@web3-react/core
'
import
{
DEFAULT_LIST_OF_LISTS
,
UNSUPPORTED_LIST_URLS
}
from
'
constants/lists
'
import
TokenSafetyLookupTable
from
'
constants/tokenSafetyLookup
'
import
useInterval
from
'
lib/hooks/useInterval
'
import
ms
from
'
ms
'
import
{
useCallback
,
useEffect
}
from
'
react
'
import
{
useAppDispatch
}
from
'
state/hooks
'
import
{
useAppDispatch
,
useAppSelector
}
from
'
state/hooks
'
import
{
useAllLists
}
from
'
state/lists/hooks
'
import
{
useFetchListCallback
}
from
'
../../hooks/useFetchListCallback
'
...
...
@@ -19,6 +20,11 @@ export default function Updater(): null {
// get all loaded lists, and the active urls
const
lists
=
useAllLists
()
const
listsState
=
useAppSelector
((
state
)
=>
state
.
lists
)
useEffect
(()
=>
{
TokenSafetyLookupTable
.
update
(
listsState
)
},
[
listsState
])
const
fetchList
=
useFetchListCallback
()
const
fetchAllListsCallback
=
useCallback
(()
=>
{
...
...
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