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: STAKE-898: build select token component for earn products #13258

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Matt561
Copy link
Contributor

@Matt561 Matt561 commented Jan 29, 2025

Description

This PR adds the <EarnTokenList /> component which displays a list of supported staking and lending tokens. Portions of the EarnTokenList are still hardcoded until we add data-fetching.

Network Switching

  • The active network will be switched automatically if a token that isn't on the current network is selected (e.g. Base USDC)

Filtering Out Ineligible Tokens

  • Staking tokens won't be displayed in the list if a user isn't eligible to stake
  • Lending tokens won't be displayed in the list if a user isn't eligible to lend.

Token Display Order

  • Tokens where a user has a balance will be displayed first
  • Tokens where a user doesn't have a balance will still be displayed with an APR estimate.

Reason for change

This is part of the Stablecoin Lending initiative.

Related issues

Manual testing steps

  1. Add export MM_STABLECOIN_LENDING_UI_ENABLED=true to your .js.env file
  2. From the home screen (asset list), click on the wallet action button (the center blue bottom in the bottom tab bar with 2 arrows)
  3. Select the "Earn" action
  4. Select any token
  5. The network should change automatically if not already selected
  6. You should be redirected to the input screen. This screen should have a title of Stake ETH or Deposit ${token.symbol} depending on your selection during step 4

Screenshots/Recordings

Designs

https://www.figma.com/design/HSYn1fXfnBvDwHvBO1ZZHb/Earn?m=auto&node-id=7079-143568

Before

stake-898-build-token-list-component-before.mov

After

stake-898-build-token-list-component-after.mov

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@Matt561 Matt561 force-pushed the feat/stake-898/build-select-token-component-for-earn-products branch 5 times, most recently from c9898fa to 889ccdc Compare January 30, 2025 18:26
@Matt561 Matt561 marked this pull request as ready for review January 30, 2025 18:27
@Matt561 Matt561 requested review from a team as code owners January 30, 2025 18:27
@Matt561 Matt561 added team-stake Run Smoke E2E Triggers smoke e2e on Bitrise labels Jan 30, 2025
Copy link
Contributor

github-actions bot commented Jan 30, 2025

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 889ccdc
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/b5b21cae-dc4a-4d4c-8307-1500a295f939

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@Matt561 Matt561 changed the title Feat/stake 898/build select token component for earn products feat: STAKE-898: build select token component for earn products Jan 30, 2025
@Matt561 Matt561 force-pushed the feat/stake-898/build-select-token-component-for-earn-products branch 2 times, most recently from 0cce0b6 to f8c0070 Compare January 30, 2025 21:39
@Matt561
Copy link
Contributor Author

Matt561 commented Jan 30, 2025

Quality Gate Failed Quality Gate failed

Failed conditions 53.6% Duplication on New Code (required ≤ 10%)

See analysis details on SonarQube Cloud

@amitabh94 @nickewansmith The code duplication is 100% in the test mock data. Is there a way to bypass this warning?

@amitabh94
Copy link
Contributor

Quality Gate Failed Quality Gate failed

Failed conditions 53.6% Duplication on New Code (required ≤ 10%)
See analysis details on SonarQube Cloud

@amitabh94 @nickewansmith The code duplication is 100% in the test mock data. Is there a way to bypass this warning?

How about having a utility function to generate list of tokens or having a common list for fields used in all tokens like aggregators ?

@Matt561 Matt561 force-pushed the feat/stake-898/build-select-token-component-for-earn-products branch 4 times, most recently from 18b3b2d to 2a70144 Compare February 6, 2025 23:04
@Matt561 Matt561 added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Feb 6, 2025
Copy link
Contributor

github-actions bot commented Feb 6, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 2a70144
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/5ece0c34-7eed-4c50-9c61-33633c242ff9

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

Copy link
Contributor

@nickewansmith nickewansmith left a comment

Choose a reason for hiding this comment

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

Tests good, just a few minor comments and questions!

app/components/Views/WalletActions/WalletActions.tsx Outdated Show resolved Hide resolved
locales/languages/en.json Show resolved Hide resolved
app/components/Views/WalletActions/WalletActions.test.tsx Outdated Show resolved Hide resolved
app/components/UI/Stake/utils/token/token.test.ts Outdated Show resolved Hide resolved
app/components/UI/Stake/utils/network/index.ts Outdated Show resolved Hide resolved
@@ -12,5 +12,6 @@ export const EVENT_LOCATIONS = {
STAKE_CONFIRMATION_VIEW: 'StakeConfirmationView',
UNSTAKE_INPUT_VIEW: 'UnstakeInputView',
UNSTAKE_CONFIRMATION_VIEW: 'UnstakeConfirmationView',
TAB_BAR: 'TabBar',
Copy link
Contributor

Choose a reason for hiding this comment

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

Which tab bar is this referring to? I may be missing context about it, but maybe there could be a more descriptive name.

Copy link
Contributor Author

@Matt561 Matt561 Feb 7, 2025

Choose a reason for hiding this comment

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

I agree that this is a bit ambiguous. This is the value for other events in the WalletActions.tsx file. I'll rename it to be more descriptive.

How about WalletActionsBottomSheet?

amitabh94
amitabh94 previously approved these changes Feb 7, 2025
Copy link
Contributor

@amitabh94 amitabh94 left a comment

Choose a reason for hiding this comment

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

A small high level comment but overall LGTM!

Copy link
Contributor

Choose a reason for hiding this comment

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

We can keep the filtering logic here for now but we can also have this whole logic on the controller side and just fetch the list of tokens that user is eligible to earn on from the Earn controller state.
All the filtering and eligibility check happens on the controller side and UI layer is responsible for only rendering the supported token list for user fetched from the state.

@Matt561 Matt561 force-pushed the feat/stake-898/build-select-token-component-for-earn-products branch 2 times, most recently from f230c33 to 990d867 Compare February 7, 2025 22:26
@Matt561 Matt561 force-pushed the feat/stake-898/build-select-token-component-for-earn-products branch from 990d867 to da49fe3 Compare February 8, 2025 19:40
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 83.76068% with 19 lines in your changes missing coverage. Please review.

Project coverage is 61.88%. Comparing base (1937f9a) to head (da49fe3).
Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
...onents/UI/Stake/components/EarnTokenList/index.tsx 81.35% 4 Missing and 7 partials ⚠️
app/components/UI/Stake/testUtils/index.ts 75.00% 2 Missing and 2 partials ⚠️
app/components/UI/Stake/utils/token/index.ts 92.59% 1 Missing and 1 partial ⚠️
...s/UI/Stake/Views/StakeInputView/StakeInputView.tsx 50.00% 0 Missing and 1 partial ⚠️
.../components/UI/Stake/Views/StakeInputView/utils.ts 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13258      +/-   ##
==========================================
+ Coverage   61.58%   61.88%   +0.30%     
==========================================
  Files        1953     1975      +22     
  Lines       43442    43903     +461     
  Branches     5835     5943     +108     
==========================================
+ Hits        26753    27170     +417     
- Misses      14905    14925      +20     
- Partials     1784     1808      +24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Matt561 Matt561 added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Feb 8, 2025
@Matt561 Matt561 requested a review from nickewansmith February 8, 2025 19:52
Copy link
Contributor

github-actions bot commented Feb 8, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: da49fe3
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/6cc38392-b19a-48c6-8d93-a1face32eaff

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@Matt561 Matt561 requested a review from amitabh94 February 8, 2025 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Run Smoke E2E Triggers smoke e2e on Bitrise team-stake
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants