Expand description
§xrpl-wasm-stdlib Library
The XRPL Standard Library provides safe, type-safe access to XRPL host functions for WebAssembly smart contract development. This no_std library offers zero-cost abstractions over raw host function calls and handles memory management, error handling, and type conversions.
§Quick Start
There is an interface available at https://ripple.github.io/xrpl-wasm-stdlib/ui/ for local or Devnet testing.
§Examples Overview
- hello_world - Basic escrow with logging
- oracle - Price-based release using oracle data
- kyc - Credential-based verification
- notary - Multi-signature authorization
- nft_owner - NFT ownership verification
- ledger_sqn - Sequence-based release
§Documentation
| Section | Description |
|---|---|
| Complete Developer Guide | Comprehensive guide with working internal links |
| Rust API Docs | Generated API documentation (cargo doc) |
The complete developer guide includes:
- Getting Started - Installation, first contract, core concepts
- API Reference - Complete API documentation and usage patterns
- Examples - Smart escrow examples and tutorials
- Development Guide - Building, testing, and CI setup
§Key Features
- Type-safe access to transaction and ledger data
- Memory-safe operations with no heap allocations
- Deterministic execution across all nodes/validators
- Zero-cost abstractions over host functions
- Comprehensive error handling with custom
Resulttypes
§Safety and Constraints
Smart escrows run in a constrained WebAssembly environment:
- Read-only ledger access (except escrow data updates)
- Deterministic execution required
- Resource limits enforced
- No network/file system access
§Contributing
See CONTRIBUTING.md for detailed guidelines on:
- Development setup and workflow
- Code standards and style guidelines
- Pull request process
- Testing requirements
- Release procedures
We welcome contributions of all kinds!
Modules§
- core
- Core modules for XRPL transaction and ledger access.
- ctx
- Smart Feature context primitives shared by all entry points.
- fields
- Field decoding traits and helpers shared across XRPL field types.
- guide
- Complete Developer Guide
- host
- Host bindings and utilities exposed to WASM smart contracts.
- sfield
- types
Macros§
- blob
- Converts a hex string to a compile-time [
Blob<N>]. - currency
- Converts an XRPL currency code to a 20-byte [
Currency] at compile time. - hash256
- Converts a 64-character hex string to a 32-byte [
Hash256] (UInt<32>) at compile time. - pubkey
- Converts a 66-character hex string to a 33-byte [
PublicKey] at compile time. - r_
address - Converts an XRPL classic address (r-address) to a 20-byte [
AccountID] at compile time.
Functions§
- decode_
hex_ 20 - Decode a 40-hex-character string into a 20-byte array.
- decode_
hex_ 32 - Decode a 64-hex-character string into a 32-byte array.
Attribute Macros§
- smart_
contract - Wraps a Smart Contract entry function in the appropriate
extern "C"export. - smart_
escrow - Wraps a Smart Escrow finish function in the
extern "C" fn finish()entry point the XRPL host calls when anEscrowFinishtransaction invokes the feature.