feat(app): let the investor cancel a subscription - #168
Open
luchobonatti wants to merge 4 commits into
Open
luchobonatti wants to merge 4 commits into
luchobonatti wants to merge 4 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
luchobonatti
added this pull request to stack #167
September 25, 2026 16:19
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
ActionPanel.tsx uses messageBlock.reason where messageBlock is typed as possibly undefined, which is likely to break TypeScript type-checking under strict null checks.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Adds an investor-facing cancellation flow for pending subscription (deposit) requests in the app, reusing a shared contract-transaction state machine and updating the UI to gate subscription actions before the wallet opens.
Changes:
- Add “Cancel” as an action for waiting deposit requests and wire it to a new
cancel_deposittransaction flow. - Introduce a reusable
useContractTransactionhook and update request deposit to use it; unify subscribe/cancel UX underTransactionModal. - Add pre-signature subscription gating based on vault pause state and “open subscription in current batch”.
| File | Description |
|---|---|
| app/src/pages/vaultRequests.ts | Adds optional Cancel action for waiting deposit request entries. |
| app/src/pages/vaultRequests.test.ts | Tests for Cancel action presence and correct handler invocation. |
| app/src/pages/VaultPreview.tsx | Wires cancel flow into UI; uses pause + open-subscription gating; uses TransactionModal. |
| app/src/pages/VaultPreview.test.tsx | Adds/updates integration tests for pause gating, duplicate prevention, and cancel behavior. |
| app/src/pages/vaultAccess.ts | Adds subscribe-side gating (SubscribeGate) and isSubscriptionOpen; enriches message blocks with sides. |
| app/src/pages/vaultAccess.test.ts | Covers new gating behavior and isSubscriptionOpen logic. |
| app/src/hooks/useVaultPaused.ts | New query hook to read vault paused state. |
| app/src/hooks/useVaultPaused.test.ts | Unit tests for pause-state classification. |
| app/src/hooks/useRequestDeposit.ts | Refactors subscribe request hook to use useContractTransaction. |
| app/src/hooks/useContractTransaction.ts | New shared transaction hook handling simulation refusal, submission lifecycle, and cache invalidation. |
| app/src/hooks/useCancelDeposit.ts | New cancel-deposit hook built on useContractTransaction. |
| app/src/hooks/useCancelDeposit.test.ts | Thorough lifecycle and edge-case tests for cancel-deposit transactions. |
| app/src/components/vault/TransactionModal.tsx | Extends modal to support both subscribe and cancel flows with appropriate copy and error mapping. |
| app/src/components/vault/TransactionModal.test.tsx | Adds cancel-modal coverage and updates subscribe-modal tests to use TransactionModal. |
| app/src/components/vault/TransactionModal.module.css | New styles for the unified transaction modal. |
| app/src/components/vault/ActionPanel.tsx | Adds per-side message blocking via sides and keeps opposite tab reachable when only one side is blocked. |
| app/src/components/vault/ActionPanel.test.tsx | Tests for both-sides vs single-side message behavior. |
| app-lib/contracts.ts | Extends AsyncVaultApi with paused: Call<boolean>. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
luchobonatti
force-pushed
the
feat/86-cancel-a-request
branch
from
September 25, 2026 16:36
f8adaa1 to
ea20c6a
Compare
luchobonatti
force-pushed
the
feat/86-cancel-a-request
branch
from
September 25, 2026 16:42
ea20c6a to
43a8fe7
Compare
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Closes #86
An investor who subscribed had no way back. Cancel returns the deposit in one transaction.
Third of three stacked PRs, based on #166.
Criterion 5 met differently: the app does not replicate
!wind_down::is_active(e) && epoch::is_priceable(...)(deposit.rs:143). Cancel is offered on any unfulfilled subscription, and the contract refuses the rest at simulation, before the wallet opens.Changes
Acceptance criteria
Test plan
Automated tests
npm run test— 372 passing, up from 336 on #166. Covers cancel through every state, its error codes, a declined signature, a pre-signature failure, and the refresh on confirmation.The refactor changed no test: the same 369 passed before and after, untouched.
Cancelling one request while another is in flight starts the second rather than replaying the first: the reattach now matches the submission actually running.
Manual verification
Local network, seeded with
npm run deploy -w scripts/harnessthennpm run test:happy-path:Breaking changes
None.
Checklist
Screenshots
None.