fix(stream-validation): add StrKey contract ID format validation - #588
Conversation
- Add validateContractId() to stream-validation.ts using StrKey.isValidContract
- Apply contract ID validation to token field in paymentStreamSchema (validations.ts)
- Guard token contract address in CreatePaymentStream handleFormSubmit
- Native XLM token ('native') is correctly exempted from contract ID check
Closes Fundable-Protocol#379
|
@Fayedamz 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! 🚀 |
📝 WalkthroughWalkthroughPayment stream token validation now accepts native XLM or valid Stellar contract IDs. A reusable validator uses Stellar SDK ChangesPayment stream validation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/web/src/lib/stream-validation.ts (1)
12-19: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd focused regression tests for the shared validator.
Cover valid contract IDs, invalid checksum/prefix/length, empty input, and confirm that
"native"remains handled by the schema/form layer rather than this helper.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/web/src/lib/stream-validation.ts` around lines 12 - 19, Add focused regression tests for validateContractId covering valid contract IDs, invalid checksum, prefix, and length cases, plus empty input. Also verify that "native" is not accepted or specially handled by validateContractId, leaving that behavior to the schema/form layer.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@apps/web/src/lib/stream-validation.ts`:
- Around line 12-19: Add focused regression tests for validateContractId
covering valid contract IDs, invalid checksum, prefix, and length cases, plus
empty input. Also verify that "native" is not accepted or specially handled by
validateContractId, leaving that behavior to the schema/form layer.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 299fcd7a-0c2c-49e1-8c3f-faf5f0105efc
📒 Files selected for processing (3)
apps/web/src/components/modules/payment-stream/CreatePaymentStream.tsxapps/web/src/lib/stream-validation.tsapps/web/src/lib/validations.ts
|
dont forget to offramp using https://stellar.fundable.finance/offramp its fast, free and p2p rates |
Closes #379
Summary by CodeRabbit