@@ -112,24 +112,30 @@ export function AccountAbstractionSettingsPage(
112112
113113 const policy = props . bundlerService ;
114114
115- const transformedQueryData = useMemo (
116- ( ) => ( {
115+ const transformedQueryData = useMemo ( ( ) => {
116+ const allowedContractAddresses = policy . allowedContractAddresses ?. filter (
117+ ( x ) => x !== "" ,
118+ ) ;
119+
120+ const allowedWallets = policy . allowedWallets ?. filter ( ( x ) => x !== "" ) ;
121+ const blockedWallets = policy . blockedWallets ?. filter ( ( x ) => x !== "" ) ;
122+
123+ return {
117124 allowedChainIds :
118125 policy . allowedChainIds && policy . allowedChainIds ?. length > 0
119126 ? policy . allowedChainIds
120127 : null ,
121128 allowedContractAddresses :
122- policy . allowedContractAddresses &&
123- policy . allowedContractAddresses ?. length > 0
124- ? joinWithComma ( policy . allowedContractAddresses )
129+ allowedContractAddresses && allowedContractAddresses . length > 0
130+ ? joinWithComma ( allowedContractAddresses )
125131 : null ,
126132 allowedWallets :
127- policy . allowedWallets && policy . allowedWallets ?. length > 0
128- ? joinWithComma ( policy . allowedWallets )
133+ allowedWallets && allowedWallets ?. length > 0
134+ ? joinWithComma ( allowedWallets )
129135 : null ,
130136 blockedWallets :
131- policy . blockedWallets && policy . blockedWallets ?. length > 0
132- ? joinWithComma ( policy . blockedWallets )
137+ blockedWallets && blockedWallets ?. length > 0
138+ ? joinWithComma ( blockedWallets )
133139 : null ,
134140 bypassWallets :
135141 policy . bypassWallets && policy . bypassWallets ?. length > 0
@@ -148,14 +154,13 @@ export function AccountAbstractionSettingsPage(
148154 } ,
149155 globalLimit : policy . limits ?. global ?? null ,
150156 allowedOrBlockedWallets :
151- policy . allowedWallets && policy . allowedWallets ?. length > 0
157+ allowedWallets && allowedWallets ?. length > 0
152158 ? "allowed"
153- : policy . blockedWallets && policy . blockedWallets ?. length > 0
159+ : blockedWallets && blockedWallets ?. length > 0
154160 ? "blocked"
155161 : null ,
156- } ) ,
157- [ policy ] ,
158- ) ;
162+ } ;
163+ } , [ policy ] ) ;
159164
160165 const form = useForm < z . infer < typeof aaSettingsFormSchema > > ( {
161166 resolver : zodResolver ( aaSettingsFormSchema ) ,
@@ -212,11 +217,12 @@ export function AccountAbstractionSettingsPage(
212217
213218 const parsedValues : Omit < ProjectBundlerService , "name" | "actions" > =
214219 {
215- allowedContractAddresses :
216- values . allowedContractAddresses !== null
217- ? toArrFromList ( values . allowedContractAddresses )
218- : null ,
219- allowedChainIds : values . allowedChainIds ,
220+ allowedContractAddresses : values . allowedContractAddresses
221+ ? toArrFromList ( values . allowedContractAddresses )
222+ : null ,
223+
224+ // don't set null - `updateProject` API adds chainId 0 to the list if its null and makes it `[0]`
225+ allowedChainIds : values . allowedChainIds || [ ] ,
220226 allowedWallets :
221227 values . allowedOrBlockedWallets === "allowed" &&
222228 values . allowedWallets !== null
0 commit comments