Skip to content

Commit

Permalink
feat: replace experimental add solana account with remote flag (#30487)
Browse files Browse the repository at this point in the history
<!--
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**

- [x] Removes experimental `Enable "Add Solana account"` setting
- [x] Adds remote feature flag fence
- [x] Enable feature in `flask - dev` 

<!--
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?
-->

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

## **Related issues**

Fixes:

## **Manual testing steps**

1. Add `MANIFEST_OVERRIDES=.manifest-overrides.json` to the
`.metamaskrc`
2. Create a `.manifest-overrides.json` file 
3. Add the following content
```
{
  "_flags": {
    "remoteFeatureFlags": { "addSolanaAccount": true }
  }
}
```
4. Build
5. Modify the value to test both cases (enabled/disabled)

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

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

- [x] 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.
  • Loading branch information
aganglada authored Feb 25, 2025
1 parent 32c2077 commit 0ad093f
Show file tree
Hide file tree
Showing 29 changed files with 34 additions and 302 deletions.
9 changes: 0 additions & 9 deletions app/_locales/de/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/_locales/el/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/_locales/en_GB/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/_locales/es/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/_locales/fr/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/_locales/hi/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/_locales/id/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/_locales/ja/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/_locales/ko/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/_locales/pt/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/_locales/ru/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/_locales/tl/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/_locales/tr/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/_locales/vi/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/_locales/zh_CN/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 0 additions & 15 deletions app/scripts/controllers/preferences-controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -875,19 +875,4 @@ describe('preferences controller', () => {
);
});
});

describe('setSolanaSupportEnabled', () => {
const { controller } = setupController({});
it('has the default value as false', () => {
expect(controller.state.solanaSupportEnabled).toStrictEqual(false);
});

it('sets the solanaSupportEnabled property in state to true and then false', () => {
controller.setSolanaSupportEnabled(true);
expect(controller.state.solanaSupportEnabled).toStrictEqual(true);

controller.setSolanaSupportEnabled(false);
expect(controller.state.solanaSupportEnabled).toStrictEqual(false);
});
});
});
24 changes: 0 additions & 24 deletions app/scripts/controllers/preferences-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ export type PreferencesControllerState = Omit<
///: BEGIN:ONLY_INCLUDE_IF(build-flask)
watchEthereumAccountEnabled: boolean;
///: END:ONLY_INCLUDE_IF
///: BEGIN:ONLY_INCLUDE_IF(solana)
solanaSupportEnabled: boolean;
///: END:ONLY_INCLUDE_IF
///: BEGIN:ONLY_INCLUDE_IF(bitcoin)
bitcoinSupportEnabled: boolean;
bitcoinTestnetSupportEnabled: boolean;
Expand Down Expand Up @@ -189,9 +186,6 @@ export const getDefaultPreferencesControllerState =
openSeaEnabled: true,
securityAlertsEnabled: true,
watchEthereumAccountEnabled: false,
///: BEGIN:ONLY_INCLUDE_IF(solana)
solanaSupportEnabled: false,
///: END:ONLY_INCLUDE_IF
bitcoinSupportEnabled: false,
bitcoinTestnetSupportEnabled: false,
///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps)
Expand Down Expand Up @@ -342,10 +336,6 @@ const controllerMetadata = {
persist: true,
anonymous: false,
},
solanaSupportEnabled: {
persist: true,
anonymous: false,
},
bitcoinSupportEnabled: {
persist: true,
anonymous: false,
Expand Down Expand Up @@ -665,20 +655,6 @@ export class PreferencesController extends BaseController<
}
///: END:ONLY_INCLUDE_IF

///: BEGIN:ONLY_INCLUDE_IF(solana)
/**
* Setter for the `solanaSupportEnabled` property.
*
* @param solanaSupportEnabled - Whether or not the user wants to
* enable the "Add a new Solana account" button.
*/
setSolanaSupportEnabled(solanaSupportEnabled: boolean): void {
this.update((state) => {
state.solanaSupportEnabled = solanaSupportEnabled;
});
}
///: END:ONLY_INCLUDE_IF

///: BEGIN:ONLY_INCLUDE_IF(bitcoin)
/**
* Setter for the `bitcoinSupportEnabled` property.
Expand Down
6 changes: 0 additions & 6 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3228,12 +3228,6 @@ export default class MetamaskController extends EventEmitter {
preferencesController,
),
///: END:ONLY_INCLUDE_IF
///: BEGIN:ONLY_INCLUDE_IF(solana)
setSolanaSupportEnabled:
preferencesController.setSolanaSupportEnabled.bind(
preferencesController,
),
///: END:ONLY_INCLUDE_IF
///: BEGIN:ONLY_INCLUDE_IF(bitcoin)
setBitcoinSupportEnabled:
preferencesController.setBitcoinSupportEnabled.bind(
Expand Down
1 change: 0 additions & 1 deletion shared/constants/metametrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,6 @@ export enum MetaMetricsEventName {
BridgeLinkClicked = 'Bridge Link Clicked',
BitcoinSupportToggled = 'Bitcoin Support Toggled',
BitcoinTestnetSupportToggled = 'Bitcoin Testnet Support Toggled',
SolanaSupportToggled = 'Solana Support Toggled',
CurrentCurrency = 'Current Currency',
DappViewed = 'Dapp Viewed',
DecryptionApproved = 'Decryption Approved',
Expand Down
1 change: 0 additions & 1 deletion test/data/mock-state.json
Original file line number Diff line number Diff line change
Expand Up @@ -1961,7 +1961,6 @@
"watchEthereumAccountEnabled": false,
"bitcoinSupportEnabled": false,
"bitcoinTestnetSupportEnabled": false,
"solanaSupportEnabled": false,
"pendingApprovals": {
"testApprovalId": {
"id": "testApprovalId",
Expand Down
4 changes: 0 additions & 4 deletions test/e2e/flask/solana/check-balance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ describe('Check balance', function (this: Suite) {
await withSolanaAccountSnap(
{
title: this.test?.fullTitle(),
solanaSupportEnabled: true,
showNativeTokenAsMainBalance: true,
},
async (driver) => {
Expand All @@ -22,7 +21,6 @@ describe('Check balance', function (this: Suite) {
await withSolanaAccountSnap(
{
title: this.test?.fullTitle(),
solanaSupportEnabled: true,
showNativeTokenAsMainBalance: false,
},
async (driver) => {
Expand All @@ -36,7 +34,6 @@ describe('Check balance', function (this: Suite) {
await withSolanaAccountSnap(
{
title: this.test?.fullTitle(),
solanaSupportEnabled: true,
showNativeTokenAsMainBalance: true,
mockCalls: true,
},
Expand All @@ -51,7 +48,6 @@ describe('Check balance', function (this: Suite) {
await withSolanaAccountSnap(
{
title: this.test?.fullTitle(),
solanaSupportEnabled: true,
showNativeTokenAsMainBalance: false,
mockCalls: true,
},
Expand Down
Loading

0 comments on commit 0ad093f

Please sign in to comment.