@johanneskares/wallet-mock
Version:
Mock Web3 Browser wallets, like Metamask, in Playwright tests.
27 lines (26 loc) • 1.13 kB
TypeScript
import { LocalAccount, Transport, type Chain } from "viem";
export type Wallet = ReturnType<typeof createWallet>;
export type WalletRequest = Wallet["request"];
export declare function createWallet(account: LocalAccount, transports?: Record<number, Transport>, defaultChain?: Chain): {
request: ({ method, params, }: {
method: string;
params?: Array<unknown>;
}) => Promise<string | boolean | void | `0x${string}`[] | import("viem").NetworkSync | import("viem").WalletGetCallsStatusReturnType<`0x${string}`, `0x${string}`> | {
[x: `0x${string}`]: import("viem").WalletCapabilities;
} | import("viem").WalletPermission[] | {
expiry: number;
factory?: `0x${string}` | undefined;
factoryData?: string | undefined;
grantedPermissions: readonly {
type: string;
data: any;
}[];
permissionsContext: string;
signerData?: {
userOpBuilder?: `0x${string}` | undefined;
submitToAddress?: `0x${string}` | undefined;
} | undefined;
} | {
parentCapability: string;
}[] | null>;
};