Skip to content

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 group thirdweb-wallet-cg
  • Error handling: DefaultErrorHandler with FixedBackOff(1s × 3) + Dead Letter Topic kyc.approved.thirdweb.DLT
  • Producer: publishes thirdweb.wallet.created with {userId, polygonAddress, createdAt, chainId}

ThirdWeb Engine Integration

  • ThirdwebEngineClient calls POST /backend-wallet/create via RestClient
  • Mock mode enabled in local profile (thirdweb.engine.mock-enabled=true)

Idempotency

  • WalletProvisionRecord (JPA) with UNIQUE(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-alpine image
  • .env.example: all variables documented

Tests

  • ThirdwebWalletServiceTest: happy path, idempotency, wallet not found, wallet already exists

Ticket Link

Rapports de requête de fusion