Expand description
§Transaction Field Access Traits
This module defines traits for accessing fields from XRPL transactions in a type-safe manner. It provides a structured interface for retrieving both common transaction fields (shared across all transaction types) and transaction-specific fields (unique to particular transaction types).
§Overview
XRPL transactions contain a variety of fields, some mandatory and others optional. This module organizes field access into logical groups:
- Common Fields: Fields present in all XRPL transactions (Account, Fee, Sequence, etc.)
- Transaction-Specific Fields: Fields unique to specific transaction types
§Design Philosophy
The trait-based design provides several benefits:
- Type Safety: Each field is accessed through methods with appropriate return types
- Composability: Transaction types can implement multiple traits as needed
- Zero-Cost Abstraction: Trait methods compile down to direct host function calls
- Extensibility: New transaction types can easily implement the relevant traits
§Field Categories
§Mandatory vs. Optional Fields
- Mandatory fields return
Result<T>and will error if missing - Optional fields return
Result<Option<T>>and returnNoneif missing
§Field Types
- AccountID: 20-byte account identifiers
- Hash256: 256-bit cryptographic hashes
- Amount: XRP amounts (with future support for tokens)
- u32: 32-bit unsigned integers for sequence numbers, flags, etc.
- Blob: Variable-length binary data
- PublicKey: 33-byte compressed public keys
- TransactionType: Enumerated transaction type identifiers
Traits§
- Escrow
Finish Fields - Trait providing access to fields specific to EscrowFinish transactions.
- Transaction
Common Fields - Trait providing access to common fields present in all XRPL transactions.