Skip to content

[AT]: Support a flexible Data enum for audit trail record payloads #224

@itsyaasir

Description

@itsyaasir

Feature description

Introduce a flexible Data payload type for audit trails so one trail can store both text and binary record data.

The intended model is to support an enum-like payload shape equivalent to:

enum Data has store + copy + drop {
    Bytes(vector<u8>),
    Text(String),
}

This would allow using AuditTrail<Data> as the default flexible trail shape, while still leaving room for custom payload types where needed.

Motivation

Today an audit trail is generic over one fixed data type. Once a trail is created as AuditTrail<String> or AuditTrail<vector<u8>>, that choice is permanent for all records in that trail.

That makes the trail schema rigid for users who want a mix of text and binary records. The discussed conclusion was that a flexible Data enum would provide a better default experience for Rust and TS users while preserving the generic model for custom Move payload types.

Requirements

  1. Introduce a Move payload type equivalent to Data { Bytes(vector<u8>), Text(String) }.
  2. Allow AuditTrail<Data> to be used as the flexible/default trail payload type.
  3. Preserve support for custom generic payload types, e.g. AuditTrail<MyCustomDataType>.
  4. Expose the same flexible Data model consistently in Rust and TS.
  5. Keep record add/read APIs aligned across Move, Rust, and TS.

Open questions

Should AuditTrail<Data> become the primary/default path in the SDKs while still allowing advanced users to opt into custom generic payload types?

Are you planning to do it yourself in a pull request?

Yes

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Product Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions