w3wallets 0.5.0 → 0.5.2
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 +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +34 -0
- package/dist/index.mjs +35 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -67,11 +67,16 @@ 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(nameOrAddress: string): Promise<void>;
|
|
71
|
+
importAccount(privateKey: string): Promise<void>;
|
|
72
|
+
addAccount(accountName?: string): Promise<void>;
|
|
73
|
+
getAccountName(): Promise<string>;
|
|
70
74
|
connectToNetwork(networkName: string): Promise<void>;
|
|
71
75
|
connectToNetwork(settings: NetworkSettings): Promise<void>;
|
|
72
76
|
approve(): Promise<void>;
|
|
73
77
|
deny(): Promise<void>;
|
|
74
78
|
private usingNotificationPage;
|
|
79
|
+
private clickTopRightCornerToCloseAllTheMarketingBullshit;
|
|
75
80
|
}
|
|
76
81
|
|
|
77
82
|
declare function withWallets<T extends readonly WalletName[]>(test: typeof test, ...config: NoDuplicates<T>): playwright_test.TestType<playwright_test.PlaywrightTestArgs & playwright_test.PlaywrightTestOptions & {
|
package/dist/index.d.ts
CHANGED
|
@@ -67,11 +67,16 @@ 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(nameOrAddress: string): Promise<void>;
|
|
71
|
+
importAccount(privateKey: string): Promise<void>;
|
|
72
|
+
addAccount(accountName?: string): Promise<void>;
|
|
73
|
+
getAccountName(): Promise<string>;
|
|
70
74
|
connectToNetwork(networkName: string): Promise<void>;
|
|
71
75
|
connectToNetwork(settings: NetworkSettings): Promise<void>;
|
|
72
76
|
approve(): Promise<void>;
|
|
73
77
|
deny(): Promise<void>;
|
|
74
78
|
private usingNotificationPage;
|
|
79
|
+
private clickTopRightCornerToCloseAllTheMarketingBullshit;
|
|
75
80
|
}
|
|
76
81
|
|
|
77
82
|
declare function withWallets<T extends readonly WalletName[]>(test: typeof test, ...config: NoDuplicates<T>): playwright_test.TestType<playwright_test.PlaywrightTestArgs & playwright_test.PlaywrightTestOptions & {
|
package/dist/index.js
CHANGED
|
@@ -221,6 +221,37 @@ var Metamask = class extends Wallet {
|
|
|
221
221
|
await this.page.getByTestId("onboarding-complete-done").click();
|
|
222
222
|
await this.page.getByTestId("pin-extension-next").click();
|
|
223
223
|
await this.page.getByTestId("pin-extension-done").click();
|
|
224
|
+
await this.page.waitForTimeout(1e3);
|
|
225
|
+
await this.clickTopRightCornerToCloseAllTheMarketingBullshit();
|
|
226
|
+
}
|
|
227
|
+
async switchAccount(nameOrAddress) {
|
|
228
|
+
if (nameOrAddress.startsWith("0x"))
|
|
229
|
+
nameOrAddress = nameOrAddress.slice(0, 7);
|
|
230
|
+
await this.page.getByTestId("account-menu-icon").click();
|
|
231
|
+
await this.page.locator(".multichain-account-menu-popover__list--menu-item").filter({ hasText: nameOrAddress }).click();
|
|
232
|
+
}
|
|
233
|
+
async importAccount(privateKey) {
|
|
234
|
+
await this.page.getByTestId("account-menu-icon").click();
|
|
235
|
+
await this.page.getByTestId("multichain-account-menu-popover-action-button").click();
|
|
236
|
+
await this.page.getByTestId("multichain-account-menu-popover-add-imported-account").click();
|
|
237
|
+
await this.page.locator("#private-key-box").fill(privateKey);
|
|
238
|
+
await this.page.getByTestId("import-account-confirm-button").click();
|
|
239
|
+
}
|
|
240
|
+
async addAccount(accountName) {
|
|
241
|
+
await this.page.getByTestId("account-menu-icon").click();
|
|
242
|
+
await this.page.getByTestId("multichain-account-menu-popover-action-button").click();
|
|
243
|
+
await this.page.getByTestId("multichain-account-menu-popover-add-account").click();
|
|
244
|
+
if (accountName) {
|
|
245
|
+
await this.page.locator("#account-name").fill(accountName);
|
|
246
|
+
}
|
|
247
|
+
await this.page.getByTestId("submit-add-account-with-name").click();
|
|
248
|
+
}
|
|
249
|
+
async getAccountName() {
|
|
250
|
+
const accountSelect = this.page.getByTestId("account-menu-icon");
|
|
251
|
+
await (0, import_test3.expect)(accountSelect).toBeVisible();
|
|
252
|
+
const text = await accountSelect.textContent();
|
|
253
|
+
if (!text) throw Error("Cannot get account name");
|
|
254
|
+
return text;
|
|
224
255
|
}
|
|
225
256
|
async connectToNetwork(settingsOrName) {
|
|
226
257
|
if (typeof settingsOrName !== "string") {
|
|
@@ -269,6 +300,9 @@ var Metamask = class extends Wallet {
|
|
|
269
300
|
await action(p);
|
|
270
301
|
await p.close();
|
|
271
302
|
}
|
|
303
|
+
async clickTopRightCornerToCloseAllTheMarketingBullshit() {
|
|
304
|
+
await this.page.mouse.click(1e3, 10);
|
|
305
|
+
}
|
|
272
306
|
};
|
|
273
307
|
|
|
274
308
|
// src/withWallets.ts
|
package/dist/index.mjs
CHANGED
|
@@ -163,7 +163,7 @@ var PolkadotJS = class extends Wallet {
|
|
|
163
163
|
};
|
|
164
164
|
|
|
165
165
|
// src/metamask/metamask.ts
|
|
166
|
-
import "@playwright/test";
|
|
166
|
+
import { expect as expect3 } from "@playwright/test";
|
|
167
167
|
var Metamask = class extends Wallet {
|
|
168
168
|
defaultPassword = "11111111";
|
|
169
169
|
async gotoOnboardPage() {
|
|
@@ -187,6 +187,37 @@ var Metamask = class extends Wallet {
|
|
|
187
187
|
await this.page.getByTestId("onboarding-complete-done").click();
|
|
188
188
|
await this.page.getByTestId("pin-extension-next").click();
|
|
189
189
|
await this.page.getByTestId("pin-extension-done").click();
|
|
190
|
+
await this.page.waitForTimeout(1e3);
|
|
191
|
+
await this.clickTopRightCornerToCloseAllTheMarketingBullshit();
|
|
192
|
+
}
|
|
193
|
+
async switchAccount(nameOrAddress) {
|
|
194
|
+
if (nameOrAddress.startsWith("0x"))
|
|
195
|
+
nameOrAddress = nameOrAddress.slice(0, 7);
|
|
196
|
+
await this.page.getByTestId("account-menu-icon").click();
|
|
197
|
+
await this.page.locator(".multichain-account-menu-popover__list--menu-item").filter({ hasText: nameOrAddress }).click();
|
|
198
|
+
}
|
|
199
|
+
async importAccount(privateKey) {
|
|
200
|
+
await this.page.getByTestId("account-menu-icon").click();
|
|
201
|
+
await this.page.getByTestId("multichain-account-menu-popover-action-button").click();
|
|
202
|
+
await this.page.getByTestId("multichain-account-menu-popover-add-imported-account").click();
|
|
203
|
+
await this.page.locator("#private-key-box").fill(privateKey);
|
|
204
|
+
await this.page.getByTestId("import-account-confirm-button").click();
|
|
205
|
+
}
|
|
206
|
+
async addAccount(accountName) {
|
|
207
|
+
await this.page.getByTestId("account-menu-icon").click();
|
|
208
|
+
await this.page.getByTestId("multichain-account-menu-popover-action-button").click();
|
|
209
|
+
await this.page.getByTestId("multichain-account-menu-popover-add-account").click();
|
|
210
|
+
if (accountName) {
|
|
211
|
+
await this.page.locator("#account-name").fill(accountName);
|
|
212
|
+
}
|
|
213
|
+
await this.page.getByTestId("submit-add-account-with-name").click();
|
|
214
|
+
}
|
|
215
|
+
async getAccountName() {
|
|
216
|
+
const accountSelect = this.page.getByTestId("account-menu-icon");
|
|
217
|
+
await expect3(accountSelect).toBeVisible();
|
|
218
|
+
const text = await accountSelect.textContent();
|
|
219
|
+
if (!text) throw Error("Cannot get account name");
|
|
220
|
+
return text;
|
|
190
221
|
}
|
|
191
222
|
async connectToNetwork(settingsOrName) {
|
|
192
223
|
if (typeof settingsOrName !== "string") {
|
|
@@ -235,6 +266,9 @@ var Metamask = class extends Wallet {
|
|
|
235
266
|
await action(p);
|
|
236
267
|
await p.close();
|
|
237
268
|
}
|
|
269
|
+
async clickTopRightCornerToCloseAllTheMarketingBullshit() {
|
|
270
|
+
await this.page.mouse.click(1e3, 10);
|
|
271
|
+
}
|
|
238
272
|
};
|
|
239
273
|
|
|
240
274
|
// src/withWallets.ts
|