mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
MMI start script and fixes a bug preventing it to run (#19594)
* adds MMI start script and fixes a bug preventing it to run * lint fix
This commit is contained in:
parent
d2f0b2f785
commit
1520f57b77
@ -14,9 +14,7 @@ import {
|
||||
REFRESH_TOKEN_CHANGE_EVENT,
|
||||
INTERACTIVE_REPLACEMENT_TOKEN_CHANGE_EVENT,
|
||||
} from '@metamask-institutional/sdk';
|
||||
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,
|
||||
@ -544,30 +542,6 @@ export default class MMIController extends EventEmitter {
|
||||
});
|
||||
}
|
||||
|
||||
async setMmiPortfolioCookie() {
|
||||
await this.appStateController.getUnlockPromise(true);
|
||||
const keyringAccounts = await this.keyringController.getAccounts();
|
||||
const { identities } = this.preferencesController.store.getState();
|
||||
const { metaMetricsId } = this.metaMetricsController.store.getState();
|
||||
const getAccountDetails = (address) =>
|
||||
this.custodyController.getAccountDetails(address);
|
||||
const extensionId = this.extension.runtime.id;
|
||||
const networks = [
|
||||
...this.preferencesController.getRpcMethodPreferences(),
|
||||
{ chainId: CHAIN_IDS.MAINNET },
|
||||
{ chainId: CHAIN_IDS.GOERLI },
|
||||
];
|
||||
|
||||
handleMmiPortfolio({
|
||||
keyringAccounts,
|
||||
identities,
|
||||
metaMetricsId,
|
||||
networks,
|
||||
getAccountDetails,
|
||||
extensionId,
|
||||
});
|
||||
}
|
||||
|
||||
async setAccountAndNetwork(origin, address, chainId) {
|
||||
await this.appStateController.getUnlockPromise(true);
|
||||
const selectedAddress = this.preferencesController.getSelectedAddress();
|
||||
|
@ -70,6 +70,7 @@ import {
|
||||
} from '@metamask-institutional/custody-keyring';
|
||||
import { InstitutionalFeaturesController } from '@metamask-institutional/institutional-features';
|
||||
import { CustodyController } from '@metamask-institutional/custody-controller';
|
||||
import { handleMmiPortfolio } from '@metamask-institutional/portfolio-dashboard';
|
||||
import { TransactionUpdateController } from '@metamask-institutional/transaction-update';
|
||||
///: END:ONLY_INCLUDE_IN
|
||||
import { SignatureController } from '@metamask/signature-controller';
|
||||
@ -348,6 +349,10 @@ export default class MetamaskController extends EventEmitter {
|
||||
),
|
||||
tokenListController: this.tokenListController,
|
||||
provider: this.provider,
|
||||
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
||||
handleMmiPortfolio: this.setMmiPortfolioCookie.bind(this),
|
||||
mmiConfigurationStore: this.mmiConfigurationController.store,
|
||||
///: END:ONLY_INCLUDE_IN
|
||||
});
|
||||
|
||||
this.tokensController = new TokensController({
|
||||
@ -3884,7 +3889,7 @@ export default class MetamaskController extends EventEmitter {
|
||||
),
|
||||
handleMmiCheckIfTokenIsPresent:
|
||||
this.mmiController.handleMmiCheckIfTokenIsPresent.bind(this),
|
||||
handleMmiPortfolio: this.mmiController.setMmiPortfolioCookie.bind(this),
|
||||
handleMmiPortfolio: this.setMmiPortfolioCookie.bind(this),
|
||||
handleMmiOpenSwaps: this.mmiController.handleMmiOpenSwaps.bind(this),
|
||||
handleMmiSetAccountAndNetwork:
|
||||
this.mmiController.setAccountAndNetwork.bind(this),
|
||||
@ -3943,6 +3948,37 @@ export default class MetamaskController extends EventEmitter {
|
||||
return engine;
|
||||
}
|
||||
|
||||
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
||||
/**
|
||||
* This method is needed in preferences controller
|
||||
* so it needs to be here and not in our controller because
|
||||
* preferences controllers is initiated first
|
||||
*/
|
||||
async setMmiPortfolioCookie() {
|
||||
await this.appStateController.getUnlockPromise(true);
|
||||
const keyringAccounts = await this.keyringController.getAccounts();
|
||||
const { identities } = this.preferencesController.store.getState();
|
||||
const { metaMetricsId } = this.metaMetricsController.store.getState();
|
||||
const getAccountDetails = (address) =>
|
||||
this.custodyController.getAccountDetails(address);
|
||||
const extensionId = this.extension.runtime.id;
|
||||
const networks = [
|
||||
...this.preferencesController.getRpcMethodPreferences(),
|
||||
{ chainId: CHAIN_IDS.MAINNET },
|
||||
{ chainId: CHAIN_IDS.GOERLI },
|
||||
];
|
||||
|
||||
return handleMmiPortfolio({
|
||||
keyringAccounts,
|
||||
identities,
|
||||
metaMetricsId,
|
||||
networks,
|
||||
getAccountDetails,
|
||||
extensionId,
|
||||
});
|
||||
}
|
||||
///: END:ONLY_INCLUDE_IN
|
||||
|
||||
/**
|
||||
* TODO:LegacyProvider: Delete
|
||||
* A method for providing our public config info over a stream.
|
||||
|
@ -10,6 +10,7 @@
|
||||
"start": "yarn build:dev dev --apply-lavamoat=false --snow=false",
|
||||
"start:mv3": "ENABLE_MV3=true yarn build:dev dev --apply-lavamoat=false",
|
||||
"start:flask": "yarn start --build-type flask",
|
||||
"start:mmi": "yarn start --build-type mmi",
|
||||
"start:lavamoat": "yarn build:dev dev --apply-lavamoat=true",
|
||||
"dist": "yarn build dist",
|
||||
"build": "yarn lavamoat:build",
|
||||
|
@ -36,8 +36,11 @@ export function getConfiguredCustodians(state) {
|
||||
export function getCustodianIconForAddress(state, address) {
|
||||
let custodianIcon;
|
||||
|
||||
const checksummedAddress = toChecksumAddress(address);
|
||||
if (state.metamask.custodyAccountDetails?.[checksummedAddress]) {
|
||||
const checksummedAddress = address && toChecksumAddress(address);
|
||||
if (
|
||||
checksummedAddress &&
|
||||
state.metamask.custodyAccountDetails?.[checksummedAddress]
|
||||
) {
|
||||
const { custodianName } =
|
||||
state.metamask.custodyAccountDetails[checksummedAddress];
|
||||
custodianIcon = state.metamask.mmiConfiguration?.custodians?.find(
|
||||
|
Loading…
Reference in New Issue
Block a user