0

is it possible to calculate the weight (and transform to fees) for a given transaction ? I mean, I need to create a custom RPC method which will calculate that and return the fees.

Thank you

1

1 Answer 1

1

Yes, take a look at this How-to-guide in the Substrate website to see how to do it with the Transaction Payment Pallet.

Then you can apply this code to your pallet and create the custom RPC, I leave here a guide about how to create a custom RPC too.

2
  • thank you Alex, but its not really related to a pallet its for a transaction that we will pass as a parameter of our new custom rpc.
    – cibou
    Commented Oct 5, 2022 at 7:22
  • You can take a look about how the transaction payment pallet is doing it: github.com/paritytech/substrate/blob/master/frame/… to implement it yourself in your RPC code
    – Alex Bean
    Commented Oct 5, 2022 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.