Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window.ethereum.isMetaMask is true for Brave Wallet #19772

Closed
garmeeh opened this issue Nov 26, 2021 · 3 comments
Closed

window.ethereum.isMetaMask is true for Brave Wallet #19772

garmeeh opened this issue Nov 26, 2021 · 3 comments
Labels
closed/wontfix OS/Desktop priority/P3 The next thing for us to work on. It'll ride the trains.

Comments

@garmeeh
Copy link

garmeeh commented Nov 26, 2021

Description

Currently trying to identify if user is using Brave Wallet or MetaMask so that we let them know which one is connected.

At the moment this is not possible due to this returning true:

window.ethereum.isMetaMask

Steps to Reproduce

  1. Open website, say google.com for example
  2. Open console
  3. Paste: window.ethereum.isMetaMask
  4. Result is true, I would expect this to be false

I do not have MetaMask installed.

Actual result:

image

Brave version (brave://version info)



Brave | 1.32.113 Chromium: 96.0.4664.45 (Official Build) (x86_64)
-- | --
Revision | 76e4c1bb2ab4671b8beba3444e61c0f17584b2fc-refs/branch-heads/4664@{#947}
OS | macOS Version 12.0.1 (Build 21A559)
JavaScript | V8 9.6.180.12
User agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36
Command Line | /Applications/Brave Browser.app/Contents/MacOS/Brave Browser --disable-client-side-phishing-detection --disable-domain-reliability --enable-dom-distiller --no-pings --component-updater=url-source=https://go-updater.brave.com/extensions --origin-trial-public-key=bYUKPJoPnCxeNvu72j4EmPuK7tr1PAC7SHh8ld9Mw3E=,fMS4mpO6buLQ/QMd+zJmxzty/VQ6B1EUZqoCU04zoRU= --sync-url=https://sync-v2.brave.com/v2 --lso-url=https://no-thanks.invalid --variations-server-url=https://variations.brave.com/seed --enable-features=LegacyTLSEnforced,WebUIDarkMode,SafetyTip,AutoupgradeMixedContent,PrefetchPrivacyChanges,PasswordImport,ReducedReferrerGranularity --disable-features=AppDiscoveryRemoteUrlSearch,AutofillEnableAccountWalletStorage,InterestCohortAPIOriginTrial,Fledge,FirstPartySets,SpeculationRulesPrefetchProxy,Prerender2,ConversionMeasurement,InterestGroupStorage,TrustTokens,DirectSockets,TabGroupsFeedback,AutofillServerCommunication,WebSQLInThirdPartyContextEnabled,Parakeet,InterestCohortFeaturePolicy,ReportAllJavaScriptFrameworks,IdleDetection,ComputePressure,AdInterestGroupAPI,CopyLinkToText,NetworkTimeServiceQuerying,SubresourceWebBundles,NotificationTriggers,WebOTP,SignedExchangeSubresourcePrefetch,NavigatorPluginsFixed,LiveCaption,FederatedLearningOfCohorts,HandwritingRecognitionWebPlatformApiFinch,FlocIdComputedEventLogging,TextFragmentAnchor,ReadLater --flag-switches-begin --flag-switches-end
Executable Path | /Applications/Brave Browser.app/Contents/MacOS/Brave Browser
Profile Path | /Users/garymeehan/Library/Application Support/BraveSoftware/Brave-Browser/Default
Linker | lld
Variations | AdRewardsStudy:NextPaymentDayAdServingStudy:MaximumAdNotificationsPerDay=100/MaximumInlineContentAdsPerHour=8/MaximumInlineContentAdsPerDay=40BraveAds.FrequencyCappingStudy:ExcludeAdIfWithinTimeWindow=0hBraveAds.UserActivityStudy:Triggers=EMPTY/Threshold=0.0/IdleTimeThreshold=5BraveTalkStudy:EnabledConversionsStudy:NewDefaultPatternDefault1pBlockingStudy:DisabledEphemeralStorageStudy:EnabledMacCoreLocationBackendStudy:EnabledNativeCosmeticFilteringStudy:EnabledPartitionConnectionsByNetworkIsolationKeyStudy:DefaultPermissionLifetimeReleaseStudy:EnabledRequestAdsEnabledApiStudy:EnabledSpeedreaderReleaseStudy:Enabled


Version/Channel Information:

  • Can you reproduce this issue with the current release? YES
  • Can you reproduce this issue with the beta channel?
  • Can you reproduce this issue with the nightly channel?

Other Additional Information:

  • Does the issue resolve itself when disabling Brave Shields?
  • Does the issue resolve itself when disabling Brave Rewards?
  • Is the issue reproducible on the latest version of Chrome? N/A

Miscellaneous Information:

@bbondy
Copy link
Member

bbondy commented Nov 26, 2021

This is expected since we aim to be fully compatible with MetaMask. Please use feature checking instead of checking for the wallet for best results.

@garmeeh
Copy link
Author

garmeeh commented Nov 26, 2021

Thanks @bbondy. The goal I would like to achieve is to show the user whether they are connected to Brave Wallet or MetaMask in the UI? So use your branding so that they know they are connected to the right wallet rather than enable/disable features.

I am assuming this will not be possible from just feature checking alone?

@bbondy
Copy link
Member

bbondy commented Nov 26, 2021

I see, thanks.
I'd recommend to use web3_clientVersion which I haven't seen a Dapp gate functionality on. Note that the Brave value there will be changing when this lands #19278 but you can test against the MetaMask return value to see if it's MetaMask.

@bbondy bbondy added the priority/P3 The next thing for us to work on. It'll ride the trains. label Dec 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed/wontfix OS/Desktop priority/P3 The next thing for us to work on. It'll ride the trains.
Projects
None yet
Development

No branches or pull requests

2 participants