-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Make get_dispatch_info
and weight_to_fee
Available via state_call
#11665
Make get_dispatch_info
and weight_to_fee
Available via state_call
#11665
Comments
This is already returned by
And should that not be doable with |
AFAIK, no, because it expects an extrinsic, not just a call. |
get_dispatch_info
and weight_to_fee
Available via RPCweight_to_fee
Available via RPC
weight_to_fee
Available via RPCget_dispatch_info
and weight_to_fee
Available via RPC
But is there any reason why you couldn't turn your call into an extrinsic and then submit it to these RPCs? It shouldn't matter with which key the extrinsic is signed. |
It's possible but it's also kind of a hack IMO. @TarikGul wrote this script to do that and that's what I use now. It also doesn't give you the weight and execution cost of the call, because it includes |
One thing I would like to add is that as we want to start using light client more, which doesn't supports custom RPC, we should avoid adding more custom RPC instead. The alternative solution is add new runtime API and use |
Yes, that's why I linked to the runtime API source in the main body. |
Had a chat with @bkontur |
Please keep in mind what @xlc said: Don't add a new RPC. Having a new runtime API should be enough in order to call it through |
get_dispatch_info
and weight_to_fee
Available via RPCget_dispatch_info
and weight_to_fee
Available via state_call
When constructing XCM Transact calls, it's useful to have an idea of how much weight some call will consume and how much that weight will cost in order to
BuyExecution
.query_info
only takes a fully encoded extrinsic and returns the weight and fee, but requires some hacks, namely:ExtrinsicBaseWeight
, which are not relevant in Transact.The addition of these two endpoints would allow submission of a
Call
and obtaining its weight and a fee estimate (with the user knowing that the weight to fee rate can be variable so they'll want to supply a little extra):fn get_dispatch_info(call) -> DispatchInfo { weight, ... };
(useful for specifying required weight)fn weight_to_fee(weight) -> Balance;
(useful for buying execution)Related: polkadot-js/apps#7688
The text was updated successfully, but these errors were encountered: