-
Notifications
You must be signed in to change notification settings - Fork 158
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
Ethereum wallets selector. #1106
Conversation
f028e03
to
34608cd
Compare
* Improve transfer type design * Format JSON better * Add text highlight * Add spinner * Add explorer link * Clean up
From a UX perspective, did you consider avoiding the modal on top of modal approach by adding the ETH wallet flow directly in the ETH wallet tab on the main modal? |
examples/angular/src/app/pages/wallet-selector/wallet-selector.component.ts
Outdated
Show resolved
Hide resolved
Yea that was the idea initially with MetaMask-only support but this approach seemed to provide most benefits and reliability. I'm considering that dApps will be multi-chain and web3Modal manages the selected network which we use with |
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.
LGTM
If any error happens, disconnect the Ethereum wallet to let the user connect again from the beginning.
Auto connect to ethereum-wallets without showing the NEAR modal.
Log in with Ethereum flow expects the Ethereum wallet to be disconnected if the NEAR selector is disconnected.
* feat: Confirm action and allow retry. * Styling * Clean up * Edit buttons * chore: Rename. --------- Co-authored-by: santerisarle <santeri.sarle@gmail.com>
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.
Please address merge conflicts. Thanks!
@paouvrard Sorry for jumping in, but I'd like to invite you to participate in the Race of Sloths - a fun and gamified open-source contributions program. Consider mentioning @race-of-sloths user in your github comment or PR description to join! See how the flow works here: near/nearcore#11778 |
* feat: Chain switch modal. * Add styling * Rows to cols --------- Co-authored-by: santerisarle <santeri.sarle@gmail.com>
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.
Thanks for addressing merge conflicts!
Description
This is the Ethereum Wallets package for NEAR Wallet Selector.
The package adds support for Ethereum wallets by creating Ethereum-compatible transactions from NEAR transaction inputs.
Ethereum wallet support NEP: near/NEPs#518
Because NEAR Protocol does not yet support the new 0x accounts natively, the eth-wallet.testnet namespace is used during development before the protocol upgrade.
Any Ethereum wallet can be connected via Web3Modal: the dApp provides the web3Modal connection and can chose which wallets to support. A multichain dApp can switch networks using the same wallet connection.
Apps can use the w3m-button and provide a "Log in with Ethereum" flow to automatically connect the ethereum-wallets package without needing to go through the NEAR modal.
This module is usable without Web3Modal but only connects to the default injected wallet (Metamask browser extension, embedded browser wallets...).
SignIn requires switching to NEAR Protocol network to ensure that the wallet is compatible, if the user switches to other networks he will be prompted to switch back to NEAR before making a transaction.
Sign out prompts to remove the FunctionCall access key if there is one, this action is non blocking and the user can sign out without executing the transaction.
A NEAR dApp can connect to multiple Ethereum wallet addresses. If the user switches to a new address from the Ethereum wallet, the NEAR wallet will be disconnected so that it can reconnect with the signIn flow. If the dApp doesn't require a FunctionCall access key or the Ethereum wallet address already signed in, then the address connects automatically when changed.
NEP-518 doesn't support multiple actions within the same transaction, so when multiple actions are requested, they are split into separate transactions and executed 1 by 1.
NEP-518 rpc relayer uses a FunctionCall access key to execute transactions on behalf of the user by calling
rlp_execute
. If this key is not yet added, the wallet will be onboarded before the first transaction is made.signMessage
andverifyOwner
are not implemented because Ethereum wallets are not compatible with these standards, instead a dApp can useeth_sign
oreth_signTypedData_v4
to authenticate the wallet by interacting with it directly.Dependency updates:
wallet-connect
package to test it but I don't expect the minor version change to break it. Happy to test it if you can recommend a wallet.ALERT: As of Angular 16, "ngcc" is no longer required and not invoked during CLI builds. You are seeing this message because the current operation invoked the "ngcc" command directly. This "ngcc" invocation can be safely removed.
)Testing:
An alpha release of this package is available to use on NEAR testnet dapps:
Previews:
Rainbow bridge: https://rainbow-bridge-next-testnet-git-ethereum-wallets-auroraisnear.vercel.app
Ref Finance: https://web3-wallet-three.vercel.app
Installation:
yarn add @aurora-is-near/ethereum-wallets
Usage:
Playground: https://near-wallet-playground.testnet.aurora.dev
This ethereum-wallets package does the onboarding of the relayer automatically, but the playground is also useful for un-onboarding of the relayer and adding NEP-141 tokens to MetaMask using their equivalent 0x address.
Checklist: