Skip to content

Commit 0534aba

Browse files
Enhance smart account factory address validation in auth options form
Co-authored-by: joaquim.verges <[email protected]>
1 parent 0e159f7 commit 0534aba

File tree

1 file changed

+22
-3
lines changed
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client

1 file changed

+22
-3
lines changed

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/auth-options-form.client.tsx

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ export function AuthOptionsForm({
9090
DEFAULT_ACCOUNT_FACTORY_V0_7
9191
? "v0.7"
9292
: ecosystem.smartAccountOptions?.accountFactoryAddress ===
93-
DEFAULT_ACCOUNT_FACTORY_V0_6
94-
? "v0.6"
95-
: "custom",
93+
DEFAULT_ACCOUNT_FACTORY_V0_6
94+
? "v0.6"
95+
: "custom",
9696
authOptions: ecosystem.authOptions || [],
9797
customAccountFactoryAddress:
9898
ecosystem.smartAccountOptions?.accountFactoryAddress || "",
@@ -133,6 +133,8 @@ export function AuthOptionsForm({
133133
(data) => {
134134
if (
135135
data.useSmartAccount &&
136+
data.executionMode === "EIP4337" &&
137+
data.accountFactoryType === "custom" &&
136138
data.customAccountFactoryAddress &&
137139
!isAddress(data.customAccountFactoryAddress)
138140
) {
@@ -145,6 +147,23 @@ export function AuthOptionsForm({
145147
path: ["customAccountFactoryAddress"],
146148
},
147149
)
150+
.refine(
151+
(data) => {
152+
if (
153+
data.useSmartAccount &&
154+
data.executionMode === "EIP4337" &&
155+
data.accountFactoryType === "custom" &&
156+
!data.customAccountFactoryAddress
157+
) {
158+
return false;
159+
}
160+
return true;
161+
},
162+
{
163+
message: "Please enter a custom account factory address",
164+
path: ["customAccountFactoryAddress"],
165+
},
166+
)
148167
.refine(
149168
(data) => {
150169
if (data.useSmartAccount && (data.defaultChainId ?? 0) <= 0) {

0 commit comments

Comments
 (0)