api.call.transactionPaymentApi.queryInfo in the crawler code of Polkastats block explorer but I want to ask about the second parameter
len: is that the extrinsic lenght o what?
The encoded length of the extrinsic (ref).
Why is the len parameter required? The runtime doesn't know all the decoding context of the the encoded call (ref). So you can't just pass the encoded call and calculate the length in the runtime, because it won't be able to decode it properly.
Some references that helped me unravel this:
Thanks, in the your referenced code the function get the lenght directly from the provided encoded extrinsic, which makes sense. Wondering why in polkadot-js you need to provide it as a different parameter. As a side note, you can pass 0 as the
api.call.transactionPaymentApi.queryInfoand still get the same response. Dec 19, 2022 at 17:24
Updated my answer which might help. When you pass 0 the fees that are calculated are incorrect Dec 20, 2022 at 8:47
Thanks for the detailed answer and the references! Dec 20, 2022 at 9:22