mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
[MMI] renames method for better understanding (#19622)
* better naming * better naming * undo change
This commit is contained in:
parent
c16b35c029
commit
39e033ea00
@ -80,7 +80,7 @@ export default class PreferencesController {
|
|||||||
this.tokenListController = opts.tokenListController;
|
this.tokenListController = opts.tokenListController;
|
||||||
|
|
||||||
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
||||||
this.handleMmiPortfolio = opts.handleMmiPortfolio;
|
this.handleMmiDashboardData = opts.handleMmiDashboardData;
|
||||||
|
|
||||||
if (!process.env.IN_TEST) {
|
if (!process.env.IN_TEST) {
|
||||||
this.mmiConfigurationStore = opts.mmiConfigurationStore.getState();
|
this.mmiConfigurationStore = opts.mmiConfigurationStore.getState();
|
||||||
@ -534,7 +534,7 @@ export default class PreferencesController {
|
|||||||
async prepareMmiPortfolio() {
|
async prepareMmiPortfolio() {
|
||||||
if (!process.env.IN_TEST) {
|
if (!process.env.IN_TEST) {
|
||||||
try {
|
try {
|
||||||
const mmiDashboardData = await this.handleMmiPortfolio();
|
const mmiDashboardData = await this.handleMmiDashboardData();
|
||||||
const cookieSetUrls =
|
const cookieSetUrls =
|
||||||
this.mmiConfigurationStore.mmiConfiguration?.portfolio?.cookieSetUrls;
|
this.mmiConfigurationStore.mmiConfiguration?.portfolio?.cookieSetUrls;
|
||||||
setDashboardCookie(mmiDashboardData, cookieSetUrls);
|
setDashboardCookie(mmiDashboardData, cookieSetUrls);
|
||||||
|
@ -5,14 +5,14 @@ const mmiPortfolio = {
|
|||||||
methodNames: [MESSAGE_TYPE.MMI_PORTFOLIO],
|
methodNames: [MESSAGE_TYPE.MMI_PORTFOLIO],
|
||||||
implementation: mmiPortfolioHandler,
|
implementation: mmiPortfolioHandler,
|
||||||
hookNames: {
|
hookNames: {
|
||||||
handleMmiPortfolio: true,
|
handleMmiDashboardData: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
export default mmiPortfolio;
|
export default mmiPortfolio;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {object} MmiPortfolioOptions
|
* @typedef {object} MmiPortfolioOptions
|
||||||
* @property {Function} handleMmiportfolio - The metmaskinsititutional_portfolio method implementation.
|
* @property {Function} handleMmiDashboardData - The metmaskinsititutional_portfolio method implementation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,7 +33,7 @@ async function mmiPortfolioHandler(
|
|||||||
res,
|
res,
|
||||||
_next,
|
_next,
|
||||||
end,
|
end,
|
||||||
{ handleMmiPortfolio },
|
{ handleMmiDashboardData },
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
let validUrl = false;
|
let validUrl = false;
|
||||||
@ -47,7 +47,7 @@ async function mmiPortfolioHandler(
|
|||||||
if (!validUrl) {
|
if (!validUrl) {
|
||||||
throw new Error('Unauthorized');
|
throw new Error('Unauthorized');
|
||||||
} else {
|
} else {
|
||||||
res.result = await handleMmiPortfolio(req);
|
res.result = await handleMmiDashboardData(req);
|
||||||
return end();
|
return end();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -355,7 +355,7 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
tokenListController: this.tokenListController,
|
tokenListController: this.tokenListController,
|
||||||
provider: this.provider,
|
provider: this.provider,
|
||||||
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
||||||
handleMmiPortfolio: this.setMmiPortfolioCookie.bind(this),
|
handleMmiDashboardData: this.handleMmiDashboardData.bind(this),
|
||||||
mmiConfigurationStore: this.mmiConfigurationController.store,
|
mmiConfigurationStore: this.mmiConfigurationController.store,
|
||||||
///: END:ONLY_INCLUDE_IN
|
///: END:ONLY_INCLUDE_IN
|
||||||
});
|
});
|
||||||
@ -3910,7 +3910,7 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
),
|
),
|
||||||
handleMmiCheckIfTokenIsPresent:
|
handleMmiCheckIfTokenIsPresent:
|
||||||
this.mmiController.handleMmiCheckIfTokenIsPresent.bind(this),
|
this.mmiController.handleMmiCheckIfTokenIsPresent.bind(this),
|
||||||
handleMmiPortfolio: this.setMmiPortfolioCookie.bind(this),
|
handleMmiDashboardData: this.handleMmiDashboardData.bind(this),
|
||||||
handleMmiOpenSwaps: this.mmiController.handleMmiOpenSwaps.bind(this),
|
handleMmiOpenSwaps: this.mmiController.handleMmiOpenSwaps.bind(this),
|
||||||
handleMmiSetAccountAndNetwork:
|
handleMmiSetAccountAndNetwork:
|
||||||
this.mmiController.setAccountAndNetwork.bind(this),
|
this.mmiController.setAccountAndNetwork.bind(this),
|
||||||
@ -3975,7 +3975,7 @@ export default class MetamaskController extends EventEmitter {
|
|||||||
* so it needs to be here and not in our controller because
|
* so it needs to be here and not in our controller because
|
||||||
* preferences controllers is initiated first
|
* preferences controllers is initiated first
|
||||||
*/
|
*/
|
||||||
async setMmiPortfolioCookie() {
|
async handleMmiDashboardData() {
|
||||||
await this.appStateController.getUnlockPromise(true);
|
await this.appStateController.getUnlockPromise(true);
|
||||||
const keyringAccounts = await this.keyringController.getAccounts();
|
const keyringAccounts = await this.keyringController.getAccounts();
|
||||||
const { identities } = this.preferencesController.store.getState();
|
const { identities } = this.preferencesController.store.getState();
|
||||||
|
Loading…
Reference in New Issue
Block a user