/**
 * Abstract wallet interfaces and signing utilities for [EIP-712](https://eips.ethereum.org/EIPS/eip-712) typed data.
 * @module
 */
/// <amd-module name="file:///home/runner/work/hyperliquid/hyperliquid/src/signing/_abstractWallet.ts" />
import { HyperliquidError } from "../_base.js";
/** Thrown when an error occurs in AbstractWallet operations (e.g., signing, getting address). */
export declare class AbstractWalletError extends HyperliquidError {
    constructor(message: string, options?: ErrorOptions);
}
/** Common domain type for EIP-712 typed data signing. */
interface TypedDataDomain {
    name: string;
    version: string;
    chainId: number;
    verifyingContract: `0x${string}`;
}
/** Common types structure for EIP-712 typed data. */
interface TypedDataTypes {
    [key: string]: readonly {
        name: string;
        type: string;
    }[];
}
/** ECDSA signature components. */
export interface Signature {
    /** First 32-byte component of ECDSA signature. */
    r: `0x${string}`;
    /** Second 32-byte component of ECDSA signature. */
    s: `0x${string}`;
    /** Recovery identifier. */
    v: 27 | 28;
}
/** Abstract interface for an {@link https://docs.ethers.org/v6/api/providers/#Signer | ethers.js v6}. */
export interface AbstractEthersV6Signer {
    signTypedData(domain: TypedDataDomain, types: TypedDataTypes, value: Record<string, unknown>): Promise<string>;
    getAddress(): Promise<string>;
    provider?: {
        getNetwork(): Promise<{
            chainId: number | bigint;
        }>;
    } | null;
}
/** Abstract interface for an {@link https://docs.ethers.org/v5/api/signer/ | ethers.js v5}. */
export interface AbstractEthersV5Signer {
    _signTypedData(domain: TypedDataDomain, types: TypedDataTypes, value: Record<string, unknown>): Promise<string>;
    getAddress(): Promise<string>;
    provider?: {
        getNetwork(): Promise<{
            chainId: number | bigint;
        }>;
    } | null;
}
/** Viem-style typed data parameters. */
interface ViemTypedDataParams {
    domain: {
        name: string;
        version: string;
        chainId: number;
        verifyingContract: `0x${string}`;
    };
    types: TypedDataTypes;
    primaryType: string;
    message: Record<string, unknown>;
}
/** Abstract interface for a {@link https://viem.sh/docs/accounts/jsonRpc#json-rpc-account | viem JSON-RPC Account}. */
export interface AbstractViemJsonRpcAccount {
    /**
     * `options` is not in {@link https://viem.sh/docs/actions/wallet/signTypedData | base viem};
     * accepted for wallet extensions like {@link https://docs.privy.io/wallets/using-wallets/ethereum/sign-typed-data | Privy}.
     */
    signTypedData(params: ViemTypedDataParams, options?: unknown): Promise<`0x${string}`>;
    getAddresses(): Promise<`0x${string}`[]>;
    getChainId(): Promise<number>;
}
/** Abstract interface for a {@link https://viem.sh/docs/accounts/local | viem Local Account}. */
export interface AbstractViemLocalAccount {
    /**
     * `options` is not in {@link https://viem.sh/docs/actions/wallet/signTypedData | base viem};
     * accepted for wallet extensions like {@link https://docs.privy.io/wallets/using-wallets/ethereum/sign-typed-data | Privy}.
     */
    signTypedData(params: ViemTypedDataParams, options?: unknown): Promise<`0x${string}`>;
    address: `0x${string}`;
}
/** Abstract interface for a wallet that can sign typed data. */
export type AbstractWallet = AbstractViemJsonRpcAccount | AbstractViemLocalAccount | AbstractEthersV6Signer | AbstractEthersV5Signer;
/**
 * Signs [EIP-712](https://eips.ethereum.org/EIPS/eip-712) typed data using the provided wallet.
 *
 * @param args The wallet, domain, types, primary type, and message to sign.
 * @return The ECDSA signature components.
 *
 * @throws {AbstractWalletError} If the wallet type is unknown or signing fails.
 */
export declare function signTypedData(args: {
    wallet: AbstractWallet;
    domain: TypedDataDomain;
    types: TypedDataTypes;
    primaryType: string;
    message: Record<string, unknown>;
}): Promise<Signature>;
/**
 * Gets the lowercase wallet address from various wallet types.
 *
 * @param wallet The wallet to query.
 * @return The lowercase wallet address as a hex string.
 *
 * @throws {AbstractWalletError} If getting the address fails or the wallet type is unknown.
 */
export declare function getWalletAddress(wallet: AbstractWallet): Promise<`0x${string}`>;
/**
 * Gets the chain ID of the wallet.
 *
 * For wallets that have no notion of chain (e.g., a viem local account, or an ethers signer without a provider),
 * defaults to `"0x1"`.
 *
 * @param wallet The wallet to query.
 * @return The chain ID as a hex string.
 *
 * @throws {AbstractWalletError} If getting the chain ID fails or the wallet type is unknown.
 */
export declare function getWalletChainId(wallet: AbstractWallet): Promise<`0x${string}`>;
export {};
