Skip to content

Implement transaction draft versioning, diffing, and rollback #518

Description

@Just-Bamford

Description

Problem

Transaction drafts can be persisted, but there is no robust version history or mechanism for determining what changed between saved states.

Users working on complex transactions may accidentally overwrite a valid draft and have no way to inspect or restore a previous version.

Solution

Extend transaction draft persistence with immutable version snapshots.

Every meaningful draft update should create a version containing the transaction builder state and metadata. Provide comparison utilities capable of identifying added, removed, and modified operations.

Add rollback functionality that restores a previous version as a new current version rather than destroying history.

Acceptance Criteria

  • Draft versions are stored independently.
  • Each version receives a deterministic identifier or sequence number.
  • revertDraft(name, version) restores a previous version.
  • Reverting creates a new version instead of deleting history.
  • compareDraftVersions(name, from, to) returns structured differences.
  • Operation additions, removals, and modifications are detected.
  • Version retention is configurable.
  • Corrupted versions fail validation before restoration.
  • Tests cover creation, comparison, rollback, retention, and corrupted state.
  • Exported through src/transaction/index.ts and src/index.ts.

Note for Contributors

Preserve backward compatibility with the existing draft persistence API. Draft history should not silently mutate older versions.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend / SDK logicenhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions