Closed brenzi closed 2 years ago
oh, and worse: The above doesn't produce a legit batch call with a single balance transfer. It takes two calls to work. (or is that a js/apps issue when I use Developer-> Extrinsics-> Decode?
If I try to do a batch call, I'd expect to supply a list of
GenericCall
, and this worked previously (before the metadata V14 change, I believe)
I ran a few tests as this was indeed lost since the MetadataV14 upgrade of the library, as it didn't check if the value was a subclass of GenericCall
which is also valid. I fixed this in https://github.com/polkascan/py-scale-codec/commit/34a2fa5e35993aaa9f146be0bf37a2192fa37bd0 and will be available in next release.
Until that is released this will also work:
batch_call = substrate.compose_call(
call_module='Utility',
call_function='batch',
call_params={
'calls': [call.value for call in calls]
}
)
which replaces the field name
call_params
withcall_args
which seems inconsistent to me
Yes I agree.. This was one many things that changed along the development in parallel with the changes of Substrate over the years, but it needs some more refactor attention to make it more consistent. I'll make a separate issue for this.
oh, and worse: The above doesn't produce a legit batch call with a single balance transfer. It takes two calls to work. (or is that a js/apps issue when I use Developer-> Extrinsics-> Decode?
I couldn't reproduce this, I submitted an Utility.batch
extrinsic (with a list containing one call) to a local substrate-node-template and was received successful. Which Substrate implementation were you using?
Side note is that for substrate-node-template you probably need to instantiate with:
substrate = SubstrateInterface(
url="ws://127.0.0.1:9944",
type_registry_preset="substrate-node-template"
)
Because the default LookupSource
type there is not a MultiAddress
Hope this helps and thanks for reporting!
If I try to do a batch call, I'd expect to supply a list of
GenericCall
, and this worked previously (before the metadata V14 change, I believe)So, I'd expect this to work
But as I understand from https://github.com/polkascan/py-substrate-interface/issues/125#issuecomment-887488443 this is no longer supported, but I'll have to supply a dict instead:
which replaces the field name
call_params
withcall_args
which seems inconsistent to me