Skip to content

Build an Address Type Detection and Validation Endpoint #216

@codeZe-us

Description

@codeZe-us

Build the /api/validate endpoint that uses stellar-address-kit package to detect address type (G, M, C), validate the address, and return structured feedback including whether memo fields should be disabled.

Contribution Guide

  • PRs go to the dev branch, not main
  • Application must explain your specific approach to this task ; generic applications will not be assigned
  • PR description must clearly describe what you built and changed
  • Link your PR to the correct issue number (e.g. Closes #12)

Implementation Guidelines
Key files: examples/ts-backend/exchange-withdrawal-validator/src/server.ts

  • POST /api/validate accepts { address: string, memoType?: string, memoValue?: string }.
  • Use detect(), validate(), and parse() from stellar-address-kit.
  • M-address: return { valid: true, addressKind: "muxed", muxedId: "...", memoDisabled: true, reason: "Muxed addresses carry their own routing ID" }.
  • C-address: return { valid: false, addressKind: "contract", error: "Contract addresses cannot receive direct exchange withdrawals" }.
  • G-address: return { valid: true, addressKind: "classic", memoDisabled: false }.
  • Invalid address: return { valid: false, error: "Invalid Stellar address" }.

Expectations
What done looks like: Each address type returns the correct structured response. Invalid addresses are rejected cleanly.

Discord for questions: codeze_us

Metadata

Metadata

Assignees

Labels

No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions