Skip to content
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

[MMI] Deletes unnecessary logic for mmi #20834

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 2 additions & 41 deletions app/scripts/controllers/mmi-controller.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import EventEmitter from 'events';
import log from 'loglevel';
import { captureException } from '@sentry/browser';
import { isEqual } from 'lodash';
import { CUSTODIAN_TYPES } from '@metamask-institutional/custody-keyring';
import {
updateCustodianTransactions,
Expand All @@ -11,17 +10,10 @@ import {
REFRESH_TOKEN_CHANGE_EVENT,
INTERACTIVE_REPLACEMENT_TOKEN_CHANGE_EVENT,
} from '@metamask-institutional/sdk';
import {
handleMmiPortfolio,
setDashboardCookie,
} from '@metamask-institutional/portfolio-dashboard';
import { handleMmiPortfolio } from '@metamask-institutional/portfolio-dashboard';
import { toChecksumHexAddress } from '../../../shared/modules/hexstring-utils';
import { CHAIN_IDS } from '../../../shared/constants/network';
import {
BUILD_QUOTE_ROUTE,
CONNECT_HARDWARE_ROUTE,
} from '../../../ui/helpers/constants/routes';
import { previousValueComparator } from '../lib/util';
import { CONNECT_HARDWARE_ROUTE } from '../../../ui/helpers/constants/routes';
import { getPermissionBackgroundApiMethods } from './permissions';

export default class MMIController extends EventEmitter {
Expand Down Expand Up @@ -63,17 +55,6 @@ export default class MMIController extends EventEmitter {
});
}

this.preferencesController.store.subscribe(
previousValueComparator(async (prevState, currState) => {
const { identities: prevIdentities } = prevState;
const { identities: currIdentities } = currState;
if (isEqual(prevIdentities, currIdentities)) {
return;
}
await this.prepareMmiPortfolio();
}, this.preferencesController.store.getState()),
);

this.signatureController.hub.on(
'personal_sign:signed',
async ({ signature, messageId }) => {
Expand Down Expand Up @@ -584,20 +565,6 @@ export default class MMIController extends EventEmitter {
});
}

async prepareMmiPortfolio() {
if (!process.env.IN_TEST) {
try {
const mmiDashboardData = await this.handleMmiDashboardData();
const cookieSetUrls =
this.mmiConfigurationController.store.mmiConfiguration?.portfolio
?.cookieSetUrls || [];
setDashboardCookie(mmiDashboardData, cookieSetUrls);
} catch (error) {
console.error(error);
}
}
}

async newUnsignedMessage(msgParams, req, version) {
// The code path triggered by deferSetAsSigned: true is for custodial accounts
const accountDetails = this.custodyController.getAccountDetails(
Expand Down Expand Up @@ -673,12 +640,6 @@ export default class MMIController extends EventEmitter {
return true;
}

async handleMmiOpenSwaps(origin, address, chainId) {
await this.setAccountAndNetwork(origin, address, chainId);
this.platform.openExtensionInBrowser(BUILD_QUOTE_ROUTE);
return true;
}

async handleMmiOpenAddHardwareWallet() {
await this.appStateController.getUnlockPromise(true);
this.platform.openExtensionInBrowser(CONNECT_HARDWARE_ROUTE);
Expand Down
2 changes: 0 additions & 2 deletions app/scripts/lib/rpc-method-middleware/handlers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import watchAsset from './watch-asset';
import mmiSupported from './institutional/mmi-supported';
import mmiAuthenticate from './institutional/mmi-authenticate';
import mmiPortfolio from './institutional/mmi-portfolio';
import mmiOpenSwaps from './institutional/mmi-open-swaps';
import mmiCheckIfTokenIsPresent from './institutional/mmi-check-if-token-is-present';
import mmiSetAccountAndNetwork from './institutional/mmi-set-account-and-network';
import mmiOpenAddHardwareWallet from './institutional/mmi-open-add-hardware-wallet';
Expand All @@ -30,7 +29,6 @@ const handlers = [
mmiAuthenticate,
mmiSupported,
mmiPortfolio,
mmiOpenSwaps,
mmiCheckIfTokenIsPresent,
mmiSetAccountAndNetwork,
mmiOpenAddHardwareWallet,
Expand Down

This file was deleted.

3 changes: 0 additions & 3 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4347,9 +4347,6 @@ export default class MetamaskController extends EventEmitter {
handleMmiDashboardData: this.mmiController.handleMmiDashboardData.bind(
this.mmiController,
),
handleMmiOpenSwaps: this.mmiController.handleMmiOpenSwaps.bind(
this.mmiController,
),
handleMmiSetAccountAndNetwork:
this.mmiController.setAccountAndNetwork.bind(this.mmiController),
handleMmiOpenAddHardwareWallet:
Expand Down
Loading