Open ppeinsold opened 4 years ago
@bsclifton why do you label that as "feature". It is clearly a bug imo. We also tested it with a lot of dapps and it breaks every single one of them.
@ppeinsold The label is for internal use to triage the issues relating to Crypto Wallets. I have added the appropriate labels
I am stumbling about this now. I found that Brave has a setting under Settings/Extensions called "Web3 provider for using Dapps". By default, it is set to "Ask":
When set like this, I cannot detect window.web3
or window.ethereum
on any page. Only when set to the "Crypto Wallets" setting, these global objects become available.
My question is now: How do I "Ask" Brave for these APIs on a per-website basis?
Was the bug resolved, Could somebody please guide me the link if an API exists to connect to crypto wallet
Description
In javascript there is no "window.ethereum" or "window.web3" available if only crypto wallets is enabled and metamask is not installed. Do you maybe inject a different variable? As long as the MetaMask extension is installed the window.ethereum property is existing and otherwise not. I've also checked if the native wallet of Brave and its API is documented somewhere but I sadly couldn't find any documentation about it.
Steps to Reproduce
Let me add a little bit of a code example. The following code is to connect to web3 browser using web3js library:
Actual result:
This works fine for all browsers but in brave it crashes when "crypto wallets" is enabled. The problem here is, that a check is missing. On the line where I have " console.error("Unable to connect to metamask");" I need to detect "crypto wallets" because I end up here if only "crypto wallets" is installed and metamask is not. Does anyone know how to make this check?
Expected result:
We can detect built-in "crypto wallets"-extension of brave browser with an injected variable.
Reproduces how often:
Easily reproduced
Brave version (brave://version info)
newest brave version