feat(DAR-104): scaffold darvest-thirdweb-wallet-service
Context
Implementation of the new microservice darvest-thirdweb-wallet-service (port 3015).
This service listens to the kyc.approved event on Kafka and automatically creates a Polygon blockchain wallet via ThirdWeb Engine for each approved investor.
Changes
Kafka Pipeline
-
Consumer: topic
kyc.approved, consumer groupthirdweb-wallet-cg -
Error handling:
DefaultErrorHandlerwithFixedBackOff(1s × 3)+ Dead Letter Topickyc.approved.thirdweb.DLT -
Producer: publishes
thirdweb.wallet.createdwith{userId, polygonAddress, createdAt, chainId}
ThirdWeb Engine Integration
-
ThirdwebEngineClientcallsPOST /backend-wallet/createviaRestClient - Mock mode enabled in
localprofile (thirdweb.engine.mock-enabled=true)
Idempotency
-
WalletProvisionRecord(JPA) withUNIQUE(user_id)constraint - Duplicate call for the same
userId→ returns the existing address without calling ThirdWeb again
REST API (Admin)
-
POST /api/thirdweb/wallets— manual provisioning -
GET /api/thirdweb/wallets/{userId}— retrieve wallet address
Local Infrastructure
-
docker-compose.yml: PostgreSQL (5435) + Kafka (9093) -
Dockerfile:eclipse-temurin:21-jre-alpineimage -
.env.example: all variables documented
Tests
-
ThirdwebWalletServiceTest: happy path, idempotency, wallet not found, wallet already exists
Ticket Link
- Closes DAR-104