Skip to content

Commit

Permalink
fix: Show error message in case saltNonce can't be retrieved
Browse files Browse the repository at this point in the history
  • Loading branch information
usame-algan committed Feb 6, 2024
1 parent e271744 commit b5e32f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/new-safe/create/steps/ReviewStep/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ const ReviewStep = ({ data, onSubmit, onBack, setStep }: StepRenderProps<NewSafe
const [gasPrice] = useGasPrice()
const [_, setPendingSafe] = usePendingSafe()
const [executionMethod, setExecutionMethod] = useState(ExecutionMethod.RELAY)
const [submitError, setSubmitError] = useState<string>()
const isCounterfactualEnabled = useHasFeature(FEATURES.COUNTERFACTUAL)

const ownerAddresses = useMemo(() => data.owners.map((owner) => owner.address), [data.owners])
Expand Down Expand Up @@ -180,7 +181,12 @@ const ReviewStep = ({ data, onSubmit, onBack, setStep }: StepRenderProps<NewSafe
}

const createSafe = async () => {
if (!wallet || !provider || !chain || !deployProps) return
if (!wallet || !provider || !chain) return

if (!deployProps) {
setSubmitError('Error creating the Safe Account. Please try again later.')
return
}

const props = deployProps.deploySafeProps
const saltNonce = deployProps.saltNonce
Expand Down Expand Up @@ -291,6 +297,7 @@ const ReviewStep = ({ data, onSubmit, onBack, setStep }: StepRenderProps<NewSafe
<Divider />

<Box className={layoutCss.row}>
{submitError && <ErrorMessage className={css.errorMessage}>{submitError}</ErrorMessage>}
<Box display="flex" flexDirection="row" justifyContent="space-between" gap={3}>
<Button
data-testid="back-btn"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
text-decoration: line-through;
color: var(--color-text-secondary);
}

.errorMessage {
margin-top: 0;
}

0 comments on commit b5e32f6

Please sign in to comment.