import type { Network, PendingTransaction, TransactionEnvelope } from "@saberhq/solana-contrib";
import type { Commitment, KeyedAccountInfo, PublicKey, TransactionSignature } from "@solana/web3.js";
import type { ProgramAccountParser } from "../parsers/programAccounts";
import type { TransactionErrorType } from "./categorizeTransactionError";
export declare type SailErrorName = `Sail${"UnknownTXFail" | "Transaction" | "InsufficientSOL" | "RefetchAfterTX" | "RefetchSubscriptions" | "TransactionSign" | "CacheRefetch" | "AccountParse" | "ProgramAccountParse" | "AccountLoad" | "SignAndConfirm" | "GetMultipleAccounts"}Error`;
export declare const ERROR_TITLES: {
    [N in SailErrorName]: string;
};
/**
 * Extracts the message from an error.
 * @param errLike Error-like object.
 * @returns
 */
export declare const extractErrorMessage: (errLike: unknown) => string | null;
/**
 * Error originating from Sail.
 */
export declare class SailError extends Error {
    /**
     * Name of the Sail error.
     */
    readonly sailErrorName: SailErrorName;
    /**
     * The original error thrown, if applicable.
     */
    readonly originalError: unknown;
    /**
     * Underlying error message.
     */
    readonly cause: string;
    _isSailError: boolean;
    constructor(
    /**
     * Name of the Sail error.
     */
    sailErrorName: SailErrorName, 
    /**
     * The original error thrown, if applicable.
     */
    originalError: unknown, 
    /**
     * Underlying error message.
     */
    cause?: string);
    /**
     * Title of the error.
     */
    get title(): string;
    /**
     * Returns the value as a {@link SailError}, or null if it isn't.
     * @param e
     * @returns
     */
    static tryInto: (e: unknown) => SailError | null;
}
/**
 * Error originating from Sail.
 */
export declare class SailUnknownTXFailError extends SailError {
    readonly network: Network;
    readonly txs: readonly TransactionEnvelope[];
    constructor(originalError: unknown, network: Network, txs: readonly TransactionEnvelope[]);
}
/**
 * Error on a Solana transaction
 */
export declare class SailTransactionError extends SailError {
    readonly network: Network;
    readonly tx: TransactionEnvelope;
    /**
     * User message representing the transaction.
     */
    readonly userMessage?: string | undefined;
    constructor(network: Network, originalError: unknown, tx: TransactionEnvelope, 
    /**
     * User message representing the transaction.
     */
    userMessage?: string | undefined);
    /**
     * Tag used for grouping errors together.
     */
    get tag(): TransactionErrorType | null;
    /**
     * Returns true if this error is associated with a simulation.
     */
    get isSimulation(): boolean;
    /**
     * Fingerprint used for grouping errors.
     */
    get fingerprint(): string[];
    /**
     * Generates a debug string representation of the transactions involved in this error.
     * @param network
     * @returns
     */
    generateLogMessage(): string;
}
/**
 * Thrown if there is not enough SOL to pay for a transaction.
 */
export declare class InsufficientSOLError extends SailError {
    readonly currentBalance?: number | null | undefined;
    constructor(currentBalance?: number | null | undefined);
}
/**
 * Thrown if there is an error refetching accounts after a transaction.
 */
export declare class SailRefetchAfterTXError extends SailError {
    readonly writable: readonly PublicKey[];
    readonly txs: readonly PendingTransaction[];
    constructor(originalError: unknown, writable: readonly PublicKey[], txs: readonly PendingTransaction[]);
    /**
     * List of {@link TransactionSignature}s.
     */
    get txSigs(): readonly TransactionSignature[];
}
/**
 * Thrown if an error occurs when refetching subscriptions.
 */
export declare class SailRefetchSubscriptionsError extends SailError {
    constructor(originalError: unknown);
}
/**
 * Thrown if transactions could not be signed.
 */
export declare class SailTransactionSignError extends SailError {
    readonly txs: readonly TransactionEnvelope[];
    constructor(originalError: unknown, txs: readonly TransactionEnvelope[]);
}
/**
 * Thrown if a cache refetch results in an error.
 */
export declare class SailCacheRefetchError extends SailError {
    readonly keys: readonly (PublicKey | null | undefined)[];
    constructor(originalError: unknown, keys: readonly (PublicKey | null | undefined)[]);
}
/**
 * Thrown if there is an error parsing an account.
 */
export declare class SailAccountParseError extends SailError {
    readonly data: KeyedAccountInfo;
    constructor(originalError: unknown, data: KeyedAccountInfo);
}
/**
 * Thrown if there is an error parsing an account.
 */
export declare class SailProgramAccountParseError extends SailError {
    readonly data: KeyedAccountInfo;
    readonly parser: ProgramAccountParser<unknown>;
    constructor(originalError: unknown, data: KeyedAccountInfo, parser: ProgramAccountParser<unknown>);
}
/**
 * Thrown if an account could not be loaded.
 */
export declare class SailAccountLoadError extends SailError {
    readonly accountId: PublicKey;
    constructor(originalError: unknown, accountId: PublicKey);
    get userMessage(): string;
}
/**
 * Callback called whenever getMultipleAccounts fails.
 */
export declare class SailGetMultipleAccountsError extends SailError {
    readonly keys: readonly PublicKey[];
    readonly commitment: Commitment;
    constructor(keys: readonly PublicKey[], commitment: Commitment, originalError: unknown);
}
/**
 * Callback called whenever getMultipleAccounts fails.
 */
export declare class SailSignAndConfirmError extends SailError {
    readonly errors: readonly SailError[] | undefined;
    constructor(errors: readonly SailError[] | undefined);
}
//# sourceMappingURL=errors.d.ts.map