Skip to content

fix: an invalid amount crashes the undelegate tab #743

Description

@rickstaa

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions