From f0b4e20ba30efd911d7b21b078282181cc5eaebc Mon Sep 17 00:00:00 2001 From: Timidan Date: Tue, 8 Sep 2026 03:08:36 +0100 Subject: [PATCH] Reject negative amounts on payable calls A value like -1 passes parseEther and reached writeContract, where the serializer fails with a raw BigInt error. Negative amounts now get the same clear message as any other unreadable input. --- src/components/simple-grid/layout/ExecutionSection.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/simple-grid/layout/ExecutionSection.tsx b/src/components/simple-grid/layout/ExecutionSection.tsx index 9ba1f37..a2a8b38 100644 --- a/src/components/simple-grid/layout/ExecutionSection.tsx +++ b/src/components/simple-grid/layout/ExecutionSection.tsx @@ -545,6 +545,11 @@ export default function ExecutionSection(): React.ReactElement | null { `Could not read "${rawValue}" as an amount. Use decimal ETH (0.1) or hex wei (0x...).`, ); } + if (sendValue < 0n) { + throw new Error( + `Could not read "${rawValue}" as an amount. Use decimal ETH (0.1) or hex wei (0x...).`, + ); + } } const hash = await activeWalletClient.writeContract({