A NestJS server that provides wallet score validation using merkle proofs.
- Validates wallet scores using merkle proofs
- Integrates with external API to fetch wallet data
- Uses OpenZeppelin's merkle-tree library for secure validation
- Production-ready error handling and logging
- Input validation using class-validator
npm installEnsure the following environment variables are set:
- PRIVATE_KEY_ATTESTER: (string) The private key for attestation.
# Development
npm run start:dev
# Production
npm run build
npm run start:prodValidates wallet scores using merkle proofs. Returns:
{
"data": boolean,
"error": boolean,
"message": string | null
}- Returns
trueif at least 2 out of 3 wallets are successfully validated. - Returns
falseotherwise.
- proofOfTask: (string) The proof of task to validate wallets against.
- walletAddresses: (array of strings) The list of wallet addresses to validate.
curl -X POST http://localhost:4002/task/validate -H 'Content-Type: application/json' -d '{"proofOfTask": "0xabcdef"}'The application includes comprehensive error handling for:
- External API failures.
- Invalid wallet data received from the external API.
- Invalid merkle proofs.
- Invalid input data.
- Server errors.
Logging is implemented using NestJS's built-in Logger, providing detailed information about:
- API requests
- Validation results
- Error details
- Debug information in development