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
da79abbc
Unverified
Commit
da79abbc
authored
Mar 27, 2023
by
Zoltan Arvai
Committed by
GitHub
Mar 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: adds Ledger Connect to non-MetaMask wallet list (#6257)
feat: add Ledger Connect to non-MetaMask wallet list
parent
5ac08e11
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
utils.ts
src/connection/utils.ts
+2
-2
react-app-env.d.ts
src/react-app-env.d.ts
+2
-0
No files found.
src/connection/utils.ts
View file @
da79abbc
...
@@ -3,8 +3,8 @@ export const isInjected = Boolean(window.ethereum)
...
@@ -3,8 +3,8 @@ export const isInjected = Boolean(window.ethereum)
// When using Brave browser, `isMetaMask` is set to true when using the built-in wallet
// When using Brave browser, `isMetaMask` is set to true when using the built-in wallet
// This variable should be true only when using the MetaMask extension
// This variable should be true only when using the MetaMask extension
// https://wallet-docs.brave.com/ethereum/wallet-detection#compatability-with-metamask
// https://wallet-docs.brave.com/ethereum/wallet-detection#compatability-with-metamask
type
NonMetaMaskFlag
=
'
isRabby
'
|
'
isBraveWallet
'
|
'
isTrustWallet
'
type
NonMetaMaskFlag
=
'
isRabby
'
|
'
isBraveWallet
'
|
'
isTrustWallet
'
|
'
isLedgerConnect
'
const
allNonMetamaskFlags
:
NonMetaMaskFlag
[]
=
[
'
isRabby
'
,
'
isBraveWallet
'
,
'
isTrustWallet
'
]
const
allNonMetamaskFlags
:
NonMetaMaskFlag
[]
=
[
'
isRabby
'
,
'
isBraveWallet
'
,
'
isTrustWallet
'
,
'
isLedgerConnect
'
]
export
const
isMetaMaskWallet
=
Boolean
(
export
const
isMetaMaskWallet
=
Boolean
(
window
.
ethereum
?.
isMetaMask
&&
!
allNonMetamaskFlags
.
some
((
flag
)
=>
window
.
ethereum
?.[
flag
])
window
.
ethereum
?.
isMetaMask
&&
!
allNonMetamaskFlags
.
some
((
flag
)
=>
window
.
ethereum
?.[
flag
])
)
)
...
...
src/react-app-env.d.ts
View file @
da79abbc
...
@@ -20,6 +20,8 @@ interface Window {
...
@@ -20,6 +20,8 @@ interface Window {
isRabby
?:
true
isRabby
?:
true
// set by the Trust Wallet browser extension
// set by the Trust Wallet browser extension
isTrustWallet
?:
true
isTrustWallet
?:
true
// set by the Ledger Extension Web 3 browser extension
isLedgerConnect
?:
true
autoRefreshOnNetworkChange
?:
boolean
autoRefreshOnNetworkChange
?:
boolean
}
}
web3
?:
Record
<
string
,
unknown
>
web3
?:
Record
<
string
,
unknown
>
...
...
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