Skip to content

fix(payments): define and export createQuote and executePayment request schemas - #277

Merged
David-patrick-chuks-02 merged 2 commits into
Lilly-Protocol:mainfrom
s6pa1rta3n-lab:fix-issue-257
Sep 6, 2026
Merged

fix(payments): define and export createQuote and executePayment request schemas#277
David-patrick-chuks-02 merged 2 commits into
Lilly-Protocol:mainfrom
s6pa1rta3n-lab:fix-issue-257

Conversation

@s6pa1rta3n-lab

Copy link
Copy Markdown
Contributor

Summary

Resolves #257 by defining and exporting createQuoteSchema and executePaymentSchema in src/modules/payments/payments.schema.ts as expected by src/modules/payments/payments.routes.ts.

Changes

  • stellarAssetCodeSchema: Enforces 1-12 alphanumeric characters (e.g., XLM, USDC), strictly rejecting whitespace, punctuation, hyphens, and emojis.
  • stellarAddressSchema & isValidStellarAddress: Enforces 56-character Ed25519 Stellar public key format using @stellar/stellar-sdk's StrKey.isValidEd25519PublicKey.
  • stellarAssetOrAddressSchema: Supports either a standard Stellar asset code or a 56-character account address.
  • positiveDecimalSchema: Trims input, validates positive decimal representation, and normalizes leading zeros via normalizeAmount.
  • createQuoteSchema: Validates sourceAsset, destinationAsset, and positive normalized sourceAmount, with optional destination properties.
  • executePaymentSchema: Validates quoteId as non-empty string and confirmed as boolean flag.
  • quoteSchema: Backwards-compatible schema supporting both legacy and route structures.
  • Unit & Route Tests: Extended tests/payments.schema.test.ts to test all schemas, edge cases, and HTTP route responses with VALIDATION_ERROR envelopes.

Payout Routing

  • EVM (Base/Arbitrum/Polygon/ETH): 0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89
  • Stellar: GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC

…st schemas

- Add stellarAssetCodeSchema for 1-12 alphanumeric asset codes
- Add stellarAddressSchema and isValidStellarAddress helper using StrKey
- Add stellarAssetOrAddressSchema to support asset codes or 56-char account addresses
- Add positiveDecimalSchema with normalizeAmount transform and positive validation
- Define and export createQuoteSchema and executePaymentSchema for route validation
- Update quoteSchema to preserve compatibility with existing unit tests
- Add comprehensive unit and route validation tests for all schemas and endpoints

Closes Lilly-Protocol#257
@David-patrick-chuks-02
David-patrick-chuks-02 marked this pull request as ready for review September 6, 2026 08:21
@David-patrick-chuks-02
David-patrick-chuks-02 merged commit 4335dd5 into Lilly-Protocol:main Sep 6, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bounty: $45] Define and export the createQuote and executePayment request schemas

3 participants