Skip to content

Commit

Permalink
Simplify IntegerInput: remove bigint type
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaw3d committed Sep 18, 2024
1 parent a841bb8 commit 7495ff3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const WriteOnlyFunctionForm = ({
inheritedFrom,
}: WriteOnlyFunctionFormProps) => {
const [form, setForm] = useState<Record<string, any>>(() => getInitialFormState(abiFunction));
const [txValue, setTxValue] = useState<string | bigint>("");
const [txValue, setTxValue] = useState<string>("");
const { chain } = useAccount();
const writeTxn = useTransactor();
const { targetNetwork } = useTargetNetwork();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useCallback, useEffect, useState } from "react";
import { parseUnits } from "viem";
import { parseEther } from "viem";
import { CommonInputProps, InputBase, IntegerVariant, isValidInteger } from "~~/components/scaffold-eth";

type IntegerInputProps = CommonInputProps<string | bigint> & {
type IntegerInputProps = CommonInputProps<string> & {
variant?: IntegerVariant;
disableMultiplyBy1e18?: boolean;
};
Expand All @@ -21,10 +21,7 @@ export const IntegerInput = ({
if (!value) {
return;
}
if (typeof value === "bigint") {
return onChange(value * 10n ** 18n);
}
return onChange(parseUnits(value, 18));
return onChange(parseEther(value).toString());
}, [onChange, value]);

useEffect(() => {
Expand Down

0 comments on commit 7495ff3

Please sign in to comment.