Split out default wallet prefs for Ethereum and Solana
See original GitHub issueDescription
If you set the Brave wallet as the default cryptocurrency wallet in v1.41.96 and have another Solana wallet extension such as the Phantom wallet installed, you can’t connect to dApps with the 3rd party wallet, even if you didn’t create any Solana account in the Brave wallet.
Steps to Reproduce
- Install the latest Brave browser (v1.41.96) on macOS (not tested on Windows or Linux, but I suspect it would be the same result)
- Set up the Brave wallet without creating a Solana wallet
- Set the
Default Cryptocurrency Wallet
toBrave Wallet
at brave://settings/wallet - Install a 3rd party Solana wallet extension (tested with the Phantom wallet)
- Import or set up a Solana wallet in the Phantom wallet
- Try to connect to any dApp (tested with magiceden.io, solsea.io and others) with your Phantom wallet
Actual result:
After trying to connect to a dApp with a 3rd party Solana Wallet (e.g. Phantom Wallet) nothing happens and the connection failed. In the console of the Dev Tools there is an error message:
Uncaught TypeError: Cannot redefine property: solana
Expected result:
The dApp should easily connect to the 3rd party Solana wallet extension even with the Brave Wallet as default wallet, if no Solana wallet was created in the Brave wallet.
Reproduces how often:
Easily reproduced
Brave version (brave://version info)
Brave: 1.41.96 Chromium: 103.0.5060.114 (Official Build) (x86_64) Revision: a1c2360c5b02a6d4d6ab33796ad8a268a6128226-refs/branch-heads/5060@{#1124} OS: macOS Version 12.4 (Build 21F79)
Version/Channel Information:
- Can you reproduce this issue with the current release? YES
- Can you reproduce this issue with the beta channel? UNTESTED
- Can you reproduce this issue with the nightly channel? UNTESTED
I didn’t have any problems before the 1.41.96 release.
Other Additional Information:
- Does the issue resolve itself when disabling Brave Shields? NO
- Does the issue resolve itself when disabling Brave Rewards? UNTESTED
- Is the issue reproducible on the latest version of Chrome? NO
The issue is only applicable if a Brave wallet is present. I couldn’t reproduce the issue with the Phantom extension in a private window, where the Brave wallet isn’t enabled. On other browsers such as Chrome the issue doesn’t appear.
Explanation:
It seems that the Solana part of the Brave wallet interferes with 3rd party Solana wallet extensions. Even if no Solana wallet has been created within the Brave wallet the window.solana
object will be written before any other Solana wallets.
There is a temporary solution: The user can always set the Default cryptocurrency wallet
to Brave Wallet (Prefer extensions)
at brave://settings/wallet. This fixes it for now.
But many users would update the Brave browser without knowing that something has changed and would get this issue instantly. They wouldn’t think of changing this setting.
Possible Solution:
With the default wallet set to Brave Wallet
, but no Solana wallet created, the window.solana
object shouldn’t be written as well. So 3rd party Solana wallets would work as expected until the user creates or imports a Solana wallet within the Brave wallet.
Maybe you should also warn the user if changes like that wouldn’t work with current setting after an update.
Issue Analytics
- State:
- Created a year ago
- Comments:9 (3 by maintainers)
Top GitHub Comments
“Default Ethereum/EVM wallet” “Default Solana wallet”
That’s not the way defaults work 😉 unless you mean we should break into more granular defaults like: