@tobelabs/chainwright 0.6.1-alpha.0 → 0.6.1-alpha.2

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.
@@ -1,152 +1,22 @@
1
- import * as _playwright_test from '@playwright/test';
2
- import { BrowserContext, Page } from '@playwright/test';
3
- import z from 'zod';
4
- import { b as WalletProfileFixtureArgs, c as WorkerScopeFixtureArgs } from '../types-dJRYhQT9.js';
5
- import { Instance } from 'prool';
1
+ import { Page, BrowserContext, WorkerInfo } from '@playwright/test';
2
+ import { S as SupportedWallets } from '../types-COvLLLoP.js';
6
3
 
7
- declare class KeplrProfile {
8
- readonly name: "keplr";
9
- readonly onboardingPath = "register.html";
10
- indexUrl(): Promise<string>;
11
- onboardingUrl(): Promise<string>;
12
- promptUrl(): Promise<string>;
13
- extensionId(): Promise<string>;
14
- promptPage(context: BrowserContext): Promise<_playwright_test.Page>;
4
+ /**
5
+ * Core wallet interface
6
+ */
7
+ declare abstract class BaseWallet {
8
+ abstract name: SupportedWallets;
9
+ abstract onboardingPath: string;
10
+ abstract indexUrl(): Promise<string>;
11
+ abstract extensionId(): Promise<string>;
15
12
  }
16
13
 
17
- declare const keplrChains: readonly ["Injective", "Injective (Testnet)", "Polygon", "Bitcoin", "Bitcoin Signet", "Bitcoin Testnet"];
18
- type KeplrChains = (typeof keplrChains)[number];
19
- type AddAndOnboardingArgs = {
20
- walletName: string;
21
- privateKey: string;
22
- chains: Array<KeplrChains>;
14
+ type WorkerScopeContext<W> = {
15
+ workerInfo: WorkerInfo;
16
+ wallet: W;
17
+ profileName?: string;
18
+ slowMo?: number;
23
19
  };
24
- type OnboardingArgs$5 = Array<AddAndOnboardingArgs>;
25
- type AddAccountArgs$4 = AddAndOnboardingArgs & {
26
- mode: "add-account-multiple" | "add-account-single" | "onboard";
27
- };
28
- declare const getAccountAddressSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
29
- chain: z.ZodLiteral<"Injective" | "Injective (Testnet)" | "Polygon">;
30
- walletName: z.ZodString;
31
- }, z.core.$strip>, z.ZodObject<{
32
- chain: z.ZodLiteral<"Bitcoin" | "Bitcoin Signet" | "Bitcoin Testnet">;
33
- chainTag: z.ZodLiteral<"Taproot" | "Native Segwit">;
34
- walletName: z.ZodString;
35
- }, z.core.$strip>], "chain">;
36
- type GetAccountAddressArgs = z.infer<typeof getAccountAddressSchema>;
37
- declare const renameAccountSchema: z.ZodObject<{
38
- currentAccountName: z.ZodString;
39
- newAccountName: z.ZodString;
40
- }, z.core.$strip>;
41
- type RenameAccountArgs$3 = z.infer<typeof renameAccountSchema>;
42
- type KeplrFixture = {
43
- contextPath: string;
44
- keplr: Keplr;
45
- keplrPage: Page;
46
- };
47
-
48
- declare class Keplr extends KeplrProfile {
49
- page: Page;
50
- constructor(page: Page);
51
- /**
52
- * Onboards the wallet.
53
- * @param {OnboardingArgs} args - The arguments required for onboarding.
54
- * @param args[0].chains - The chains to onboard the wallet on.
55
- * @param args[0].privateKey - The private key of the wallet to onboard.
56
- * @param args[0].walletName - The name of the wallet to onboard.
57
- * @example
58
- * const keplr = new Keplr(page);
59
- * await keplr.onboard([
60
- * {
61
- * chains: ["Injective", "Injective (Testnet)"],
62
- * privateKey: "private key",
63
- * walletName: "Wallet Name"
64
- * }
65
- * ]);
66
- */
67
- onboard(args: OnboardingArgs$5): Promise<void>;
68
- /**
69
- * Unlocks the wallet by entering the password.
70
- * @example
71
- * const keplr = new Keplr(page);
72
- * await keplr.unlock();
73
- */
74
- unlock(): Promise<void>;
75
- /**
76
- * Locks the wallet by entering the password.
77
- * This function locks the wallet by opening the settings page and then locking the wallet.
78
- * @example
79
- * const keplr = new Keplr(page);
80
- * await keplr.lock();
81
- */
82
- lock(): Promise<void>;
83
- /**
84
- * Renames an account in the wallet.
85
- * @param {RenameAccount} args - The arguments to rename the account.
86
- * @param args.currentName - The current name of the active account.
87
- * @param args.newAccountName - The new name of the account.
88
- * @example
89
- * const keplr = new Keplr(page);
90
- * await keplr.renameAccount({ newAccountName: "New Account Name" });
91
- */
92
- renameAccount({ currentAccountName, newAccountName }: RenameAccountArgs$3): Promise<void>;
93
- /**
94
- * Switches the current account to the given account.
95
- * @param accountName - The name of the account to switch to.
96
- * @example
97
- * const keplr = new keplr(page);
98
- * await keplr.switchAccount("Account 1");
99
- */
100
- switchAccount(accountName: string): Promise<void>;
101
- /**
102
- * Retrieves the current account's address.
103
- * @returns A promise that resolves with the current account's address as a string.
104
- *
105
- * @example
106
- * const keplr = new Keplr(page);
107
- * const address = await keplr.getAccountAddress();
108
- */
109
- getAccountAddress({ ...args }: GetAccountAddressArgs): Promise<string>;
110
- /**
111
- * Adds an account to the wallet via a private key or mnemonic phrase.
112
- * @param {AddAccountArgs} args - The arguments to add the account.
113
- * @param args.chains - The chains of the account to add.
114
- * @param args.privateKey - The private key of the account to add, if the mode is "privateKey".
115
- * @param args.walletName - The name of the wallet to add the account to.
116
- * @param args.mode - The mode of adding the account (default: "add-account-multiple").
117
- * @example
118
- * const keplr = new Keplr(page);
119
- * await keplr.addAccount({ chains: ["Testnet"], privateKey: "private key", walletName: "Keplr Wallet", mode: "add-account-multiple" });
120
- */
121
- addAccount({ chains, privateKey, walletName, mode }: AddAccountArgs$4): Promise<void>;
122
- /**
123
- * Connects to the wallet.
124
- * This function connects to the wallet by opening the connect page and then clicking on the connect button.
125
- * @example
126
- * const keplr = new Keplr(page);
127
- * await keplr.connectToApp();
128
- */
129
- connectToApp(): Promise<void>;
130
- /**
131
- * Confirms a transaction in the wallet by clicking on the "Approve" button.
132
- * This function confirms a transaction in the wallet by opening the popup page and then clicking on the "Approve" button.
133
- * @example
134
- * const keplr = new Keplr(page);
135
- * await keplr.confirmTransaction();
136
- */
137
- confirmTransaction(): Promise<void>;
138
- /**
139
- * Rejects a transaction in the wallet by clicking on the "Reject" button.
140
- * This function rejects a transaction in the wallet by opening the popup page and then clicking on the "Reject" button.
141
- * @example
142
- * const keplr = new Keplr(page);
143
- * await keplr.rejectTransaction();
144
- */
145
- rejectTransaction(): Promise<void>;
146
- }
147
-
148
- declare const keplrFixture: ({ slowMo, profileName }?: WalletProfileFixtureArgs) => _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & KeplrFixture, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions>;
149
-
150
20
  type WorkerScopeFixture<Wallet> = {
151
21
  workerScopeContents: {
152
22
  wallet: Wallet;
@@ -155,821 +25,10 @@ type WorkerScopeFixture<Wallet> = {
155
25
  };
156
26
  dappPage: Page;
157
27
  };
158
-
159
- declare const keplrWorkerScopeFixture: ({ slowMo, profileName, dappUrl }?: WorkerScopeFixtureArgs) => _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & KeplrFixture, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & WorkerScopeFixture<Keplr>>;
160
-
161
- type RenameAccount$1 = {
162
- page: Page;
163
- currentAccountName: string;
164
- newAccountName: string;
165
- };
166
-
167
- type SwitchAccount = {
168
- page: Page;
169
- accountName: string;
170
- };
171
-
172
- declare class MetamaskProfile {
173
- readonly name: "metamask";
174
- readonly onboardingPath = "/home.html#onboarding";
175
- indexUrl(): Promise<string>;
176
- promptUrl(): Promise<string>;
177
- extensionId(): Promise<string>;
178
- promptPage(context: BrowserContext): Promise<_playwright_test.Page>;
179
- }
180
-
181
- type OnboardingArgs$4 = {
182
- mode: "create";
183
- mainAccountName?: string;
184
- } | {
185
- mode: "import";
186
- mainAccountName?: string;
187
- secretRecoveryPhrase: string;
188
- };
189
- type AddAccountArgs$3 = {
190
- privateKey: string;
191
- accountName: string;
192
- };
193
- declare const addCustomNetworkSchema: z.ZodObject<{
194
- networkName: z.ZodString;
195
- rpcUrl: z.ZodURL;
196
- chainId: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
197
- currencySymbol: z.ZodString;
198
- }, z.core.$strip>;
199
- type AddCustomNetwork = z.infer<typeof addCustomNetworkSchema>;
200
- type SwitchNetwork$3 = {
201
- chainName: "Ethereum" | "Base" | "Linea";
202
- networkType: "mainnet";
203
- } | {
204
- chainName: "Sepolia" | "Linea Sepolia" | "Mega Testnet" | "Monad Testnet" | (string & {});
205
- networkType: "testnet" | "custom";
206
- };
207
- type GasFeeSettings = {
208
- feeType: "low" | "medium" | "high";
209
- } | {
210
- feeType: "advanced";
211
- maxBaseFee: string;
212
- priorityFee: string;
213
- };
214
- type GetAccountAddressChains = "Ethereum" | "Tron" | "Bitcoin" | "Solana";
215
- type MetamaskFixture = {
216
- contextPath: string;
217
- metamask: Metamask;
218
- metamaskPage: Page;
219
- createAnvilNode: (options?: Instance.anvil.Parameters) => Promise<{
220
- rpcUrl: string;
221
- anvil: Instance.anvil.Parameters;
222
- chainId: number;
223
- }>;
224
- connectToAnvil: () => Promise<void>;
225
- };
226
-
227
- declare class Metamask extends MetamaskProfile {
228
- page: Page;
229
- constructor(page: Page);
230
- /**
231
- * Onboards the wallet.
232
- * This function onboards the wallet by entering the password and other required information.
233
- * @param {OnboardingArgs} args - The arguments required for onboarding.
234
- * @param args.mode - Create a new wallet or import an existing wallet.
235
- * @param args.password - The password for the wallet.
236
- * @param args.secretRecoveryPhrase - The secret recovery phrase for the wallet when importing a wallet.
237
- * @example
238
- * const metamask = new Metamask(page);
239
- * await metamask.onboard({ mode: "import", password: "password", secretRecoveryPhrase: "Recovery phrase" });
240
- */
241
- onboard(args: OnboardingArgs$4): Promise<void>;
242
- /**
243
- * Unlocks the wallet.
244
- * This function unlocks the wallet by entering the password.
245
- * @example
246
- * const metamask = new Metamask(page);
247
- * await metamask.unlock()
248
- */
249
- unlock(): Promise<void>;
250
- /**
251
- * Locks the wallet.
252
- * This function opens the settings page and then locks the wallet.
253
- * @example
254
- * const metamask = new Metamask(page);
255
- * await metamask.lock()
256
- */
257
- lock(): Promise<void>;
258
- /**
259
- * Renames an account.
260
- * @param {Omit<RenameAccount, "page">} args - The arguments to rename the account.
261
- * @param args.newAccountName - The new name of the account.
262
- * @param args.currentAccountName - The current name of the account.
263
- * @example
264
- * const metamask = new Metamask(page);
265
- * await metamask.renameAccount({ newAccountName: "New Account Name", currentAccountName: "Current Account Name" });
266
- */
267
- renameAccount({ newAccountName, currentAccountName }: Omit<RenameAccount$1, "page">): Promise<void>;
268
- /**
269
- * Adds an account to the wallet via a private key.
270
- * @param {AddAccountArgs} args - The arguments to add the account.
271
- * @param args.privateKey - The private key of the account to add.
272
- * @param args.accountName - The name of the account to add.
273
- * @example
274
- * const metamask = new Metamask(page);
275
- * await metamask.addAccount({ privateKey: "private key", accountName: "Account 1" });
276
- */
277
- addAccount({ privateKey, accountName }: AddAccountArgs$3): Promise<void>;
278
- /**
279
- * Switches the current account to the given account.
280
- * @param {Omit<SwitchAccount, "page">} args - The arguments to switch the account.
281
- * @param args.accountName - The name of the account to switch to.
282
- * @example
283
- * const metamask = new Metamask(page);
284
- * await metamask.switchAccount({ accountName: "Account 1" });
285
- */
286
- switchAccount({ accountName }: Omit<SwitchAccount, "page">): Promise<void>;
287
- /**
288
- * Switches the current network to the given network.
289
- * @param {SwitchNetwork} args - The arguments to switch the network.
290
- * @param args.networkType - It should be "testnet", "mainnet", and "custom".
291
- * @param args.chainName - (Mainnet): Ethereum, Base, Linea.
292
- * @param args.chainName - (Testnet): Sepolia, Linea Sepolia, Mega Testnet, Monad Testnet.
293
- * @example
294
- * const metamask = new Metamask(page);
295
- * await metamask.switchNetwork({chainName: "Sepolia", networkType: "testnet"});
296
- */
297
- switchNetwork({ ...args }: SwitchNetwork$3): Promise<void>;
298
- /**
299
- * Gets the current account's address.
300
- * @returns The current account's address as a string.
301
- * @example
302
- * const metamask = new Metamask(page);
303
- * await metamask.getAccountAddress()
304
- */
305
- getAccountAddress(network: GetAccountAddressChains): Promise<string | null>;
306
- /**
307
- * Toggles the visibility of testnet networks in the wallet's network selector.
308
- * To persists the change, do it at the point of onboarding.
309
- * @example
310
- * const metamask = new Metamask(page);
311
- * await metamask.toggleShowTestnetNetwork()
312
- */
313
- toggleShowTestnetNetwork(): Promise<void>;
314
- /**
315
- * Add a custom network to the wallet. If you want to persist the added wallet, do it at
316
- * the point of onboarding.
317
- * @param {AddCustomNetwork} options - an object containing the parameters for adding a custom network.
318
- * @param {number|string} options.chainId - the chain ID of the network.
319
- * @param {string} options.currencySymbol - the currency symbol of the network.
320
- * @param {string} options.networkName - the name of the network.
321
- * @param {string} options.rpcUrl - the RPC URL of the network.
322
- * @example
323
- * const metamask = new Metamask(page);
324
- * await metamask.addCustomNetwork({chainId: 100, currencySymbol: "XDAI", networkName: "Gnosis", rpcUrl: "https://gnosis.oat.farm"});
325
- */
326
- addCustomNetwork({ chainId, currencySymbol, networkName, rpcUrl }: AddCustomNetwork): Promise<void>;
327
- /**
328
- * Connects to an app by clicking on the "Connect to app" button.
329
- * If an account is provided, it will be selected before connecting to the app.
330
- * @param {string} [account] - The account to select before connecting to the app.
331
- * @example
332
- * const metamask = new Metamask(page);
333
- * await metamask.connectToApp("Account 1");
334
- */
335
- connectToApp(account?: string): Promise<void>;
336
- /**
337
- * Confirms a transaction in the wallet by clicking on the "Confirm" button.
338
- * @example
339
- * const metamask = new Metamask(page);
340
- * await metamask.confirmTransaction();
341
- */
342
- confirmTransaction(gasFee?: GasFeeSettings): Promise<void>;
343
- /**
344
- * Cancels a transaction in the wallet by clicking on the "Cancel" button.
345
- * @example
346
- * const metamask = new Metamask(page);
347
- * await metamask.cancelTransaction();
348
- */
349
- rejectTransaction(): Promise<void>;
350
- }
351
-
352
- declare const metamaskFixture: ({ slowMo, profileName }?: WalletProfileFixtureArgs) => _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & MetamaskFixture, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions>;
353
-
354
- declare const metamaskWorkerScopeFixture: ({ profileName, dappUrl, slowMo }?: WorkerScopeFixtureArgs) => _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & MetamaskFixture, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & WorkerScopeFixture<Metamask>>;
355
-
356
- declare class MeteorProfile {
357
- readonly name: "meteor";
358
- readonly onboardingPath = "ext_index_popup.html";
359
- indexUrl(): Promise<string>;
360
- promptUrl(): Promise<string>;
361
- extensionId(): Promise<string>;
362
- promptPage(context: BrowserContext): Promise<_playwright_test.Page>;
363
- }
364
-
365
- type MeteorNetwork = "Mainnet" | "Testnet";
366
- type OnboardingArgs$3 = {
367
- network: MeteorNetwork;
368
- privateKey: string;
369
- accountName: string;
370
- addWallet?: Array<AddAccountArgs$2>;
371
- };
372
- type RenameAccountArgs$2 = {
373
- newAccountName: string;
374
- };
375
- type AddAccountArgs$2 = {
376
- privateKey: string;
377
- accountName: string;
378
- network: MeteorNetwork;
379
- };
380
- type MeteorFixture = {
381
- contextPath: string;
382
- meteor: Meteor;
383
- meteorPage: Page;
384
- };
385
-
386
- declare class Meteor extends MeteorProfile {
387
- page: Page;
388
- constructor(page: Page);
389
- /**
390
- * Onboards the wallet.
391
- * This function onboards the wallet by entering the password and other required information.
392
- * @param {OnboardingArgs} args - The arguments required for onboarding.
393
- * @param args.password - The password for the wallet.
394
- * @param args.secretRecoveryPhrase - The secret recovery phrase for the wallet when importing a wallet.
395
- * @example
396
- * const meteor = new Meteor(page);
397
- * await meteor.onboard({ mode: "importPrivateKey", password: "password", privateKey: "private key" });
398
- */
399
- onboard({ network, privateKey, accountName, addWallet }: OnboardingArgs$3): Promise<void>;
400
- /**
401
- * Unlocks the wallet by entering the password.
402
- * @example
403
- * const meteor = new Meteor(page);
404
- * await meteor.unlock();
405
- */
406
- unlock(): Promise<void>;
407
- /**
408
- * Locks the wallet by entering the password.
409
- * This function locks the wallet by opening the settings page and then locking the wallet.
410
- * @example
411
- * const meteor = new Meteor(page);
412
- * await meteor.lock();
413
- */
414
- lock(): Promise<void>;
415
- /**
416
- * Renames an account in the wallet.
417
- * @param {Omit<RenameAccount, "page">} args - The arguments to rename the account.
418
- * @param args.newAccountName - The new name of the account.
419
- * @example
420
- * const meteor = new Meteor(page);
421
- * await meteor.renameAccount({ newAccountName: "New Account Name" });
422
- */
423
- renameAccount({ newAccountName }: RenameAccountArgs$2): Promise<void>;
424
- /**
425
- * Switches the current network to the given network.
426
- * @param {SwitchNetwork} networkName - The name of the network to switch to.
427
- * @example
428
- * const meteor = new Meteor(page);
429
- * await meteor.switchNetwork("network name");
430
- */
431
- switchNetwork(network: MeteorNetwork): Promise<void>;
432
- /**
433
- * Switches the current account to the given account.
434
- * @param {string} accountName - The name of the account to switch to.
435
- * @example
436
- * const meteor = new meteor(page);
437
- * await meteor.switchAccount("Account 1");
438
- */
439
- switchAccount(accountName: string): Promise<void>;
440
- /**
441
- * Retrieves the current account's address.
442
- * @returns A promise that resolves with the current account's address as a string.
443
- *
444
- * @example
445
- * const meteor = new Meteor(page);
446
- * const address = await meteor.getAccountAddress();
447
- */
448
- getAccountAddress(): Promise<string>;
449
- /**
450
- * Adds an account to the wallet via a private key or mnemonic phrase.
451
- * @param {{ accountName, ...args }: AddAccount} - The arguments to add the account.
452
- * @param {string} args.accountName - The name of the account to add.
453
- * @param {string} args.privateKey - The private key of the account to add, if the mode is "privateKey".
454
- * @param {string[]} args.mnemonicPhrase - The mnemonic phrase of the account to add, if the mode is "mnemonic".
455
- * @example
456
- * const meteor = new Meteor(page);
457
- * await meteor.addAccount(TBD);
458
- */
459
- addAccount({ accountName, network, privateKey }: AddAccountArgs$2): Promise<void>;
460
- /**
461
- * Opens the settings page for the wallet.
462
- * @example
463
- * const meteor = new Meteor(page);
464
- * await meteor.openSettings();
465
- */
466
- openSettings(): Promise<void>;
467
- /**
468
- * Connects to an app by clicking on the "Connect" button.
469
- * If an account is provided, it will be selected before connecting to the app.
470
- * @param {string} [account] - The account to select before connecting to the app.
471
- * @example
472
- * const meteor = new Meteor(page);
473
- * await meteor.connectToApp("Account 1");
474
- */
475
- connectToApp(account?: string): Promise<void>;
476
- /**
477
- * Confirms a transaction in the wallet by clicking on the "Approve" button.
478
- * This function confirms a transaction in the wallet by clicking on the "Approve" button.
479
- * It first opens the popup page and then clicks on the "Confirm" button.
480
- * @example
481
- * const meteor = new Meteor(page);
482
- * await meteor.confirmTransaction();
483
- */
484
- confirmTransaction(): Promise<void>;
485
- /**
486
- * Cancels a transaction in the wallet by clicking on the "Cancel" button.
487
- * This function cancels a transaction in the wallet by clicking on the "Cancel" button.
488
- * It first opens the popup page and then clicks on the "Cancel" button.
489
- * @example
490
- * const meteor = new Meteor(page);
491
- * await meteor.cancelTransaction();
492
- */
493
- rejectTransaction(): Promise<void>;
494
- }
495
-
496
- declare const meteorFixture: ({ slowMo, profileName }?: WalletProfileFixtureArgs) => _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & MeteorFixture, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions>;
497
-
498
- declare const meteorWorkerScopeFixture: ({ slowMo, profileName, dappUrl }?: WorkerScopeFixtureArgs) => _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & MeteorFixture, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & WorkerScopeFixture<Meteor>>;
499
-
500
- type RenameAccount = {
501
- page: Page;
502
- newAccountName: string;
503
- };
504
-
505
- declare class PetraProfile {
506
- readonly name: "petra";
507
- readonly onboardingPath = "/onboarding.html";
508
- indexUrl(): Promise<string>;
509
- promptUrl(): Promise<string>;
510
- extensionId(): Promise<string>;
511
- promptPage(context: BrowserContext): Promise<_playwright_test.Page>;
512
- }
513
-
514
- type OnboardingArgs$2 = {
515
- mode: "create";
516
- accountName: string;
517
- addWallet?: Array<AddAccount>;
518
- } | {
519
- mode: "importMnemonic";
520
- accountName: string;
521
- secretRecoveryPhrase: string;
522
- addWallet?: Array<AddAccount>;
523
- } | {
524
- mode: "importPrivateKey";
525
- accountName: string;
526
- privateKey: string;
527
- addWallet?: Array<AddAccount>;
528
- };
529
- type SwitchNetwork$2 = "Mainnet" | "Testnet" | "Devnet" | "Shelbynet" | "Netna";
530
- type AddAccount = {
531
- mode: "privateKey";
532
- accountName: string;
533
- privateKey: string;
534
- } | {
535
- mode: "mnemonic";
536
- accountName: string;
537
- mnemonicPhrase: string;
538
- };
539
- type PetraFixture = {
540
- contextPath: string;
541
- petra: Petra;
542
- petraPage: Page;
543
- };
544
-
545
- declare class Petra extends PetraProfile {
546
- page: Page;
547
- constructor(page: Page);
548
- /**
549
- * Onboards the wallet.
550
- * This function onboards the wallet by entering the password and other required information.
551
- * @param {OnboardingArgs} args - The arguments required for onboarding.
552
- * @param args.mode - Create a new wallet or import via private key / mnemonic.
553
- * @param args.password - The password for the wallet.
554
- * @param args.secretRecoveryPhrase - The secret recovery phrase for the wallet when importing a wallet.
555
- * @example
556
- * const petra = new Petra(page);
557
- * await petra.onboard({ mode: "importPrivateKey", password: "password", privateKey: "private key" });
558
- */
559
- onboard(args: OnboardingArgs$2): Promise<void>;
560
- /**
561
- * Unlocks the wallet by entering the password.
562
- * @example
563
- * const petra = new Petra(page);
564
- * await petra.unlock();
565
- */
566
- unlock(): Promise<void>;
567
- /**
568
- * Locks the wallet by entering the password.
569
- * This function locks the wallet by opening the settings page and then locking the wallet.
570
- * @example
571
- * const petra = new Petra(page);
572
- * await petra.lock();
573
- */
574
- lock(): Promise<void>;
575
- /**
576
- * Renames an account in the wallet.
577
- * @param {Omit<RenameAccount, "page">} args - The arguments to rename the account.
578
- * @param args.newAccountName - The new name of the account.
579
- * @example
580
- * const petra = new Petra(page);
581
- * await petra.renameAccount({ newAccountName: "New Account Name" });
582
- */
583
- renameAccount({ newAccountName }: Omit<RenameAccount, "page">): Promise<void>;
584
- /**
585
- * Switches the current network to the given network.
586
- * @param {SwitchNetwork} networkName - The name of the network to switch to.
587
- * @example
588
- * const petra = new Petra(page);
589
- * await petra.switchNetwork("Testnet");
590
- */
591
- switchNetwork(networkName: SwitchNetwork$2): Promise<void>;
592
- /**
593
- * Switches the current account to the given account.
594
- * @param {string} accountName - The name of the account to switch to.
595
- * @example
596
- * const petra = new Petra(page);
597
- * await petra.switchAccount("Account 1");
598
- */
599
- switchAccount(accountName: string): Promise<void>;
600
- /**
601
- * Retrieves the current account's address.
602
- * @returns A promise that resolves with the current account's address as a string.
603
- *
604
- * @example
605
- * const petra = new Petra(page);
606
- * const address = await petra.getAccountAddress();
607
- */
608
- getAccountAddress(): Promise<string>;
609
- /**
610
- * Adds an account to the wallet via a private key or mnemonic phrase.
611
- * @param {{ accountName, ...args }: AddAccount} - The arguments to add the account.
612
- * @param {string} args.accountName - The name of the account to add.
613
- * @param {string} args.privateKey - The private key of the account to add, if the mode is "privateKey".
614
- * @param {string[]} args.mnemonicPhrase - The mnemonic phrase of the account to add, if the mode is "mnemonic".
615
- * @example
616
- * const petra = new Petra(page);
617
- * await petra.addAccount({ accountName: "Account 1", privateKey: "private key", mode: "privateKey" });
618
- */
619
- addAccount({ accountName, ...args }: AddAccount): Promise<void>;
620
- /**
621
- * Connects to an app by clicking on the "Connect to app" button.
622
- * If an account is provided, it will be selected before connecting to the app.
623
- * @param {string} [account] - The account to select before connecting to the app.
624
- * @example
625
- * const petra = new Petra(page);
626
- * await petra.connectToApp("Account 1");
627
- */
628
- connectToApp(account?: string): Promise<void>;
629
- /**
630
- * Confirms a transaction in the wallet by clicking on the "Approve" button.
631
- *
632
- * @example
633
- * const petra = new Petra(page);
634
- * await petra.confirmTransaction();
635
- */
636
- confirmTransaction(): Promise<void>;
637
- /**
638
- * Rejects a transaction in the wallet by clicking on the "Cancel" button.
639
- *
640
- * @example
641
- * const petra = new Petra(page);
642
- * await petra.rejectTransaction();
643
- * */
644
- rejectTransaction(): Promise<void>;
645
- }
646
-
647
- declare const petraFixture: ({ slowMo, profileName }?: WalletProfileFixtureArgs) => _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & PetraFixture, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions>;
648
-
649
- declare const petraWorkerScopeFixture: ({ slowMo, profileName, dappUrl }?: WorkerScopeFixtureArgs) => _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & PetraFixture, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & WorkerScopeFixture<Petra>>;
650
-
651
- declare class PhantomProfile {
652
- readonly name: "phantom";
653
- readonly onboardingPath = "/onboarding.html";
654
- indexUrl(): Promise<string>;
655
- promptUrl(): Promise<string>;
656
- extensionId(): Promise<string>;
657
- promptPage(context: BrowserContext): Promise<_playwright_test.Page>;
658
- }
659
-
660
- type OnboardingArgs$1 = {
661
- mode: "create";
662
- accountName: string;
663
- toggleNetworkMode?: SwitchNetwork$1;
664
- addWallet?: Array<AddAccountArgs$1>;
665
- } | {
666
- mode: "recovery phrase";
667
- secretRecoveryPhrase: string;
668
- toggleNetworkMode?: SwitchNetwork$1;
669
- addWallet?: Array<AddAccountArgs$1>;
670
- } | {
671
- mode: "private key";
672
- privateKey: string;
673
- accountName: string;
674
- chain: "Ethereum" | "Solana" | "Base" | "Sui" | "Bitcoin" | "Polygon" | "HyperEVM";
675
- toggleNetworkMode?: SwitchNetwork$1;
676
- addWallet?: Array<AddAccountArgs$1>;
677
- };
678
- type RenameAccountArgs$1 = {
679
- currentAccountName: string;
680
- newAccountName: string;
681
- };
682
- type AddAccountArgs$1 = {
683
- privateKey: string;
684
- accountName: string;
685
- chain: "Ethereum" | "Solana" | "Base" | "Sui" | "Bitcoin" | "Polygon" | "HyperEVM";
686
- };
687
- type OptionalChains = "Ethereum" | "Monad" | "Base" | "Sui" | "Polygon" | "Bitcoin" | "Hyperevm";
688
- type ToggleOptionalChainMode = "on" | "off";
689
- type ToggleOptionalChainArgs = {
690
- supportedChains: Array<OptionalChains>;
691
- toggleMode: ToggleOptionalChainMode;
692
- };
693
- type SwitchNetwork$1 = ({
694
- mode: "on";
695
- chain: "Solana";
696
- network: "Solana Devnet" | "Solana Testnet" | "Solana Localnet";
697
- } | {
698
- mode: "on";
699
- chain: "Ethereum";
700
- network: "Ethereum Sepolia" | "Monad Testnet" | "Base Sepolia" | "Polygon Amoy" | "HyperEVM Testnet";
701
- }) | {
702
- mode: "off";
703
- };
704
- type GetAccountAddress = {
705
- accountName: string;
706
- chain: {
707
- mode: "mainnet";
708
- network: "Solana" | "Ethereum" | "Monad" | "Base" | "Sui" | "Polygon" | "Bitcoin" | "Hyperevm";
709
- } | {
710
- mode: "testnet";
711
- network: "Devnet" | "Sepolia" | "Testnet";
712
- };
713
- };
714
- type PhantomFixture = {
28
+ declare function workerScopeContext<T extends BaseWallet>({ wallet, workerInfo, profileName, slowMo, }: WorkerScopeContext<T>): Promise<{
29
+ context: BrowserContext;
30
+ walletPage: Page;
715
31
  contextPath: string;
716
- autoCloseNotification: undefined;
717
- phantom: Phantom;
718
- phantomPage: Page;
719
- };
720
-
721
- declare class Phantom extends PhantomProfile {
722
- page: Page;
723
- constructor(page: Page);
724
- /**
725
- * Onboards the wallet.
726
- * This function onboards the wallet by entering the password and other required information.
727
- * @param {OnboardingArgs} args - The arguments required for onboarding.
728
- * @param args.mode - Create a new wallet or import via private key / mnemonic.
729
- * @param args.password - The password for the wallet.
730
- * @param args.secretRecoveryPhrase - The secret recovery phrase for the wallet when importing a wallet.
731
- * @example
732
- * const phantom = new Phantom(page);
733
- * await phantom.onboard({ mode: "importPrivateKey", password: "password", privateKey: "private key" });
734
- */
735
- onboard({ ...args }: OnboardingArgs$1): Promise<void>;
736
- /**
737
- * Unlocks the wallet by entering the password.
738
- * @example
739
- * const phantom = new Phantom(page);
740
- * await phantom.unlock();
741
- */
742
- unlock(): Promise<void>;
743
- /**
744
- * Locks the wallet by entering the password.
745
- * This function locks the wallet by opening the settings page and then locking the wallet.
746
- * @example
747
- * const phantom = new Phantom(page);
748
- * await phantom.lock();
749
- */
750
- lock(): Promise<void>;
751
- /**
752
- * Renames an account in the wallet.
753
- * @param {RenameAccountArgs} args - The arguments to rename the account.
754
- * @param args.currentName - The current name of the active account.
755
- * @param args.newAccountName - The new name of the account.
756
- * @example
757
- * const phantom = new Phantom(page);
758
- * await phantom.renameAccount({ newAccountName: "New Account Name", currentAccountName: "Account 1" });
759
- */
760
- renameAccount({ ...args }: RenameAccountArgs$1): Promise<void>;
761
- /**
762
- * Switches the current account to the given account.
763
- * @param {string} accountName - The name of the account to switch to.
764
- * @example
765
- * const phantom = new phantom(page);
766
- * await phantom.switchAccount("Account 1");
767
- */
768
- switchAccount(accountName: string): Promise<void>;
769
- /**
770
- * Retrieves the current account's address.
771
- * @param {string} accountName - The name of the account to switch to.
772
- * @returns A promise that resolves with the current account's address as a string.
773
- *
774
- * @example
775
- * const phantom = new Phantom(page);
776
- * const address = await phantom.getAccountAddress();
777
- */
778
- getAccountAddress({ accountName, chain }: GetAccountAddress): Promise<string>;
779
- /**
780
- * Adds an account to the wallet via a private key or mnemonic phrase.
781
- * @param {{ accountName, ...args }: AddAccount} - The arguments to add the account.
782
- * @param {string} args.accountName - The name of the account to add.
783
- * @param {string} args.privateKey - The private key of the account to add, if the mode is "privateKey".
784
- * @param {string[]} args.mnemonicPhrase - The mnemonic phrase of the account to add, if the mode is "mnemonic".
785
- * @example
786
- * const phantom = new Phantom(page);
787
- * await phantom.addAccount(TBD);
788
- */
789
- addAccount({ ...args }: AddAccountArgs$1): Promise<void>;
790
- /**
791
- * Toggles the optional chains on or off.
792
- * @param {ToggleOptionalchainArgs} args - The arguments to toggle the optional chains.
793
- * @param {string} args.toggleMode - The mode of the optional chains. Can be either "on" or "off".
794
- * @param {string[]} args.supportedChains - The list of supported chains.
795
- * @example
796
- * const phantom = new Phantom(page);
797
- * await phantom.toggleOptionalChains({ supportedChains: ["Monad", "Bitcoin"], toggleMode: "off" });
798
- */
799
- toggleOptionalChains({ toggleMode, supportedChains }: ToggleOptionalChainArgs): Promise<void>;
800
- /**
801
- * Toggles the testnet network on or off.
802
- * @param {SwitchNetwork} args - The arguments to toggle the testnet network.
803
- * @param {string} args.mode - The mode of the testnet network. Can be either "on" or "off".
804
- * @param {string} args.chain - The name of the chain to toggle the testnet network for. Can be either "Solana" or "Ethereum".
805
- * @param {string} args.network - The name of the network to toggle the testnet network for. For example, "Solana Testnet".
806
- * @example
807
- * const phantom = new Phantom(page);
808
- * await phantom.switchNetwork({ mode: "on", chain: "Solana", network: "Solana Testnet" });
809
- */
810
- switchNetwork({ ...args }: SwitchNetwork$1): Promise<void>;
811
- /**
812
- * Connects to an app by clicking on the "Connect to app" button.
813
- * If an account is provided, it will be selected before connecting to the app.
814
- * @param {string} [account] - The account to select before connecting to the app.
815
- * @example
816
- * const phantom = new Phantom(page);
817
- * await phantom.connectToApp("Account 1");
818
- */
819
- connectToApp(account?: string): Promise<void>;
820
- /**
821
- * Confirms a transaction in the wallet by clicking on the "Confirm" button.
822
- * @example
823
- * const phantom = new Phantom(page);
824
- * await phantom.confirmTransaction();
825
- */
826
- confirmTransaction(): Promise<void>;
827
- /**
828
- * Rejects a transaction in the wallet by clicking on the "Reject" button.
829
- * @example
830
- * const phantom = new Phantom(page);
831
- * await phantom.rejectTransaction();
832
- */
833
- rejectTransaction(): Promise<void>;
834
- }
835
-
836
- declare const phantomFixture: ({ slowMo, profileName }?: WalletProfileFixtureArgs) => _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & PhantomFixture, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions>;
837
-
838
- declare const phantomWorkerScopeFixture: ({ slowMo, profileName, dappUrl }?: WorkerScopeFixtureArgs) => _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & PhantomFixture, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & WorkerScopeFixture<Phantom>>;
839
-
840
- declare class SolflareProfile {
841
- readonly name: "solflare";
842
- readonly onboardingPath = "wallet.html#/onboard";
843
- indexUrl(): Promise<string>;
844
- promptUrl(): Promise<string>;
845
- extensionId(): Promise<string>;
846
- promptPage(context: BrowserContext): Promise<_playwright_test.Page>;
847
- }
848
-
849
- type OnboardingArgs = {
850
- recoveryPhrase: string;
851
- walletName: string;
852
- network?: "Mainnet" | "Devnet" | "Testnet";
853
- addWallet?: Array<AddAccountArgs>;
854
- };
855
- type SwitchNetwork = Omit<Required<OnboardingArgs>, "recoveryPhrase">["network"];
856
- declare const addAccountSchema: z.ZodObject<{
857
- walletName: z.ZodString;
858
- privateKey: z.ZodArray<z.ZodNumber>;
859
- }, z.core.$strip>;
860
- type AddAccountArgs = z.infer<typeof addAccountSchema>;
861
- type RenameAccountArgs = {
862
- currentAccountName: string;
863
- newAccountName: string;
864
- };
865
- type SolflareFixture = {
866
- contextPath: string;
867
- solflare: Solflare;
868
- solflarePage: Page;
869
- autoCloseNotification: undefined;
870
- };
871
-
872
- declare class Solflare extends SolflareProfile {
873
- page: Page;
874
- constructor(page: Page);
875
- /**
876
- * Onboards the wallet.
877
- * This function onboards the wallet by entering the password and other required information.
878
- * @param {OnboardingArgs} args - The arguments required for onboarding.
879
- * @param args.mode - Create a new wallet or import via private key / mnemonic.
880
- * @param args.password - The password for the wallet.
881
- * @param args.secretRecoveryPhrase - The secret recovery phrase for the wallet when importing a wallet.
882
- * @example
883
- * const solflare = new Solflare(page);
884
- * await solflare.onboard({ mode: "importPrivateKey", password: "password", privateKey: "private key" });
885
- */
886
- onboard({ recoveryPhrase, network, addWallet, walletName }: OnboardingArgs): Promise<void>;
887
- /**
888
- * Unlocks the wallet by entering the password.
889
- * @example
890
- * const solflare = new Solflare(page);
891
- * await solflare.unlock();
892
- */
893
- unlock(): Promise<void>;
894
- /**
895
- * Locks the wallet by entering the password.
896
- * This function locks the wallet by opening the settings page and then locking the wallet.
897
- * @example
898
- * const solflare = new Solflare(page);
899
- * await solflare.lock();
900
- */
901
- lock(): Promise<void>;
902
- /**
903
- * Renames an account in the wallet.
904
- * @param {Omit<RenameAccount, "page">} args - The arguments to rename the account.
905
- * @param args.newAccountName - The new name of the account.
906
- * @example
907
- * const solflare = new Solflare(page);
908
- * await solflare.renameAccount({ newAccountName: "New Account Name" });
909
- */
910
- renameAccount({ currentAccountName, newAccountName }: RenameAccountArgs): Promise<void>;
911
- /**
912
- * Switches the current network to the given network.
913
- * @param {SwitchNetwork} networkName - The name of the network to switch to.
914
- * @example
915
- * const solflare = new Solflare(page);
916
- * await solflare.switchNetwork("network name");
917
- */
918
- switchNetwork(network: SwitchNetwork): Promise<void>;
919
- /**
920
- * Switches the current account to the given account.
921
- * @param {string} accountName - The name of the account to switch to.
922
- * @example
923
- * const solflare = new solflare(page);
924
- * await solflare.switchAccount("Account 1");
925
- */
926
- switchAccount(accountName: string): Promise<void>;
927
- /**
928
- * Retrieves the current account's address.
929
- * @returns A promise that resolves with the current account's address as a string.
930
- *
931
- * @example
932
- * const solflare = new Solflare(page);
933
- * const address = await solflare.getAccountAddress();
934
- */
935
- getAccountAddress(): Promise<string>;
936
- /**
937
- * Adds an account to the wallet via a private key or mnemonic phrase.
938
- * @param {{ accountName, ...args }: AddAccount} - The arguments to add the account.
939
- * @param {string} args.walletName - The name of the account to add.
940
- * @param {string} args.privateKey - The private key of the account to add, if the mode is "privateKey".
941
- * @example
942
- * const solflare = new Solflare(page);
943
- * await solflare.addAccount({ walletName: "Gamify", privateKey: "private key"});
944
- */
945
- addAccount({ privateKey, walletName }: AddAccountArgs): Promise<void>;
946
- /**
947
- * Connects to an app by clicking on the "Connect to app" button.
948
- * If an account is provided, it will be selected before connecting to the app.
949
- * @param {string} [account] - The account to select before connecting to the app.
950
- * @example
951
- * const solflare = new Solflare(page);
952
- * await solflare.connectToApp("Account 1");
953
- */
954
- connectToApp(account?: string): Promise<void>;
955
- /**
956
- * Confirms a transaction in the wallet by clicking on the "Confirm" button.
957
- * @example
958
- * const solflare = new Solflare(page);
959
- * await solflare.confirmTransaction();
960
- */
961
- confirmTransaction(): Promise<void>;
962
- /**
963
- * Rejects a transaction in the wallet by clicking on the "Reject" button.
964
- * @example
965
- * const solflare = new Solflare(page);
966
- * await solflare.rejectTransaction();
967
- */
968
- rejectTransaction(): Promise<void>;
969
- }
970
-
971
- declare const solflareFixture: ({ slowMo, profileName }?: WalletProfileFixtureArgs) => _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & SolflareFixture, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions>;
972
-
973
- declare const solflareWorkerScopeFixture: ({ slowMo, profileName, dappUrl }?: WorkerScopeFixtureArgs) => _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & SolflareFixture, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & WorkerScopeFixture<Solflare>>;
32
+ }>;
974
33
 
975
- export { Keplr, Metamask, Meteor, Petra, Phantom, Solflare, keplrFixture, keplrWorkerScopeFixture, metamaskFixture, metamaskWorkerScopeFixture, meteorFixture, meteorWorkerScopeFixture, petraFixture, petraWorkerScopeFixture, phantomFixture, phantomWorkerScopeFixture, solflareFixture, solflareWorkerScopeFixture };
34
+ export { type WorkerScopeFixture, workerScopeContext };