Skip to content

[REFACTOR] Enforce transfer event invariants in schema and API typing #1795

@purplesmoke05

Description

@purplesmoke05

Background

Transfer history endpoints still rely on nullable ORM fields and runtime guards for relationships between source_event, message, and data. The current implementation works, but the real invariants are only implied in comments and router-side checks instead of being encoded in the schema and typing.

Description

Promote the existing transfer event rules into explicit database and ORM guarantees. That includes required identifiers used by the response, valid source_event and message combinations, and a stricter shape for transfer.data when an event requires structured payload data. Once the schema is aligned, remove the router guards that only exist to compensate for weak typing.

Scope

  • Review transfer.transaction_hash, token_address, from_address, to_address, value, and created nullability in the history response path.
  • Add schema constraints or validation for valid source_event and message combinations.
  • Define the expected JSON shape for transfer.data where applicable.
  • Update IDXTransfer typing and transfer history response builders.
  • Add or update tests for normal transfer, unlock, force unlock, and force-change-locked-account events.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions