diff --git a/src/components/new-safe/create/logic/index.ts b/src/components/new-safe/create/logic/index.ts index 332497b162..19d8249215 100644 --- a/src/components/new-safe/create/logic/index.ts +++ b/src/components/new-safe/create/logic/index.ts @@ -53,15 +53,16 @@ export const createNewSafe = async ( undeployedSafeProps: UndeployedSafeProps, safeVersion: SafeVersion, chain: ChainInfo, + options: DeploySafeProps['options'], callback: (txHash: string) => void, isL1SafeSingleton?: boolean, ): Promise => { const safeFactory = await getSafeFactory(provider, safeVersion, isL1SafeSingleton) if (isPredictedSafeProps(undeployedSafeProps)) { - await safeFactory.deploySafe({ ...undeployedSafeProps, callback }) + await safeFactory.deploySafe({ ...undeployedSafeProps, options, callback }) } else { - const txResponse = await activateReplayedSafe(chain, undeployedSafeProps, createWeb3(provider)) + const txResponse = await activateReplayedSafe(chain, undeployedSafeProps, createWeb3(provider), options) callback(txResponse.hash) } } diff --git a/src/components/new-safe/create/steps/ReviewStep/index.tsx b/src/components/new-safe/create/steps/ReviewStep/index.tsx index e3d87b916e..58a8f9f9b3 100644 --- a/src/components/new-safe/create/steps/ReviewStep/index.tsx +++ b/src/components/new-safe/create/steps/ReviewStep/index.tsx @@ -139,7 +139,6 @@ const ReviewStep = ({ data, onSubmit, onBack, setStep }: StepRenderProps(false) const [submitError, setSubmitError] = useState() const isCounterfactualEnabled = useHasFeature(FEATURES.COUNTERFACTUAL) - const isMultiChainDeploymentEnabled = useHasFeature(FEATURES.MULTI_CHAIN_SAFE_CREATION) const isEIP1559 = chain && hasFeature(chain, FEATURES.EIP1559) const ownerAddresses = useMemo(() => data.owners.map((owner) => owner.address), [data.owners]) @@ -166,11 +165,17 @@ const ReviewStep = ({ data, onSubmit, onBack, setStep }: StepRenderProps { + return newSafeProps + ? { + ...newSafeProps, + saltNonce: Date.now().toString(), + } + : undefined + }, [newSafeProps]) + // We estimate with a random nonce as we'll just slightly overestimates like this - const { gasLimit } = useEstimateSafeCreationGas( - newSafeProps ? { ...newSafeProps, saltNonce: Date.now().toString() } : undefined, - data.safeVersion, - ) + const { gasLimit } = useEstimateSafeCreationGas(safePropsForGasEstimation, data.safeVersion) const maxFeePerGas = gasPrice?.maxFeePerGas const maxPriorityFeePerGas = gasPrice?.maxPriorityFeePerGas @@ -281,6 +286,7 @@ const ReviewStep = ({ data, onSubmit, onBack, setStep }: StepRenderProps { onSubmitCallback(undefined, txHash) }, diff --git a/src/features/counterfactual/ActivateAccountFlow.tsx b/src/features/counterfactual/ActivateAccountFlow.tsx index 361feda378..34372eeda2 100644 --- a/src/features/counterfactual/ActivateAccountFlow.tsx +++ b/src/features/counterfactual/ActivateAccountFlow.tsx @@ -94,8 +94,7 @@ const ActivateAccountFlow = () => { if (!undeployedSafe || !undeployedSafeSetup) return null - const { owners, threshold } = undeployedSafeSetup - const { saltNonce, safeVersion } = undeployedSafeSetup + const { owners, threshold, safeVersion } = undeployedSafeSetup const onSubmit = (txHash?: string) => { trackEvent({ ...TX_EVENTS.CREATE, label: TX_TYPES.activate_without_tx }) @@ -128,6 +127,7 @@ const ActivateAccountFlow = () => { undeployedSafe.props, safeVersion ?? getLatestSafeVersion(chain), chain, + options, onSubmit, isMultichainSafe ? true : undefined, ) diff --git a/src/features/counterfactual/utils.ts b/src/features/counterfactual/utils.ts index 77a1fff5fa..c02c58d173 100644 --- a/src/features/counterfactual/utils.ts +++ b/src/features/counterfactual/utils.ts @@ -435,10 +435,16 @@ export const extractCounterfactualSafeSetup = ( } } -export const activateReplayedSafe = async (chain: ChainInfo, props: ReplayedSafeProps, provider: BrowserProvider) => { - const data = await encodeSafeCreationTx(props, chain) +export const activateReplayedSafe = async ( + chain: ChainInfo, + props: ReplayedSafeProps, + provider: BrowserProvider, + options: DeploySafeProps['options'], +) => { + const data = encodeSafeCreationTx(props, chain) return (await provider.getSigner()).sendTransaction({ + ...options, to: props.factoryAddress, data, value: '0',