Commit da79abbc authored by Zoltan Arvai's avatar Zoltan Arvai Committed by GitHub

feat: adds Ledger Connect to non-MetaMask wallet list (#6257)

feat: add Ledger Connect to non-MetaMask wallet list
parent 5ac08e11
...@@ -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])
) )
......
...@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment