diff --git a/components/forms/CreateTxForm/MsgForm/MsgCreateVestingAccountForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgCreateVestingAccountForm.tsx index 93d5525..eafa188 100644 --- a/components/forms/CreateTxForm/MsgForm/MsgCreateVestingAccountForm.tsx +++ b/components/forms/CreateTxForm/MsgForm/MsgCreateVestingAccountForm.tsx @@ -76,6 +76,10 @@ const MsgCreateVestingAccountForm = ({ const microCoin = (() => { try { + if (!amount || amount === "0") { + return null; + } + return macroCoinToMicroCoin({ denom: chain.displayDenom, amount }, chain.assets); } catch { return null; diff --git a/components/forms/CreateTxForm/MsgForm/MsgExecuteContractForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgExecuteContractForm.tsx index 6437a59..c77736a 100644 --- a/components/forms/CreateTxForm/MsgForm/MsgExecuteContractForm.tsx +++ b/components/forms/CreateTxForm/MsgForm/MsgExecuteContractForm.tsx @@ -73,7 +73,12 @@ const MsgExecuteContractForm = ({ return false; } - if (selectedDenom.value === customDenomOption.value && !customDenom) { + if ( + selectedDenom.value === customDenomOption.value && + !customDenom && + amount && + amount !== "0" + ) { setCustomDenomError("Custom denom must be set because of selection above"); return false; } @@ -102,6 +107,10 @@ const MsgExecuteContractForm = ({ const microCoin = (() => { try { + if (!denom || !amount || amount === "0") { + return null; + } + return macroCoinToMicroCoin({ denom, amount }, chain.assets); } catch { return null; @@ -124,6 +133,8 @@ const MsgExecuteContractForm = ({ funds: microCoin ? [microCoin] : [], }); + console.log({ msgValue }); + const msg: MsgExecuteContractEncodeObject = { typeUrl: MsgTypeUrls.Execute, value: msgValue }; setMsgGetter({ isMsgValid, msg }); diff --git a/components/forms/CreateTxForm/MsgForm/MsgInstantiateContract2Form.tsx b/components/forms/CreateTxForm/MsgForm/MsgInstantiateContract2Form.tsx index ff8edf8..9505e0c 100644 --- a/components/forms/CreateTxForm/MsgForm/MsgInstantiateContract2Form.tsx +++ b/components/forms/CreateTxForm/MsgForm/MsgInstantiateContract2Form.tsx @@ -101,7 +101,12 @@ const MsgInstantiateContract2Form = ({ return false; } - if (selectedDenom.value === customDenomOption.value && !customDenom) { + if ( + selectedDenom.value === customDenomOption.value && + !customDenom && + amount && + amount !== "0" + ) { setCustomDenomError("Custom denom must be set because of selection above"); return false; } @@ -131,6 +136,10 @@ const MsgInstantiateContract2Form = ({ const microCoin = (() => { try { + if (!denom || !amount || amount === "0") { + return null; + } + return macroCoinToMicroCoin({ denom, amount }, chain.assets); } catch { return null; diff --git a/components/forms/CreateTxForm/MsgForm/MsgInstantiateContractForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgInstantiateContractForm.tsx index 0b478ee..7ce77d4 100644 --- a/components/forms/CreateTxForm/MsgForm/MsgInstantiateContractForm.tsx +++ b/components/forms/CreateTxForm/MsgForm/MsgInstantiateContractForm.tsx @@ -87,7 +87,12 @@ const MsgInstantiateContractForm = ({ return false; } - if (selectedDenom.value === customDenomOption.value && !customDenom) { + if ( + selectedDenom.value === customDenomOption.value && + !customDenom && + amount && + amount !== "0" + ) { setCustomDenomError("Custom denom must be set because of selection above"); return false; } @@ -117,6 +122,10 @@ const MsgInstantiateContractForm = ({ const microCoin = (() => { try { + if (!denom || !amount || amount === "0") { + return null; + } + return macroCoinToMicroCoin({ denom, amount }, chain.assets); } catch { return null; diff --git a/components/forms/CreateTxForm/MsgForm/MsgSendForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgSendForm.tsx index b17d746..cd28907 100644 --- a/components/forms/CreateTxForm/MsgForm/MsgSendForm.tsx +++ b/components/forms/CreateTxForm/MsgForm/MsgSendForm.tsx @@ -57,7 +57,12 @@ const MsgSendForm = ({ fromAddress, setMsgGetter, deleteMsg }: MsgSendFormProps) return false; } - if (selectedDenom.value === customDenomOption.value && !customDenom) { + if ( + selectedDenom.value === customDenomOption.value && + !customDenom && + amount && + amount !== "0" + ) { setCustomDenomError("Custom denom must be set because of selection above"); return false; } @@ -87,6 +92,10 @@ const MsgSendForm = ({ fromAddress, setMsgGetter, deleteMsg }: MsgSendFormProps) const microCoin = (() => { try { + if (!denom || !amount || amount === "0") { + return null; + } + return macroCoinToMicroCoin({ denom, amount }, chain.assets); } catch { return null;