Skip to content

Commit

Permalink
Added get_param_info function to Variant (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
arjanz committed Aug 18, 2022
1 parent 6c897a0 commit b81c9c3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions scalecodec/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2111,6 +2111,23 @@ class GenericVariant(Struct):
def args(self):
return self.value_object['fields']

def get_param_info(self) -> dict:
"""
Generates a dictionary of all possible params with their decomposition information
Returns
-------
dict
"""
param_info = {}

for arg in self.args:
param_type_obj = self.runtime_config.create_scale_object(arg.type)

param_info[arg.name] = param_type_obj.scale_info_type.retrieve_type_decomposition()

return param_info

@property
def name(self):
return self.value['name']
Expand Down

0 comments on commit b81c9c3

Please sign in to comment.