w3wallets 0.8.4 → 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 -25
- package/dist/index.mjs +30 -25
- 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
|
@@ -264,33 +264,38 @@ var Metamask = class extends Wallet {
|
|
|
264
264
|
if (!text) throw Error("Cannot get account name");
|
|
265
265
|
return text;
|
|
266
266
|
}
|
|
267
|
-
async connectToNetwork(
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
await
|
|
273
|
-
await
|
|
274
|
-
await this.page.getByTestId("
|
|
275
|
-
|
|
276
|
-
await this.page.
|
|
277
|
-
await this.page.getByTestId("
|
|
278
|
-
await this.page.getByRole("button", { name: "Add URL" }).click();
|
|
279
|
-
await this.page.getByRole("button", { name: "Save" }).click();
|
|
280
|
-
} else {
|
|
281
|
-
await this.page.getByTestId("sort-by-networks").click();
|
|
282
|
-
await this.page.getByRole("button", { name: "Default" }).click();
|
|
283
|
-
const additionalNetwork = this.page.getByTestId("additional-network-item").getByText(settingsOrName);
|
|
284
|
-
try {
|
|
285
|
-
await additionalNetwork.isEnabled({ timeout: 1e3 });
|
|
286
|
-
await additionalNetwork.click();
|
|
287
|
-
await this.page.getByTestId("confirmation-submit-button").click();
|
|
288
|
-
} catch (error) {
|
|
289
|
-
await this.page.getByText(settingsOrName).click();
|
|
290
|
-
await this.page.getByTestId("modal-header-close-button").click();
|
|
291
|
-
}
|
|
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();
|
|
292
278
|
}
|
|
293
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();
|
|
296
|
+
await this.page.locator("text=Show test networks >> xpath=following-sibling::label").click();
|
|
297
|
+
await this.page.keyboard.press("Escape");
|
|
298
|
+
}
|
|
294
299
|
async approve() {
|
|
295
300
|
const p = await this.page.context().newPage();
|
|
296
301
|
await p.goto(`chrome-extension://${this.extensionId}/notification.html`);
|
package/dist/index.mjs
CHANGED
|
@@ -230,33 +230,38 @@ var Metamask = class extends Wallet {
|
|
|
230
230
|
if (!text) throw Error("Cannot get account name");
|
|
231
231
|
return text;
|
|
232
232
|
}
|
|
233
|
-
async connectToNetwork(
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
await
|
|
239
|
-
await
|
|
240
|
-
await this.page.getByTestId("
|
|
241
|
-
|
|
242
|
-
await this.page.
|
|
243
|
-
await this.page.getByTestId("
|
|
244
|
-
await this.page.getByRole("button", { name: "Add URL" }).click();
|
|
245
|
-
await this.page.getByRole("button", { name: "Save" }).click();
|
|
246
|
-
} else {
|
|
247
|
-
await this.page.getByTestId("sort-by-networks").click();
|
|
248
|
-
await this.page.getByRole("button", { name: "Default" }).click();
|
|
249
|
-
const additionalNetwork = this.page.getByTestId("additional-network-item").getByText(settingsOrName);
|
|
250
|
-
try {
|
|
251
|
-
await additionalNetwork.isEnabled({ timeout: 1e3 });
|
|
252
|
-
await additionalNetwork.click();
|
|
253
|
-
await this.page.getByTestId("confirmation-submit-button").click();
|
|
254
|
-
} catch (error) {
|
|
255
|
-
await this.page.getByText(settingsOrName).click();
|
|
256
|
-
await this.page.getByTestId("modal-header-close-button").click();
|
|
257
|
-
}
|
|
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();
|
|
258
244
|
}
|
|
259
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();
|
|
262
|
+
await this.page.locator("text=Show test networks >> xpath=following-sibling::label").click();
|
|
263
|
+
await this.page.keyboard.press("Escape");
|
|
264
|
+
}
|
|
260
265
|
async approve() {
|
|
261
266
|
const p = await this.page.context().newPage();
|
|
262
267
|
await p.goto(`chrome-extension://${this.extensionId}/notification.html`);
|