Skip to content

Simple JavaScript and Python scripts to interact with the XRP Ledger (XRPL), enabling wallet generation, trustline approval, Escrow, MPT, transactions, AMM interactions... πŸ”§

Notifications You must be signed in to change notification settings

RippleDevRel/xrpl-js-python-simple-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

XRPL Scripts - JavaScript & Python πŸš€

This repository contains scripts in both JavaScript and Python to interact with the XRP Ledger (XRPL). These scripts allow testing functionalities such as wallet generation, trustline approval, transactions, and Automated Market Maker (AMM) operations.

Devnet - Testnet - Mainnet

The XRP Ledger operates on three distinct network environments, each serving different purposes in the development and deployment lifecycle.

Devnet functions as a sandbox environment where new amendments and features are tested in their pre-release state, allowing developers to experiment with upcoming functionality before it reaches production.

Mainnet (livenet) is the live production network where real XRP transactions occur and hold actual monetary value.

Testnet serves as a replica of Mainnet, mirroring its current state and configuration - when an amendment is activated on Mainnet, it is subsequently enabled on Testnet to maintain consistency between the two environments.

This tiered approach ensures thorough testing and validation of new features while providing developers with appropriate environments for different stages of application development.

πŸ“ Project Structure

The scripts are divided into two main folders:

  • js/ β†’ Contains JavaScript scripts for XRPL interactions.
  • python/ β†’ Contains Python scripts for XRPL interactions.

JavaScript Scripts (js/)

  • generate.js β†’ Generates a new XRPL wallet (address & seed) πŸ”‘
  • generate_and_trustline.js β†’ Generates a wallet and establishes a trustline 🀝
  • trustline.js β†’ Creates a trustline for the RLUSD token πŸ”„
  • xrp_transaction.js β†’ Handles XRP transactions πŸ’Έ
  • rlusd_transaction.js β†’ Manages RLUSD token transactions πŸ’°
  • amm_create_RLUSD_XRP.js β†’ Creates an AMM pool for RLUSD/XRP pair 🏦
  • amm_deposit_RLUSD_XRP.js β†’ Deposits assets into an existing AMM pool πŸ“₯
  • escrow.js β†’ Create a condition and time based escrow πŸ”’.

Python Scripts (python/)

  • generate.py β†’ Generates a new XRPL wallet (address & seed) πŸ”‘
  • generate_and_trustline.py β†’ Generates a wallet and establishes a trustline 🀝
  • trustline.py β†’ Creates a trustline for the RLUSD token πŸ”„
  • xrp_transaction.py β†’ Handles XRP transactions πŸ’Έ
  • rlusd_transaction.py β†’ Manages RLUSD token transactions πŸ’°
  • amm_create_RLUSD_XRP.py β†’ Creates an AMM pool for RLUSD/XRP pair 🏦
  • amm_deposit_RLUSD_XRP.py β†’ Deposits assets into an existing AMM pool πŸ“₯
  • escrow.py β†’ Create a condition and time based escrow πŸ”’

New amendments (devnet/)

Within this folder you will find scripts to interact with new amendments that are only live on DevNet and not on Testnet/Mainnet. You can find the list of amendments currently live on DevNet here: https://devnet.xrpl.org/amendments.
Important note: An amendment may be live on DevNet but not yet supported by one of the XRPL libraries (Python/JS). Please check the library documentation or release notes for compatibility before using these scripts.

  • mpt.js β†’ Issue and interact with MPTs
  • batch.js β†’ Test the new batch transaction amendment
  • tokenEscrow.js β†’ Use MPT with Escrow instead of XRP
  • credential.js -> Demonstrates On-Chain Credentials functionality

πŸ”§ Installation & Setup

JavaScript

  1. Clone this repo and navigate to the js/ folder.
  2. Run npm install to install dependencies.

Python

  1. Navigate to the python/ folder.
  2. Install required packages:
pip install -r requirements.txt

or:

# Create a virtual env
python3 -m venv myenv

# Activate env
source myenv/bin/activate  # On macOS/Linux
# myenv\Scripts\activate  # On Windows

# Install xrpl-py in the virtual env
pip install xrpl-py```

⚠️ Important Notes

  • All scripts are designed for the XRPL Testnet / Devnet.
  • Keep your wallet seed secure and never share it.
  • Ensure you have sufficient XRP for fees and reserves.
  • RLUSD operations require an established trustline first.

πŸ”— Useful Links

About

Simple JavaScript and Python scripts to interact with the XRP Ledger (XRPL), enabling wallet generation, trustline approval, Escrow, MPT, transactions, AMM interactions... πŸ”§

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •