Skip to content
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

Merged
merged 14 commits into from
Jun 26, 2024

Conversation

naorye
Copy link
Contributor

@naorye naorye commented Apr 8, 2024

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:

  1. hasSupport() - async, return true whether this wallet is supported
  2. loadWallet() - async, download and return the actual wallet instance
    Wallet 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.

@naorye naorye changed the base branch from master to develop April 8, 2024 14:11
@stanleyyconsensys
Copy link

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

@naorye2
Copy link
Contributor

naorye2 commented Apr 9, 2024

@stanleyyconsensys
Let me know which url to use.

@naorye2 naorye2 requested review from dan-ziv and avimak April 9, 2024 11:35
@naorye2 naorye2 requested a review from dan-ziv June 26, 2024 13:49
@dan-ziv dan-ziv changed the title Virtual wallet support + Metamask integration feat: virtual wallet support + Metamask integration Jun 26, 2024
@dan-ziv dan-ziv merged commit 078dcb4 into starknet-io:develop Jun 26, 2024
1 check passed
Comment on lines +47 to +51
// 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"))
}
})
Copy link
Collaborator

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?

Copy link
Contributor

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 ?

Comment on lines +35 to +38
windowObject.addEventListener(
"eip6963:announceProvider",
handleEIP6963Provider,
)
Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants