Description
SEP-24 interactive deposit and withdrawal endpoints require strict query parameter verification to ensure anchor integrations receive fully compliant parameters (such as asset_code, account, memo, memo_type, and wallet_name). We need to solidify input schema validation and normalize response structures for SEP-24 routes.
Context & Requirements
Anchor deposit/withdraw flows are handled in src/routes/sep24.ts. Currently, some input parameters lack rigorous schema validation before processing, which can lead to unhandled errors when interacting with external SEP-24 anchor services.
Requirements:
- Define comprehensive Zod schemas for
/deposit and /withdraw interactive endpoints adhering to the Stellar SEP-24 spec.
- Validate that
asset_code matches supported Stellar assets configured in the backend.
- Enforce correct combination validation for
memo and memo_type (e.g. memo_type must be one of text, id, hash if memo is supplied).
- Return standard structured JSON error responses (HTTP 400) for missing or invalid parameters.
Acceptance Criteria
Implementation Guidance
- Define schema validators in
src/schemas/sep24.ts (or within src/routes/sep24.ts).
- Apply Fastify schema validation options directly to route declarations in
src/routes/sep24.ts.
- Cross-check SEP-24 standard specification for field requirements and error codes.
Testing & Validation
- Add test cases in
tests/routes/sep24.test.ts covering invalid assets, malformed memos, and missing mandatory parameters.
- Run integration tests with
npm run test:integration or unit tests with npm test.
Submission Guidelines
- PR body must state "Closes #".
- Request assignment on the issue before starting implementation.
- Follow standard project naming conventions and code style.
Wave complexity: Medium
Description
SEP-24 interactive deposit and withdrawal endpoints require strict query parameter verification to ensure anchor integrations receive fully compliant parameters (such as
asset_code,account,memo,memo_type, andwallet_name). We need to solidify input schema validation and normalize response structures for SEP-24 routes.Context & Requirements
Anchor deposit/withdraw flows are handled in
src/routes/sep24.ts. Currently, some input parameters lack rigorous schema validation before processing, which can lead to unhandled errors when interacting with external SEP-24 anchor services.Requirements:
/depositand/withdrawinteractive endpoints adhering to the Stellar SEP-24 spec.asset_codematches supported Stellar assets configured in the backend.memoandmemo_type(e.g.memo_typemust be one oftext,id,hashifmemois supplied).Acceptance Criteria
asset_codeor mismatchedmemo/memo_typecombinations return descriptive HTTP 400 errors.Implementation Guidance
src/schemas/sep24.ts(or withinsrc/routes/sep24.ts).src/routes/sep24.ts.Testing & Validation
tests/routes/sep24.test.tscovering invalid assets, malformed memos, and missing mandatory parameters.npm run test:integrationor unit tests withnpm test.Submission Guidelines
Wave complexity: Medium