From 0cba3eb91e25fd2c377c3c3394d7f3f1f59d4b03 Mon Sep 17 00:00:00 2001 From: abefernan <44572727+abefernan@users.noreply.github.com> Date: Thu, 15 Jun 2023 12:37:33 +0200 Subject: [PATCH] Add create tx error --- components/forms/CreateTxForm/index.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/components/forms/CreateTxForm/index.tsx b/components/forms/CreateTxForm/index.tsx index e861838..c1e7caa 100644 --- a/components/forms/CreateTxForm/index.tsx +++ b/components/forms/CreateTxForm/index.tsx @@ -32,6 +32,7 @@ const CreateTxForm = ({ router, senderAddress, accountOnChain }: CreateTxFormPro const [memo, setMemo] = useState(""); const [gasLimit, setGasLimit] = useState(gasOfTx([])); const [gasLimitError, setGasLimitError] = useState(""); + const [showCreateTxError, setShowTxError] = useState(false); const gasPrice = state.chain.gasPrice; assert(gasPrice, "gasPrice missing"); @@ -47,6 +48,8 @@ const CreateTxForm = ({ router, senderAddress, accountOnChain }: CreateTxFormPro const createTx = async () => { try { + setShowTxError(false); + assert(typeof accountOnChain.accountNumber === "number", "accountNumber missing"); assert(msgGetters.current.length, "form filled incorrectly"); @@ -81,6 +84,7 @@ const CreateTxForm = ({ router, senderAddress, accountOnChain }: CreateTxFormPro router.push(`${senderAddress}/transaction/${transactionID}`); } catch (error) { console.error("Creat transaction error:", error); + setShowTxError(true); } finally { setProcessing(false); } @@ -158,6 +162,13 @@ const CreateTxForm = ({ router, senderAddress, accountOnChain }: CreateTxFormPro />