feat: friendlyError Extended with Soroban XDR Diagnostic Extraction and Error Telemetry Hook#565
feat: friendlyError Extended with Soroban XDR Diagnostic Extraction and Error Telemetry Hook#565enniedokz wants to merge 5 commits into
Conversation
|
@enniedokz 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! 🚀 |
There was a problem hiding this comment.
Pull request overview
This PR aims to improve frontend error reporting for Soroban simulation failures by introducing parseContractError, wiring it into the transaction build/simulation flow, and adding an error-telemetry hook plus an end-to-end Vitest integration test for the subscribe → pay-per-use → cancel journey. It also includes a few contract-side fixes/adjustments (subscription struct cloning, grace-period governance call updates, and a contract error enum update), along with dependency/lockfile updates.
Changes:
- Frontend: add
parseContractError+ newuseErrorTelemetry()hook; integrate parsing into simulation/build paths. - Frontend: add an end-to-end integration test with Freighter + Stellar mocks for subscribe → pay-per-use → cancel.
- Contract: minor subscription cloning changes, grace-period propose/commit usage in tests, and error enum adjustments.
Reviewed changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Adds root-level TypeScript dependency (potentially redundant vs frontend/). |
| package-lock.json | Lockfile updates for new root dependency. |
| frontend/src/utils/errors.ts | Extends CONTRACT_ERRORS and adds parseContractError(). |
| frontend/src/test/errors.test.ts | Adds unit tests for parseContractError(). |
| frontend/src/stellar.ts | Integrates contract error parsing into simulation/build flows; refactors some helpers. |
| frontend/src/hooks/useStellarBalance.ts | Updates getBalance call signature usage. |
| frontend/src/hooks/useErrorTelemetry.ts | Adds telemetry hook that counts payflow:error CustomEvents. |
| frontend/src/components/SubscriptionHistory.tsx | Minor comment removal in UI component. |
| frontend/src/components/SubscriptionCard.tsx | Adds optional onCancel/onPause hooks and updates cancel button behavior. |
| frontend/src/components/PayPerUseForm.tsx | Cleans up duplicated/incorrect imports. |
| frontend/src/components/Dashboard.tsx | Moves cancellation confirmation to Dashboard-level modal and adds keyboard shortcut handling. |
| frontend/src/tests/stellar.test.ts | Updates fetchEvents test expectations to match return shape usage. |
| frontend/src/tests/integration/subscribe-pay-cancel.test.tsx | Adds full integration test with fake timers and mocked infrastructure. |
| frontend/src/tests/mocks/stellar.ts | Adds a manual mock module for Stellar interactions used by tests. |
| frontend/src/tests/mocks/freighter.ts | Adds a manual Freighter wallet mock used by tests. |
| frontend/package-lock.json | Frontend lockfile changes (dependency graph adjustments). |
| contract/src/test.rs | Updates grace period test to use propose/commit flow; minor variable naming tweak. |
| contract/src/lib.rs | Avoids moves by cloning addresses when building/storing subscriptions. |
| contract/src/grace.rs | Adds set_grace_period storage + TTL extension and cleans up whitespace. |
| contract/src/events.rs | Removes duplicate stubbed publish_paused definition. |
| contract/src/errors.rs | Adjusts/extends ContractError enum discriminants and adds MetadataLabelTooLong. |
Files not reviewed (1)
- frontend/package-lock.json: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Close #454
Close #456
Close #490
Close #500