@@ -112,24 +112,31 @@ export function AccountAbstractionSettingsPage(
112
112
113
113
const policy = props . bundlerService ;
114
114
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 {
117
127
allowedChainIds :
118
- policy . allowedChainIds && policy . allowedChainIds ?. length > 0
119
- ? policy . allowedChainIds
120
- : null ,
128
+ allowedChainIds && allowedChainIds ?. length > 0 ? allowedChainIds : null ,
121
129
allowedContractAddresses :
122
- policy . allowedContractAddresses &&
123
- policy . allowedContractAddresses ?. length > 0
124
- ? joinWithComma ( policy . allowedContractAddresses )
130
+ allowedContractAddresses && allowedContractAddresses . length > 0
131
+ ? joinWithComma ( allowedContractAddresses )
125
132
: null ,
126
133
allowedWallets :
127
- policy . allowedWallets && policy . allowedWallets ?. length > 0
128
- ? joinWithComma ( policy . allowedWallets )
134
+ allowedWallets && allowedWallets ?. length > 0
135
+ ? joinWithComma ( allowedWallets )
129
136
: null ,
130
137
blockedWallets :
131
- policy . blockedWallets && policy . blockedWallets ?. length > 0
132
- ? joinWithComma ( policy . blockedWallets )
138
+ blockedWallets && blockedWallets ?. length > 0
139
+ ? joinWithComma ( blockedWallets )
133
140
: null ,
134
141
bypassWallets :
135
142
policy . bypassWallets && policy . bypassWallets ?. length > 0
@@ -148,14 +155,13 @@ export function AccountAbstractionSettingsPage(
148
155
} ,
149
156
globalLimit : policy . limits ?. global ?? null ,
150
157
allowedOrBlockedWallets :
151
- policy . allowedWallets && policy . allowedWallets ?. length > 0
158
+ allowedWallets && allowedWallets ?. length > 0
152
159
? "allowed"
153
- : policy . blockedWallets && policy . blockedWallets ?. length > 0
160
+ : blockedWallets && blockedWallets ?. length > 0
154
161
? "blocked"
155
162
: null ,
156
- } ) ,
157
- [ policy ] ,
158
- ) ;
163
+ } ;
164
+ } , [ policy ] ) ;
159
165
160
166
const form = useForm < z . infer < typeof aaSettingsFormSchema > > ( {
161
167
resolver : zodResolver ( aaSettingsFormSchema ) ,
@@ -212,11 +218,12 @@ export function AccountAbstractionSettingsPage(
212
218
213
219
const parsedValues : Omit < ProjectBundlerService , "name" | "actions" > =
214
220
{
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 || [ ] ,
220
227
allowedWallets :
221
228
values . allowedOrBlockedWallets === "allowed" &&
222
229
values . allowedWallets !== null
0 commit comments