@@ -112,24 +112,31 @@ 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+ // there is a bug in API server that makes `allowedChainIds` an array with `0` if we set it to null
124+ const allowedChainIds = policy . allowedChainIds ?. filter ( ( x ) => x !== 0 ) ;
125+
126+ return {
117127 allowedChainIds :
118- policy . allowedChainIds && policy . allowedChainIds ?. length > 0
119- ? policy . allowedChainIds
120- : null ,
128+ allowedChainIds && allowedChainIds ?. length > 0 ? allowedChainIds : null ,
121129 allowedContractAddresses :
122- policy . allowedContractAddresses &&
123- policy . allowedContractAddresses ?. length > 0
124- ? joinWithComma ( policy . allowedContractAddresses )
130+ allowedContractAddresses && allowedContractAddresses . length > 0
131+ ? joinWithComma ( allowedContractAddresses )
125132 : null ,
126133 allowedWallets :
127- policy . allowedWallets && policy . allowedWallets ?. length > 0
128- ? joinWithComma ( policy . allowedWallets )
134+ allowedWallets && allowedWallets ?. length > 0
135+ ? joinWithComma ( allowedWallets )
129136 : null ,
130137 blockedWallets :
131- policy . blockedWallets && policy . blockedWallets ?. length > 0
132- ? joinWithComma ( policy . blockedWallets )
138+ blockedWallets && blockedWallets ?. length > 0
139+ ? joinWithComma ( blockedWallets )
133140 : null ,
134141 bypassWallets :
135142 policy . bypassWallets && policy . bypassWallets ?. length > 0
@@ -148,14 +155,13 @@ export function AccountAbstractionSettingsPage(
148155 } ,
149156 globalLimit : policy . limits ?. global ?? null ,
150157 allowedOrBlockedWallets :
151- policy . allowedWallets && policy . allowedWallets ?. length > 0
158+ allowedWallets && allowedWallets ?. length > 0
152159 ? "allowed"
153- : policy . blockedWallets && policy . blockedWallets ?. length > 0
160+ : blockedWallets && blockedWallets ?. length > 0
154161 ? "blocked"
155162 : null ,
156- } ) ,
157- [ policy ] ,
158- ) ;
163+ } ;
164+ } , [ policy ] ) ;
159165
160166 const form = useForm < z . infer < typeof aaSettingsFormSchema > > ( {
161167 resolver : zodResolver ( aaSettingsFormSchema ) ,
@@ -212,11 +218,12 @@ export function AccountAbstractionSettingsPage(
212218
213219 const parsedValues : Omit < ProjectBundlerService , "name" | "actions" > =
214220 {
215- allowedContractAddresses :
216- values . allowedContractAddresses !== null
217- ? toArrFromList ( values . allowedContractAddresses )
218- : null ,
219- allowedChainIds : values . allowedChainIds ,
221+ allowedContractAddresses : values . allowedContractAddresses
222+ ? toArrFromList ( values . allowedContractAddresses )
223+ : null ,
224+
225+ // don't set null - `updateProject` API adds chainId 0 to the list if its null and makes it `[0]`
226+ allowedChainIds : values . allowedChainIds || [ ] ,
220227 allowedWallets :
221228 values . allowedOrBlockedWallets === "allowed" &&
222229 values . allowedWallets !== null
0 commit comments