1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 11:28:51 +01:00

[MMI] renames method for better understanding (#19622)

* better naming

* better naming

* undo change
This commit is contained in:
António Regadas 2023-06-15 23:33:28 +01:00 committed by GitHub
parent c16b35c029
commit 39e033ea00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View File

@ -80,7 +80,7 @@ export default class PreferencesController {
this.tokenListController = opts.tokenListController;
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
this.handleMmiPortfolio = opts.handleMmiPortfolio;
this.handleMmiDashboardData = opts.handleMmiDashboardData;
if (!process.env.IN_TEST) {
this.mmiConfigurationStore = opts.mmiConfigurationStore.getState();
@ -534,7 +534,7 @@ export default class PreferencesController {
async prepareMmiPortfolio() {
if (!process.env.IN_TEST) {
try {
const mmiDashboardData = await this.handleMmiPortfolio();
const mmiDashboardData = await this.handleMmiDashboardData();
const cookieSetUrls =
this.mmiConfigurationStore.mmiConfiguration?.portfolio?.cookieSetUrls;
setDashboardCookie(mmiDashboardData, cookieSetUrls);

View File

@ -5,14 +5,14 @@ const mmiPortfolio = {
methodNames: [MESSAGE_TYPE.MMI_PORTFOLIO],
implementation: mmiPortfolioHandler,
hookNames: {
handleMmiPortfolio: true,
handleMmiDashboardData: true,
},
};
export default mmiPortfolio;
/**
* @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,
_next,
end,
{ handleMmiPortfolio },
{ handleMmiDashboardData },
) {
try {
let validUrl = false;
@ -47,7 +47,7 @@ async function mmiPortfolioHandler(
if (!validUrl) {
throw new Error('Unauthorized');
} else {
res.result = await handleMmiPortfolio(req);
res.result = await handleMmiDashboardData(req);
return end();
}
} catch (error) {

View File

@ -355,7 +355,7 @@ export default class MetamaskController extends EventEmitter {
tokenListController: this.tokenListController,
provider: this.provider,
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
handleMmiPortfolio: this.setMmiPortfolioCookie.bind(this),
handleMmiDashboardData: this.handleMmiDashboardData.bind(this),
mmiConfigurationStore: this.mmiConfigurationController.store,
///: END:ONLY_INCLUDE_IN
});
@ -3910,7 +3910,7 @@ export default class MetamaskController extends EventEmitter {
),
handleMmiCheckIfTokenIsPresent:
this.mmiController.handleMmiCheckIfTokenIsPresent.bind(this),
handleMmiPortfolio: this.setMmiPortfolioCookie.bind(this),
handleMmiDashboardData: this.handleMmiDashboardData.bind(this),
handleMmiOpenSwaps: this.mmiController.handleMmiOpenSwaps.bind(this),
handleMmiSetAccountAndNetwork:
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
* preferences controllers is initiated first
*/
async setMmiPortfolioCookie() {
async handleMmiDashboardData() {
await this.appStateController.getUnlockPromise(true);
const keyringAccounts = await this.keyringController.getAccounts();
const { identities } = this.preferencesController.store.getState();