Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide suggestions for upper and lower bounds for max priority fee #17037

Closed
saledjenic opened this issue Jan 8, 2025 · 3 comments · Fixed by #17053
Closed

Provide suggestions for upper and lower bounds for max priority fee #17037

saledjenic opened this issue Jan 8, 2025 · 3 comments · Fixed by #17053
Assignees
Milestone

Comments

@saledjenic
Copy link
Contributor

saledjenic commented Jan 8, 2025

For the time being, we're estimating low/medium/high fees as well as the tx time on our side using SuggestedFees and TransactionEstimatedTime functions of the FeeManager.

According to the new Send modal design we need base fee and priority fee ranges, that's something we don't have yet. So we need to think about how to calculate those ranges, while for estimated fees and time, we have some discrepancies comparing those values with Metamask.

Maybe it's a good time to start using suggestedGasFees call that provides all those details instead of calculating them on our side.
https://docs.metamask.io/services/reference/gas-api/api-reference/gasprices-type2

This is what the response looks like:
Image

Since it's a GET call to Infura that is using API key, what's the best way to integrate it into the app?
Do we want to add it to StatusProxy?
Do we need a similar logic we have for rpc providers?

@alaibe @shivekkhurana @friofry @dlipicar @alexjba

@alaibe
Copy link
Collaborator

alaibe commented Jan 8, 2025

@saledjenic can we call that from any provider or only infura offers it?

@dlipicar
Copy link
Contributor

dlipicar commented Jan 8, 2025

My opinion:
We should try to keep the wallet as operational as possible using standard JSON-RPC calls, particularly for the most basic wallet operations (fetching balances, send transaction). I know this is already not the case, but it doesn't mean we need to keep moving in that direction.
There's some reference implementations we can use as a guide if we wanted to do this ourselves: https://github.com/brave/brave-core/blob/master/components/brave_wallet/browser/eth_gas_utils.cc#L69

If it's not possible/practical, or as a short term solution until we decide we want to work on the first approach, we can just add the custom Infura API to the proxy. If these results are block-based, make sure we cache them (like I wish we did with prices obtained from CryptoCompare).

@saledjenic saledjenic changed the title Fetch estimated values for the tx instead of calculating them on our side Provide suggestions for upper and lower bounds for max priority fee Jan 10, 2025
@saledjenic
Copy link
Contributor Author

I was also searching a bit, and yes, the link you shared is a good one to implement.
It's implemented here: status-im/status-go#6243

Initially, I was thinking about https://github.com/zsfelfoldi/feehistory/blob/main/docs/feeOracle.md ( https://github.com/zsfelfoldi/feehistory/blob/main/js/feeOracle.js ) but that's not what we need. Maybe we can use that oracle and map the time factor to some real times (to 30 secs period for example, factor 1, less than 30 secs, factor 2 less than 1 min, factor 4 less than 1.5 min, factor 8 less than 2 mins, since we have factors as a power of 2 up to 128) and use that for calculating estimated time if we're not confident enough in our estimated time algorithm.

saledjenic added a commit that referenced this issue Jan 10, 2025
…se fee to the path v2 dto

The following properties added to the path v2 dto:
- suggestedMinPriorityFee
- suggestedMaxPriorityFee
- currentBaseFee

Path model of the new send modal updated with those properties.

Closes #17037
@saledjenic saledjenic moved this to Code Review in Status Desktop/Mobile Board Jan 10, 2025
saledjenic added a commit that referenced this issue Jan 17, 2025
…se fee to the path v2 dto

The following properties added to the path v2 dto:
- suggestedMinPriorityFee
- suggestedMaxPriorityFee
- currentBaseFee

Path model of the new send modal updated with those properties.

Closes #17037
@github-project-automation github-project-automation bot moved this from Code Review to Done in Status Desktop/Mobile Board Jan 17, 2025
@anastasiyaig anastasiyaig added this to the 2.33.0 Beta milestone Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment