-
Notifications
You must be signed in to change notification settings - Fork 115
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
feat: virtual wallet support + Metamask integration #227
Conversation
- Integrate virtual wallets with enable
The URL : https://s3.eu-central-1.amazonaws.com/dev.snaps.consensys.io/get-starknet/remoteEntry.js is developed base on current master/main branch of get-starknet hence it will not work to the get-starknet:develop branch |
@stanleyyconsensys |
# Conflicts: # packages/core/package.json # packages/core/src/main.ts # packages/core/src/wallet/filter.ts # pnpm-lock.yaml
// Notify event listeners and other parts of the dapp that a provider is requested. | ||
if (typeof windowObject.dispatchEvent === "function") { | ||
windowObject.dispatchEvent(new Event("eip6963:requestProvider")) | ||
} | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one could be added once for all providers over main.ts, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This standard is designed for ethereum wallet detection so I am not sure it's interesting for other providers on Starknet. This basically depends on how multi wallet discovery is handled currently on starknet but adopting the EIP6963 standard could maybe be an option ?
windowObject.addEventListener( | ||
"eip6963:announceProvider", | ||
handleEIP6963Provider, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one could be registered once for all providers, right?
Virtual wallet is a wallet instance that has no implementation, which will be loaded upon calling to
enable
method.Virtual wallet include two important methods:
hasSupport()
- async, return true whether this wallet is supportedloadWallet()
- async, download and return the actual wallet instanceWallet vendors that requires additional code will be supported in get-starknet via virtual wallet.
For example, in Metamask integration,
hasSupport()
returns true if MetaMask extension exists and if there is a snap support. In such case, MetaMask will be an option for the available wallets. Once the user will choose Metamask and will enable it, the actual wallet implementation will be downloaded and return to the user.