w3wallets 0.8.3 → 0.9.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 +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +30 -16
- package/dist/index.mjs +30 -16
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -76,8 +76,9 @@ declare class Metamask extends Wallet {
|
|
|
76
76
|
importAccount(privateKey: string): Promise<void>;
|
|
77
77
|
addAccount(accountName?: string): Promise<void>;
|
|
78
78
|
getAccountName(): Promise<string>;
|
|
79
|
-
connectToNetwork(networkName: string): Promise<void>;
|
|
80
|
-
|
|
79
|
+
connectToNetwork(networkName: string, networkType?: "Default" | "Custom"): Promise<void>;
|
|
80
|
+
addCustomNetwork(settings: NetworkSettings): Promise<void>;
|
|
81
|
+
enableTestNetworks(): Promise<void>;
|
|
81
82
|
approve(): Promise<void>;
|
|
82
83
|
deny(): Promise<void>;
|
|
83
84
|
private usingNotificationPage;
|
package/dist/index.d.ts
CHANGED
|
@@ -76,8 +76,9 @@ declare class Metamask extends Wallet {
|
|
|
76
76
|
importAccount(privateKey: string): Promise<void>;
|
|
77
77
|
addAccount(accountName?: string): Promise<void>;
|
|
78
78
|
getAccountName(): Promise<string>;
|
|
79
|
-
connectToNetwork(networkName: string): Promise<void>;
|
|
80
|
-
|
|
79
|
+
connectToNetwork(networkName: string, networkType?: "Default" | "Custom"): Promise<void>;
|
|
80
|
+
addCustomNetwork(settings: NetworkSettings): Promise<void>;
|
|
81
|
+
enableTestNetworks(): Promise<void>;
|
|
81
82
|
approve(): Promise<void>;
|
|
82
83
|
deny(): Promise<void>;
|
|
83
84
|
private usingNotificationPage;
|
package/dist/index.js
CHANGED
|
@@ -221,6 +221,7 @@ var Metamask = class extends Wallet {
|
|
|
221
221
|
await this.page.getByTestId("terms-of-use-checkbox").click();
|
|
222
222
|
await this.page.getByTestId("terms-of-use-agree-button").click();
|
|
223
223
|
await this.page.getByTestId("onboarding-import-wallet").click();
|
|
224
|
+
await this.page.getByTestId("onboarding-import-with-srp-button").click();
|
|
224
225
|
await this.page.getByTestId("srp-input-import__srp-note").pressSequentially(mnemonic);
|
|
225
226
|
await this.page.getByTestId("import-srp-confirm").click();
|
|
226
227
|
await this.page.getByTestId("create-password-new-input").fill(password);
|
|
@@ -263,24 +264,37 @@ var Metamask = class extends Wallet {
|
|
|
263
264
|
if (!text) throw Error("Cannot get account name");
|
|
264
265
|
return text;
|
|
265
266
|
}
|
|
266
|
-
async connectToNetwork(
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
await
|
|
272
|
-
await
|
|
273
|
-
await this.page.getByTestId("
|
|
274
|
-
|
|
275
|
-
await this.page.
|
|
276
|
-
await this.page.
|
|
277
|
-
await this.page.getByRole("button", { name: "Save" }).click();
|
|
267
|
+
async connectToNetwork(networkName, networkType = "Default") {
|
|
268
|
+
await this.page.getByTestId("sort-by-networks").click();
|
|
269
|
+
await this.page.getByRole("button", { name: networkType }).click();
|
|
270
|
+
const additionalNetwork = this.page.getByTestId("additional-network-item").getByText(networkName);
|
|
271
|
+
try {
|
|
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
|
+
await this.page.getByTestId("modal-header-close-button").click();
|
|
278
278
|
}
|
|
279
|
-
|
|
279
|
+
}
|
|
280
|
+
async addCustomNetwork(settings) {
|
|
281
|
+
await this.page.getByTestId("account-options-menu-button").click();
|
|
282
|
+
await this.page.getByTestId("global-menu-networks").click();
|
|
283
|
+
await this.page.getByRole("button", { name: "Add a custom network" }).click();
|
|
284
|
+
await this.page.getByTestId("network-form-network-name").fill(settings.name);
|
|
285
|
+
await this.page.getByTestId("network-form-chain-id").fill(settings.chainId.toString());
|
|
286
|
+
await this.page.getByTestId("network-form-ticker-input").fill(settings.currencySymbol);
|
|
287
|
+
await this.page.getByTestId("test-add-rpc-drop-down").click();
|
|
288
|
+
await this.page.getByRole("button", { name: "Add RPC URL" }).click();
|
|
289
|
+
await this.page.getByTestId("rpc-url-input-test").fill(settings.rpc);
|
|
290
|
+
await this.page.getByRole("button", { name: "Add URL" }).click();
|
|
291
|
+
await this.page.getByRole("button", { name: "Save" }).click();
|
|
292
|
+
}
|
|
293
|
+
async enableTestNetworks() {
|
|
294
|
+
await this.page.getByTestId("account-options-menu-button").click();
|
|
295
|
+
await this.page.getByTestId("global-menu-networks").click();
|
|
280
296
|
await this.page.locator("text=Show test networks >> xpath=following-sibling::label").click();
|
|
281
|
-
await this.page.
|
|
282
|
-
typeof settingsOrName === "string" ? settingsOrName : settingsOrName.name
|
|
283
|
-
).click();
|
|
297
|
+
await this.page.keyboard.press("Escape");
|
|
284
298
|
}
|
|
285
299
|
async approve() {
|
|
286
300
|
const p = await this.page.context().newPage();
|
package/dist/index.mjs
CHANGED
|
@@ -187,6 +187,7 @@ var Metamask = class extends Wallet {
|
|
|
187
187
|
await this.page.getByTestId("terms-of-use-checkbox").click();
|
|
188
188
|
await this.page.getByTestId("terms-of-use-agree-button").click();
|
|
189
189
|
await this.page.getByTestId("onboarding-import-wallet").click();
|
|
190
|
+
await this.page.getByTestId("onboarding-import-with-srp-button").click();
|
|
190
191
|
await this.page.getByTestId("srp-input-import__srp-note").pressSequentially(mnemonic);
|
|
191
192
|
await this.page.getByTestId("import-srp-confirm").click();
|
|
192
193
|
await this.page.getByTestId("create-password-new-input").fill(password);
|
|
@@ -229,24 +230,37 @@ var Metamask = class extends Wallet {
|
|
|
229
230
|
if (!text) throw Error("Cannot get account name");
|
|
230
231
|
return text;
|
|
231
232
|
}
|
|
232
|
-
async connectToNetwork(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
await
|
|
238
|
-
await
|
|
239
|
-
await this.page.getByTestId("
|
|
240
|
-
|
|
241
|
-
await this.page.
|
|
242
|
-
await this.page.
|
|
243
|
-
await this.page.getByRole("button", { name: "Save" }).click();
|
|
233
|
+
async connectToNetwork(networkName, networkType = "Default") {
|
|
234
|
+
await this.page.getByTestId("sort-by-networks").click();
|
|
235
|
+
await this.page.getByRole("button", { name: networkType }).click();
|
|
236
|
+
const additionalNetwork = this.page.getByTestId("additional-network-item").getByText(networkName);
|
|
237
|
+
try {
|
|
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
|
+
await this.page.getByTestId("modal-header-close-button").click();
|
|
244
244
|
}
|
|
245
|
-
|
|
245
|
+
}
|
|
246
|
+
async addCustomNetwork(settings) {
|
|
247
|
+
await this.page.getByTestId("account-options-menu-button").click();
|
|
248
|
+
await this.page.getByTestId("global-menu-networks").click();
|
|
249
|
+
await this.page.getByRole("button", { name: "Add a custom network" }).click();
|
|
250
|
+
await this.page.getByTestId("network-form-network-name").fill(settings.name);
|
|
251
|
+
await this.page.getByTestId("network-form-chain-id").fill(settings.chainId.toString());
|
|
252
|
+
await this.page.getByTestId("network-form-ticker-input").fill(settings.currencySymbol);
|
|
253
|
+
await this.page.getByTestId("test-add-rpc-drop-down").click();
|
|
254
|
+
await this.page.getByRole("button", { name: "Add RPC URL" }).click();
|
|
255
|
+
await this.page.getByTestId("rpc-url-input-test").fill(settings.rpc);
|
|
256
|
+
await this.page.getByRole("button", { name: "Add URL" }).click();
|
|
257
|
+
await this.page.getByRole("button", { name: "Save" }).click();
|
|
258
|
+
}
|
|
259
|
+
async enableTestNetworks() {
|
|
260
|
+
await this.page.getByTestId("account-options-menu-button").click();
|
|
261
|
+
await this.page.getByTestId("global-menu-networks").click();
|
|
246
262
|
await this.page.locator("text=Show test networks >> xpath=following-sibling::label").click();
|
|
247
|
-
await this.page.
|
|
248
|
-
typeof settingsOrName === "string" ? settingsOrName : settingsOrName.name
|
|
249
|
-
).click();
|
|
263
|
+
await this.page.keyboard.press("Escape");
|
|
250
264
|
}
|
|
251
265
|
async approve() {
|
|
252
266
|
const p = await this.page.context().newPage();
|