@finn_gal/patchright-wallet-mock-ts
Version:
Mock Web3 Browser wallets, like Metamask, in Patchright tests.
46 lines (45 loc) • 1.1 kB
TypeScript
import type { Page } from 'patchright';
import { Chain, LocalAccount, Transport } from 'viem';
import { Wallet } from './createWallet';
declare global {
interface Window {
ethereum?: EIP1193Provider;
eip1193Request?: (params: eip1193RequestParams) => Promise<any>;
}
}
export declare function installMockWallet({ debug, ...params }: {
debug?: boolean;
} & {
page: Page;
} & ({
account: LocalAccount;
transports?: Record<number, Transport>;
defaultChain?: Chain;
} | {
wallet: Wallet;
})): Promise<void>;
interface EIP6963ProviderInfo {
uuid: string;
name: string;
icon: string;
rdns: string;
}
interface EIP1193Provider {
request: (request: {
method: string;
params?: Array<unknown>;
}) => Promise<unknown>;
on: () => void;
removeListener: () => void;
}
export interface EIP6963ProviderDetail {
info: EIP6963ProviderInfo;
provider: EIP1193Provider;
}
export interface eip1193RequestParams {
method: string;
params?: Array<unknown>;
uuid: string;
debug?: boolean;
}
export {};