Skip to main content

stringify_deterministic

Function stringify_deterministic 

Source
pub fn stringify_deterministic(
    value: &AppDataDoc,
) -> Result<String, AppDataError>
Expand description

Serializes an app-data document as RFC 8785 canonical JSON via serde_jcs::to_string.

The output applies UTF-16 code-unit key ordering, decimal-only number serialisation, and the canonical insignificant-whitespace rules specified by RFC 8785 (JSON Canonicalization Scheme). ASCII-only documents serialise byte-identically to the previous bytewise key ordering; documents whose object keys carry characters whose UTF-16 representation diverges from their UTF-8 byte ordering now match the canonical RFC 8785 form, closing a latent gap with the upstream @cowprotocol/cow-sdk TypeScript implementation.

ยงErrors

Returns AppDataError::Serialization if the canonicalisation pass fails.