Skip to content

Commit

Permalink
Added max_recursion to get_param_info()
Browse files Browse the repository at this point in the history
  • Loading branch information
arjanz committed Dec 13, 2022
1 parent be2d9c8 commit 2120b4c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions scalecodec/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2290,7 +2290,7 @@ class GenericVariant(Struct):
def args(self):
return self.value_object['fields']

def get_param_info(self) -> dict:
def get_param_info(self, max_recursion: int = TYPE_DECOMP_MAX_RECURSIVE) -> dict:
"""
Generates a dictionary of all possible params with their decomposition information
Expand All @@ -2303,7 +2303,7 @@ def get_param_info(self) -> dict:
for arg in self.args:
param_type_obj = self.runtime_config.create_scale_object(arg.type)

param_info[arg.name] = param_type_obj.generate_type_decomposition()
param_info[arg.name] = param_type_obj.generate_type_decomposition(max_recursion=max_recursion)

return param_info

Expand Down Expand Up @@ -2572,7 +2572,7 @@ def get_param_hashers(self):
else:
raise NotImplementedError()

def get_param_info(self) -> list:
def get_param_info(self, max_recursion: int = TYPE_DECOMP_MAX_RECURSIVE) -> list:
raise NotImplementedError()


Expand Down Expand Up @@ -2624,7 +2624,7 @@ def get_param_hashers(self):
else:
raise NotImplementedError()

def get_param_info(self) -> list:
def get_param_info(self, max_recursion: int = TYPE_DECOMP_MAX_RECURSIVE) -> list:
"""
Return a type decomposition how to format parameters for current storage function
Expand All @@ -2635,14 +2635,14 @@ def get_param_info(self) -> list:
param_info = []
for param_type_string in self.get_params_type_string():
scale_type = self.runtime_config.create_scale_object(param_type_string)
param_info.append(scale_type.generate_type_decomposition())
param_info.append(scale_type.generate_type_decomposition(max_recursion=max_recursion))

return param_info


class GenericRuntimeCallDefinition(Struct):

def get_param_info(self) -> list:
def get_param_info(self, max_recursion: int = TYPE_DECOMP_MAX_RECURSIVE) -> list:
"""
Return a type decomposition how to format parameters for current storage function
Expand All @@ -2653,7 +2653,7 @@ def get_param_info(self) -> list:
param_info = []
for param in self.value['params']:
scale_type = self.runtime_config.create_scale_object(param['type'])
param_info.append(scale_type.generate_type_decomposition())
param_info.append(scale_type.generate_type_decomposition(max_recursion=max_recursion))

return param_info

Expand Down

0 comments on commit 2120b4c

Please sign in to comment.