Skip to main content

Crate xrpl_macros

Crate xrpl_macros 

Source
Expand description

Procedural-macro entry points for xrpl-wasm-stdlib.

Each macro here is a thin shim that delegates to its module’s expand. Logic, helpers, and unit tests live in the per-macro files.

  • Typed-constant macros (r_address!, hash256!, pubkey!, currency!, blob!): validate at compile time and emit a typed XRPL value. hex_util holds decode helpers shared across these macros.
  • Entry-point macros (#[smart_escrow], #[smart_contract]): wrap user functions in the extern "C" symbols the XRPL host calls. All three stages — parse, validate, codegen — live in entry_point/ and are shared between the two macros so adding a third follows the same pattern.

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.

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 an EscrowFinish transaction invokes the feature.