import * as viem from 'viem';
import { Address, Hex, Chain, PublicClient, Transport, WalletClient, Account, TestClient, PublicRpcSchema, LocalAccount } from 'viem';
import { NexusAccount } from '@biconomy/abstractjs-canary';
import { Options } from 'get-port';
import { BundlerClient, SmartAccount } from 'viem/account-abstraction';
import { TestClientMode } from 'viem/clients/createTestClient';

declare const DETERMINISTIC_DEPLOYER: Address;
declare const CREATE2_FACTORY_DEPLOYER_ADDRESS: Address;
declare const ENTRYPOINT_V07_ADDRESS: Address;
declare const ENTRY_POINT_SIMULATIONS_ADDRESS: Address;
declare const NEXUS_IMPLEMENTATION_ADDRESS: Address;
declare const NEXUS_BOOTSTRAP_ADDRESS: Address;
declare const NEXUS_ACCOUNT_FACTORY_ADDRESS: Address;
declare const MEE_VALIDATOR_ADDRESS: Address;
declare const COMPOSABLE_MODULE_ADDRESS: Address;
declare const SMART_SESSION_ADDRESS: Address;
declare const SUDO_POLICY_ADDRESS: Address;
declare const SPENDING_LIMITS_POLICY_ADDRESS: Address;
declare const UNIVERSAL_ACTION_POLICY_ADDRESS: Address;
declare const TIME_FRAME_POLICY_ADDRESS: Address;
declare const VALUE_LIMIT_POLICY_ADDRESS: Address;
declare const OWNABLE_VALIDATOR_ADDRESS: Address;
declare const OWNABLE_EXECUTOR_ADDRESS: Address;
declare const MINTABLE_ADDRESS: Address;
declare const COUNTER_ADDRESS: Address;
declare const TOKEN_WITH_PERMIT: Address;
declare const MOCK_SIGNATURE_VALIDATOR: Address;
declare const MOCK_CALLEE: Address;
declare const MOCK_TOKEN: Address;
declare const ALL_ADDRESSES: Record<string, {
    address: Address;
    chainId: number;
}>;

declare const BYTECODES: Record<Address, {
    address: Address;
    bytecode: Hex;
    name: string;
}>;

type DeployContractsArgs = {
    rpcUrl: string;
    chain: Chain;
    privateKey?: Hex;
};
declare const deployContracts: ({ rpcUrl, chain, privateKey }: DeployContractsArgs) => Promise<void>;
declare const RHINESTONE_REGISTRY_CREATECALL: Hex;
declare const ENTRY_POINT_V07_CREATECALL: Hex;
declare const ENTRY_POINT_SIMULATIONS_CREATECALL: Hex;

type FundAccountsArgs = {
    rpcUrl: string;
    chain: Chain;
    privateKey?: Hex;
};
declare const fundAccounts: ({ rpcUrl, chain, privateKey }: FundAccountsArgs) => Promise<void>;

type NetworkArgs = {
    rpcPort?: number;
    rpcUrl?: string;
    chainId?: string;
    name?: string;
    privateKey?: Hex;
    forkUrl?: string;
};
type Network = Awaited<ReturnType<typeof toNetwork>>;
declare const toNetwork: (parameters?: NetworkArgs) => Promise<{
    instance: any;
    chain: Chain;
    rpcUrl: string;
    rpcPort: number;
    chainId: string;
    name: string;
    privateKey: `0x${string}`;
}>;

type Bundler = Awaited<ReturnType<typeof toBundler>>;
type ToBundlerParameters = NetworkArgs & {
    port?: number;
};
declare const toBundler: (parameters: ToBundlerParameters) => Promise<{
    instance: any;
    port: number;
    url: string;
}>;

type ToEcosystemParameters = {
    chainLength?: number;
    forkUrl?: string;
};
type Infra = {
    network: Network;
    bundler: Bundler;
};
type Ecosystem = {
    meeNode: any;
    infras: Infra[];
};
declare const toEcosystem: (parameters?: ToEcosystemParameters) => Promise<{
    meeNode: {
        chainIds: string[];
        url: string;
    };
    infras: {
        network: {
            instance: any;
            chain: viem.Chain;
            rpcUrl: string;
            rpcPort: number;
            chainId: string;
            name: string;
            privateKey: `0x${string}`;
        };
        bundler: {
            instance: any;
            port: number;
            url: string;
        };
    }[];
}>;

type toMeeNodeParameters = {
    infras: Infra[];
};
type MeeNode = Awaited<ReturnType<typeof toMeeNode>>;
declare const toMeeNode: ({ infras }: toMeeNodeParameters) => Promise<{
    chainIds: string[];
    url: string;
}>;

declare const getRandomNumber: (min?: number, max?: number) => number;
declare const sleep: (ms: number) => Promise<unknown>;
declare const toClients: ({ rpcUrl, chain, privateKey }: {
    rpcUrl: string;
    chain: Chain;
    privateKey?: Hex;
}) => Promise<{
    publicClient: PublicClient<Transport, Chain>;
    walletClients: WalletClient<Transport, Chain, Account>[];
    testClient: TestClient<TestClientMode, Transport, Chain | undefined, Account | undefined, true, PublicRpcSchema>;
}>;
declare global {
    var __BICONOMY_USED_PORTS__: number[];
}
declare const PORT_OPTS: Options;
declare const getFreePort: (max: number, min: number, options?: Options) => Promise<number>;
declare const getFundedAccount: () => {
    account: Account;
    privateKey: Hex;
};
type Url = `https://${string}` | `http://${string}`;
type MinimalVars = {
    privateKey: Hex;
    chainId: number;
    bundlerUrl: Url;
};
declare const getEnvVars: (prefix?: string) => MinimalVars;
type NetworkConfig = {
    account: LocalAccount;
    chain: Chain;
    walletClient: WalletClient<Transport, Chain, Account>;
    publicClient: PublicClient<Transport, Chain>;
    bundlerClient: BundlerClient<Transport, Chain, SmartAccount>;
    nexusAccount: NexusAccount;
};
declare const validateNetwork: ({ chain, account, nexusAccount, bundlerClient, publicClient, walletClient }: NetworkConfig) => Promise<void>;

export { ALL_ADDRESSES, BYTECODES, type Bundler, COMPOSABLE_MODULE_ADDRESS, COUNTER_ADDRESS, CREATE2_FACTORY_DEPLOYER_ADDRESS, DETERMINISTIC_DEPLOYER, type DeployContractsArgs, ENTRYPOINT_V07_ADDRESS, ENTRY_POINT_SIMULATIONS_ADDRESS, ENTRY_POINT_SIMULATIONS_CREATECALL, ENTRY_POINT_V07_CREATECALL, type Ecosystem, type FundAccountsArgs, type Infra, MEE_VALIDATOR_ADDRESS, MINTABLE_ADDRESS, MOCK_CALLEE, MOCK_SIGNATURE_VALIDATOR, MOCK_TOKEN, type MeeNode, type MinimalVars, NEXUS_ACCOUNT_FACTORY_ADDRESS, NEXUS_BOOTSTRAP_ADDRESS, NEXUS_IMPLEMENTATION_ADDRESS, type Network, type NetworkArgs, type NetworkConfig, OWNABLE_EXECUTOR_ADDRESS, OWNABLE_VALIDATOR_ADDRESS, PORT_OPTS, RHINESTONE_REGISTRY_CREATECALL, SMART_SESSION_ADDRESS, SPENDING_LIMITS_POLICY_ADDRESS, SUDO_POLICY_ADDRESS, TIME_FRAME_POLICY_ADDRESS, TOKEN_WITH_PERMIT, type ToBundlerParameters, type ToEcosystemParameters, UNIVERSAL_ACTION_POLICY_ADDRESS, type Url, VALUE_LIMIT_POLICY_ADDRESS, deployContracts, fundAccounts, getEnvVars, getFreePort, getFundedAccount, getRandomNumber, sleep, toBundler, toClients, toEcosystem, toMeeNode, type toMeeNodeParameters, toNetwork, validateNetwork };
