Skip to content

Commit

Permalink
Check if pallet has call functions (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
arjanz authored Feb 7, 2024
1 parent 17ddfd8 commit 226eb42
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scalecodec/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1646,12 +1646,13 @@ def process_encode(self, value):

data = ScaleBytes(self.call_module['index'].get_used_bytes())

call_type_string = self.call_module['calls'].value_object.get_type_string()

call_obj = self.runtime_config.create_scale_object(call_type_string)
if self.call_module['calls'].value_object:
# Retrieve call function
call_type_string = self.call_module['calls'].value_object.get_type_string()
call_obj = self.runtime_config.create_scale_object(call_type_string)

# Retrieve used variant of call type
self.call_function = call_obj.scale_info_type['def'][1].get_variant_by_name(value['call_function'])
# Retrieve used variant of call type
self.call_function = call_obj.scale_info_type['def'][1].get_variant_by_name(value['call_function'])

if not self.call_function:
raise ValueError(f"Call function '{value['call_module']}.{value['call_function']}' not found")
Expand Down

0 comments on commit 226eb42

Please sign in to comment.