Skip to content

fix: validate PoolDepositButton and MilestoneFundButton amounts with parseMoneyInput (#69) - #173

Open
rafaio1 wants to merge 1 commit into
MergeFi:mainfrom
rafaio1:fix/69-validate-pool-deposit
Open

fix: validate PoolDepositButton and MilestoneFundButton amounts with parseMoneyInput (#69)#173
rafaio1 wants to merge 1 commit into
MergeFi:mainfrom
rafaio1:fix/69-validate-pool-deposit

Conversation

@rafaio1

@rafaio1 rafaio1 commented Aug 20, 2026

Copy link
Copy Markdown

Fixes #69.

  • Add parseMoneyInput(raw, asset) helper to utils.ts that validates and normalizes user-entered monetary amounts: rejects empty, non-numeric, zero, negative, Infinity, NaN, and over-precision values; returns a normalized fixed-decimal string (2 decimals for USDC, 7 for XLM).
  • Wire PoolDepositButton to use parseMoneyInput on every change to drive inline disabled state and error messaging, and send the normalized amount to the backend instead of the raw input string.
  • Also update MilestoneFundButton (from MilestoneFundButton has no amount input, making partial milestone funding impossible from the UI #83) to use the same shared validator instead of its ad-hoc inline checks, ensuring consistent validation across both money-moving inputs.
  • Accept an optional asset prop on PoolDepositButton (defaults to USDC) so precision limits match the pool's actual asset type.
  • TypeScript compiles cleanly with npx tsc --noEmit.

@vercel

vercel Bot commented Aug 20, 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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate PoolDepositButton's amount input before posting to the maintenance-pool deposit endpoint

1 participant