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
    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
    Oct 5, 2022 at 7:42

Your Answer

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

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