Skip to content

Commit

Permalink
fix: Dispatch success event, adjust notification wording
Browse files Browse the repository at this point in the history
  • Loading branch information
usame-algan committed Feb 12, 2024
1 parent 7a458ff commit 6dd0239
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/features/counterfactual/CounterfactualForm.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -81,6 +82,7 @@ export const CounterfactualForm = ({

const onSuccess = () => {
dispatch(removeUndeployedSafe({ chainId, address: safeAddress }))
txDispatch(TxEvent.SUCCESS, { groupKey: CF_TX_GROUP_KEY })
}

try {
Expand Down
6 changes: 4 additions & 2 deletions src/features/counterfactual/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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,
}),
Expand Down

0 comments on commit 6dd0239

Please sign in to comment.