Skip to content

fix: update #disconnect to not revoke session on Solana disconnect via account changed event #48

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

Merged

Conversation

baptiste-marchand
Copy link
Contributor

@baptiste-marchand baptiste-marchand commented Jul 15, 2025

Description

This PR updates the disconnect logic to not revoke the session when called from an account changed event, while still revoking the session when called from the StandardDisconnect feature.

It fixes a bug where EVM scopes where being disconnected when removing all the Solana accounts from a session in MetaMask.

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/5376
Contributes to fixing https://github.com/MetaMask/MetaMask-planning/issues/5158

Manual testing steps

  1. Go to https://metamask.github.io/test-dapp-solana/staging/
  2. Connect with both an EVM and a Solana account
  3. Disconnect the Solana account from MetaMask by editing the permissions
  4. EVM account should still be connected

Screenshots/Recordings

Before

Screen.Recording.2025-07-15.at.11.24.15.mov

After

Screen.Recording.2025-07-15.at.11.26.58.mov

@baptiste-marchand baptiste-marchand requested a review from a team as a code owner July 15, 2025 09:27
@baptiste-marchand baptiste-marchand merged commit b89f4f6 into main Jul 15, 2025
22 checks passed
github-merge-queue bot pushed a commit to MetaMask/metamask-extension that referenced this pull request Jul 15, 2025
<!--
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 bumps @metamask/solana-wallet-standard to 0.5.1, to fix a bug
that was causing disconnection of EVM scopes when removing Solana
permissions while being connected with Wallet Standard.

The fix is to not call `wallet_revokeSession` when the Wallet Standard
disconnection comes from an `accountsChanged` event.
Related change:
MetaMask/solana-wallet-standard#48

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

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: null

## **Related issues**

Fixes: MetaMask/MetaMask-planning#5376
Contributes to fixing
MetaMask/MetaMask-planning#5158

## **Manual testing steps**

1. Go to https://metamask.github.io/test-dapp-solana/staging/
2. Connect with both an EVM and a Solana account
3. Disconnect the Solana account from MetaMask by editing the
permissions
4. EVM account should still be connected

## **Screenshots/Recordings**

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

### **Before**


https://github.com/user-attachments/assets/5d94e168-167c-4e61-b41f-ed0d72b600ec

### **After**


https://github.com/user-attachments/assets/8f147b29-246d-47d9-a72c-d86523357c7c

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.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.
github-merge-queue bot pushed a commit to MetaMask/metamask-extension that referenced this pull request Jul 15, 2025
<!--
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 bumps @metamask/solana-wallet-standard to 0.5.1, to fix a bug
that was causing disconnection of EVM scopes when removing Solana
permissions while being connected with Wallet Standard.

The fix is to not call `wallet_revokeSession` when the Wallet Standard
disconnection comes from an `accountsChanged` event.
Related change:
MetaMask/solana-wallet-standard#48

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

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: null

## **Related issues**

Fixes: MetaMask/MetaMask-planning#5376
Contributes to fixing
MetaMask/MetaMask-planning#5158

## **Manual testing steps**

1. Go to https://metamask.github.io/test-dapp-solana/staging/
2. Connect with both an EVM and a Solana account
3. Disconnect the Solana account from MetaMask by editing the
permissions
4. EVM account should still be connected

## **Screenshots/Recordings**

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

### **Before**


https://github.com/user-attachments/assets/5d94e168-167c-4e61-b41f-ed0d72b600ec

### **After**


https://github.com/user-attachments/assets/8f147b29-246d-47d9-a72c-d86523357c7c

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.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.
runway-github bot added a commit to MetaMask/metamask-extension that referenced this pull request Jul 16, 2025
<!--
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 bumps @metamask/solana-wallet-standard to 0.5.1, to fix a bug
that was causing disconnection of EVM scopes when removing Solana
permissions while being connected with Wallet Standard.

The fix is to not call `wallet_revokeSession` when the Wallet Standard
disconnection comes from an `accountsChanged` event.
Related change:
MetaMask/solana-wallet-standard#48

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

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: null

## **Related issues**

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/5376
Contributes to fixing
https://github.com/MetaMask/MetaMask-planning/issues/5158

## **Manual testing steps**

1. Go to https://metamask.github.io/test-dapp-solana/staging/
2. Connect with both an EVM and a Solana account
3. Disconnect the Solana account from MetaMask by editing the
permissions
4. EVM account should still be connected

## **Screenshots/Recordings**

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

### **Before**


https://github.com/user-attachments/assets/5d94e168-167c-4e61-b41f-ed0d72b600ec

### **After**


https://github.com/user-attachments/assets/8f147b29-246d-47d9-a72c-d86523357c7c

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.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.
runway-github bot added a commit to MetaMask/metamask-extension that referenced this pull request Jul 16, 2025
<!--
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 bumps @metamask/solana-wallet-standard to 0.5.1, to fix a bug
that was causing disconnection of EVM scopes when removing Solana
permissions while being connected with Wallet Standard.

The fix is to not call `wallet_revokeSession` when the Wallet Standard
disconnection comes from an `accountsChanged` event.
Related change:
MetaMask/solana-wallet-standard#48

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

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: null

## **Related issues**

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/5376
Contributes to fixing
https://github.com/MetaMask/MetaMask-planning/issues/5158

## **Manual testing steps**

1. Go to https://metamask.github.io/test-dapp-solana/staging/
2. Connect with both an EVM and a Solana account
3. Disconnect the Solana account from MetaMask by editing the
permissions
4. EVM account should still be connected

## **Screenshots/Recordings**

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

### **Before**

https://github.com/user-attachments/assets/5d94e168-167c-4e61-b41f-ed0d72b600ec

### **After**

https://github.com/user-attachments/assets/8f147b29-246d-47d9-a72c-d86523357c7c

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.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.
runway-github bot pushed a commit to MetaMask/metamask-extension that referenced this pull request Jul 16, 2025
…rd to 0.5.1 (#34281)

<!--
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 bumps @metamask/solana-wallet-standard to 0.5.1, to fix a bug
that was causing disconnection of EVM scopes when removing Solana
permissions while being connected with Wallet Standard.

The fix is to not call `wallet_revokeSession` when the Wallet Standard
disconnection comes from an `accountsChanged` event.
Related change:
MetaMask/solana-wallet-standard#48

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

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: null

## **Related issues**

Fixes: MetaMask/MetaMask-planning#5376
Contributes to fixing
MetaMask/MetaMask-planning#5158

## **Manual testing steps**

1. Go to https://metamask.github.io/test-dapp-solana/staging/
2. Connect with both an EVM and a Solana account
3. Disconnect the Solana account from MetaMask by editing the
permissions
4. EVM account should still be connected

## **Screenshots/Recordings**

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

### **Before**


https://github.com/user-attachments/assets/5d94e168-167c-4e61-b41f-ed0d72b600ec

### **After**


https://github.com/user-attachments/assets/8f147b29-246d-47d9-a72c-d86523357c7c

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.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.
DDDDDanica pushed a commit to MetaMask/metamask-extension that referenced this pull request Jul 16, 2025
## Original PR against main

#34281

<!--
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 bumps @metamask/solana-wallet-standard to 0.5.1, to fix a bug
that was causing disconnection of EVM scopes when removing Solana
permissions while being connected with Wallet Standard.

The fix is to not call `wallet_revokeSession` when the Wallet Standard
disconnection comes from an `accountsChanged` event.
Related change:
MetaMask/solana-wallet-standard#48

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

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: null

## **Related issues**

Fixes: MetaMask/MetaMask-planning#5376
Contributes to fixing
MetaMask/MetaMask-planning#5158

## **Manual testing steps**

1. Go to https://metamask.github.io/test-dapp-solana/staging/
2. Connect with both an EVM and a Solana account
3. Disconnect the Solana account from MetaMask by editing the
permissions
4. EVM account should still be connected

## **Screenshots/Recordings**

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

### **Before**


https://github.com/user-attachments/assets/5d94e168-167c-4e61-b41f-ed0d72b600ec

### **After**


https://github.com/user-attachments/assets/8f147b29-246d-47d9-a72c-d86523357c7c

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.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.
github-merge-queue bot pushed a commit to MetaMask/metamask-mobile that referenced this pull request Jul 17, 2025
## **Description**

This PR bumps @metamask/solana-wallet-standard to 0.5.1, to fix a bug
that was causing disconnection of EVM scopes when removing Solana
permissions while being connected with Wallet Standard.

The fix is to not call wallet_revokeSession when the Wallet Standard
disconnection comes from an accountsChanged event.
Related change:
MetaMask/solana-wallet-standard#48

## **Changelog**

CHANGELOG entry: null

## **Related issues**

Fixes: MetaMask/MetaMask-planning#5376
Contributes to fixing
MetaMask/MetaMask-planning#5158

## **Manual testing steps**

1. Go to https://metamask.github.io/test-dapp-solana/staging/
2. Connect with both an EVM and a Solana account
3. Disconnect the Solana account from MetaMask by editing the
permissions
4. EVM account should still be connected

## **Screenshots/Recordings**

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

### **Before**


https://github.com/user-attachments/assets/5d94e168-167c-4e61-b41f-ed0d72b600ec

### **After**


https://github.com/user-attachments/assets/8f147b29-246d-47d9-a72c-d86523357c7c

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.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.

Co-authored-by: Alex Donesky <[email protected]>
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