@@ -234,9 +234,27 @@ impl ContractCall {
234234 . as_array ( )
235235 . ok_or_else ( || "Expected array for complex type" . to_string ( ) ) ?;
236236
237- let dyn_sol_value = Self :: json_to_sol ( json_value, & json_abi_param. components ) ?;
238-
239- parsed_params. push ( DynSolValue :: Tuple ( dyn_sol_value) ) ;
237+ // if the json_abi_param.ty is tuple[],
238+ // then instead of deconstructing the json_value into the components directly,
239+ // we treat it as components[]
240+
241+ if json_abi_param. ty == "tuple[]" {
242+ // for each element in json_value, try to parse it as component
243+ let mut components = Vec :: new ( ) ;
244+ for element in json_value {
245+ let component = Self :: json_to_sol (
246+ element
247+ . as_array ( )
248+ . ok_or_else ( || "Expected array for complex type" . to_string ( ) ) ?,
249+ & json_abi_param. components ,
250+ ) ?;
251+ components. push ( DynSolValue :: Tuple ( component) ) ;
252+ }
253+ parsed_params. push ( DynSolValue :: Array ( components) ) ;
254+ } else {
255+ let dyn_sol_value = Self :: json_to_sol ( json_value, & json_abi_param. components ) ?;
256+ parsed_params. push ( DynSolValue :: Tuple ( dyn_sol_value) ) ;
257+ }
240258 } else {
241259 let sol_type: DynSolType = json_abi_param
242260 . ty
@@ -258,7 +276,6 @@ impl ContractCall {
258276 parsed_params. push ( parsed_value) ;
259277 }
260278 }
261-
262279 Ok ( parsed_params)
263280 }
264281
0 commit comments