w3wallets 0.9.4 → 0.10.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 +0 -3
- package/dist/index.d.ts +0 -3
- package/dist/index.js +13 -32
- package/dist/index.mjs +13 -32
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -70,9 +70,6 @@ declare class Metamask extends Wallet {
|
|
|
70
70
|
switchAccount(accountName: {
|
|
71
71
|
name: string;
|
|
72
72
|
}): Promise<void>;
|
|
73
|
-
switchAccount(accountAddress: {
|
|
74
|
-
address: string;
|
|
75
|
-
}): Promise<void>;
|
|
76
73
|
importAccount(privateKey: string): Promise<void>;
|
|
77
74
|
addAccount(accountName?: string): Promise<void>;
|
|
78
75
|
getAccountName(): Promise<string>;
|
package/dist/index.d.ts
CHANGED
|
@@ -70,9 +70,6 @@ declare class Metamask extends Wallet {
|
|
|
70
70
|
switchAccount(accountName: {
|
|
71
71
|
name: string;
|
|
72
72
|
}): Promise<void>;
|
|
73
|
-
switchAccount(accountAddress: {
|
|
74
|
-
address: string;
|
|
75
|
-
}): Promise<void>;
|
|
76
73
|
importAccount(privateKey: string): Promise<void>;
|
|
77
74
|
addAccount(accountName?: string): Promise<void>;
|
|
78
75
|
getAccountName(): Promise<string>;
|
package/dist/index.js
CHANGED
|
@@ -123,20 +123,19 @@ var Backpack = class extends Wallet {
|
|
|
123
123
|
}
|
|
124
124
|
await this.page.getByRole("button", { name: "I agree to the terms" }).click();
|
|
125
125
|
await this.page.getByText("I already have a wallet").click();
|
|
126
|
-
await this.page.getByText("View all").click();
|
|
127
126
|
await this.page.getByText(network).click();
|
|
128
127
|
await this.page.getByText("Private key").click();
|
|
129
128
|
await this.page.getByPlaceholder("Private key").fill(privateKey);
|
|
130
129
|
await this.page.waitForTimeout(1e3);
|
|
131
130
|
await this.page.getByText("Import", { exact: true }).click();
|
|
132
131
|
if (isOnboard) {
|
|
132
|
+
await this.page.getByRole("textbox").nth(0).fill(this.defaultPassword);
|
|
133
133
|
await this.page.getByRole("textbox").nth(1).fill(this.defaultPassword);
|
|
134
|
-
await this.page.getByRole("textbox").nth(2).fill(this.defaultPassword);
|
|
135
134
|
await this.page.getByText("Next", { exact: true }).click();
|
|
136
135
|
await (0, import_test.expect)(this.page.getByText("You're all good!")).toBeVisible();
|
|
137
136
|
}
|
|
138
137
|
await this.page.goto(`chrome-extension://${this.extensionId}/popup.html`);
|
|
139
|
-
await this.page.getByTestId("
|
|
138
|
+
await this.page.getByTestId("__CAROUSEL_ITEM_0__").waitFor({ state: "visible" });
|
|
140
139
|
}
|
|
141
140
|
};
|
|
142
141
|
|
|
@@ -199,13 +198,6 @@ var PolkadotJS = class extends Wallet {
|
|
|
199
198
|
|
|
200
199
|
// src/metamask/metamask.ts
|
|
201
200
|
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
|
|
209
201
|
var Metamask = class extends Wallet {
|
|
210
202
|
defaultPassword = "11111111";
|
|
211
203
|
async gotoOnboardPage() {
|
|
@@ -216,10 +208,6 @@ var Metamask = class extends Wallet {
|
|
|
216
208
|
* @param mnemonic 12-word mnemonic seed phrase
|
|
217
209
|
*/
|
|
218
210
|
async onboard(mnemonic, password = this.defaultPassword) {
|
|
219
|
-
await this.page.getByTestId("onboarding-get-started-button").click();
|
|
220
|
-
await this.page.getByTestId("terms-of-use-scroll-button").click();
|
|
221
|
-
await this.page.getByTestId("terms-of-use-checkbox").click();
|
|
222
|
-
await this.page.getByTestId("terms-of-use-agree-button").click();
|
|
223
211
|
await this.page.getByTestId("onboarding-import-wallet").click();
|
|
224
212
|
await this.page.getByTestId("onboarding-import-with-srp-button").click();
|
|
225
213
|
await this.page.getByTestId("srp-input-import__srp-note").pressSequentially(mnemonic);
|
|
@@ -228,25 +216,22 @@ var Metamask = class extends Wallet {
|
|
|
228
216
|
await this.page.getByTestId("create-password-confirm-input").fill(password);
|
|
229
217
|
await this.page.getByTestId("create-password-terms").click();
|
|
230
218
|
await this.page.getByTestId("create-password-submit").click();
|
|
231
|
-
await this.page.getByTestId("metametrics-
|
|
219
|
+
await this.page.getByTestId("metametrics-i-agree").click();
|
|
232
220
|
await this.page.getByTestId("onboarding-complete-done").click();
|
|
233
|
-
await this.
|
|
234
|
-
await this.page.getByTestId("pin-extension-done").click();
|
|
221
|
+
await this.clickTopRightCornerToCloseAllTheMarketingBullshit();
|
|
235
222
|
}
|
|
223
|
+
// async switchAccount(accountAddress: { address: string }): Promise<void>;
|
|
236
224
|
async switchAccount(accountNameOrAddress) {
|
|
237
225
|
await this.page.getByTestId("account-menu-icon").click();
|
|
238
|
-
|
|
239
|
-
await this.page.locator(".multichain-account-list-item__account-name").getByRole("button", { name: accountNameOrAddress.name, exact: true }).click();
|
|
240
|
-
} else {
|
|
241
|
-
await this.page.getByTestId("account-list-address").filter({ hasText: shortenAddress(accountNameOrAddress.address) }).click();
|
|
242
|
-
}
|
|
226
|
+
await this.page.getByText(accountNameOrAddress.name, { exact: true }).click();
|
|
243
227
|
}
|
|
244
228
|
async importAccount(privateKey) {
|
|
245
229
|
await this.page.getByTestId("account-menu-icon").click();
|
|
246
|
-
await this.page.getByTestId("
|
|
247
|
-
await this.page.getByTestId("
|
|
230
|
+
await this.page.getByTestId("account-list-add-wallet-button").click();
|
|
231
|
+
await this.page.getByTestId("add-wallet-modal-import-account").click();
|
|
248
232
|
await this.page.locator("#private-key-box").fill(privateKey);
|
|
249
233
|
await this.page.getByTestId("import-account-confirm-button").click();
|
|
234
|
+
await this.page.getByRole("button", { name: "Back" }).click();
|
|
250
235
|
}
|
|
251
236
|
async addAccount(accountName) {
|
|
252
237
|
await this.page.getByTestId("account-menu-icon").click();
|
|
@@ -266,15 +251,9 @@ var Metamask = class extends Wallet {
|
|
|
266
251
|
}
|
|
267
252
|
async connectToNetwork(networkName, networkType = "Popular") {
|
|
268
253
|
await this.page.getByTestId("sort-by-networks").click();
|
|
269
|
-
await this.page.getByRole("
|
|
254
|
+
await this.page.getByRole("tab", { name: networkType, exact: true }).click();
|
|
270
255
|
const additionalNetwork = this.page.getByTestId("additional-network-item").getByText(networkName);
|
|
271
|
-
|
|
272
|
-
await additionalNetwork.isEnabled({ timeout: 1e3 });
|
|
273
|
-
await additionalNetwork.click();
|
|
274
|
-
await this.page.getByTestId("confirmation-submit-button").click();
|
|
275
|
-
} catch (error) {
|
|
276
|
-
await this.page.getByText(networkName).click();
|
|
277
|
-
}
|
|
256
|
+
await this.page.getByText(networkName).click();
|
|
278
257
|
}
|
|
279
258
|
async addCustomNetwork(settings) {
|
|
280
259
|
await this.page.getByTestId("account-options-menu-button").click();
|
|
@@ -318,6 +297,8 @@ var Metamask = class extends Wallet {
|
|
|
318
297
|
await p.close();
|
|
319
298
|
}
|
|
320
299
|
async clickTopRightCornerToCloseAllTheMarketingBullshit() {
|
|
300
|
+
await this.page.waitForTimeout(500);
|
|
301
|
+
await this.page.keyboard.press("Escape");
|
|
321
302
|
await this.page.mouse.click(1e3, 10);
|
|
322
303
|
}
|
|
323
304
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -89,20 +89,19 @@ var Backpack = class extends Wallet {
|
|
|
89
89
|
}
|
|
90
90
|
await this.page.getByRole("button", { name: "I agree to the terms" }).click();
|
|
91
91
|
await this.page.getByText("I already have a wallet").click();
|
|
92
|
-
await this.page.getByText("View all").click();
|
|
93
92
|
await this.page.getByText(network).click();
|
|
94
93
|
await this.page.getByText("Private key").click();
|
|
95
94
|
await this.page.getByPlaceholder("Private key").fill(privateKey);
|
|
96
95
|
await this.page.waitForTimeout(1e3);
|
|
97
96
|
await this.page.getByText("Import", { exact: true }).click();
|
|
98
97
|
if (isOnboard) {
|
|
98
|
+
await this.page.getByRole("textbox").nth(0).fill(this.defaultPassword);
|
|
99
99
|
await this.page.getByRole("textbox").nth(1).fill(this.defaultPassword);
|
|
100
|
-
await this.page.getByRole("textbox").nth(2).fill(this.defaultPassword);
|
|
101
100
|
await this.page.getByText("Next", { exact: true }).click();
|
|
102
101
|
await expect(this.page.getByText("You're all good!")).toBeVisible();
|
|
103
102
|
}
|
|
104
103
|
await this.page.goto(`chrome-extension://${this.extensionId}/popup.html`);
|
|
105
|
-
await this.page.getByTestId("
|
|
104
|
+
await this.page.getByTestId("__CAROUSEL_ITEM_0__").waitFor({ state: "visible" });
|
|
106
105
|
}
|
|
107
106
|
};
|
|
108
107
|
|
|
@@ -165,13 +164,6 @@ var PolkadotJS = class extends Wallet {
|
|
|
165
164
|
|
|
166
165
|
// src/metamask/metamask.ts
|
|
167
166
|
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
|
|
175
167
|
var Metamask = class extends Wallet {
|
|
176
168
|
defaultPassword = "11111111";
|
|
177
169
|
async gotoOnboardPage() {
|
|
@@ -182,10 +174,6 @@ var Metamask = class extends Wallet {
|
|
|
182
174
|
* @param mnemonic 12-word mnemonic seed phrase
|
|
183
175
|
*/
|
|
184
176
|
async onboard(mnemonic, password = this.defaultPassword) {
|
|
185
|
-
await this.page.getByTestId("onboarding-get-started-button").click();
|
|
186
|
-
await this.page.getByTestId("terms-of-use-scroll-button").click();
|
|
187
|
-
await this.page.getByTestId("terms-of-use-checkbox").click();
|
|
188
|
-
await this.page.getByTestId("terms-of-use-agree-button").click();
|
|
189
177
|
await this.page.getByTestId("onboarding-import-wallet").click();
|
|
190
178
|
await this.page.getByTestId("onboarding-import-with-srp-button").click();
|
|
191
179
|
await this.page.getByTestId("srp-input-import__srp-note").pressSequentially(mnemonic);
|
|
@@ -194,25 +182,22 @@ var Metamask = class extends Wallet {
|
|
|
194
182
|
await this.page.getByTestId("create-password-confirm-input").fill(password);
|
|
195
183
|
await this.page.getByTestId("create-password-terms").click();
|
|
196
184
|
await this.page.getByTestId("create-password-submit").click();
|
|
197
|
-
await this.page.getByTestId("metametrics-
|
|
185
|
+
await this.page.getByTestId("metametrics-i-agree").click();
|
|
198
186
|
await this.page.getByTestId("onboarding-complete-done").click();
|
|
199
|
-
await this.
|
|
200
|
-
await this.page.getByTestId("pin-extension-done").click();
|
|
187
|
+
await this.clickTopRightCornerToCloseAllTheMarketingBullshit();
|
|
201
188
|
}
|
|
189
|
+
// async switchAccount(accountAddress: { address: string }): Promise<void>;
|
|
202
190
|
async switchAccount(accountNameOrAddress) {
|
|
203
191
|
await this.page.getByTestId("account-menu-icon").click();
|
|
204
|
-
|
|
205
|
-
await this.page.locator(".multichain-account-list-item__account-name").getByRole("button", { name: accountNameOrAddress.name, exact: true }).click();
|
|
206
|
-
} else {
|
|
207
|
-
await this.page.getByTestId("account-list-address").filter({ hasText: shortenAddress(accountNameOrAddress.address) }).click();
|
|
208
|
-
}
|
|
192
|
+
await this.page.getByText(accountNameOrAddress.name, { exact: true }).click();
|
|
209
193
|
}
|
|
210
194
|
async importAccount(privateKey) {
|
|
211
195
|
await this.page.getByTestId("account-menu-icon").click();
|
|
212
|
-
await this.page.getByTestId("
|
|
213
|
-
await this.page.getByTestId("
|
|
196
|
+
await this.page.getByTestId("account-list-add-wallet-button").click();
|
|
197
|
+
await this.page.getByTestId("add-wallet-modal-import-account").click();
|
|
214
198
|
await this.page.locator("#private-key-box").fill(privateKey);
|
|
215
199
|
await this.page.getByTestId("import-account-confirm-button").click();
|
|
200
|
+
await this.page.getByRole("button", { name: "Back" }).click();
|
|
216
201
|
}
|
|
217
202
|
async addAccount(accountName) {
|
|
218
203
|
await this.page.getByTestId("account-menu-icon").click();
|
|
@@ -232,15 +217,9 @@ var Metamask = class extends Wallet {
|
|
|
232
217
|
}
|
|
233
218
|
async connectToNetwork(networkName, networkType = "Popular") {
|
|
234
219
|
await this.page.getByTestId("sort-by-networks").click();
|
|
235
|
-
await this.page.getByRole("
|
|
220
|
+
await this.page.getByRole("tab", { name: networkType, exact: true }).click();
|
|
236
221
|
const additionalNetwork = this.page.getByTestId("additional-network-item").getByText(networkName);
|
|
237
|
-
|
|
238
|
-
await additionalNetwork.isEnabled({ timeout: 1e3 });
|
|
239
|
-
await additionalNetwork.click();
|
|
240
|
-
await this.page.getByTestId("confirmation-submit-button").click();
|
|
241
|
-
} catch (error) {
|
|
242
|
-
await this.page.getByText(networkName).click();
|
|
243
|
-
}
|
|
222
|
+
await this.page.getByText(networkName).click();
|
|
244
223
|
}
|
|
245
224
|
async addCustomNetwork(settings) {
|
|
246
225
|
await this.page.getByTestId("account-options-menu-button").click();
|
|
@@ -284,6 +263,8 @@ var Metamask = class extends Wallet {
|
|
|
284
263
|
await p.close();
|
|
285
264
|
}
|
|
286
265
|
async clickTopRightCornerToCloseAllTheMarketingBullshit() {
|
|
266
|
+
await this.page.waitForTimeout(500);
|
|
267
|
+
await this.page.keyboard.press("Escape");
|
|
287
268
|
await this.page.mouse.click(1e3, 10);
|
|
288
269
|
}
|
|
289
270
|
};
|