import type { BrowserContext, Page } from '@playwright/test'; import { SettingsSidebarMenus } from '../selectors/pages/HomePage/settings'; import type { GasSettings } from '../type/GasSettings'; import { MetaMaskAbstract } from '../type/MetaMaskAbstract'; import type { Network } from '../type/Network'; import { CrashPage, HomePage, LockPage, NotificationPage, OnboardingPage } from './pages'; import { SettingsPage } from './pages/SettingsPage/page'; /** * MetaMask class for interacting with the MetaMask extension in Playwright tests. * * This class provides methods to perform various operations on the MetaMask extension, * such as importing wallets, switching networks, confirming transactions, and more. * * @class * @extends MetaMaskAbstract */ export declare class MetaMask extends MetaMaskAbstract { readonly context: BrowserContext; readonly page: Page; readonly password: string; readonly extensionId?: string | undefined; /** * This property can be used to access selectors for the crash page. * * @public * @readonly */ readonly crashPage: CrashPage; /** * This property can be used to access selectors for the onboarding page. * * @public * @readonly */ readonly onboardingPage: OnboardingPage; /** * This property can be used to access selectors for the lock page. * * @public * @readonly */ readonly lockPage: LockPage; /** * This property can be used to access selectors for the home page. * * @public * @readonly */ readonly homePage: HomePage; /** * This property can be used to access selectors for the notification page. * * @public * @readonly */ readonly notificationPage: NotificationPage; /** * This property can be used to access selectors for the settings page. * * @public * @readonly */ readonly settingsPage: SettingsPage; /** * Creates an instance of MetaMask. * * @param context - The Playwright BrowserContext in which the MetaMask extension is running. * @param page - The Playwright Page object representing the MetaMask extension's main page. * @param password - The password for the MetaMask wallet. * @param extensionId - The ID of the MetaMask extension. Optional if no interaction with dapps is required. */ constructor(context: BrowserContext, page: Page, password: string, extensionId?: string | undefined); /** * Imports a wallet using the given seed phrase. * * @param seedPhrase - The seed phrase to import. */ importWallet(seedPhrase: string): Promise; /** * Adds a new account with the given name. * * @param accountName - The name for the new account. */ addNewAccount(accountName: string): Promise; /** * Renames the currently selected account. * * @param currentAccountName - The current account name. * @param newAccountName - The new name for the account. */ renameAccount(currentAccountName: string, newAccountName: string): Promise; /** * Imports a wallet using the given private key. * * @param privateKey - The private key to import. */ importWalletFromPrivateKey(privateKey: string): Promise; /** * Switches to the account with the given name. * * @param accountName - The name of the account to switch to. */ switchAccount(accountName: string): Promise; /** * Adds a new network to MetaMask. * * @param network - The network configuration to add. */ addNetwork(network: Network): Promise; /** * Gets the address of the currently selected account. * * @returns The account address. */ getAccountAddress(): Promise; /** * Switches to the specified network. * * @param networkName - The name of the network to switch to. * @param isTestnet - Whether the network is a testnet. Default is false. */ switchNetwork(networkName: string, isTestnet?: boolean): Promise; /** * Connects MetaMask to a dapp. * * @param accounts - Optional array of account addresses to connect. * @throws {Error} If extensionId is not set. */ connectToDapp(accounts?: string[]): Promise; /** * Locks the MetaMask wallet. */ lock(): Promise; /** * Unlocks the MetaMask wallet. */ unlock(): Promise; /** * Confirms a signature request. * * @throws {Error} If extensionId is not set. */ confirmSignature(): Promise; /** * Confirms a signature request with risk. * * @throws {Error} If extensionId is not set. */ confirmSignatureWithRisk(): Promise; /** * Rejects a signature request. * * @throws {Error} If extensionId is not set. */ rejectSignature(): Promise; /** * Approves adding a new network. * * @throws {Error} If extensionId is not set. */ approveNewNetwork(): Promise; /** * Rejects adding a new network. * * @throws {Error} If extensionId is not set. */ rejectNewNetwork(): Promise; /** * Approves switching to a new network. * * @throws {Error} If extensionId is not set. */ approveSwitchNetwork(): Promise; /** * Rejects switching to a new network. * * @throws {Error} If extensionId is not set. */ rejectSwitchNetwork(): Promise; /** * Approves adding a new RPC provider for Ethereum Mainnet. * * @throws {Error} If extensionId is not set. */ approveNewEthereumRPC(): Promise; /** * Rejects adding a new RPC provider for Ethereum Mainnet. * * @throws {Error} If extensionId is not set. */ rejectNewEthereumRPC(): Promise; /** * Confirms a transaction. * * @param options - Optional gas settings for the transaction. * @throws {Error} If extensionId is not set. */ confirmTransaction(options?: { gasSetting?: GasSettings; }): Promise; /** * Rejects a transaction. * * @throws {Error} If extensionId is not set. */ rejectTransaction(): Promise; /** * Approves a token permission request. * * @param options - Optional settings for the approval. * @throws {Error} If extensionId is not set. */ approveTokenPermission(options?: { spendLimit?: 'max' | number; gasSetting?: GasSettings; }): Promise; /** * Rejects a token permission request. * * @throws {Error} If extensionId is not set. */ rejectTokenPermission(): Promise; /** * Navigates back to the home page. */ goBackToHomePage(): Promise; /** * Opens the settings page. */ openSettings(): Promise; /** * Opens a specific sidebar menu in the settings. * * @param menu - The menu to open. */ openSidebarMenu(menu: SettingsSidebarMenus): Promise; /** * Toggles the display of test networks. */ toggleShowTestNetworks(): Promise; /** * Toggles the dismissal of the secret recovery phrase reminder. */ toggleDismissSecretRecoveryPhraseReminder(): Promise; /** * Resets the account. */ resetAccount(): Promise; /** * Enables eth_sign (unsafe). */ unsafe_enableEthSign(): Promise; /** * Disables eth_sign. */ disableEthSign(): Promise; /** * Adds a new token. * * @throws {Error} If extensionId is not set. */ addNewToken(): Promise; /** * Provides a public encryption key. * * @throws {Error} If extensionId is not set. */ providePublicEncryptionKey(): Promise; /** * Decrypts a message. * * @throws {Error} If extensionId is not set. */ decrypt(): Promise; /** * Confirms a transaction and waits for it to be mined. * * @param options - Optional gas settings for the transaction. * @throws {Error} If extensionId is not set. */ confirmTransactionAndWaitForMining(options?: { gasSetting?: GasSettings; }): Promise; /** * Opens the details of a specific transaction. * * @param txIndex - The index of the transaction to open. */ openTransactionDetails(txIndex: number): Promise; /** * Closes the transaction details view. */ closeTransactionDetails(): Promise; } //# sourceMappingURL=MetaMask.d.ts.map