Prevent inputing decimals

This commit is contained in:
Valtteri Karesto
2022-06-02 15:22:28 +03:00
parent b09d029931
commit 80d6bb691d

View File

@@ -121,7 +121,7 @@ export const SetHookDialog: React.FC<{ accountAddress: string }> = React.memo(
}
const res = await estimateFee(tx, account);
if (res && res.base_fee) {
setValue("Fee", res.base_fee);
setValue("Fee", Math.round(Number(res.base_fee || "")).toString());
}
})();
}
@@ -256,6 +256,12 @@ export const SetHookDialog: React.FC<{ accountAddress: string }> = React.memo(
type="number"
{...register("Fee", { required: true })}
autoComplete={"off"}
onKeyPress={(e) => {
if (e.key === "." || e.key === ",") {
e.preventDefault();
}
}}
step="1"
defaultValue={10000}
css={{
"-moz-appearance": "textfield",
@@ -295,7 +301,12 @@ export const SetHookDialog: React.FC<{ accountAddress: string }> = React.memo(
const res = await estimateFee(tx, account);
if (res && res.base_fee) {
setValue("Fee", res.base_fee);
setValue(
"Fee",
Math.round(
Number(res.base_fee || "")
).toString()
);
}
}
} catch (err) {}