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

feat(trading): gas fee estimation for withdraw transaction #5668

Merged
merged 7 commits into from Feb 1, 2024

Conversation

asiaznik
Copy link
Member

@asiaznik asiaznik commented Jan 25, 2024

Related issues 🔗

Closes #5510

Description ℹ️

This PR adds the gas fee estimation for the <WitdrawLimits> component. It colours the prices orange if the amount it between base and max price, and red if it's below the base fee.

Demo 📺

Screenshot 2024-01-25 at 19 40 14
Screenshot 2024-01-25 at 19 40 23

Shows in ETH when price is >1e6 gwei:
Screenshot 2024-01-30 at 15 13 16

Technical 👨‍🔧

The withdrawal amount (any asset) is only somewhat comparable to the estimated gas (ETH) fee only if they're both equalised to qUSD. This PR also adds the useWETH hook which looks for the WETH configuration (quantum is really what's needed) in the Vega's assets (it returns hardcoded values if not found, 1 WETH ~= 2000 qUSD).

Copy link

@daro-maj daro-maj self-assigned this Jan 30, 2024
Copy link
Member

@edd edd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise (non-blocking): Good test coverage for the important bits, and it's nicely broken up to make a complex thing understandable.

libs/utils/src/lib/format/ether.ts Outdated Show resolved Hide resolved
libs/web3/src/lib/use-gas-price.ts Show resolved Hide resolved
libs/withdraws/src/lib/withdraw-limits.tsx Show resolved Hide resolved
@daro-maj daro-maj merged commit 2002731 into develop Feb 1, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an estimate of gas fee's for withdrawals when releasing funds
4 participants