polkascan / py-substrate-interface

Python Substrate Interface
https://polkascan.github.io/py-substrate-interface/
Apache License 2.0
240 stars 114 forks source link

Introduce helper function to construct call params #236

Closed arjanz closed 2 years ago

arjanz commented 2 years ago

To get more information how to construct the params needed in substrate.compose_call, the process is something like:

call_function = substrate.get_metadata_call_function("XTokens", "transfer")

for arg in call_function.args:
    print('name:',  arg.name)
    param_type_obj = substrate.create_scale_object(arg.type)

    print('type info', param_type_obj.scale_info_type.retrieve_type_decomposition())

But should be more accessible like storage functions ScaleInfoStorageEntryMetadata.get_param_info()