Skip to content

Backend: Persist wallet alias mappings for cross-service identity resolution #859

Description

@Junirezz

Context

walletAliasService.ts resolves wallet identity links across aliases and sources. referralService.ts already depends on canonical wallet resolution via this service.

Problem / Gap

Alias mappings are stored only in memory. Restarts wipe alias registrations, breaking referral attribution and any admin workflows that rely on persisted identity links.

Proposed approach

  • Add Prisma tables for canonical wallet IDs, alias rows, and source metadata.
  • Implement upsert/merge semantics matching current in-memory behavior.
  • Seed service from DB on startup; keep in-memory cache for hot reads.
  • Add admin endpoints to list and delete alias groups if not already exposed.

Acceptance criteria

  • Registered aliases survive restart and resolve to the same canonical ID.
  • Merge behavior when the same alias maps to different canonical IDs matches current tests.
  • Referral flows continue to resolve wallets via persisted aliases.
  • Migration path documented for environments with existing in-memory-only data.

Files/areas affected

  • backend/src/walletAliasService.ts
  • backend/src/walletAliasEndpoints.ts
  • backend/src/referralService.ts
  • backend/prisma/schema.prisma

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions