w3wallets 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +14 -6
- package/dist/index.mjs +14 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -67,7 +67,12 @@ declare class Metamask extends Wallet {
|
|
|
67
67
|
* @param mnemonic 12-word mnemonic seed phrase
|
|
68
68
|
*/
|
|
69
69
|
onboard(mnemonic: string, password?: string): Promise<void>;
|
|
70
|
-
switchAccount(
|
|
70
|
+
switchAccount(accountName: {
|
|
71
|
+
name: string;
|
|
72
|
+
}): Promise<void>;
|
|
73
|
+
switchAccount(accountAddress: {
|
|
74
|
+
address: string;
|
|
75
|
+
}): Promise<void>;
|
|
71
76
|
importAccount(privateKey: string): Promise<void>;
|
|
72
77
|
addAccount(accountName?: string): Promise<void>;
|
|
73
78
|
getAccountName(): Promise<string>;
|
package/dist/index.d.ts
CHANGED
|
@@ -67,7 +67,12 @@ declare class Metamask extends Wallet {
|
|
|
67
67
|
* @param mnemonic 12-word mnemonic seed phrase
|
|
68
68
|
*/
|
|
69
69
|
onboard(mnemonic: string, password?: string): Promise<void>;
|
|
70
|
-
switchAccount(
|
|
70
|
+
switchAccount(accountName: {
|
|
71
|
+
name: string;
|
|
72
|
+
}): Promise<void>;
|
|
73
|
+
switchAccount(accountAddress: {
|
|
74
|
+
address: string;
|
|
75
|
+
}): Promise<void>;
|
|
71
76
|
importAccount(privateKey: string): Promise<void>;
|
|
72
77
|
addAccount(accountName?: string): Promise<void>;
|
|
73
78
|
getAccountName(): Promise<string>;
|
package/dist/index.js
CHANGED
|
@@ -136,6 +136,7 @@ var Backpack = class extends Wallet {
|
|
|
136
136
|
await (0, import_test.expect)(this.page.getByText("You're all good!")).toBeVisible();
|
|
137
137
|
}
|
|
138
138
|
await this.page.goto(`chrome-extension://${this.extensionId}/popup.html`);
|
|
139
|
+
await this.page.getByTestId("AccountBalanceRoundedIcon").waitFor({ state: "visible" });
|
|
139
140
|
}
|
|
140
141
|
};
|
|
141
142
|
|
|
@@ -198,6 +199,13 @@ var PolkadotJS = class extends Wallet {
|
|
|
198
199
|
|
|
199
200
|
// src/metamask/metamask.ts
|
|
200
201
|
var import_test3 = require("@playwright/test");
|
|
202
|
+
|
|
203
|
+
// tests/utils/address.ts
|
|
204
|
+
var shortenAddress = (address) => {
|
|
205
|
+
return `${address.slice(0, 7)}...${address.slice(-5)}`;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// src/metamask/metamask.ts
|
|
201
209
|
var Metamask = class extends Wallet {
|
|
202
210
|
defaultPassword = "11111111";
|
|
203
211
|
async gotoOnboardPage() {
|
|
@@ -224,13 +232,13 @@ var Metamask = class extends Wallet {
|
|
|
224
232
|
await this.page.waitForTimeout(1e3);
|
|
225
233
|
await this.clickTopRightCornerToCloseAllTheMarketingBullshit();
|
|
226
234
|
}
|
|
227
|
-
async switchAccount(
|
|
228
|
-
if (nameOrAddress.startsWith("0x"))
|
|
229
|
-
nameOrAddress = nameOrAddress.slice(0, 7);
|
|
235
|
+
async switchAccount(accountNameOrAddress) {
|
|
230
236
|
await this.page.getByTestId("account-menu-icon").click();
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
}
|
|
237
|
+
if ("name" in accountNameOrAddress) {
|
|
238
|
+
await this.page.locator(".multichain-account-list-item__account-name").getByRole("button", { name: accountNameOrAddress.name, exact: true }).click();
|
|
239
|
+
} else {
|
|
240
|
+
await this.page.getByTestId("account-list-address").filter({ hasText: shortenAddress(accountNameOrAddress.address) }).click();
|
|
241
|
+
}
|
|
234
242
|
}
|
|
235
243
|
async importAccount(privateKey) {
|
|
236
244
|
await this.page.getByTestId("account-menu-icon").click();
|
package/dist/index.mjs
CHANGED
|
@@ -102,6 +102,7 @@ var Backpack = class extends Wallet {
|
|
|
102
102
|
await expect(this.page.getByText("You're all good!")).toBeVisible();
|
|
103
103
|
}
|
|
104
104
|
await this.page.goto(`chrome-extension://${this.extensionId}/popup.html`);
|
|
105
|
+
await this.page.getByTestId("AccountBalanceRoundedIcon").waitFor({ state: "visible" });
|
|
105
106
|
}
|
|
106
107
|
};
|
|
107
108
|
|
|
@@ -164,6 +165,13 @@ var PolkadotJS = class extends Wallet {
|
|
|
164
165
|
|
|
165
166
|
// src/metamask/metamask.ts
|
|
166
167
|
import { expect as expect3 } from "@playwright/test";
|
|
168
|
+
|
|
169
|
+
// tests/utils/address.ts
|
|
170
|
+
var shortenAddress = (address) => {
|
|
171
|
+
return `${address.slice(0, 7)}...${address.slice(-5)}`;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// src/metamask/metamask.ts
|
|
167
175
|
var Metamask = class extends Wallet {
|
|
168
176
|
defaultPassword = "11111111";
|
|
169
177
|
async gotoOnboardPage() {
|
|
@@ -190,13 +198,13 @@ var Metamask = class extends Wallet {
|
|
|
190
198
|
await this.page.waitForTimeout(1e3);
|
|
191
199
|
await this.clickTopRightCornerToCloseAllTheMarketingBullshit();
|
|
192
200
|
}
|
|
193
|
-
async switchAccount(
|
|
194
|
-
if (nameOrAddress.startsWith("0x"))
|
|
195
|
-
nameOrAddress = nameOrAddress.slice(0, 7);
|
|
201
|
+
async switchAccount(accountNameOrAddress) {
|
|
196
202
|
await this.page.getByTestId("account-menu-icon").click();
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
203
|
+
if ("name" in accountNameOrAddress) {
|
|
204
|
+
await this.page.locator(".multichain-account-list-item__account-name").getByRole("button", { name: accountNameOrAddress.name, exact: true }).click();
|
|
205
|
+
} else {
|
|
206
|
+
await this.page.getByTestId("account-list-address").filter({ hasText: shortenAddress(accountNameOrAddress.address) }).click();
|
|
207
|
+
}
|
|
200
208
|
}
|
|
201
209
|
async importAccount(privateKey) {
|
|
202
210
|
await this.page.getByTestId("account-menu-icon").click();
|