Skip to main content

xrpl_common_stdlib/types/
contract_data.rs

1//! `ContractData` — the value type of an escrow's `Data` field.
2//!
3//! An escrow's contract data is a plain fixed-max byte buffer, structurally identical to a
4//! [`StandardBlob`] (`Blob<DEFAULT_BLOB_SIZE>`). It is therefore defined as a transparent alias
5//! rather than a distinct struct: existing `ContractData` references stay valid, and because the
6//! generic ledger-object getters decode any `Blob<N>`, the `Data` field can be read through the
7//! generated `EscrowFields::data()` getter like any other field. The escrow-only *write*
8//! (`set_data`) still lives in `xrpl-escrow-stdlib`.
9
10use crate::types::blob::{DEFAULT_BLOB_SIZE, StandardBlob};
11
12/// Maximum size, in bytes, of an escrow's contract data. Tied to [`DEFAULT_BLOB_SIZE`] so it can
13/// never drift from the [`StandardBlob`] buffer that backs [`ContractData`].
14pub const XRPL_CONTRACT_DATA_SIZE: usize = DEFAULT_BLOB_SIZE;
15
16/// A fixed-max byte buffer holding an escrow's `Data` field. Alias for [`StandardBlob`].
17pub type ContractData = StandardBlob;