w3wallets 0.5.0 → 0.5.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 +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +29 -0
- package/dist/index.mjs +30 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -67,6 +67,10 @@ 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>;
|
package/dist/index.d.ts
CHANGED
|
@@ -67,6 +67,10 @@ 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>;
|
package/dist/index.js
CHANGED
|
@@ -222,6 +222,35 @@ var Metamask = class extends Wallet {
|
|
|
222
222
|
await this.page.getByTestId("pin-extension-next").click();
|
|
223
223
|
await this.page.getByTestId("pin-extension-done").click();
|
|
224
224
|
}
|
|
225
|
+
async switchAccount(nameOrAddress) {
|
|
226
|
+
if (nameOrAddress.startsWith("0x"))
|
|
227
|
+
nameOrAddress = nameOrAddress.slice(0, 7);
|
|
228
|
+
await this.page.getByTestId("account-menu-icon").click();
|
|
229
|
+
await this.page.locator(".multichain-account-menu-popover__list--menu-item").filter({ hasText: nameOrAddress }).click();
|
|
230
|
+
}
|
|
231
|
+
async importAccount(privateKey) {
|
|
232
|
+
await this.page.getByTestId("account-menu-icon").click();
|
|
233
|
+
await this.page.getByTestId("multichain-account-menu-popover-action-button").click();
|
|
234
|
+
await this.page.getByTestId("multichain-account-menu-popover-add-imported-account").click();
|
|
235
|
+
await this.page.locator("#private-key-box").fill(privateKey);
|
|
236
|
+
await this.page.getByTestId("import-account-confirm-button").click();
|
|
237
|
+
}
|
|
238
|
+
async addAccount(accountName) {
|
|
239
|
+
await this.page.getByTestId("account-menu-icon").click();
|
|
240
|
+
await this.page.getByTestId("multichain-account-menu-popover-action-button").click();
|
|
241
|
+
await this.page.getByTestId("multichain-account-menu-popover-add-account").click();
|
|
242
|
+
if (accountName) {
|
|
243
|
+
await this.page.locator("#account-name").fill(accountName);
|
|
244
|
+
}
|
|
245
|
+
await this.page.getByTestId("submit-add-account-with-name").click();
|
|
246
|
+
}
|
|
247
|
+
async getAccountName() {
|
|
248
|
+
const accountSelect = this.page.getByTestId("account-menu-icon");
|
|
249
|
+
await (0, import_test3.expect)(accountSelect).toBeVisible();
|
|
250
|
+
const text = await accountSelect.textContent();
|
|
251
|
+
if (!text) throw Error("Cannot get account name");
|
|
252
|
+
return text;
|
|
253
|
+
}
|
|
225
254
|
async connectToNetwork(settingsOrName) {
|
|
226
255
|
if (typeof settingsOrName !== "string") {
|
|
227
256
|
await this.page.locator(".mm-picker-network").click();
|
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() {
|
|
@@ -188,6 +188,35 @@ var Metamask = class extends Wallet {
|
|
|
188
188
|
await this.page.getByTestId("pin-extension-next").click();
|
|
189
189
|
await this.page.getByTestId("pin-extension-done").click();
|
|
190
190
|
}
|
|
191
|
+
async switchAccount(nameOrAddress) {
|
|
192
|
+
if (nameOrAddress.startsWith("0x"))
|
|
193
|
+
nameOrAddress = nameOrAddress.slice(0, 7);
|
|
194
|
+
await this.page.getByTestId("account-menu-icon").click();
|
|
195
|
+
await this.page.locator(".multichain-account-menu-popover__list--menu-item").filter({ hasText: nameOrAddress }).click();
|
|
196
|
+
}
|
|
197
|
+
async importAccount(privateKey) {
|
|
198
|
+
await this.page.getByTestId("account-menu-icon").click();
|
|
199
|
+
await this.page.getByTestId("multichain-account-menu-popover-action-button").click();
|
|
200
|
+
await this.page.getByTestId("multichain-account-menu-popover-add-imported-account").click();
|
|
201
|
+
await this.page.locator("#private-key-box").fill(privateKey);
|
|
202
|
+
await this.page.getByTestId("import-account-confirm-button").click();
|
|
203
|
+
}
|
|
204
|
+
async addAccount(accountName) {
|
|
205
|
+
await this.page.getByTestId("account-menu-icon").click();
|
|
206
|
+
await this.page.getByTestId("multichain-account-menu-popover-action-button").click();
|
|
207
|
+
await this.page.getByTestId("multichain-account-menu-popover-add-account").click();
|
|
208
|
+
if (accountName) {
|
|
209
|
+
await this.page.locator("#account-name").fill(accountName);
|
|
210
|
+
}
|
|
211
|
+
await this.page.getByTestId("submit-add-account-with-name").click();
|
|
212
|
+
}
|
|
213
|
+
async getAccountName() {
|
|
214
|
+
const accountSelect = this.page.getByTestId("account-menu-icon");
|
|
215
|
+
await expect3(accountSelect).toBeVisible();
|
|
216
|
+
const text = await accountSelect.textContent();
|
|
217
|
+
if (!text) throw Error("Cannot get account name");
|
|
218
|
+
return text;
|
|
219
|
+
}
|
|
191
220
|
async connectToNetwork(settingsOrName) {
|
|
192
221
|
if (typeof settingsOrName !== "string") {
|
|
193
222
|
await this.page.locator(".mm-picker-network").click();
|