Getting started

1. Connect to MetaMask and get the provider

Before you can install and interact with the XRP Ledger Snap, you need to connect your DApp to MetaMask and retrieve the provider object.

Steps:

  1. Install MetaMask: Ensure that the MetaMask extension is installed in your browser. You can download it here.

  2. Connect to MetaMask:

    • In your DApp, prompt the user to connect their MetaMask wallet. This will give you access to the Ethereum provider, which is required to interact with Snaps.

  1. Verify that your provider has snaps support

Example:

Full code from the site in the MetaMask Snap monorepo

*If you are using typescript, you might want to install the package: @metamask/providers

2. Install the XRP Ledger Snap

Once you have connected to MetaMask and obtained the provider, you can proceed to install the XRP Ledger Snap. To install the XRP Ledger Snap call the wallet_requestSnaps method with the npm package of the XRP Ledger Snap: npm:@peersyst/xrpl-snap.

3. Interact with the XRP Ledger Snap

Once the XRP Ledger Snap is installed, you can interact with the XRP Ledger directly from your DApp.

After installation, use the XRP Ledger Snap's API to interact with the XRP Ledger. Below is an example of how to fetch the balance of the connected account.

To know more about the API of the Snap visit the API reference page

API Reference

Last updated