Skip to content

Commit 8ab1426

Browse files
agangladazone-liveAndepandeNicolasMassart
authored
feat: cp-7.47.0 solana code fences (#15297)
## **Description** - enables the Solana and Non-EVM code by moving the code fence flags to the main set. - this change makes all the Solana and Non-EVM features available in main build. > [!NOTE] > The `keyring-snaps` is the code fence flag that allows for snaps like the `solana`, `bitcoin`, any keyring snap to work, the Solana snap and bitcoin snap are keyring-snaps. > This code fence has all the broad/general code for non-evm snaps, and then for specific network logic we have the solana, bitcoin etc... ## **Related issues** Fixes: the current feature is under code fencing, only available in our beta build, it has to be moved from beta to main set to be available in the next release. ## **Manual testing steps** ```gherkin Feature: Solana Scenario: user opens new app install Given the app is installed and wallet created When user lands on wallet screen Then user sees the new Solana feature announcement bottom sheet And user sees in the accounts list "add Solana account" And user sees in the network tab "Solana" Scenario: user opens updated app Given the app is updated with wallet already created When user logs in Then user sees the new Solana feature announcement bottom sheet And user sees in the accounts list "add Solana account" And user sees in the network tab "Solana" ``` ## **Screenshots/Recordings** ### **Before** #### Add account <img width="340" alt="add account screenshot" src="https://github.com/user-attachments/assets/2473cd0b-cfcd-4c4a-8f8e-73143e16315d" /> #### Select network <img width="340" alt="select network screenshot" src="https://github.com/user-attachments/assets/632f52cc-1013-4573-853d-178e372e220c" /> ### **After** #### New welcome bottom sheet <img width="340" alt="new welcome modal screenshot" src="https://github.com/user-attachments/assets/8124a0cd-e4b2-4daf-bdef-c08e7ff18516" /> #### Add account <img width="340" alt="add account screenshot" src="https://github.com/user-attachments/assets/5771e51a-6688-4d26-91df-7d7da622feba" /> #### Select network <img width="340" alt="select network screenshot" src="https://github.com/user-attachments/assets/54e3a06c-1d65-41dc-a2c2-eef8fb5a3c37" /> ## **Pre-merge author checklist** - [x] 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). - [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-mobile/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). - [x] 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: António Regadas <antonio.regadas@consensys.net> Co-authored-by: yande <110056475+Andepande@users.noreply.github.com> Co-authored-by: Nico MASSART <NicolasMassart@users.noreply.github.com>
1 parent ebce0f0 commit 8ab1426

File tree

6 files changed

+118
-6
lines changed

6 files changed

+118
-6
lines changed

app/components/UI/SolanaNewFeatureContent/SolanaNewFeatureContent.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import Engine from '../../../core/Engine';
2626
import { SOLANA_NEW_FEATURE_CONTENT_LEARN_MORE } from '../../../constants/urls';
2727
import Routes from '../../../constants/navigation/Routes';
2828
import { useNavigation } from '@react-navigation/native';
29+
import { SolanaNewFeatureSheetSelectorsIDs } from '../../../../e2e/selectors/wallet/SolanaNewFeatureSheet.selectors';
2930

3031
const SolanaNewFeatureContent = () => {
3132
const [isVisible, setIsVisible] = useState(false);
@@ -132,6 +133,7 @@ const SolanaNewFeatureContent = () => {
132133
variant={ButtonVariants.Link}
133134
label={strings('solana_new_feature_content.learn_more')}
134135
onPress={onLearnMoreClicked}
136+
testID={SolanaNewFeatureSheetSelectorsIDs.SOLANA_LEARN_MORE_BUTTON}
135137
/>
136138
<Button
137139
variant={ButtonVariants.Primary}
@@ -144,13 +146,15 @@ const SolanaNewFeatureContent = () => {
144146
hasExistingSolanaAccount ? viewSolanaAccount : createSolanaAccount
145147
}
146148
width={ButtonWidthTypes.Full}
149+
testID={SolanaNewFeatureSheetSelectorsIDs.SOLANA_CREATE_ACCOUNT_BUTTON}
147150
/>
148151

149152
<Button
150153
variant={ButtonVariants.Link}
151154
label={strings('solana_new_feature_content.not_now')}
152155
onPress={handleClose}
153156
style={styles.cancelButton}
157+
testID={SolanaNewFeatureSheetSelectorsIDs.SOLANA_NOT_NOW_BUTTON}
154158
/>
155159
</View>
156160
</BottomSheet>

e2e/fixtures/fixture-builder.js

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ class FixtureBuilder {
5959
return this;
6060
}
6161

62+
/**
63+
* Ensures that the Solana feature modal is suppressed by adding the appropriate flag to asyncState.
64+
* @returns {FixtureBuilder} - The FixtureBuilder instance for method chaining.
65+
*/
66+
ensureSolanaModalSuppressed() {
67+
if (!this.fixture.asyncState) {
68+
this.fixture.asyncState = {};
69+
}
70+
this.fixture.asyncState['@MetaMask:solanaFeatureModalShown'] = 'true';
71+
return this;
72+
}
73+
6274
/**
6375
* Set the default fixture values.
6476
* @returns {FixtureBuilder} - The FixtureBuilder instance for method chaining.
@@ -647,6 +659,7 @@ class FixtureBuilder {
647659
'@MetaMask:onboardingWizard': 'explored',
648660
'@MetaMask:UserTermsAcceptedv1.0': 'true',
649661
'@MetaMask:WhatsNewAppVersionSeen': '7.24.3',
662+
'@MetaMask:solanaFeatureModalShown': 'true',
650663
},
651664
};
652665
return this;
@@ -758,7 +771,9 @@ class FixtureBuilder {
758771
this.withPermissionController(
759772
this.createPermissionControllerConfig(additionalPermissions),
760773
);
761-
return this;
774+
775+
// Ensure Solana feature modal is suppressed
776+
return this.ensureSolanaModalSuppressed();
762777
}
763778

764779
withRampsSelectedRegion(region = null) {
@@ -870,7 +885,8 @@ class FixtureBuilder {
870885
// Update selectedNetworkClientId to the new network client ID
871886
fixtures.NetworkController.selectedNetworkClientId = newNetworkClientId;
872887

873-
return this;
888+
// Ensure Solana feature modal is suppressed
889+
return this.ensureSolanaModalSuppressed();
874890
}
875891

876892
withSepoliaNetwork() {
@@ -910,7 +926,8 @@ class FixtureBuilder {
910926
// Update selectedNetworkClientId to the new network client ID
911927
fixtures.NetworkController.selectedNetworkClientId = newNetworkClientId;
912928

913-
return this;
929+
// Ensure Solana feature modal is suppressed
930+
return this.ensureSolanaModalSuppressed();
914931
}
915932

916933
withPopularNetworks() {
@@ -961,7 +978,8 @@ class FixtureBuilder {
961978
networkConfigurationsByChainId,
962979
};
963980

964-
return this;
981+
// Ensure Solana feature modal is suppressed
982+
return this.ensureSolanaModalSuppressed();
965983
}
966984

967985
withPreferencesController(data) {
@@ -976,8 +994,8 @@ class FixtureBuilder {
976994
merge(this.fixture.state.engine.backgroundState.KeyringController, {
977995
keyrings: [
978996
{
997+
accounts: [DEFAULT_FIXTURE_ACCOUNT],
979998
type: 'HD Key Tree',
980-
accounts: ['0x37cc5ef6bfe753aeaf81f945efe88134b238face'],
981999
},
9821000
{ type: 'QR Hardware Wallet Device', accounts: [] },
9831001
],
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
'use strict';
2+
3+
import { SolanaNewFeatureSheetSelectorsIDs } from '../../selectors/wallet/SolanaNewFeatureSheet.selectors';
4+
import Gestures from '../../utils/Gestures';
5+
import Assertions from '../../utils/Assertions';
6+
import { WalletViewSelectorsIDs } from '../../selectors/wallet/WalletView.selectors';
7+
import Matchers from '../../utils/Matchers';
8+
9+
class SolanaNewFeatureSheet {
10+
// Sheet container
11+
get sheetContainer() {
12+
return Matchers.getElementByID(SolanaNewFeatureSheetSelectorsIDs.SOLANA_NEW_FEATURE_SHEET);
13+
}
14+
15+
// Create Account button
16+
get createAccountButton() {
17+
return Matchers.getElementByID(SolanaNewFeatureSheetSelectorsIDs.SOLANA_CREATE_ACCOUNT_BUTTON);
18+
}
19+
20+
get learnMoreButton() {
21+
return Matchers.getElementByID(SolanaNewFeatureSheetSelectorsIDs.SOLANA_LEARN_MORE_BUTTON);
22+
}
23+
24+
get notNowButton() {
25+
return Matchers.getElementByID(SolanaNewFeatureSheetSelectorsIDs.SOLANA_NOT_NOW_BUTTON);
26+
}
27+
28+
get addAccountButton() {
29+
return Matchers.getElementByID(SolanaNewFeatureSheetSelectorsIDs.SOLANA_ADD_ACCOUNT_BUTTON_IN_SHEET);
30+
}
31+
32+
get carouselLogo() {
33+
return Matchers.getElementByID(WalletViewSelectorsIDs.CAROUSEL_SIXTH_SLIDE);
34+
}
35+
36+
// Interaction methods
37+
async tapCreateAccountButton() {
38+
await Gestures.waitAndTap(this.createAccountButton);
39+
}
40+
41+
async tapAddAccountButton() {
42+
await Gestures.waitAndTap(this.addAccountButton);
43+
}
44+
45+
async tapLearnMoreButton() {
46+
await Gestures.waitAndTap(this.learnMoreButton);
47+
}
48+
49+
50+
async tapNotNowButton() {
51+
await Gestures.waitAndTap(this.notNowButton);
52+
}
53+
54+
async swipeWithCarouselLogo() {
55+
await Gestures.swipe(this.learnMoreButton, 'down', 'fast');
56+
}
57+
}
58+
59+
export default new SolanaNewFeatureSheet();
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { SNAP_ACCOUNT_CUSTOM_NAME_ADD_ACCOUNT_BUTTON } from '../../../app/components/Approvals/SnapAccountCustomNameApproval/SnapAccountCustomNameApproval.constants';
2+
3+
export const SolanaNewFeatureSheetSelectorsIDs = {
4+
SOLANA_NEW_FEATURE_SHEET: 'solana-new-feature-sheet',
5+
SOLANA_CREATE_ACCOUNT_BUTTON: 'solana-create-account-button',
6+
SOLANA_LEARN_MORE_BUTTON: 'solana-learn-more-button',
7+
SOLANA_ADD_ACCOUNT_BUTTON_IN_SHEET: SNAP_ACCOUNT_CUSTOM_NAME_ADD_ACCOUNT_BUTTON,
8+
SOLANA_NOT_NOW_BUTTON: 'solana-not-now-button',
9+
SOLANA_CARASOULE_LOGO: 'carousel-sixth-slide',
10+
};
11+
12+
export const SolanaNewFeatureSheetSelectorsText = {
13+
TITLE: 'Solana is here!',
14+
DESCRIPTION: 'Create, send, and receive Solana tokens in MetaMask',
15+
CREATE_ACCOUNT_BUTTON: 'Create Solana Account',
16+
};

e2e/viewHelper.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import Assertions from './utils/Assertions';
2929
import { CustomNetworks } from './resources/networks.e2e';
3030
import ToastModal from './pages/wallet/ToastModal';
3131
import TestDApp from './pages/Browser/TestDApp';
32+
import SolanaNewFeatureSheet from './pages/wallet/SolanaNewFeatureSheet';
3233

3334
const LOCALHOST_URL = `http://localhost:${getGanachePort()}/`;
3435
const validAccount = Accounts.getValidAccount();
@@ -68,6 +69,15 @@ have to have all these workarounds in the tests
6869

6970
console.log('The marketing toast is not visible');
7071
}
72+
73+
// Handle Solana New feature sheet
74+
try {
75+
await SolanaNewFeatureSheet.swipeWithCarouselLogo();
76+
} catch {
77+
/* eslint-disable no-console */
78+
79+
console.log('The new Solana feature modal is not visible');
80+
}
7181
};
7282

7383
export const skipNotificationsDeviceSettings = async () => {

metro.transform.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ const availableFeatures = new Set([
2323
'solana',
2424
]);
2525

26-
const mainFeatureSet = new Set(['preinstalled-snaps', 'multi-srp']);
26+
const mainFeatureSet = new Set([
27+
'preinstalled-snaps',
28+
'keyring-snaps',
29+
'multi-srp',
30+
'solana',
31+
]);
2732
const betaFeatureSet = new Set([
2833
'beta',
2934
'preinstalled-snaps',

0 commit comments

Comments
 (0)