Skip to content

Implement query validation and response schema for SEP-24 deposit and withdraw routes #279

Description

@Cjay-Cyber-2

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

  • SEP-24 deposit and withdrawal endpoints validate query parameters against Zod spec schemas.
  • Invalid asset_code or mismatched memo/memo_type combinations return descriptive HTTP 400 errors.
  • Valid request parameters generate correct anchor interactive URL parameters.
  • Unit tests cover parameter validation for valid and malformed requests.

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programcomplexity: mediumDrips Wave — moderate scope, some designdrips-waveTracked in a Drips Wave programenhancementNew feature or requestsep-24

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions