Skip to content

feat: build username resolver API endpoint #397

@ryzen-xp

Description

@ryzen-xp

📝 Description

Implement the most important user-facing API endpoint: resolving a username hash to its linked addresses. This endpoint powers the core use case of sending crypto to @username. It checks the database cache first and falls back to a live contract call.

✅ Requirements

  • Create ResolverModule, ResolverController, ResolverService
  • Implement GET /resolve/:usernameHash endpoint
  • Service checks Username entity cache first; on miss calls resolve_stellar on core contract
  • Response includes stellarAddress, chainAddresses (EVM, Bitcoin, Solana, Cosmos if set), owner, registeredAt
  • Implement GET /resolve/:usernameHash/stellar for Stellar-only fast resolution
  • Add NotFoundException with clear message when username hash not found on-chain
  • Add UsernameHashDto with @IsString() and length validation using class-validator
  • Write unit tests for service cache-hit and cache-miss paths

🎯 Acceptance Criteria

  • GET /resolve/:usernameHash returns correct address data
  • Cache-hit path does not call the contract
  • Cache-miss path calls contract and saves result to database
  • 404 returned for unknown username hash
  • Input validated with class-validator
  • Unit tests cover both cache paths and not-found case

📁 Expected files to change/structure

  • backend/src/resolver/resolver.module.ts
  • backend/src/resolver/resolver.controller.ts
  • backend/src/resolver/resolver.service.ts
  • backend/src/resolver/dto/resolve-username.dto.ts
  • backend/src/resolver/resolver.service.spec.ts

Commit: feat: build username resolver API endpoint
Branch: feat/backend-resolver-api | Priority: HIGH | Difficulty: one-coffee

Metadata

Metadata

Assignees

Labels

stellar waveThis issue listed on Drip stellar wave contest

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions