Repository navigation
Closed
Labels
enhancementNew feature or requestNew feature or requestepic:investor-dappInterface: the investor dAppInterface: the investor dApppriority: low
Description
User story / Problem statement
Currently, app/src/components/vault/TransactionModal.tsx is 1,739 lines, but the modal component itself is about 120 (:1617-1739 on main; the file is 2,158 lines on feedback). The rest is copy written by hand per action:
- 13
*ContractErrorReasonfunctions (:185-398) thatswitchon raw contract error numbers (6007,6039,304…). The generated clients already export these codes with their names (VaultErrorinapp-lib/clients/async_vault, e.g.6007: {message:"InvalidAmount"}), straight from the contract's#[contracterror]enum. - 15
describe*Statusfunctions (:460-1003) that each repeat the same six-caseswitchoverTransactionStatus(idle,preparing,awaiting-signature,submitted,confirmed,failed); only the strings differ. - About 400 lines of admin copy and a dispatcher (
:1004-1508).
This is a problem because adding an action means copying about 40 lines of switch, and a renumbered contract error leaves the UI showing the wrong message without any test noticing.
Expected outcome
Each action's copy is a small object, one generic function turns a TransactionStatus into heading and body, and contract errors are matched by their generated name instead of their number. The modal file holds the modal; the copy lives in its own files, grouped by investor, cycle and admin actions. What the user sees does not change.
Acceptance criteria
- Contract errors reach the UI by name (
InvalidAmount), resolved at runtime from the contract spec the generated clients already carry (spec.errorCases()), across the vault, share token and identity verifier. No numeric error code appears in app code or in a hand-written table. - A single
describeStatushandles the sixTransactionStatuscases for every action; per-action copy is data, not aswitch. - The copy lives outside
TransactionModal.tsx, split by investor, cycle and admin actions. -
TransactionModal.tsxis under 300 lines. - Every heading, body and error message the user sees is unchanged:
TransactionModal.test.tsxpasses without edits to its assertions. -
ADMIN_VERBS,ShareLinkand the exported modal action types keep their current exports forSignPage,sign.tsand the admin sections.
Alternatives considered
- Leave it as is: every new action keeps growing the file by about 40 lines.
- An i18n library for the copy: no translation need today; it adds a dependency for what plain objects do.
Technical notes
app-lib/clientsis generated and gitignored, andnpm run testin CI swaps every client for the stub invitest.clients.ts. Importing a generated error map would beundefinedthere, so the name is resolved from the client's spec where the code is parsed today (parseErrorCodeinapp-lib/readContract.ts), and failures carry the name instead of the number. Tests build failures by name and need no clients.- A nested call can fail with another contract's code (the vault surfaces the share token's
304), so resolution looks across the specs of every contract involved. TransactionFailureis shared by every transaction hook; changing it from a code to a name touches those hooks and their tests.- The total line count drops (estimate ~1,740 → ~900 across four files) but the copy text itself stays; the gain is that the structure stops repeating.
- UI copy only: no contract, hook or transaction-flow changes.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestepic:investor-dappInterface: the investor dAppInterface: the investor dApppriority: low
Activity
feat(app): resolve contract errors by generated name
refactor(app): split TransactionModal copy into data
luchobonatti commentedon Nov 3, 2026
Closed by #427, merged into
feedback.