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(TokenEnterAmount): add new flow to EarnEnterAmount.tsx #6246

Open
wants to merge 8 commits into
base: slava/change-send-flow
Choose a base branch
from

Conversation

sviderock
Copy link
Contributor

@sviderock sviderock commented Nov 19, 2024

Description

4/5 PR for new Enter Amount component. This PR uses the new component and hook on Earn flow.

Test plan

earn.flow.mp4

Related issues

Backwards compatibility

Yes

Network scalability

If a new NetworkId and/or Network are added in the future, the changes in this PR will:

  • Continue to work without code changes, OR trigger a compilation error (guaranteeing we find it when a new network is added)

Copy link

codecov bot commented Nov 19, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 5 lines in your changes missing coverage. Please review.

Project coverage is 88.99%. Comparing base (080de6d) to head (9e54474).
Report is 1 commits behind head on slava/change-send-flow.

Files with missing lines Patch % Lines
src/earn/EarnEnterAmount.tsx 91.22% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                    Coverage Diff                     @@
##           slava/change-send-flow    #6246      +/-   ##
==========================================================
+ Coverage                   88.93%   88.99%   +0.06%     
==========================================================
  Files                         739      739              
  Lines                       31593    31521      -72     
  Branches                     5567     5544      -23     
==========================================================
- Hits                        28097    28053      -44     
+ Misses                       3449     3421      -28     
  Partials                       47       47              
Files with missing lines Coverage Δ
src/components/TokenEnterAmount.tsx 94.70% <100.00%> (+0.07%) ⬆️
src/earn/EarnEnterAmount.tsx 93.68% <91.22%> (+6.77%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 080de6d...9e54474. Read the comment docs.

@sviderock sviderock marked this pull request as ready for review November 19, 2024 09:35
<TokenEnterAmount
autoFocus
testID="EarnEnterAmount"
token={inputToken}
Copy link
Contributor

Choose a reason for hiding this comment

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

this will need some special handling for withdraws. It looks like the TokenEnterAmount uses token.balance to populate "Available", but for withdraws, we actually have to use the LP token balance converted in deposit token (its 1:1 for aave and allbridge pools but not beefy pools). See balanceInInputToken field above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@satish-ravi I'll provide an option to define where "available" comes from so it can be overwritten!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@satish-ravi updated!

amountType={amountType}
toggleAmountType={handleToggleAmountType}
onOpenTokenPicker={dropdownEnabled ? onOpenTokenPicker : undefined}
tokenBalance={isWithdrawal ? balanceInInputToken : inputToken.balance}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@satish-ravi this should do the trick!

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.

2 participants