Skip to content

Type ledger_entry response node field using ledger object models instead of serde_json::Value #308

Description

@pdp2121

The ledger_entry result currently types node as Option<serde_json::Value> to accept any ledger object type. This was changed from a hardcoded AccountRoot-shaped struct that caused deserialization failures for non-AccountRoot entries.

To improve type safety, node should be restricted to only accept valid ledger entry types, using the existing LedgerEntry enum from models::ledger::objects.

Blockers:

The LedgerEntry enum uses serde's default externally-tagged representation ({"AccountRoot": {...}}), but the XRPL wire format is a flat object with an internal LedgerEntryType discriminator. Switching requires either:

  1. Adding #[serde(tag = "LedgerEntryType")] to the enum and removing ledger_entry_type from CommonFields (breaking change across all ledger objects), or
  2. Writing a custom deserializer for the enum.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions