We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent db0018c commit 9698245Copy full SHA for 9698245
web/src/hooks/useParsedAmount.ts
@@ -1,12 +1,6 @@
1
import { useMemo } from "react";
2
import { parseUnits } from "viem";
3
4
-export function useParsedAmount(amount: string): bigint {
5
- return useMemo(() => {
6
- if (amount === "" || isNaN(Number(amount))) {
7
- return BigInt(0);
8
- } else {
9
- return parseUnits(`${Number(amount)}`, 18);
10
- }
11
- }, [amount]);
+export function useParsedAmount(amount: `${number}`): bigint {
+ return useMemo(() => parseUnits(amount, 18), [amount]);
12
}
0 commit comments