currency!() { /* proc-macro */ }Expand description
Converts an XRPL currency code to a 20-byte [Currency] at compile time.
Two forms are accepted:
- Standard (3 ASCII alphanumeric chars) — stored verbatim in bytes 12–14;
bytes 0–11 and 15–19 are zero.
"XRP"is reserved and rejected. Standard codes are case-sensitive ("USD"and"usd"are distinct on-ledger identifiers); use uppercase by convention. - Non-standard (40 hex chars) — interpreted as a raw 20-byte value. Must
not start with
00(that would alias the standard-code format).
§Example
ⓘ
use xrpl_wasm_stdlib::currency;
use xrpl_wasm_stdlib::core::types::currency::Currency;
const USD: Currency = currency!("USD");
const CUSTOM: Currency = currency!("0158415500000000C1F76FF6ECB0BAC600000000");