2.6 KiB
2.6 KiB
WalletConnect React Wallet Example
⚠️ Wallet should only be used as a refference example & for development purposes
🔗 Live wallet app - https://react-wallet-v2.vercel.app
🔗 Live dapp app - https://react-dapp-v2.vercel.app
📚 WalletConnect docs - https://docs.walletconnect.com/2.0
Example wallet implementation using WalletConnect, Ethers, React and TypeScript
Getting started
This example is built atop of NextJS in order to abstract complexity of setting up bundlers, routing etc.. So there are only few steps you need to follow in order to set everything up
- Go to WalletConnect Cloud and obtain a project id
- Add your project details in WalletConnectUtil.ts file.
- [Optional] To use project id as environment variable follow NextJS environment docs
- Install dependencies
yarn install
ornpm install
- Run
yarn dev
ornpm run dev
to start local development
Navigating through this example
- Initial setup and initializations happen in _app.ts file.
- WalletConnect client and ethers wallets are initialized in useInitialization.ts hook
- Subscription and handling of WalletConnect events happens in useWalletConnectEventsManager.ts hook, that oppens related Modal views and passes them all necesary data.
- Modal views are responsible for data display and handling approval or rejection actions.
- Uppon approval or rejection modals pass request data to RequestHandlerUtil.ts that performs all necesary ethers work based on request method and returns formated json rpc result data that can be then used for WallteConnect client responses.