apibara / starknet-react

A collection of React providers and hooks for StarkNet
https://starknet-react.com
MIT License
364 stars 141 forks source link

Add support for estimate fees and simulate transactions #411

Closed VenkatTeja closed 1 month ago

VenkatTeja commented 6 months ago

As described in title, it would be good to have support for these two features. We could propose a standard and take help of wallets to do necessary integrations.

Reason for estimate fees: DApps will be able to show precise fee to users on their UI's itself

Reason for simulate: Dapps will be able to precisely use info on tokens in and out to give users easy clarity on what they would receive finally. Usually, this is an easy thing for simple contracts, but for projects like Hashstack.finance which involve integrations with different DeFi apps for swaps, liquidity provisions, staking etc, being able to write logic to estimate tokens output can itself be complex math. Given that the RPC supports simulation, exposing it could be easier and may even help others?

VenkatTeja commented 6 months ago

I haven't checked the project code in detail, but if project contributors think this can be implemented, I can try working on this.

fracek commented 6 months ago

Hello, yes I think it would be very useful. My understanding is that we need two steps:

VenkatTeja commented 6 months ago

@fracek will try to complete this and raise a PR.