diff --git a/components/forms/CreateTxForm/MsgForm/MsgInstantiateContract2Form.tsx b/components/forms/CreateTxForm/MsgForm/MsgInstantiateContract2Form.tsx index ed9d02c..7ce09ec 100644 --- a/components/forms/CreateTxForm/MsgForm/MsgInstantiateContract2Form.tsx +++ b/components/forms/CreateTxForm/MsgForm/MsgInstantiateContract2Form.tsx @@ -50,12 +50,14 @@ const MsgInstantiateContract2Form = ({ const [amount, setAmount] = useState("0"); const [codeIdError, setCodeIdError] = useState(""); + const [labelError, setLabelError] = useState(""); const [adminAddressError, setAdminAddressError] = useState(""); const [customDenomError, setCustomDenomError] = useState(""); const [amountError, setAmountError] = useState(""); useEffect(() => { setCodeIdError(""); + setLabelError(""); setAdminAddressError(""); setCustomDenomError(""); setAmountError(""); @@ -66,6 +68,11 @@ const MsgInstantiateContract2Form = ({ return false; } + if (!label) { + setLabelError("Label is required"); + return false; + } + const addressErrorMsg = checkAddress(adminAddress, chain.addressPrefix); if (adminAddress && addressErrorMsg) { setAdminAddressError(`Invalid address for network ${chain.chainId}: ${addressErrorMsg}`); @@ -174,6 +181,7 @@ const MsgInstantiateContract2Form = ({ name="label" value={label} onChange={({ target }) => setLabel(target.value)} + error={labelError} />
diff --git a/components/forms/CreateTxForm/MsgForm/MsgInstantiateContractForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgInstantiateContractForm.tsx index 9b21e04..ad4d172 100644 --- a/components/forms/CreateTxForm/MsgForm/MsgInstantiateContractForm.tsx +++ b/components/forms/CreateTxForm/MsgForm/MsgInstantiateContractForm.tsx @@ -48,12 +48,14 @@ const MsgInstantiateContractForm = ({ const [amount, setAmount] = useState("0"); const [codeIdError, setCodeIdError] = useState(""); + const [labelError, setLabelError] = useState(""); const [adminAddressError, setAdminAddressError] = useState(""); const [customDenomError, setCustomDenomError] = useState(""); const [amountError, setAmountError] = useState(""); useEffect(() => { setCodeIdError(""); + setLabelError(""); setAdminAddressError(""); setCustomDenomError(""); setAmountError(""); @@ -64,6 +66,11 @@ const MsgInstantiateContractForm = ({ return false; } + if (!label) { + setLabelError("Label is required"); + return false; + } + const addressErrorMsg = checkAddress(adminAddress, chain.addressPrefix); if (adminAddress && addressErrorMsg) { setAdminAddressError(`Invalid address for network ${chain.chainId}: ${addressErrorMsg}`); @@ -168,6 +175,7 @@ const MsgInstantiateContractForm = ({ name="label" value={label} onChange={({ target }) => setLabel(target.value)} + error={labelError} />