fix: an invalid amount crashes the undelegate tab
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 11
- Forks
- 26
- Avg merge
- 11h 58m
- Merged PRs (30d)
- 16
Description
components/DelegatingWidget/Undelegate.tsx:36-40 calls parseEther unguarded while building the transaction args:
const args = {
amount: parseEther(amount ? amount.toString() : "0"),
...
};
That runs during render, and parseEther throws on exponent notation (1e3), which <input type="number"> accepts and hands through. The result is a Runtime InvalidDecimalNumberError overlay and a blank widget.
Same defect was fixed on the delegate side in #738, which introduced parseAmountToWei in utils/web3.ts — a parse that returns null instead of throwing. The undelegate tab shares the same amount input and was missed.
Reproduction
Open the Undelegate tab and type 1e3.
Fix
Use parseAmountToWei and fall back to 0n, as Delegate.tsx and Footer.tsx now do.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in components/DelegatingWidget/Undelegate.tsx:36-40 and compare its amount handling with Delegate.tsx and Footer.tsx. Read parseAmountToWei in utils/web3.ts, then reproduce the issue by entering 1e3 in the Undelegate tab. Done means exponent notation no longer blanks the widget or shows a Runtime InvalidDecimalNumberError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100