From acbc83f90c3023dcad574262aab4307dcce2905d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Sworze=C5=84?= Date: Tue, 11 Jun 2024 13:10:10 +0200 Subject: [PATCH] add link to register/ edit drep and create GA --- .../src/hooks/forms/useCreateGovernanceActionForm.ts | 7 ++++--- govtool/frontend/src/hooks/forms/useEditDRepInfoForm.ts | 7 ++++--- govtool/frontend/src/hooks/forms/useRegisterAsdRepForm.tsx | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/govtool/frontend/src/hooks/forms/useCreateGovernanceActionForm.ts b/govtool/frontend/src/hooks/forms/useCreateGovernanceActionForm.ts index 4994b7ff1..08892c1c3 100644 --- a/govtool/frontend/src/hooks/forms/useCreateGovernanceActionForm.ts +++ b/govtool/frontend/src/hooks/forms/useCreateGovernanceActionForm.ts @@ -162,10 +162,11 @@ export const useCreateGovernanceActionForm = ( [hash], ); - const showSuccessModal = useCallback(() => { + const showSuccessModal = useCallback((link: string) => { openModal({ type: "statusModal", state: { + link: `https://sancho.cexplorer.io/tx/${link}`, status: "success", title: t( "createGovernanceAction.modals.submitTransactionSuccess.title", @@ -208,12 +209,12 @@ export const useCreateGovernanceActionForm = ( } const govActionBuilder = await buildTransaction(data); - await buildSignSubmitConwayCertTx({ + const result = await buildSignSubmitConwayCertTx({ govActionBuilder, type: "createGovAction", }); - showSuccessModal(); + if (result) showSuccessModal(result); // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (error: any) { const isInsufficientBalance = error diff --git a/govtool/frontend/src/hooks/forms/useEditDRepInfoForm.ts b/govtool/frontend/src/hooks/forms/useEditDRepInfoForm.ts index a44412642..fa1913dd4 100644 --- a/govtool/frontend/src/hooks/forms/useEditDRepInfoForm.ts +++ b/govtool/frontend/src/hooks/forms/useEditDRepInfoForm.ts @@ -121,10 +121,11 @@ export const useEditDRepInfoForm = ( }); }, []); - const showSuccessModal = useCallback(() => { + const showSuccessModal = useCallback((link: string) => { openModal({ type: "statusModal", state: { + link: `https://sancho.cexplorer.io/tx/${link}`, status: "success", title: t("modals.registration.title"), message: t("modals.registration.message"), @@ -156,12 +157,12 @@ export const useEditDRepInfoForm = ( } const updateDRepMetadataCert = await buildDRepUpdateCert(url, hash); - await buildSignSubmitConwayCertTx({ + const result = await buildSignSubmitConwayCertTx({ certBuilder: updateDRepMetadataCert, type: "updateMetaData", }); - showSuccessModal(); + if (result) showSuccessModal(result); // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (error: any) { if (Object.values(MetadataValidationStatus).includes(error)) { diff --git a/govtool/frontend/src/hooks/forms/useRegisterAsdRepForm.tsx b/govtool/frontend/src/hooks/forms/useRegisterAsdRepForm.tsx index 463dc8e5a..af3fc66ac 100644 --- a/govtool/frontend/src/hooks/forms/useRegisterAsdRepForm.tsx +++ b/govtool/frontend/src/hooks/forms/useRegisterAsdRepForm.tsx @@ -159,10 +159,11 @@ export const useRegisterAsdRepForm = ( }); }, []); - const showSuccessModal = useCallback(() => { + const showSuccessModal = useCallback((link: string) => { openModal({ type: "statusModal", state: { + link: `https://sancho.cexplorer.io/tx/${link}`, status: "success", title: t("modals.registration.title"), message: t("modals.registration.message"), @@ -191,12 +192,12 @@ export const useRegisterAsdRepForm = ( throw status; } const registerAsDRepCert = await createRegistrationCert(data); - await buildSignSubmitConwayCertTx({ + const result = await buildSignSubmitConwayCertTx({ certBuilder: registerAsDRepCert, type: "registerAsDrep", }); - showSuccessModal(); + if (result) showSuccessModal(result); // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (error: any) { if (Object.values(MetadataValidationStatus).includes(error)) {