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(ramps): update isNativeTokenBuyable to include BTC #25621

Merged
merged 20 commits into from
Jul 10, 2024

Conversation

georgeweiler
Copy link
Contributor

@georgeweiler georgeweiler commented Jul 2, 2024

Description

  • updates the isNativeTokenBuyable function to consider bitcoin
  • updates the zero balance state for the ramps card to look at token balance instead of fiat balance

Open in GitHub Codespaces

Related issues

Fixes: #25657

Manual testing steps

# METAMASK_RAMP_API_CONTENT_BASE_URL=https://on-ramp-content.api.cx.metamask.io/ -- BTC DISABLED
# METAMASK_RAMP_API_CONTENT_BASE_URL=https://on-ramp-content.uat-api.cx.metamask.io/ -- BTC ENABLED

The following QA steps will allow you to test the permutations of this feature:

Verify that ERC20 Ramps card is still working for 0 balance accounts

  1. Install the Metamask flask extension
  2. Verify that the ERC20 Ramps card is still working for the selected network on accounts that have zero token balance

Verify ERC20 Ramps card is hidden for accounts with > 0 token balance

  1. Verify that the ERC20 Ramps card is does not appear on accounts that have > 0 token balance

Verify that BTC Ramps card is working

  1. configure .metamaskrc to access ramps UAT
  2. Install the Metamask flask extension and create a brand new wallet
  3. Add a bitcoin account via ramps-dev portfolio environment. It should have 0 BTC.
  4. Verify that the BTC Ramps card appears
  5. Verify that the correct URL params are added when clicking the "buy" CTA (deeplink UX does not work yet)

Verify that BTC Ramps card is hidden for accounts with > 0 BTC

  1. configure .metamaskrc to access ramps UAT
  2. Install the Metamask flask extension and recover a wallet that has > 0 BTC balance
  3. Add the bitcoin account via ramps-dev portfolio environment
  4. Verify that the BTC Ramps card does not appear

Verify that BTC Ramps card is hidden in PROD for all accounts

  1. configure .metamaskrc to access ramps PROD
  2. Install the Metamask flask extension create a new wallet
  3. Add a bitcoin account via ramps-dev portfolio environment. It should have 0 BTC
  4. Verify that the BTC Ramps card does not appear

Screenshots/Recordings

BTC card appears for 0 balance accounts:
Screenshot 2024-07-01 at 6 33 30 PM

BTC card does not appear for > 0 balance:
Screenshot 2024-07-09 at 10 14 07 AM

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

github-actions bot commented Jul 2, 2024

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.

@georgeweiler georgeweiler marked this pull request as ready for review July 3, 2024 15:20
@georgeweiler georgeweiler requested a review from a team as a code owner July 3, 2024 15:20
ui/components/app/asset-list/asset-list.js Outdated Show resolved Hide resolved
ui/components/app/asset-list/asset-list.js Outdated Show resolved Hide resolved
ui/components/app/wallet-overview/btc-overview.test.tsx Outdated Show resolved Hide resolved
ui/ducks/ramps/types.ts Outdated Show resolved Hide resolved
ui/selectors/multichain.ts Outdated Show resolved Hide resolved
Copy link

sonarcloud bot commented Jul 3, 2024

Copy link

codecov bot commented Jul 3, 2024

Codecov Report

Attention: Patch coverage is 95.83333% with 1 line in your changes missing coverage. Please review.

Project coverage is 69.68%. Comparing base (92ca197) to head (1534cf9).
Report is 7 commits behind head on develop.

Files Patch % Lines
ui/components/app/asset-list/asset-list.js 83.33% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #25621   +/-   ##
========================================
  Coverage    69.67%   69.68%           
========================================
  Files         1366     1366           
  Lines        48233    48248   +15     
  Branches     13305    13307    +2     
========================================
+ Hits         33606    33618   +12     
- Misses       14627    14630    +3     

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

@metamaskbot
Copy link
Collaborator

Builds ready [785472f]
Page Load Metrics (61 ± 9 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint58134882110
domContentLoaded95721126
load3812061199
domInteractive95721126
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 1.05 KiB (0.02%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [1534cf9]
Page Load Metrics (302 ± 265 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint581711032613
domContentLoaded95628126
load391621302552265
domInteractive95628126
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 1.05 KiB (0.02%)
  • common: 0 Bytes (0.00%)

Copy link
Member

@gantunesr gantunesr left a comment

Choose a reason for hiding this comment

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

lgtm

@gantunesr

This comment was marked as resolved.

@georgeweiler georgeweiler merged commit 420b93b into develop Jul 10, 2024
83 of 84 checks passed
@georgeweiler georgeweiler deleted the feature/btc-is-token-buyable branch July 10, 2024 23:47
@github-actions github-actions bot locked and limited conversation to collaborators Jul 10, 2024
@metamaskbot metamaskbot added the release-12.2.0 Issue or pull request that will be included in release 12.2.0 label Jul 10, 2024
@bkirb
Copy link

bkirb commented Jul 11, 2024

LGTM for QA ✅

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.2.0 Issue or pull request that will be included in release 12.2.0 team-ramp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: "Buy ETH" card appears when user has > 0 balance
5 participants