-
Notifications
You must be signed in to change notification settings - Fork 93
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
Injected Interface Design #12
Comments
Some thoughts about this:
|
Good point. I have added Solution 3 to address this. |
Solution 3 is better, but all inject wallets need to follow the rules:
|
I've updated #11 so the provider object can be passed directly to the constructor, so it works with any of the solutions above. Dapp code can use |
Been trying to use solflare extension wallet and receive error saying "provider parameter must be an injected provider or a URL string" when doing new Wallet(window.solflare). any hints on whats causing the issue? phantom and sollet work without issues, for coin98 wallet had to build a wrapper for it to work |
We need an injected interface design so dapps can interact with browser extension wallets (MathWallet, eDeFi, etc.)
Goals:
Ethereum dapps rely on a single injection point (
window.ethereum
) for wallet interaction. All wallet extensions (MetaMask, ezDeFi, etc.) must compete for the chance to get injected since there's only 1 extension is active at a time. This is very simple for dapp to use but dapp also doesn't know which wallet is used (for display).Solution 1: single interface - single wallet (same with Ethereum with extra info)
window.solana
for all wallet extensions. The name of the wallet can be queried inwindow.solana.name
andwindow.solana.desc
, but they're optional for both dapp and wallets.window.solana.name
or justinjected
.Solution 2: single interface - multiple wallets
window.solana[walletname]
, and dapps can use any of the wallets in the array they preferred, using the same interface as the currentwindow.solana
. Or just select the first one if they don't care.Solution 3: single dispatcher - multiple wallets
window.solana
is injected to be a dispatcher, so it can be used just likewindow.ethereum
window.solana.wallet[name]
is injected by each extensions.window.solana.selectWallet(name)
tells the dispatcher to redirect all requests towindow.solana.wallets[name]
. If none is set, the first wallet will be used.window.solana.getWallets()
returns all injected wallets.Please discuss.
Related PRs: #11 #8
The text was updated successfully, but these errors were encountered: