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
f349ecdd
Unverified
Commit
f349ecdd
authored
Aug 15, 2022
by
Vignesh Mohankumar
Committed by
GitHub
Aug 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: remove selectedWalletBackfilled (#4283)
* remove selectedWalletBackfilled * FIX
parent
57fb481d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
24 deletions
+8
-24
e2e.ts
cypress/support/e2e.ts
+1
-0
useEagerlyConnect.ts
src/hooks/useEagerlyConnect.ts
+1
-8
useOrderedConnections.ts
src/hooks/useOrderedConnections.ts
+6
-2
constants.ts
src/state/connection/constants.ts
+0
-7
reducer.ts
src/state/user/reducer.ts
+0
-7
No files found.
cypress/support/e2e.ts
View file @
f349ecdd
...
...
@@ -35,6 +35,7 @@ Cypress.Commands.overwrite(
onBeforeLoad
(
win
)
{
options
?.
onBeforeLoad
?.(
win
)
win
.
localStorage
.
clear
()
win
.
localStorage
.
setItem
(
'
redux_localstorage_simple_user
'
,
'
{"selectedWallet":"INJECTED"}
'
)
win
.
ethereum
=
injected
},
})
...
...
src/hooks/useEagerlyConnect.ts
View file @
f349ecdd
...
...
@@ -2,7 +2,6 @@ import { Connector } from '@web3-react/types'
import
{
gnosisSafeConnection
,
networkConnection
}
from
'
connection
'
import
{
getConnection
}
from
'
connection/utils
'
import
{
useEffect
}
from
'
react
'
import
{
BACKFILLABLE_WALLETS
}
from
'
state/connection/constants
'
import
{
useAppSelector
}
from
'
state/hooks
'
async
function
connect
(
connector
:
Connector
)
{
...
...
@@ -18,7 +17,6 @@ async function connect(connector: Connector) {
}
export
default
function
useEagerlyConnect
()
{
const
selectedWalletBackfilled
=
useAppSelector
((
state
)
=>
state
.
user
.
selectedWalletBackfilled
)
const
selectedWallet
=
useAppSelector
((
state
)
=>
state
.
user
.
selectedWallet
)
useEffect
(()
=>
{
...
...
@@ -27,11 +25,6 @@ export default function useEagerlyConnect() {
if
(
selectedWallet
)
{
connect
(
getConnection
(
selectedWallet
).
connector
)
}
else
if
(
!
selectedWalletBackfilled
)
{
BACKFILLABLE_WALLETS
.
map
(
getConnection
)
.
map
((
connection
)
=>
connection
.
connector
)
.
forEach
(
connect
)
}
// The dependency list is empty so this is only run once on mount
}
// The dependency list is empty so this is only run once on mount
},
[])
// eslint-disable-line react-hooks/exhaustive-deps
}
src/hooks/useOrderedConnections.ts
View file @
f349ecdd
import
{
ConnectionType
}
from
'
connection
'
import
{
getConnection
}
from
'
connection/utils
'
import
{
useMemo
}
from
'
react
'
import
{
BACKFILLABLE_WALLETS
}
from
'
state/connection/constants
'
import
{
useAppSelector
}
from
'
state/hooks
'
const
SELECTABLE_WALLETS
=
[...
BACKFILLABLE_WALLETS
,
ConnectionType
.
FORTMATIC
]
const
SELECTABLE_WALLETS
=
[
ConnectionType
.
INJECTED
,
ConnectionType
.
COINBASE_WALLET
,
ConnectionType
.
WALLET_CONNECT
,
ConnectionType
.
FORTMATIC
,
]
export
default
function
useOrderedConnections
()
{
const
selectedWallet
=
useAppSelector
((
state
)
=>
state
.
user
.
selectedWallet
)
...
...
src/state/connection/constants.ts
deleted
100644 → 0
View file @
57fb481d
import
{
ConnectionType
}
from
'
connection
'
export
const
BACKFILLABLE_WALLETS
=
[
ConnectionType
.
INJECTED
,
ConnectionType
.
COINBASE_WALLET
,
ConnectionType
.
WALLET_CONNECT
,
]
src/state/user/reducer.ts
View file @
f349ecdd
...
...
@@ -9,11 +9,6 @@ import { SerializedPair, SerializedToken } from './types'
const
currentTimestamp
=
()
=>
new
Date
().
getTime
()
export
interface
UserState
{
// We want the user to be able to define which wallet they want to use, even if there are multiple connected wallets via web3-react.
// If a user had previously connected a wallet but didn't have a wallet override set (because they connected prior to this field being added),
// we want to handle that case by backfilling them manually. Once we backfill, we set the backfilled field to `true`.
// After some period of time, our active users will have this property set so we can likely remove the backfilling logic.
selectedWalletBackfilled
:
boolean
selectedWallet
?:
ConnectionType
// the timestamp of the last updateVersion action
...
...
@@ -66,7 +61,6 @@ function pairKey(token0Address: string, token1Address: string) {
export
const
initialState
:
UserState
=
{
selectedWallet
:
undefined
,
selectedWalletBackfilled
:
false
,
matchesDarkMode
:
false
,
userDarkMode
:
null
,
userExpertMode
:
false
,
...
...
@@ -90,7 +84,6 @@ const userSlice = createSlice({
reducers
:
{
updateSelectedWallet
(
state
,
{
payload
:
{
wallet
}
})
{
state
.
selectedWallet
=
wallet
state
.
selectedWalletBackfilled
=
true
},
updateUserDarkMode
(
state
,
action
)
{
state
.
userDarkMode
=
action
.
payload
.
userDarkMode
...
...
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