Skip to content

fix(milestones): add validated amount input to MilestoneFundButton and PoolDepositButton (#83, #69) - #111

Open
ghzhost wants to merge 1 commit into
MergeFi:mainfrom
ghzhost:fix-milestone-deposit-amount-input
Open

ghzhost wants to merge 1 commit into
MergeFi:mainfrom
ghzhost:fix-milestone-deposit-amount-input

Conversation

@ghzhost

@ghzhost ghzhost commented Aug 17, 2026

Copy link
Copy Markdown

Summary

Closes #83
Closes #69

Changes:

  1. Extracted Monetary Input Validation Helper (src/lib/money.ts):

    • Implemented parseMoneyInput(raw: string, asset: "USDC" | "XLM") enforcing positive non-zero numeric validation, rejecting exponent syntax, negative numbers, non-numeric strings, and enforcing decimal precision rules (2 places for USDC, 7 places for XLM).
    • Added unit test suite in src/lib/money.test.ts covering zero, negative, empty, non-numeric, overflow, and decimal limits.
  2. MilestoneFundButton Amount Input (MilestoneFundButton has no amount input, making partial milestone funding impossible from the UI #83):

    • Added amount input to MilestoneFundButton matching the pattern used across funding actions.
    • Defaults amount intelligently to the remaining budget (m.budget - m.distributed) or 100.
    • Forwards the validated and normalized decimal amount to POST /milestones/:id/fund.
  3. PoolDepositButton Input Validation (Validate PoolDepositButton's amount input before posting to the maintenance-pool deposit endpoint #69):

    • Wired client-side validation to PoolDepositButton with live inline validation feedback.
    • Disables deposit button whenever invalid amount is typed or pending.
    • Forwards asset type from MilestonesPage to enforce asset-specific decimal precision (USDC / XLM).

Verification

  • npx jest src/lib/money.test.ts src/lib/utils.test.ts src/lib/markdown.test.ts passed (54/54 tests green).

@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant