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

chore(cherry-pick): cherry picks Bitcoin related fixes/changes for V12.2.0 #26119

Closed
wants to merge 10 commits into from

Conversation

ccharly
Copy link
Contributor

@ccharly ccharly commented Jul 25, 2024

Description

Cherry picks Bitcoin related fixes/changes.

Open in GitHub Codespaces

Related issues

Fixes: https://github.com/MetaMask/accounts-planning/issues/535

Screenshots/Recordings

Before

N/A

After

N/A

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.

@ccharly ccharly self-assigned this Jul 25, 2024
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.

@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Jul 25, 2024
Copy link

socket-security bot commented Jul 25, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@metamask/[email protected] network 0 1.02 MB metamaskbot

🚮 Removed packages: npm/@metamask/[email protected])

View full report↗︎

Copy link

socket-security bot commented Jul 25, 2024

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSourceCI
Network access npm/@metamask/[email protected] 🚫
Network access npm/@metamask/[email protected] 🚫

View full report↗︎

Next steps

What is network access?

This module accesses the network.

Packages should remove all network access that is functionally unnecessary. Consumers should audit network access to ensure legitimate use.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

@ccharly ccharly force-pushed the v12.2.0-cherrypick-btc-fixes branch from cb30b56 to 591f099 Compare August 1, 2024 14:02
@ccharly ccharly force-pushed the v12.2.0-cherrypick-btc-fixes branch from d3ec470 to 4e97d4f Compare August 26, 2024 16:00
@ccharly ccharly marked this pull request as ready for review August 26, 2024 17:01
@ccharly ccharly requested review from a team as code owners August 26, 2024 17:01
@ccharly
Copy link
Contributor Author

ccharly commented Aug 27, 2024

Screenshots

Here are some screenshots to make sure the fixes are working as expect on top of the v12.2.0:

Bitcoin balance showing properly:

Screenshot 2024-08-27 at 09 56 09


Pre-installed Bitcoin Snap not showing:

Screenshot 2024-08-27 at 09 56 18


Account connection screen filters Bitcoin accounts:

Screenshot 2024-08-27 at 10 00 32
Screenshot 2024-08-27 at 10 00 49
Screenshot 2024-08-27 at 10 01 06


Cannot send to Bitcoin accounts while sending from an Ethereum account:

Screenshot 2024-08-27 at 10 01 26


Here's the link when you click on the "survey form" from the experimental tab:


Bitcoin Snap version is 0.3.0:

gantunesr and others added 9 commits August 29, 2024 10:49
…25884)

## **Description**

Fixing the balances fetching that happens a bit too frequently.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25884?quickstart=1)

## **Related issues**

Fixes: MetaMask/accounts-planning#527

## **Manual testing steps**

- Use `yarn start:flask`
- Enable Bitcoin support: Settings > Experimental > Bitcoin toggles
- Create Bitcoin accounts (mainnet, testnet or both)
- You should see your balances as usual

Extra steps:
- You can check your `Network` tabs on your dev-tools and look for
blockchair requests
- You should see 1 request (for each Bitcoin accounts) upon account
creation (to fetch the initial balance)
- You should NOT see any new requests when you're adding new Ethereum/HW
accounts or when selecting a new accounts (basically any changes to the
`AccountsController` should not trigger new fetches)
- You MIGHT see new requests after some time (around 10min, which is the
average block time of Bitcoin), to refresh the balance

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.
## **Description**

This PR updates the `@metamask/btc-wallet-snap` to version 0.2.5.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/26058?quickstart=1)

## **Related issues**

Fixes: <MetaMask/accounts-planning#534>

## **Manual testing steps**

N/A

## **Screenshots/Recordings**

### **Before**

N/A

### **After**

N/A

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.
# **Description**

Bump the BTC Snap to version 0.3.0.
- This new release adds the fee estimation feature.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25808?quickstart=1)

## **Related issues**

N/A

## **Manual testing steps**

N/A

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

This pr updates the e2e testing for user operations to use the latest
snap and removes the `submitRequest` permission from dapps.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/26276?quickstart=1)

## **Related issues**

Fixes: MetaMask/accounts-planning#554

## **Manual testing steps**

N/A

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

This PR filters BTC accounts from the permission connect list.

Fixes:

1. Create a BTC account
2. Connect to a dapp
3. Open popup
4. Click network icon
5. Click on `Connect more accounts`
6. See that there aren't any btc accounts

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

<!-- [screenshots/recordings] -->
![Screenshot 2024-07-19 at 21 09
57](https://github.com/user-attachments/assets/91dbd13d-c136-4666-ad3d-f57bd85d073d)

<!-- [screenshots/recordings] -->
![Screenshot 2024-07-19 at 21 04
04](https://github.com/user-attachments/assets/fded0169-c62d-4f2e-9ea0-abf345d711c6)

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

- [ ] 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.

---------

Co-authored-by: Charly Chevalier <[email protected]>
Co-authored-by: Daniel Rocha <[email protected]>
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

This PR removes BTC accounts from the account picker and `Your Accounts`
list in the send flow.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/26271?quickstart=1)

Fixes: MetaMask/accounts-planning#546

1. Create btc account
2. Select an evm account
3. Click send
4. See that the BTC account is not available in `Your Accounts`
5. Click the account picker and see that the BTC account is not
available.

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

<!-- [screenshots/recordings] -->
![Screenshot 2024-08-01 at 15 01
15](https://github.com/user-attachments/assets/42ab54eb-f97f-46d4-9179-8bc7d6a84fe1)
![Screenshot 2024-08-01 at 15 01
18](https://github.com/user-attachments/assets/e74b0d1a-3192-4831-a3cd-ccefe3e0c74f)

<!-- [screenshots/recordings] -->
![Screenshot 2024-08-01 at 14 58
39](https://github.com/user-attachments/assets/ba4b3136-766c-4222-afe4-ecbc455cb37c)
![Screenshot 2024-08-01 at 14 58
43](https://github.com/user-attachments/assets/6d9bef5b-68a9-4eee-9a11-672788855000)

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

- [ ] 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.

---------

Co-authored-by: Charly Chevalier <[email protected]>
## **Description**

Bump the BTC Snap to version 0.4.0.
- This new release adds the account name suggestion during account
creation, which allows us to use the new Snap account creation flow.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25808?quickstart=1)

## **Related issues**

N/A

## **Manual testing steps**

N/A

## **Screenshots/Recordings**

### **Before**

### **After**

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.
## **Description**

Bump the BTC Snap to version 0.5.0.

- This new release adds the new `getMaxSpendableBalance` method to fetch
the max spendable amount/balance from your account.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/26701?quickstart=1)

## **Related issues**

N/A

## **Manual testing steps**

N/A

## **Screenshots/Recordings**

### **Before**

### **After**

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.
@ccharly ccharly force-pushed the v12.2.0-cherrypick-btc-fixes branch from 5ededb3 to a19c4e1 Compare August 29, 2024 08:49
@ccharly ccharly removed the INVALID-PR-TEMPLATE PR's body doesn't match template label Aug 29, 2024
…ete callback

## **Why do we need this fix?**
Why do we need this fix?

This produces a linting error, now that `account-menu-list` is a `.tsx`
file.

## **Why don't we have this error on `develop`?**

This is because we are cherry-picking specific commits for BTC fixes,
but not all! (otherwise this would introduce much more changes)

The commit that converts `account-menu-list.js` to `.tsx` was not using
`CreateBtcAccount` on `develop` since this component has been replaced
by the new "Snap account creation flow" (which is not part of the
v12.2.0).

During the merge and conflict resolution, the `CreateBtcAccount` has
been kept, and now that we are using TypeScript for this file, this new
typing error occurs.
@ccharly ccharly added the DO-NOT-MERGE Pull requests that should not be merged label Aug 29, 2024
@ccharly ccharly marked this pull request as draft August 30, 2024 08:27
@ccharly
Copy link
Contributor Author

ccharly commented Sep 3, 2024

All those commits have been merged to the v12.2.0 already (using multiple PRs).

@ccharly ccharly closed this Sep 3, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
DO-NOT-MERGE Pull requests that should not be merged team-accounts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants