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:
- Adding
#[serde(tag = "LedgerEntryType")] to the enum and removing ledger_entry_type from CommonFields (breaking change across all ledger objects), or
- Writing a custom deserializer for the enum.
The
ledger_entryresult currently typesnodeasOption<serde_json::Value>to accept any ledger object type. This was changed from a hardcodedAccountRoot-shaped struct that caused deserialization failures for non-AccountRootentries.To improve type safety,
nodeshould be restricted to only accept valid ledger entry types, using the existingLedgerEntryenum frommodels::ledger::objects.Blockers:
The
LedgerEntryenum usesserde's default externally-tagged representation({"AccountRoot": {...}}), but the XRPL wire format is a flat object with an internalLedgerEntryTypediscriminator. Switching requires either:#[serde(tag = "LedgerEntryType")]to the enum and removingledger_entry_typefromCommonFields(breaking change across all ledger objects), or