Here’s a concise guide to integrating Joey Wallet into your XRPL-based dApp using WalletConnect
Do you have an existing that dapp that already supports WalletConnect? See here for details on how to add Joey Wallet.
Set Up Your Development Environment:
Install Node.js and npm. ◦ Set up a project with a framework like React, NextJS or plain Typescript/Javascript.
In this example, we will be using NextJS and pnpm
Install our joey provider:
pnpminstall@joey-wallet/wc-client
Obtain your Reown Project Identification:
Go to Reown Dashboard and configure your projects details. Once finished, copy your Reown ProjectId.
Configure your Joey provider:
Create a configuration file for your provider.
// File: ./src/app/config.tsimporttype{Config}from'@joey-wallet/wc-client';exportdefault{ // RequiredprojectId:process.env['NEXT_PUBLIC_PROJECT_ID'], // Optional - Add your projects detailsmetadata:{name:'Joey Example Project',description:'A sample project using walletconnect and Joey Wallet.',url:"http://localhost:3000",icons: ['/assets/favicon.ico'],redirect:{universal:"http://localhost:3000",},},}asConfig
View here for a more thorough explanation for all the acceptable configuration parameters for the provider.
Create, import your config file, and include the context provider around your page components:
Handling Wallet Events and Actions:
The first thing to do - connect to WalletConnect using Joey Wallet! See below for an example using the connect action included in the provider:
After the connect button is clicked, the WalletConnect modal will open and ask for the user to sign-in using Joey Wallet. Once the user approves the interaction, the connection will be complete and you can proceed to issuing transaction request.