From 6dd0239069f3715a3699b37beb165a66056ff553 Mon Sep 17 00:00:00 2001 From: Usame Algan Date: Mon, 12 Feb 2024 09:35:27 +0100 Subject: [PATCH] fix: Dispatch success event, adjust notification wording --- src/features/counterfactual/CounterfactualForm.tsx | 4 +++- src/features/counterfactual/utils.ts | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/features/counterfactual/CounterfactualForm.tsx b/src/features/counterfactual/CounterfactualForm.tsx index a4b3753086..dc0ac86310 100644 --- a/src/features/counterfactual/CounterfactualForm.tsx +++ b/src/features/counterfactual/CounterfactualForm.tsx @@ -1,13 +1,14 @@ import { TxModalContext } from '@/components/tx-flow' import useDeployGasLimit from '@/features/counterfactual/hooks/useDeployGasLimit' import { removeUndeployedSafe } from '@/features/counterfactual/store/undeployedSafesSlice' -import { deploySafeAndExecuteTx } from '@/features/counterfactual/utils' +import { CF_TX_GROUP_KEY, deploySafeAndExecuteTx } from '@/features/counterfactual/utils' import useChainId from '@/hooks/useChainId' import { getTotalFeeFormatted } from '@/hooks/useGasPrice' import useSafeInfo from '@/hooks/useSafeInfo' import useWalletCanPay from '@/hooks/useWalletCanPay' import useOnboard from '@/hooks/wallets/useOnboard' import useWallet from '@/hooks/wallets/useWallet' +import { txDispatch, TxEvent } from '@/services/tx/txEvents' import { useAppDispatch } from '@/store' import madProps from '@/utils/mad-props' import React, { type ReactElement, type SyntheticEvent, useContext, useState } from 'react' @@ -81,6 +82,7 @@ export const CounterfactualForm = ({ const onSuccess = () => { dispatch(removeUndeployedSafe({ chainId, address: safeAddress })) + txDispatch(TxEvent.SUCCESS, { groupKey: CF_TX_GROUP_KEY }) } try { diff --git a/src/features/counterfactual/utils.ts b/src/features/counterfactual/utils.ts index 12639f84f2..afc54d02c7 100644 --- a/src/features/counterfactual/utils.ts +++ b/src/features/counterfactual/utils.ts @@ -31,6 +31,8 @@ import type { BrowserProvider } from 'ethers' import { createWeb3 } from '@/hooks/wallets/web3' import type { NextRouter } from 'next/router' +export const CF_TX_GROUP_KEY = 'cf-tx' + export const getUndeployedSafeInfo = (undeployedSafe: PredictedSafeProps, address: string, chainId: string) => { return Promise.resolve({ ...defaultSafeInfo, @@ -54,7 +56,7 @@ export const dispatchTxExecutionAndDeploySafe = async ( onSuccess?: () => void, ) => { const sdkUnchecked = await getUncheckedSafeSDK(onboard, chainId) - const eventParams = { groupKey: 'cf-tx' } + const eventParams = { groupKey: CF_TX_GROUP_KEY } const safeAddress = await sdkUnchecked.getAddress() let result: ContractTransactionResponse | undefined @@ -189,7 +191,7 @@ export const showSubmitNotification = (dispatch: AppDispatch, chain?: ChainInfo, showNotification({ variant: 'info', groupKey: 'cf-activate-account', - message: 'Transaction submitted', + message: 'Safe Account activation in progress', detailedMessage: 'Your Safe Account will be deployed onchain after the transaction is executed.', link: link ? { href: link.href, title: link.title } : undefined, }),