How to make a estimated transaction fee preview

I’m creating a broser wallet. The feature that I’m writing needs to obtain the estimated transaction fee as the current web wallet is doing.
Screenshot 2023-09-27 at 12.12.03

From what i’m able to see here the fee is being calculated using this.
The feature that i’m implementing needs to calculate the fees only for simple transfers of CCD.
I don’t understand what are that tokenId and contractIndex in my case

Simple transfer has a fixed NRG cost of 501 NRG (for transfers without a memo).

You can then get the exchange rate of NRG/CCD by querying chain parameters using GetBlockChainParameters. From this you can compute the cost of the transaction in CCD (estimated).

This is the response that i get calling GetBlockChainParameters, what do i have to multiply to 501 ?

If you multiply microGTUPerEuro with euroPerEnergy you will get the exchange rate between micro CCD and NRG.

Multiply the NRG cost by that (of course 1 CCD is 1_000_000 microCCD).

Ok thanks for the help

1 Like