This project provides a rapid development template for building applications on the XRP Ledger (XRPL) using the Crossmark Browser Wallet and React. Designed as a quickstart solution, it's particularly useful for hackathons, prototypes, and developers looking to jumpstart their XRPL projects.
- Wallet Connection: Easily connect to the Crossmark Browser Wallet.
- Account Information Display: View your current XRPL address and network details.
- Network Auto-update: Automatically checks and updates network information every 5 seconds.
- Interactions:
- Get User Session
- Sign Transactions
- Submit Transactions
- WalletContext: Access user's address throughout your app after wallet sign-in.
To get started with this project, follow these steps:
-
Clone the repository:
git clone https://github.com/maximedgr/xrpl-quickstart-react-crossmark -
Navigate to the project directory:
cd xrpl-crossmark-react-template -
Install the dependencies:
npm installor if you're using yarn:
yarn install -
Start the development server:
npm startor with yarn:
yarn start -
Open your browser and visit
http://localhost:3000to view the application.
- Click on the "Connect Wallet" button to connect your Crossmark Browser Wallet. If the wallet is not installed, it will prompt the user to install it, redirecting them to the Chrome Web Store and once installed, the wallet will be connected.
- Once connected, you'll see your account information and network details.
- Use the interaction buttons to perform various actions on the XRPL.
- Access the Crossmark SDK documentation for more detailed information on available features.
This template uses React's Context API to provide easy access to the user's wallet address throughout the application after sign-in. Here's how to use it in your components:
import { useWallet } from './path/to/WalletContext';
const MyComponent = () => {
const { address } = useWallet();
return <div>Your XRPL address: {address}</div>;
};
The WalletContext provides:
address: The user's XRPL address after successful sign-in.setAddress: A function to update the address (typically used internally by the WalletConnect component).
- React
- TypeScript
- Crossmark Browser Wallet SDK
Contributions are welcome! Please feel free to submit a Pull Request.
Based on a template from Crossmark. You can find other templates on Crossmark's GitHub for Next, Vue and Angular.