w3wallets 0.9.5 → 0.10.1
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 +11 -28
- package/dist/index.mjs +11 -28
- 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,15 +123,14 @@ 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
|
}
|
|
@@ -152,6 +151,7 @@ var PolkadotJS = class extends Wallet {
|
|
|
152
151
|
}
|
|
153
152
|
async onboard(seed, password, name) {
|
|
154
153
|
await this.page.getByRole("button", { name: "Understood, let me continue" }).click();
|
|
154
|
+
await this.page.getByRole("button", { name: "I Understand" }).click();
|
|
155
155
|
await this.page.locator(".popupToggle").first().click();
|
|
156
156
|
await this.page.getByText("Import account from pre-existing seed").click();
|
|
157
157
|
await this.page.locator(".seedInput").getByRole("textbox").fill(seed);
|
|
@@ -199,13 +199,6 @@ var PolkadotJS = class extends Wallet {
|
|
|
199
199
|
|
|
200
200
|
// src/metamask/metamask.ts
|
|
201
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
|
|
209
202
|
var Metamask = class extends Wallet {
|
|
210
203
|
defaultPassword = "11111111";
|
|
211
204
|
async gotoOnboardPage() {
|
|
@@ -218,32 +211,28 @@ var Metamask = class extends Wallet {
|
|
|
218
211
|
async onboard(mnemonic, password = this.defaultPassword) {
|
|
219
212
|
await this.page.getByTestId("onboarding-import-wallet").click();
|
|
220
213
|
await this.page.getByTestId("onboarding-import-with-srp-button").click();
|
|
221
|
-
await this.page.getByTestId("srp-input-import__srp-note").pressSequentially(mnemonic);
|
|
214
|
+
await this.page.getByTestId("srp-input-import__srp-note").pressSequentially(mnemonic, { delay: 5 });
|
|
222
215
|
await this.page.getByTestId("import-srp-confirm").click();
|
|
223
216
|
await this.page.getByTestId("create-password-new-input").fill(password);
|
|
224
217
|
await this.page.getByTestId("create-password-confirm-input").fill(password);
|
|
225
218
|
await this.page.getByTestId("create-password-terms").click();
|
|
226
219
|
await this.page.getByTestId("create-password-submit").click();
|
|
227
|
-
await this.page.getByTestId("metametrics-
|
|
220
|
+
await this.page.getByTestId("metametrics-i-agree").click();
|
|
228
221
|
await this.page.getByTestId("onboarding-complete-done").click();
|
|
229
|
-
await this.page.getByTestId("download-app-continue").click();
|
|
230
|
-
await this.page.getByTestId("pin-extension-done").click();
|
|
231
222
|
await this.clickTopRightCornerToCloseAllTheMarketingBullshit();
|
|
232
223
|
}
|
|
224
|
+
// async switchAccount(accountAddress: { address: string }): Promise<void>;
|
|
233
225
|
async switchAccount(accountNameOrAddress) {
|
|
234
226
|
await this.page.getByTestId("account-menu-icon").click();
|
|
235
|
-
|
|
236
|
-
await this.page.locator(".multichain-account-list-item__account-name").getByRole("button", { name: accountNameOrAddress.name, exact: true }).click();
|
|
237
|
-
} else {
|
|
238
|
-
await this.page.getByTestId("account-list-address").filter({ hasText: shortenAddress(accountNameOrAddress.address) }).click();
|
|
239
|
-
}
|
|
227
|
+
await this.page.getByText(accountNameOrAddress.name, { exact: true }).click();
|
|
240
228
|
}
|
|
241
229
|
async importAccount(privateKey) {
|
|
242
230
|
await this.page.getByTestId("account-menu-icon").click();
|
|
243
|
-
await this.page.getByTestId("
|
|
244
|
-
await this.page.getByTestId("
|
|
231
|
+
await this.page.getByTestId("account-list-add-wallet-button").click();
|
|
232
|
+
await this.page.getByTestId("add-wallet-modal-import-account").click();
|
|
245
233
|
await this.page.locator("#private-key-box").fill(privateKey);
|
|
246
234
|
await this.page.getByTestId("import-account-confirm-button").click();
|
|
235
|
+
await this.page.getByRole("button", { name: "Back" }).click();
|
|
247
236
|
}
|
|
248
237
|
async addAccount(accountName) {
|
|
249
238
|
await this.page.getByTestId("account-menu-icon").click();
|
|
@@ -263,15 +252,9 @@ var Metamask = class extends Wallet {
|
|
|
263
252
|
}
|
|
264
253
|
async connectToNetwork(networkName, networkType = "Popular") {
|
|
265
254
|
await this.page.getByTestId("sort-by-networks").click();
|
|
266
|
-
await this.page.getByRole("
|
|
255
|
+
await this.page.getByRole("tab", { name: networkType, exact: true }).click();
|
|
267
256
|
const additionalNetwork = this.page.getByTestId("additional-network-item").getByText(networkName);
|
|
268
|
-
|
|
269
|
-
await additionalNetwork.isEnabled({ timeout: 1e3 });
|
|
270
|
-
await additionalNetwork.click();
|
|
271
|
-
await this.page.getByTestId("confirmation-submit-button").click();
|
|
272
|
-
} catch (error) {
|
|
273
|
-
await this.page.getByText(networkName).click();
|
|
274
|
-
}
|
|
257
|
+
await this.page.getByText(networkName).click();
|
|
275
258
|
}
|
|
276
259
|
async addCustomNetwork(settings) {
|
|
277
260
|
await this.page.getByTestId("account-options-menu-button").click();
|
package/dist/index.mjs
CHANGED
|
@@ -89,15 +89,14 @@ 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
|
}
|
|
@@ -118,6 +117,7 @@ var PolkadotJS = class extends Wallet {
|
|
|
118
117
|
}
|
|
119
118
|
async onboard(seed, password, name) {
|
|
120
119
|
await this.page.getByRole("button", { name: "Understood, let me continue" }).click();
|
|
120
|
+
await this.page.getByRole("button", { name: "I Understand" }).click();
|
|
121
121
|
await this.page.locator(".popupToggle").first().click();
|
|
122
122
|
await this.page.getByText("Import account from pre-existing seed").click();
|
|
123
123
|
await this.page.locator(".seedInput").getByRole("textbox").fill(seed);
|
|
@@ -165,13 +165,6 @@ var PolkadotJS = class extends Wallet {
|
|
|
165
165
|
|
|
166
166
|
// src/metamask/metamask.ts
|
|
167
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
|
|
175
168
|
var Metamask = class extends Wallet {
|
|
176
169
|
defaultPassword = "11111111";
|
|
177
170
|
async gotoOnboardPage() {
|
|
@@ -184,32 +177,28 @@ var Metamask = class extends Wallet {
|
|
|
184
177
|
async onboard(mnemonic, password = this.defaultPassword) {
|
|
185
178
|
await this.page.getByTestId("onboarding-import-wallet").click();
|
|
186
179
|
await this.page.getByTestId("onboarding-import-with-srp-button").click();
|
|
187
|
-
await this.page.getByTestId("srp-input-import__srp-note").pressSequentially(mnemonic);
|
|
180
|
+
await this.page.getByTestId("srp-input-import__srp-note").pressSequentially(mnemonic, { delay: 5 });
|
|
188
181
|
await this.page.getByTestId("import-srp-confirm").click();
|
|
189
182
|
await this.page.getByTestId("create-password-new-input").fill(password);
|
|
190
183
|
await this.page.getByTestId("create-password-confirm-input").fill(password);
|
|
191
184
|
await this.page.getByTestId("create-password-terms").click();
|
|
192
185
|
await this.page.getByTestId("create-password-submit").click();
|
|
193
|
-
await this.page.getByTestId("metametrics-
|
|
186
|
+
await this.page.getByTestId("metametrics-i-agree").click();
|
|
194
187
|
await this.page.getByTestId("onboarding-complete-done").click();
|
|
195
|
-
await this.page.getByTestId("download-app-continue").click();
|
|
196
|
-
await this.page.getByTestId("pin-extension-done").click();
|
|
197
188
|
await this.clickTopRightCornerToCloseAllTheMarketingBullshit();
|
|
198
189
|
}
|
|
190
|
+
// async switchAccount(accountAddress: { address: string }): Promise<void>;
|
|
199
191
|
async switchAccount(accountNameOrAddress) {
|
|
200
192
|
await this.page.getByTestId("account-menu-icon").click();
|
|
201
|
-
|
|
202
|
-
await this.page.locator(".multichain-account-list-item__account-name").getByRole("button", { name: accountNameOrAddress.name, exact: true }).click();
|
|
203
|
-
} else {
|
|
204
|
-
await this.page.getByTestId("account-list-address").filter({ hasText: shortenAddress(accountNameOrAddress.address) }).click();
|
|
205
|
-
}
|
|
193
|
+
await this.page.getByText(accountNameOrAddress.name, { exact: true }).click();
|
|
206
194
|
}
|
|
207
195
|
async importAccount(privateKey) {
|
|
208
196
|
await this.page.getByTestId("account-menu-icon").click();
|
|
209
|
-
await this.page.getByTestId("
|
|
210
|
-
await this.page.getByTestId("
|
|
197
|
+
await this.page.getByTestId("account-list-add-wallet-button").click();
|
|
198
|
+
await this.page.getByTestId("add-wallet-modal-import-account").click();
|
|
211
199
|
await this.page.locator("#private-key-box").fill(privateKey);
|
|
212
200
|
await this.page.getByTestId("import-account-confirm-button").click();
|
|
201
|
+
await this.page.getByRole("button", { name: "Back" }).click();
|
|
213
202
|
}
|
|
214
203
|
async addAccount(accountName) {
|
|
215
204
|
await this.page.getByTestId("account-menu-icon").click();
|
|
@@ -229,15 +218,9 @@ var Metamask = class extends Wallet {
|
|
|
229
218
|
}
|
|
230
219
|
async connectToNetwork(networkName, networkType = "Popular") {
|
|
231
220
|
await this.page.getByTestId("sort-by-networks").click();
|
|
232
|
-
await this.page.getByRole("
|
|
221
|
+
await this.page.getByRole("tab", { name: networkType, exact: true }).click();
|
|
233
222
|
const additionalNetwork = this.page.getByTestId("additional-network-item").getByText(networkName);
|
|
234
|
-
|
|
235
|
-
await additionalNetwork.isEnabled({ timeout: 1e3 });
|
|
236
|
-
await additionalNetwork.click();
|
|
237
|
-
await this.page.getByTestId("confirmation-submit-button").click();
|
|
238
|
-
} catch (error) {
|
|
239
|
-
await this.page.getByText(networkName).click();
|
|
240
|
-
}
|
|
223
|
+
await this.page.getByText(networkName).click();
|
|
241
224
|
}
|
|
242
225
|
async addCustomNetwork(settings) {
|
|
243
226
|
await this.page.getByTestId("account-options-menu-button").click();
|