Skip to content

Commit

Permalink
feat: add multi-srp fence
Browse files Browse the repository at this point in the history
  • Loading branch information
montelaidev committed Mar 3, 2025
1 parent 4ed72c9 commit 88b11b1
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 8 deletions.
2 changes: 2 additions & 0 deletions app/components/Views/AccountConnect/AccountConnect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,12 @@ const AccountConnect = (props: AccountConnectProps) => {
);
break;
}
///: BEGIN:ONLY_INCLUDE_IF(multi-srp)
case USER_INTENT.ImportSrp: {
navigation.navigate('ImportSrpView');
break;
}
///: END:ONLY_INCLUDE_IF
case USER_INTENT.ConnectHW: {
navigation.navigate('ConnectQRHardwareFlow');
// TODO: Confirm if this is where we want to track connecting a hardware wallet or within ConnectQRHardwareFlow screen.
Expand Down
21 changes: 13 additions & 8 deletions app/components/Views/AddAccountActions/AddAccountActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ const AddAccountActions = ({ onBack }: AddAccountActionsProps) => {
createEventBuilder(MetaMetricsEvents.CONNECT_HARDWARE_WALLET).build(),
);
}, [onBack, navigate, trackEvent, createEventBuilder]);

///: BEGIN:ONLY_INCLUDE_IF(multi-srp)
const openImportSrp = useCallback(() => {
navigate(Routes.MULTI_SRP.IMPORT);
onBack();
}, [onBack, navigate]);
///: END:ONLY_INCLUDE_IF

const createNewAccount = useCallback(async () => {
const { KeyringController } = Engine.context;
Expand Down Expand Up @@ -219,13 +220,17 @@ const AddAccountActions = ({ onBack }: AddAccountActionsProps) => {
AddAccountBottomSheetSelectorsIDs.ADD_HARDWARE_WALLET_BUTTON
}
/>
<AccountAction
actionTitle={strings('account_actions.import_srp')}
iconName={IconName.Hardware}
onPress={openImportSrp}
disabled={isLoading}
testID={AddAccountBottomSheetSelectorsIDs.IMPORT_SRP_BUTTON}
/>
{
///: BEGIN:ONLY_INCLUDE_IF(multi-srp)
<AccountAction
actionTitle={strings('account_actions.import_srp')}
iconName={IconName.Hardware}
onPress={openImportSrp}
disabled={isLoading}
testID={AddAccountBottomSheetSelectorsIDs.IMPORT_SRP_BUTTON}
/>
///: END:ONLY_INCLUDE_IF
}
</View>
</Fragment>
</SafeAreaView>
Expand Down
2 changes: 2 additions & 0 deletions app/constants/navigation/Routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,11 @@ const Routes = {
STANDALONE_CONFIRMATIONS: {
STAKE_DEPOSIT: 'RedesignedStakeDeposit',
},
///: BEGIN:ONLY_INCLUDE_IF(multi-srp)
MULTI_SRP: {
IMPORT: 'ImportSRPView',
},
///: END:ONLY_INCLUDE_IF
///: BEGIN:ONLY_INCLUDE_IF(external-snaps)
SNAPS: {
SNAPS_SETTINGS_LIST: 'SnapsSettingsList',
Expand Down
2 changes: 2 additions & 0 deletions app/constants/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ export enum USER_INTENT {
Cancel,
Import,
ConnectHW,
///: BEGIN:ONLY_INCLUDE_IF(multi-srp)
ImportSrp,
///: END:ONLY_INCLUDE_IF
}
4 changes: 4 additions & 0 deletions app/selectors/keyringController/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
///: BEGIN:ONLY_INCLUDE_IF(multi-srp)
import ExtendedKeyringTypes from '../../constants/keyringTypes';
///: END:ONLY_INCLUDE_IF
import { RootState } from '../../reducers';
import { createDeepEqualSelector } from '../util';

Expand All @@ -18,7 +20,9 @@ export const selectKeyrings = createDeepEqualSelector(
(keyringControllerState) =>
keyringControllerState.keyrings.map((keyring, index) => ({
...keyring,
///: BEGIN:ONLY_INCLUDE_IF(multi-srp)
metadata: keyringControllerState.keyringsMetadata?.[index] || {},
///: END:ONLY_INCLUDE_IF
})),
);

Expand Down
2 changes: 2 additions & 0 deletions metro.transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const availableFeatures = new Set([
'external-snaps',
'beta',
'keyring-snaps',
'multi-srp',
]);

const mainFeatureSet = new Set(['preinstalled-snaps']);
Expand All @@ -26,6 +27,7 @@ const flaskFeatureSet = new Set([
'preinstalled-snaps',
'external-snaps',
'keyring-snaps',
'multi-srp',
]);

/**
Expand Down

0 comments on commit 88b11b1

Please sign in to comment.