-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error composing call using latest substrate #344
Comments
I'm not sure which runtime you are connecting to, but it seems the parameter structure changed/is incorrect for that call. What you can do is to check the composition of the params for that call: https://polkascan.github.io/py-substrate-interface/usage/extrinsics/#type-decomposition-of-call-params More information how to interpret that info: https://polkascan.github.io/py-substrate-metadata-docs/ If your runtime is already listed there you can directly lookup the call param composition info. |
Seems like on latest polkadot if a call has like a vector of something (some objects) as input, the input needs to be wrapped with another |
That is indeed strange. I can examine the structure in the |
I ran some tests on the product endpoint I found on the tfchain Github, I could compose the call above as followed: Retrieve the type composition with: call_function = substrate.get_metadata_call_function("TfgridModule", "create_node")
params = call_function.get_param_info()
# {'farm_id': 'u32', 'resources': {'hru': 'u64', 'sru': 'u64', 'cru': 'u64', 'mru': 'u64'}, 'location': {'city': 'Bytes', 'country': 'Bytes', 'latitude': 'Bytes', 'longitude': 'Bytes'}, 'interfaces': [{'name': 'Bytes', 'mac': 'Bytes', 'ips': ['Bytes']}], 'secure_boot': 'bool', 'virtualized': 'bool', 'serial_number': (None, 'Bytes')} Then entered some dummy data: call = substrate.compose_call("TfgridModule", "create_node", {
'farm_id': 1,
'resources': {'hru': 1, 'sru': 1, 'cru': 1, 'mru': 1},
'location': {'city': 'Test', 'country': 'Test', 'latitude': 'Test', 'longitude': 'Test'},
'interfaces': [{'name': 'Test', 'mac': 'Test', 'ips': ['Test', 'Test2']}, {'name': 'Test2', 'mac': 'Test2', 'ips': ['Test', 'Test2']}],
'secure_boot': True, 'virtualized': True, 'serial_number': None
})
# 0x0b0801000000010000000000000001000000000000000100000000000000010000000000000010546573741054657374105465737410546573740810546573741054657374081054657374145465737432145465737432145465737432081054657374145465737432010100 Seems my |
When using using substrate on branch
polkadot-0.9.42
we got the following error trying to compose a call:The text was updated successfully, but these errors were encountered: