diff --git a/src/features/counterfactual/utils.ts b/src/features/counterfactual/utils.ts index e04772b29b..6e65e96063 100644 --- a/src/features/counterfactual/utils.ts +++ b/src/features/counterfactual/utils.ts @@ -356,27 +356,20 @@ export const extractCounterfactualSafeSetup = ( saltNonce: string | undefined } | undefined => { - if (!undeployedSafe || !chainId) { + if (!undeployedSafe || !chainId || !undeployedSafe.props.safeAccountConfig) { return undefined } - if (isPredictedSafeProps(undeployedSafe.props)) { - return { - owners: undeployedSafe.props.safeAccountConfig.owners, - threshold: undeployedSafe.props.safeAccountConfig.threshold, - fallbackHandler: undeployedSafe.props.safeAccountConfig.fallbackHandler, - safeVersion: undeployedSafe.props.safeDeploymentConfig?.safeVersion, - saltNonce: undeployedSafe.props.safeDeploymentConfig?.saltNonce, - } - } else { - const { owners, threshold, fallbackHandler } = undeployedSafe.props.safeAccountConfig - - return { - owners, - threshold: Number(threshold), - fallbackHandler, - safeVersion: undeployedSafe.props.safeVersion, - saltNonce: undeployedSafe.props.saltNonce, - } + const { owners, threshold, fallbackHandler } = undeployedSafe.props.safeAccountConfig + const { safeVersion, saltNonce } = isPredictedSafeProps(undeployedSafe.props) + ? undeployedSafe.props.safeDeploymentConfig ?? {} + : undeployedSafe.props + + return { + owners, + threshold: Number(threshold), + fallbackHandler, + safeVersion, + saltNonce, } }