Skip to content

feat(sep6): add SEP-6 withdrawal endpoint with fee calculation#477

Merged
Ceejaytech25 merged 1 commit into
ceejaylaboratory:mainfrom
Damola09:feat/sep6-withdrawal-374
May 29, 2026
Merged

feat(sep6): add SEP-6 withdrawal endpoint with fee calculation#477
Ceejaytech25 merged 1 commit into
ceejaylaboratory:mainfrom
Damola09:feat/sep6-withdrawal-374

Conversation

@Damola09
Copy link
Copy Markdown
Contributor

Summary

Implements the SEP-6 non-interactive withdrawal endpoint as specified in issue #374.

  • Accepts account, amount, asset_code, type, dest, dest_extra, callback_url, lang query parameters
  • Computes fee_amount and amount_out using computeAssetFee from the fee service
  • Stores receiverInfo, callbackUrl, feeAmount, feeAssetCode, and feeType on the transaction record
  • Returns fee_amount, amount_out, and type in the JSON response
  • Validates amount range (min/max) and rejects unsupported assets
  • Gracefully handles DB errors with a 500 response and structured logger output

Test plan

  • Returns fee_amount and amount_out in the response
  • Stores receiverInfo and callbackUrl on the transaction
  • Rejects NaN, below-min, and above-max amounts with 400
  • Returns 404 for unsupported asset codes
  • Returns 500 on DB errors

Fixes #374

- Add fee calculation via computeAssetFee (flat/percentage/tiered)
- Accept account, callback_url, and lang query params per SEP-6 spec
- Persist receiverInfo JSON, callbackUrl, feeAmount, feeAssetCode, feeType
- Return fee_amount and amount_out (net of fee) in every response
- Replace console.error with structured logger; mask error details
- Update withdrawQuerySchema with new optional fields
- Add 13 new withdrawal tests covering fees, receiverInfo, callbackUrl,
  amount boundaries, NaN, crypto type, and downstream DB errors

Fixes ceejaylaboratory#374
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

@Damola09 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Ceejaytech25
Copy link
Copy Markdown
Contributor

LGTM!

@Ceejaytech25 Ceejaytech25 merged commit e85b811 into ceejaylaboratory:main May 29, 2026
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.

[Backend] Implement SEP-6 Withdrawal Endpoint

2 participants