diff --git a/app/scripts/controllers/preferences-controller.ts b/app/scripts/controllers/preferences-controller.ts index 536ec33b34eb..d56bae3bae19 100644 --- a/app/scripts/controllers/preferences-controller.ts +++ b/app/scripts/controllers/preferences-controller.ts @@ -136,9 +136,7 @@ export type PreferencesControllerState = Omit< use4ByteResolution: boolean; useCurrencyRateCheck: boolean; useRequestQueue: boolean; - ///: BEGIN:ONLY_INCLUDE_IF(build-flask) watchEthereumAccountEnabled: boolean; - ///: END:ONLY_INCLUDE_IF bitcoinSupportEnabled: boolean; bitcoinTestnetSupportEnabled: boolean; addSnapAccountEnabled?: boolean; @@ -653,7 +651,6 @@ export class PreferencesController extends BaseController< } ///: END:ONLY_INCLUDE_IF - ///: BEGIN:ONLY_INCLUDE_IF(build-flask) /** * Setter for the `watchEthereumAccountEnabled` property. * @@ -665,7 +662,6 @@ export class PreferencesController extends BaseController< state.watchEthereumAccountEnabled = watchEthereumAccountEnabled; }); } - ///: END:ONLY_INCLUDE_IF /** * Setter for the `bitcoinSupportEnabled` property. diff --git a/app/scripts/lib/snap-keyring/account-watcher-snap.ts b/app/scripts/lib/snap-keyring/account-watcher-snap.ts index 48ace4e595af..3775dcd28405 100644 --- a/app/scripts/lib/snap-keyring/account-watcher-snap.ts +++ b/app/scripts/lib/snap-keyring/account-watcher-snap.ts @@ -1,4 +1,3 @@ -// BEGIN:ONLY_INCLUDE_IF(build-flask) import { SnapId } from '@metamask/snaps-sdk'; import AccountWatcherSnap from '@metamask/account-watcher/dist/preinstalled-snap.json'; @@ -7,4 +6,3 @@ export const ACCOUNT_WATCHER_SNAP_ID: SnapId = export const ACCOUNT_WATCHER_NAME: string = AccountWatcherSnap.manifest.proposedName; -// END:ONLY_INCLUDE_IF diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 24ae9c0b63e7..8cbfb3c26ce4 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -3319,12 +3319,10 @@ export default class MetamaskController extends EventEmitter { preferencesController, ), ///: END:ONLY_INCLUDE_IF - ///: BEGIN:ONLY_INCLUDE_IF(build-flask) setWatchEthereumAccountEnabled: preferencesController.setWatchEthereumAccountEnabled.bind( preferencesController, ), - ///: END:ONLY_INCLUDE_IF setBitcoinSupportEnabled: preferencesController.setBitcoinSupportEnabled.bind( preferencesController, diff --git a/app/scripts/snaps/preinstalled-snaps.ts b/app/scripts/snaps/preinstalled-snaps.ts index c725a2cbd837..30dfdb02ebf0 100644 --- a/app/scripts/snaps/preinstalled-snaps.ts +++ b/app/scripts/snaps/preinstalled-snaps.ts @@ -1,8 +1,8 @@ import type { PreinstalledSnap } from '@metamask/snaps-controllers'; import MessageSigningSnap from '@metamask/message-signing-snap/dist/preinstalled-snap.json'; import EnsResolverSnap from '@metamask/ens-resolver-snap/dist/preinstalled-snap.json'; -///: BEGIN:ONLY_INCLUDE_IF(build-flask) import AccountWatcherSnap from '@metamask/account-watcher/dist/preinstalled-snap.json'; +///: BEGIN:ONLY_INCLUDE_IF(build-flask) import BitcoinWalletSnap from '@metamask/bitcoin-wallet-snap/dist/preinstalled-snap.json'; import PreinstalledExampleSnap from '@metamask/preinstalled-example-snap/dist/preinstalled-snap.json'; ///: END:ONLY_INCLUDE_IF @@ -11,8 +11,8 @@ import PreinstalledExampleSnap from '@metamask/preinstalled-example-snap/dist/pr const PREINSTALLED_SNAPS = Object.freeze([ MessageSigningSnap as unknown as PreinstalledSnap, EnsResolverSnap as PreinstalledSnap, - ///: BEGIN:ONLY_INCLUDE_IF(build-flask) AccountWatcherSnap as PreinstalledSnap, + ///: BEGIN:ONLY_INCLUDE_IF(build-flask) BitcoinWalletSnap as unknown as PreinstalledSnap, PreinstalledExampleSnap as unknown as PreinstalledSnap, ///: END:ONLY_INCLUDE_IF diff --git a/shared/constants/metametrics.ts b/shared/constants/metametrics.ts index e701bda2f626..9e454a3e8911 100644 --- a/shared/constants/metametrics.ts +++ b/shared/constants/metametrics.ts @@ -651,9 +651,7 @@ export enum MetaMetricsEventName { WalletSetupCanceled = 'Wallet Setup Canceled', WalletSetupFailed = 'Wallet Setup Failed', WalletCreated = 'Wallet Created', - // BEGIN:ONLY_INCLUDE_IF(build-flask) WatchEthereumAccountsToggled = 'Watch Ethereum Accounts Toggled', - // END:ONLY_INCLUDE_IF ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) DeeplinkClicked = 'Deeplink Clicked', ConnectCustodialAccountClicked = 'Connect Custodial Account Clicked', diff --git a/test/e2e/flask/create-watch-account.spec.ts b/test/e2e/accounts/create-watch-account.spec.ts similarity index 100% rename from test/e2e/flask/create-watch-account.spec.ts rename to test/e2e/accounts/create-watch-account.spec.ts diff --git a/ui/components/multichain/account-list-menu/account-list-menu.tsx b/ui/components/multichain/account-list-menu/account-list-menu.tsx index eff0d3cb8868..ae586ba1e7a0 100644 --- a/ui/components/multichain/account-list-menu/account-list-menu.tsx +++ b/ui/components/multichain/account-list-menu/account-list-menu.tsx @@ -60,7 +60,6 @@ import { getIsAddSnapAccountEnabled, ///: END:ONLY_INCLUDE_IF ///: BEGIN:ONLY_INCLUDE_IF(build-flask) - getIsWatchEthereumAccountEnabled, getIsBitcoinSupportEnabled, getIsBitcoinTestnetSupportEnabled, ///: END:ONLY_INCLUDE_IF @@ -68,6 +67,7 @@ import { getOriginOfCurrentTab, getSelectedInternalAccount, getUpdatedAndSortedAccounts, + getIsWatchEthereumAccountEnabled, } from '../../../selectors'; import { setSelectedAccount } from '../../../store/actions'; import { @@ -87,12 +87,6 @@ import { getEnvironmentType } from '../../../../app/scripts/lib/util'; import { ENVIRONMENT_TYPE_POPUP } from '../../../../shared/constants/app'; import { getAccountLabel } from '../../../helpers/utils/accounts'; ///: BEGIN:ONLY_INCLUDE_IF(build-flask) -import { - ACCOUNT_WATCHER_NAME, - ACCOUNT_WATCHER_SNAP_ID, - // TODO: Remove restricted import - // eslint-disable-next-line import/no-restricted-paths -} from '../../../../app/scripts/lib/snap-keyring/account-watcher-snap'; import { hasCreatedBtcMainnetAccount, hasCreatedBtcTestnetAccount, @@ -106,6 +100,12 @@ import { MergedInternalAccount, } from '../../../selectors/selectors.types'; import { endTrace, TraceName } from '../../../../shared/lib/trace'; +import { + ACCOUNT_WATCHER_NAME, + ACCOUNT_WATCHER_SNAP_ID, + // TODO: Remove restricted import + // eslint-disable-next-line import/no-restricted-paths +} from '../../../../app/scripts/lib/snap-keyring/account-watcher-snap'; import { HiddenAccountList } from './hidden-account-list'; const ACTION_MODES = { @@ -115,9 +115,9 @@ const ACTION_MODES = { MENU: 'menu', // Displays the add account form controls ADD: 'add', - ///: BEGIN:ONLY_INCLUDE_IF(build-flask) // Displays the add account form controls (for watch-only account) ADD_WATCH_ONLY: 'add-watch-only', + ///: BEGIN:ONLY_INCLUDE_IF(build-flask) // Displays the add account form controls (for bitcoin account) ADD_BITCOIN: 'add-bitcoin', // Same but for testnet @@ -141,9 +141,9 @@ export const getActionTitle = ( switch (actionMode) { case ACTION_MODES.ADD: case ACTION_MODES.MENU: + case ACTION_MODES.ADD_WATCH_ONLY: return t('addAccount'); ///: BEGIN:ONLY_INCLUDE_IF(build-flask) - case ACTION_MODES.ADD_WATCH_ONLY: case ACTION_MODES.ADD_BITCOIN: return t('addAccount'); case ACTION_MODES.ADD_BITCOIN_TESTNET: @@ -237,7 +237,6 @@ export const AccountListMenu = ({ ///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps) const addSnapAccountEnabled = useSelector(getIsAddSnapAccountEnabled); ///: END:ONLY_INCLUDE_IF - ///: BEGIN:ONLY_INCLUDE_IF(build-flask) const isAddWatchEthereumAccountEnabled = useSelector( getIsWatchEthereumAccountEnabled, ); @@ -255,7 +254,7 @@ export const AccountListMenu = ({ onClose(); history.push(`/snaps/view/${encodeURIComponent(ACCOUNT_WATCHER_SNAP_ID)}`); }, [trackEvent, onClose, history]); - + ///: BEGIN:ONLY_INCLUDE_IF(build-flask) const bitcoinSupportEnabled = useSelector(getIsBitcoinSupportEnabled); const bitcoinTestnetSupportEnabled = useSelector( getIsBitcoinTestnetSupportEnabled, @@ -552,23 +551,19 @@ export const AccountListMenu = ({ ///: END:ONLY_INCLUDE_IF } - { - ///: BEGIN:ONLY_INCLUDE_IF(build-flask) - isAddWatchEthereumAccountEnabled && ( - - - {t('addEthereumWatchOnlyAccount')} - - - ) - ///: END:ONLY_INCLUDE_IF - } + {isAddWatchEthereumAccountEnabled && ( + + + {t('addEthereumWatchOnlyAccount')} + + + )} ) : null} {actionMode === ACTION_MODES.LIST ? ( diff --git a/ui/pages/settings/experimental-tab/experimental-tab.component.tsx b/ui/pages/settings/experimental-tab/experimental-tab.component.tsx index f1d1f610a7a4..b888ac31efbe 100644 --- a/ui/pages/settings/experimental-tab/experimental-tab.component.tsx +++ b/ui/pages/settings/experimental-tab/experimental-tab.component.tsx @@ -263,7 +263,6 @@ export default class ExperimentalTab extends PureComponent }); } - ///: BEGIN:ONLY_INCLUDE_IF(build-flask) renderWatchAccountToggle() { const { t, trackEvent } = this.context; const { watchAccountEnabled, setWatchAccountEnabled } = this.props; @@ -298,6 +297,7 @@ export default class ExperimentalTab extends PureComponent }); } + ///: BEGIN:ONLY_INCLUDE_IF(build-flask) // We're only setting the code fences here since // we should remove it for the feature release renderBitcoinSupport() { @@ -385,15 +385,12 @@ export default class ExperimentalTab extends PureComponent this.renderKeyringSnapsToggle() ///: END:ONLY_INCLUDE_IF } - { - ///: BEGIN:ONLY_INCLUDE_IF(build-flask) - this.renderWatchAccountToggle() - ///: END:ONLY_INCLUDE_IF - } + {this.renderWatchAccountToggle()} { ///: BEGIN:ONLY_INCLUDE_IF(build-flask) // We're only setting the code fences here since // we should remove it for the feature release + /* Section: Bitcoin Accounts */ this.renderBitcoinSupport() ///: END:ONLY_INCLUDE_IF