Proposal about how to connect DApp with Injected Wallet in Solana

There are several requirements:

  1. sol-wallet-adapter can be used for both web wallet (ex: and injected wallet (chrome extension & App) so that DApp do not need to change any code for web wallet or injected wallet.

  2. Injected wallet should not block the web wallet, so that user can select the wallet preferred. If only match the injected object window.solana exist, the injected wallet will take control even if the user's selection is a web wallet, and will block the web wallet.

Code PR

The mainly change for this PR is to compare:
window.solana.providerUrl.origin === this._providerUrl.origin

window.solana.providerUrl is from the injected wallet.
this._providerUrl is from the DApp fronend.

Only if they are the same, the injected wallet will take control.

Injected Wallet Needs To

Injected wallet does not need to update any code in sol-wallet-adapter.
Injected wallet needs to add below object in their own injected solana object.

For example:
solana.providerUrl = new URL("");

DApp Needs To

  1. Install latest version of sol-wallet-adapter

  2. Add supported wallet to the wallet list and the url value for injected wallet should match the url provided by injected wallet. (Normally the wallets will submit PR to the DApp repo, and DApp just need to approve the PR)

For example:

export const WALLET_PROVIDERS = [
{ name: "", url: "" },
{ name: "", url: "" },
{ name: "", url: "" },
{ name: "", url: "" },