xrpl-std 0.5.0-devnet5

Standard library for XRPL WebAssembly smart contracts
Documentation
  • Coverage
  • 22.46%
    157 out of 699 items documented15 out of 222 items with examples
  • Size
  • Source code size: 257.87 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 23.21 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • intelliot

xrpl-std

Standard library for XRPL WebAssembly smart contracts.

This crate provides the core functionality needed to develop smart contracts for the XRP Ledger, including:

  • Host function bindings for interacting with the XRPL
  • Type definitions for XRPL objects and transactions
  • No-std compatible implementation for WASM environments

Usage

Add this to your Cargo.toml:

[dependencies]
xrpl-std = "0.5.0-devnet5"

Example

#![no_std]
use xrpl_std::core::current_tx::escrow_finish;
use xrpl_std::core::current_tx::traits::TransactionCommonFields;

#[no_mangle]
pub extern "C" fn finish() -> i32 {
    // Get the current escrow finish transaction
    let escrow_finish = escrow_finish::get_current_escrow_finish();
    
    // Access transaction fields
    let account = match escrow_finish.get_account() {
        Ok(v) => v,
        Err(_) => return 0,  // Keep escrow locked on error
    };
    
    // Make escrow release decision based on account
    if account.0 == b"rAuthorizedAccount..." {
        1  // Release escrow
    } else {
        0  // Keep escrow locked
    }
}

Features

  • No-std compatible: Designed for WebAssembly environments
  • Type-safe API: Strongly typed interfaces for XRPL objects
  • Host function access: Direct bindings to XRPL validator functions
  • Memory safety: Built-in panic handler and allocation management

Documentation

For more information about developing XRPL smart contracts, see the craft repository.

License

This project is licensed under the ISC License.