3

I want to get extrinsic fee using polkadot.js/api.

I am checking kusama chain.

https://kusama.subscan.io/extrinsic/17981827-3

I need to get 0.00053835621 fee from above extrinsic. Which api can I use in polkadot.js/api?

1 Answer 1

3

I am not sure how Subscan is getting this values, but I believe to get the Used Fee you have to scan the events, see this previous answer in StackExchange: Is there a way to collect fee of transaction?

In particular for fees in balance transfers, a Withdraw event will tell us the fee amount the sender account paid whereas Deposit events will tell us the amount of that fee that was deposited to the Treasury account and the amount that was deposited as tip to the block validator account

The Estimated Fee you can estimated querying the queryFeeDetails call with the extrinsic encoded. See this previous answer as an example of how to do it using PolkadotJS: Estimated fee and Used fee

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.