miden-note-schema 0.1.0

Host-side reader and codec registry for Miden note storage schemas
Documentation
// Mirror note: the wit-crate file is canonical; sdk/note-schema/wit/note-codec.wit exists because
// Wasmtime bindgen!(path:) needs package-local WIT, and an equality test guards both files.
package miden:note-codec@1.0.0;

/// Parses, displays, and validates custom note storage types.
interface codec {
    /// A canonical Miden field element at the component boundary.
    ///
    /// This is a `u64`, not the core-types `felt` record, because that record models the
    /// compiler's guest felt value and does not expose its canonical integer representation.
    type felt = u64;

    /// Returns the fully-qualified WIT names handled by this component.
    supported-types: func() -> list<string>;

    /// Parses text into a type's structural felt representation.
    parse: func(type-fqn: string, value: string) -> result<list<felt>, string>;

    /// Displays a type's structural felt representation.
    display: func(type-fqn: string, value: list<felt>) -> result<string, string>;

    /// Validates a type's structural felt representation.
    validate: func(type-fqn: string, value: list<felt>) -> result<_, string>;
}

world note-codec {
    export codec;
}