How to integrate Ethereum Wallets to Near DApps?
In this article we will describe how to add EVM wallets support to your Near app, which is already uses the Near Wallet Selector.
To integrate Metamask and other EVM wallets you will need to:
- Update the
Wallet Selector
and add the Web3Modal libraries (wagmi
,web3wallet
,@near-wallet-selector/ethereum-wallets
) - Create configurations so the Ethereum wallets can communicate with our Near RPCs
- Create a Web3Modal and connect it to the Near Wallet Selector
- Initialize the Ethereum Wallets
We will show how we added Ethereum Wallets support to our Hello Near Examples. Let's go step-by-step with it!
AuroraLabs team has worked on this feature almost for a year now. You can learn more about it from NEP-518.
This article was created by the AuroraLabs team, and appeared originally in the official Aurora documentation
1. Update Wallet Selector libraries
Lets start by updating the package.json
, adding all the necessary libraries to support Ethereum wallets.
Wallet Selector Packages
In your package.json
, add the @near-wallet-selector/ethereum-wallets
package, and update all wallet selector packages to version 8.9.13
or above:
"dependencies": {
...
"@near-wallet-selector/core": "^8.9.13",
"@near-wallet-selector/ethereum-wallets": "^8.9.13",
"@near-wallet-selector/here-wallet": "^8.9.13",
"@near-wallet-selector/modal-ui": "^8.9.13",
"@near-wallet-selector/my-near-wallet": "^8.9.13",
...
}