fairDataSociety / fdp-contracts

Fair Data Protocol smart contracts and its utilities
4 stars 1 forks source link

`registerUsernameEstimateGas` method doesn't work for unregistered usernames #152

Closed IgorShadurin closed 1 year ago

IgorShadurin commented 1 year ago

The registerUsernameEstimateGas method seems to only work for estimating gas when the username has already been registered in the contract. It appears that other methods dependent on register cannot be estimated because they rely on the execution of register.

The best way to fix it should be found. One potential solution could be to estimate gas based on a username that is already registered in the contract. To implement this, we would need to make sure that the chosen username is registered across all networks.

IgorShadurin commented 1 year ago

eth_estimateGas will check the balance of the sender (to make sure that the sender has enough gas to complete the request). This means that even though the call doesn't consume any gas, the from address must have enough gas to execute the transaction.

https://docs.alchemy.com/reference/eth-estimategas

We are trying to get the gas cost before topping up the balance.