Skip to content

Commit

Permalink
use extension data for metamask
Browse files Browse the repository at this point in the history
Signed-off-by: r3kt.eth <so@r3kt.io>
  • Loading branch information
r3kt-eth committed Aug 2, 2023
1 parent 6ae906a commit c588f00
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions commands/metamask.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ const {
getCurrentNetwork,
} = require('../helpers');

let extensionInitialUrl;
let extensionId;
let extensionVersion;
let extensionHomeUrl;
let extensionSettingsUrl;
let extensionAdvancedSettingsUrl;
Expand All @@ -59,7 +59,6 @@ const metamask = {
},
extensionUrls: () => {
return {
extensionInitialUrl,
extensionHomeUrl,
extensionSettingsUrl,
extensionAdvancedSettingsUrl,
Expand Down Expand Up @@ -105,8 +104,11 @@ const metamask = {
await module.exports.goTo(extensionImportTokenUrl);
},
async getExtensionDetails() {
extensionInitialUrl = await playwright.metamaskWindow().url();
extensionId = extensionInitialUrl.match('//(.*?)/')[1];
const metamaskExtensionData = (await playwright.getExtensionsData())
.metamask;

extensionId = metamaskExtensionData.id;
extensionVersion = metamaskExtensionData.version;
extensionHomeUrl = `chrome-extension://${extensionId}/home.html`;
extensionSettingsUrl = `${extensionHomeUrl}#settings`;
extensionAdvancedSettingsUrl = `${extensionSettingsUrl}/advanced`;
Expand All @@ -117,8 +119,8 @@ const metamask = {
extensionImportTokenUrl = `${extensionHomeUrl}#import-token`;

return {
extensionInitialUrl,
extensionId,
extensionVersion,
extensionSettingsUrl,
extensionAdvancedSettingsUrl,
extensionExperimentalSettingsUrl,
Expand Down

0 comments on commit c588f00

Please sign in to comment.