Skip to content

sephynox/xrpl-rust

Repository files navigation

xrpl-rust Downloads

latest deps_status audit_status unit_status

Warning

This repository is under active development. All releases before v1.0.0 can be considered as beta-releases

A Rust library to interact with the XRPL. Based off of the xrpl-py library.

A pure Rust implementation for interacting with the XRP Ledger. The xrpl-rust crate simplifies the hardest parts of XRP Ledger interaction including serialization and transaction signing while providing idiomatic Rust functionality for XRP Ledger transactions and core server API (rippled) objects.

Interactions with this crate occur using data structures from this crate or core alloc types with the exception of serde for JSON handling and indexmap for dictionaries. The goal is to ensure this library can be used on devices without the ability to use a std environment.

WIP - Help Welcome

🛠 Installation rustc

To install, add the following to your project's Cargo.toml:

[dependencies.xrpl]
version = "0.5.0"

🕮 Documentation docs_status

Documentation is available here.

⛮ Quickstart

TODO - Most core functionality is in place and working.

In Progress:

  • no_std examples
  • Benchmarks

⚐ Flags

By default, the following features are enabled:

  • std
  • core
  • models
  • wallet
  • utils
  • websocket
  • json-rpc
  • helpers
  • tokio-rt

When helpers is enabled you also need to specify a *-rt feature flag as it is needed for waiting between requests when using the submit_and_wait function.

To operate in a #![no_std] environment simply disable the defaults and enable features manually:

[dependencies.xrpl]
version = "*"
default-features = false
features = ["core", "models", "wallet", "utils", "websocket", "json-rpc", "helpers", "embassy-rt"]

⚙ #![no_std]

This library aims to be #![no_std] compliant.

Command Line Interface

The XRPL Rust library provides a powerful CLI tool for interacting with the XRP Ledger directly from your terminal. This makes it easy to perform common XRPL operations without writing code.

Installation

To install the CLI tool, you can add the cli feature to your dependencies:

[dependencies.xrpl]
version = "0.5.0"
features = ["cli"]

Or install it directly using Cargo:

cargo install xrpl-rust --features=cli

Basic Usage

After installation, you can use the CLI with the xrpl command:

xrpl [COMMAND] [OPTIONS]

For help with available commands:

xrpl --help

For help with a specific command:

xrpl [COMMAND] --help

Available Commands

The CLI offers commands in several categories:

Wallet Commands

Command Subcommand Description
wallet generate Generate a new XRPL wallet
wallet from-seed Create a wallet from an existing seed
wallet faucet Generate a wallet funded by the testnet faucet
wallet validate Validate an XRPL address (classic or X-address)

Account Commands

Command Subcommand Description
account info Get basic account information
account tx Get account transactions
account objects Get account objects (trust lines, offers, etc.)
account channels Get account payment channels
account currencies Get currencies an account can send/receive
account lines Get account trust lines

Transaction Commands

Command Subcommand Description
transaction sign Sign a transaction using your seed
transaction submit Submit a signed transaction to the network

Server and Ledger Commands

Command Subcommand Description
server fee Get the current network fee
server info Get information about a rippled server
ledger data Get data about a specific ledger
server subscribe Subscribe to ledger events via WebSocket

Command Details

Wallet Operations

wallet generate

Generate a new XRPL wallet (keypair).

# Generate a new wallet
xrpl wallet generate

# Generate and save wallet (functionality not yet implemented)
xrpl wallet generate --save

wallet from-seed

Derive a wallet from an existing seed.

xrpl wallet from-seed --seed s123... [--sequence 0]

Parameters:

  • --seed: The seed to use (required)
  • --sequence: The key sequence number (default: 0)

wallet faucet

Generate a new wallet and fund it using the testnet faucet.

xrpl wallet faucet [--url https://s.altnet.rippletest.net:51234]

Parameters:

wallet validate

Validate an XRPL address (works with both classic and X-addresses).

xrpl wallet validate --address rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh

Parameters:

  • --address: The address to validate (required)

Account Information

account info

Get basic account information.

xrpl account info --address rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh [--url https://xrplcluster.com/]

Parameters:

account tx

Get account transactions.

xrpl account tx --address rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh [--limit 10] [--url https://xrplcluster.com/]

Parameters:

  • --address: The account address (required)
  • --limit: Maximum number of transactions to return (default: 10)
  • --url: The XRPL node URL (default: https://xrplcluster.com/)

account objects

Get account objects (trust lines, offers, etc.)

xrpl account objects --address rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh [--type-filter offer] [--limit 10] [--url https://xrplcluster.com/]

Parameters:

  • --address: The account address (required)
  • --type-filter: Type of objects to return (e.g., "offer", "state")
  • --limit: Maximum number of objects to return (default: 10)
  • --url: The XRPL node URL (default: https://xrplcluster.com/)

account channels

Get information about an account's payment channels.

xrpl account channels --address rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh [--destination-account rDestination...] [--limit 10] [--url https://xrplcluster.com/]

Parameters:

  • --address: The account address (required)
  • --destination-account: Filter channels by destination account
  • --limit: Maximum number of channels to return (default: 10)
  • --url: The XRPL node URL (default: https://xrplcluster.com/)

account currencies

Get a list of currencies that an account can send or receive.

xrpl account currencies --address rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh [--url https://xrplcluster.com/]

Parameters:

account lines

Get information about an account's trust lines.

xrpl account lines --address rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh [--peer rPeer...] [--limit 10] [--url https://xrplcluster.com/]

Parameters:

  • --address: The account address (required)
  • --peer: Filter trust lines by peer account
  • --limit: Maximum number of trust lines to return (default: 10)
  • --url: The XRPL node URL (default: https://xrplcluster.com/)

account set-flag

Set an account flag.

xrpl account set-flag --seed s... --flag asfRequireAuth [--url https://xrplcluster.com/]

Parameters:

  • --seed, -s (required): The seed to use for signing
  • --flag, -f (required): The flag to set (e.g., asfRequireAuth, asfDisableMaster, etc.)
  • --url, -u (optional, default: https://xrplcluster.com/): The XRPL node URL

Example Output:

Signed transaction blob: ...
To submit, use: xrpl transaction submit --tx-blob ... --url ...

account clear-flag

Clear an account flag.

xrpl account clear-flag --seed s... --flag asfRequireAuth [--url https://xrplcluster.com/]

Parameters:

  • --seed, -s (required): The seed to use for signing
  • --flag, -f (required): The flag to clear (e.g., asfRequireAuth, asfDisableMaster, etc.)
  • --url, -u (optional, default: https://xrplcluster.com/): The XRPL node URL

Example Output:

Signed transaction blob: ...
To submit, use: xrpl transaction submit --tx-blob ... --url ...

About

A 100% Rust library to interact with the XRPL. XRPL Grant Winner

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages