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
9b0fa8a2
Unverified
Commit
9b0fa8a2
authored
Nov 18, 2021
by
Brendan Weinstein
Committed by
GitHub
Nov 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Enable 3085 requests for coinbase wallet (#2753)
enable 3085 requests for coinbase wallet
parent
82c02687
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
react-app-env.d.ts
src/react-app-env.d.ts
+4
-0
updater.ts
src/state/application/updater.ts
+9
-2
No files found.
src/react-app-env.d.ts
View file @
9b0fa8a2
...
@@ -7,7 +7,11 @@ declare module '@metamask/jazzicon' {
...
@@ -7,7 +7,11 @@ declare module '@metamask/jazzicon' {
declare
module
'
fortmatic
'
declare
module
'
fortmatic
'
interface
Window
{
interface
Window
{
// walletLinkExtension is injected by the Coinbase Wallet extension
walletLinkExtension
?:
any
ethereum
?:
{
ethereum
?:
{
// value that is populated and returns true by the Coinbase Wallet mobile dapp browser
isCoinbaseWallet
?:
true
isMetaMask
?:
true
isMetaMask
?:
true
on
?:
(...
args
:
any
[])
=>
void
on
?:
(...
args
:
any
[])
=>
void
removeListener
?:
(...
args
:
any
[])
=>
void
removeListener
?:
(...
args
:
any
[])
=>
void
...
...
src/state/application/updater.ts
View file @
9b0fa8a2
import
{
InjectedConnector
}
from
'
@web3-react/injected-connector
'
import
{
WalletLinkConnector
}
from
'
@web3-react/walletlink-connector
'
import
useDebounce
from
'
hooks/useDebounce
'
import
useDebounce
from
'
hooks/useDebounce
'
import
useIsWindowVisible
from
'
hooks/useIsWindowVisible
'
import
useIsWindowVisible
from
'
hooks/useIsWindowVisible
'
import
{
useActiveWeb3React
}
from
'
hooks/web3
'
import
{
useActiveWeb3React
}
from
'
hooks/web3
'
...
@@ -23,7 +25,7 @@ function useQueryCacheInvalidator() {
...
@@ -23,7 +25,7 @@ function useQueryCacheInvalidator() {
}
}
export
default
function
Updater
():
null
{
export
default
function
Updater
():
null
{
const
{
account
,
chainId
,
library
}
=
useActiveWeb3React
()
const
{
account
,
chainId
,
library
,
connector
}
=
useActiveWeb3React
()
const
dispatch
=
useAppDispatch
()
const
dispatch
=
useAppDispatch
()
const
windowVisible
=
useIsWindowVisible
()
const
windowVisible
=
useIsWindowVisible
()
...
@@ -78,7 +80,12 @@ export default function Updater(): null {
...
@@ -78,7 +80,12 @@ export default function Updater(): null {
},
[
dispatch
,
debouncedState
.
chainId
])
},
[
dispatch
,
debouncedState
.
chainId
])
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
!
account
||
!
library
?.
provider
?.
request
||
!
library
?.
provider
?.
isMetaMask
)
{
const
isCbWalletDappBrowser
=
window
?.
ethereum
?.
isCoinbaseWallet
const
isWalletlink
=
connector
instanceof
WalletLinkConnector
||
(
connector
instanceof
InjectedConnector
&&
window
.
walletLinkExtension
)
const
isCbWallet
=
isCbWalletDappBrowser
||
isWalletlink
const
isMetamaskOrCbWallet
=
library
?.
provider
?.
isMetaMask
||
isCbWallet
if
(
!
account
||
!
library
?.
provider
?.
request
||
!
isMetamaskOrCbWallet
)
{
return
return
}
}
switchToNetwork
({
library
})
switchToNetwork
({
library
})
...
...
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