📝 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
📁 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
📝 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
ResolverModule,ResolverController,ResolverServiceGET /resolve/:usernameHashendpointUsernameentity cache first; on miss callsresolve_stellaron core contractstellarAddress,chainAddresses(EVM, Bitcoin, Solana, Cosmos if set),owner,registeredAtGET /resolve/:usernameHash/stellarfor Stellar-only fast resolutionNotFoundExceptionwith clear message when username hash not found on-chainUsernameHashDtowith@IsString()and length validation usingclass-validator🎯 Acceptance Criteria
GET /resolve/:usernameHashreturns correct address dataclass-validator📁 Expected files to change/structure
backend/src/resolver/resolver.module.tsbackend/src/resolver/resolver.controller.tsbackend/src/resolver/resolver.service.tsbackend/src/resolver/dto/resolve-username.dto.tsbackend/src/resolver/resolver.service.spec.ts