import { NodeConfig } from "./node/types"; import { WalletFixtureOptions } from "./types"; import { BaseWalletConfig, WalletSetupContext } from "./wallets/BaseWallet"; import { CoinbaseWallet } from "./wallets/Coinbase"; import { MetaMask } from "./wallets/MetaMask"; import { PhantomWallet } from "./wallets/Phantom"; /** * Configuration builder for E2E testing with different wallet types. * Provides a fluent interface for configuring wallet behavior and setup. * * @example Basic Usage * ```typescript * const test = createOnchainTest( * configure() * .withLocalNode({ chainId: 1337 }) * .withMetaMask() * .withNetwork({ * name: 'Base Sepolia', * rpcUrl: 'https://sepolia.base.org', * chainId: 84532, * symbol: 'ETH', * }) * .build() * ); * ``` * * @example Complete Setup * ```typescript * const test = createOnchainTest( * configure() * .withLocalNode({ chainId: 1337 }) * .withMetaMask() * .withNetwork({ * name: 'Base Sepolia', * rpcUrl: 'https://sepolia.base.org', * chainId: 84532, * symbol: 'ETH', * }) * .withSeedPhrase({ * seedPhrase: 'your seed phrase', * password: 'your password', * }) * .withCustomSetup(async (wallet) => { * await wallet.importToken('0x...'); * }) * .build() * ); * ``` * * @example Using Private Key * ```typescript * const test = createOnchainTest( * configure() * .withLocalNode({ chainId: 1337 }) * .withPhantom() * .withNetwork({ * name: 'Base Sepolia', * rpcUrl: 'https://sepolia.base.org', * chainId: 84532, * symbol: 'ETH', * }) * .withPrivateKey({ * privateKey: 'your-private-key-here', * password: 'your password', * name: 'Test Account', // Optional name for the private key * // chain defaults to 'base', or specify: chain: 'ethereum' * }) * .build() * ); * ``` */ import { NetworkConfig } from "./wallets/types"; type WalletType = MetaMask | CoinbaseWallet | PhantomWallet; /** * Base configuration builder that handles common wallet setup */ declare abstract class BaseWalletBuilder { protected nodeConfig?: NodeConfig; protected config: Partial; constructor(config: Partial); /** * Helper method to chain multiple setup functions together. * Ensures setup functions are executed in the order they were added. */ protected chainSetup(newSetup: (wallet: T, context: WalletSetupContext) => Promise): void; /** * Configure wallet with a seed phrase and optional password * @param seedPhrase - The wallet's seed phrase * @param password - Optional password for the wallet */ withSeedPhrase({ seedPhrase, password, username, }: { seedPhrase: string; password?: string; username?: string; }): this; /** * Configure wallet with a private key and optional password * @param privateKey - The wallet's private key * @param password - Optional password for the wallet * @param chain - Optional blockchain to use (for Phantom wallet: solana, ethereum, base, sui, polygon, bitcoin). Defaults to "base". * @param name - Optional name for the private key (for organization purposes) */ withPrivateKey({ privateKey, password, chain, name, }: { privateKey: string; password?: string; chain?: string; name?: string; }): this; /** * Add custom setup steps to the wallet configuration * @param setupFn - Custom function to perform additional wallet setup */ withCustomSetup(setupFn: (wallet: T) => Promise): this; setNodeConfig(config?: NodeConfig): void; /** * Build the final wallet configuration * @returns WalletFixtureOptions ready to be used with createOnchainTest */ build(): WalletFixtureOptions; } /** * MetaMask-specific configuration builder * Extends base builder with MetaMask-specific functionality */ declare class MetaMaskConfigBuilder extends BaseWalletBuilder { withNetwork(network: NetworkConfig): this; } /** * Coinbase-specific configuration builder * Extends base builder with Coinbase-specific functionality */ declare class CoinbaseConfigBuilder extends BaseWalletBuilder { withNetwork(network: NetworkConfig): this; } /** * Phantom-specific configuration builder * Extends base builder with Phantom-specific functionality */ declare class PhantomConfigBuilder extends BaseWalletBuilder { withNetwork(network: NetworkConfig): this; } /** * Main configuration builder that initializes wallet-specific builders */ export declare class ConfigBuilder { private config; private nodeConfig?; /** * Initialize MetaMask configuration * @returns MetaMask-specific builder */ withMetaMask(): MetaMaskConfigBuilder; /** * Initialize Coinbase configuration * @returns Coinbase-specific builder */ withCoinbase(): CoinbaseConfigBuilder; /** * Initialize Phantom configuration * @returns Phantom-specific builder */ withPhantom(): PhantomConfigBuilder; /** * Configure the local Anvil node * @param config - Node configuration options * @returns This builder for chaining */ withLocalNode(config?: NodeConfig): this; /** * Build the final configuration * @returns Configuration object ready to be used with createOnchainTest */ build(): { options: WalletFixtureOptions; }; } /** * Creates a new configuration builder * @returns ConfigBuilder instance */ export declare function configure(): ConfigBuilder; export {};