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(tangle-dapp): Add liquid staking unstaking card #2415

Merged
merged 70 commits into from
Jul 22, 2024

Conversation

yurixander
Copy link
Member

@yurixander yurixander commented Jul 4, 2024

Summary of changes

Provide a detailed description of proposed changes.

  • ➕ Ability to redeem (schedule unstake) minted tokens on the Parachain.
  • ➕ Added hook to calculate exchange rate for minting and redeeming for any given token/LST.
  • ➕ Created hook for fetching ongoing time units, as well as basic logic for estimating unlock times. This will be completed in my future PRs.
  • ➕ Mint/redeem fees are also calculated and displayed.
  • ➕ Wallet balance for the selected token is now fetched from the parachain and shown. It also shows a skeleton loader when loading.
  • 🖌️ Implemented designs of unstake card, unstaking requests table, unstake confirmation modal, cancel unstake modal, and more.
  • 🔧 Added missing check required when redeeming: Check that all delegations aren't occupied, otherwise the redeem extrinsic will fail.
  • 🔧 Refactored some utility functions, fixing bugs and making the code clearer (ex. formatBn no longer uses confusing regex).
  • 🐛 Fixed bug with the formatBn function which was causing certain values like 0.0001 to be incorrectly formatted as 0.1.

Proposed area of change

Put an x in the boxes that apply.

  • apps/bridge-dapp
  • apps/hubble-stats
  • apps/stats-dapp
  • apps/tangle-dapp
  • apps/testnet-leaderboard
  • apps/faucet
  • apps/zk-explorer
  • libs/webb-ui-components

Reference issue to close (if applicable)

Specify any issues that can be closed from these changes (e.g. Closes #233).

Screen Recording

If possible provide a screen recording of proposed change.

liquid-staking-unstake.webm

Code Checklist

Please be sure to add .stories documentation if any additions are made to libs/webb-ui-components.

  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@yurixander yurixander self-assigned this Jul 4, 2024
Copy link

netlify bot commented Jul 4, 2024

Deploy Preview for tangle-dapp ready!

Name Link
🔨 Latest commit 54e0dbb
🔍 Latest deploy log https://app.netlify.com/sites/tangle-dapp/deploys/669e3df12f3a320008dbd83a
😎 Deploy Preview https://deploy-preview-2415--tangle-dapp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@yurixander yurixander requested a review from monaiuu July 11, 2024 02:58
@yurixander yurixander marked this pull request as ready for review July 18, 2024 04:51
Copy link
Contributor

@vutuanlinh2k2 vutuanlinh2k2 left a comment

Choose a reason for hiding this comment

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

Just 1 comment, otherwise LGTM!

Copy link
Contributor

@monaiuu monaiuu left a comment

Choose a reason for hiding this comment

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

  • Update copy for modal to remove mention of NFTs: "After the schedule period completes, you can withdraw unstaked tokens."
  • Update button to view explorer instead.
Screenshot 2024-07-18 at 6 10 21 PM
  • Unsure if it is due to the background image, but the transaction input components seem inconsistent to latest Figma designs, default, hover, and error states can be referenced here in design system
    • Wallet balance
    • Select validators button
    • Select network dropdown button
    • Have a blue/purple (Tangle's primary color) border to denote tg versions of the tokens' icons
    • Chevron icons & on-hover styling of them
Screenshot 2024-07-18 at 6 24 58 PM Screenshot 2024-07-18 at 6 17 39 PM Screenshot 2024-07-18 at 6 21 32 PM

(the above components should be reused in restaking as well, unsure if @AtelyPham has worked on these)

  • Remove background fill to fees component

@vutuanlinh2k2
Copy link
Contributor

vutuanlinh2k2 commented Jul 19, 2024

@yurixander I got overflow UI when using Arc browser on Liquid Staking page

  • Fix UI overflow

CleanShot 2024-07-19 at 15 21 50@2x

Copy link
Member

@AtelyPham AtelyPham left a comment

Choose a reason for hiding this comment

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

Left some comments.

apps/tangle-dapp/components/LiquidStaking/AddressLink.tsx Outdated Show resolved Hide resolved
apps/tangle-dapp/components/LiquidStaking/ExternalLink.tsx Outdated Show resolved Hide resolved
apps/tangle-dapp/components/LiquidStaking/IconButton.tsx Outdated Show resolved Hide resolved
apps/tangle-dapp/utils/addCommasToNumber.ts Outdated Show resolved Hide resolved
apps/tangle-dapp/utils/calculateBnRatio.ts Show resolved Hide resolved
Copy link
Member

@AtelyPham AtelyPham left a comment

Choose a reason for hiding this comment

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

LGTM 👍! The CI is still failing @yurixander.

@yurixander
Copy link
Member Author

@vutuanlinh2k2 I'm not seeing the UI overflow problem on my end, also the UI on your screenshot seems to be from previous code... do you happen to be on the most up to date version of this branch?

@yurixander
Copy link
Member Author

@AtelyPham Seems like a tiny bug regarding table headers was introduced in #2436:
image

@yurixander yurixander requested a review from monaiuu July 21, 2024 11:46
@AtelyPham
Copy link
Member

@AtelyPham Seems like a tiny bug regarding table headers was introduced in #2436: image

Can you check again on the develop branch? I don't see the error on the live development site.

CleanShot 2024-07-21 at 19 16 37@2x

@yurixander
Copy link
Member Author

yurixander commented Jul 22, 2024

@AtelyPham Check here: https://deploy-preview-2436--tangle-dapp.netlify.app/nomination, for some reason the dev branch preview doesn't show the problem, but that link (the deploy preview of #2436) does. The problem also occurred after merging those changes for me.
image

@yurixander yurixander merged commit 3f7904b into develop Jul 22, 2024
12 checks passed
@yurixander yurixander deleted the yuri/ls-unstaking-card branch July 22, 2024 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT] Unstake Flow to redeem tgTokens (ie. from tgDOT back to DOT)
4 participants