/// <reference types="node" />
import { PublicKey, Connection, Keypair, TransactionInstruction } from '@solana/web3.js';
import type { Logger, Nullable } from '../../utils';
import type { IdentityService } from '../identity';
declare type HandleTransactionParams = {
    instructions: TransactionInstruction[];
    errorMapping?: Nullable<{
        fromErrorCode: (errorCode: number) => string;
    }>;
    recentBlockhash?: Nullable<string>;
    logger?: Logger;
    skipPreflight?: Nullable<boolean>;
    feePayerOverride?: Nullable<PublicKey>;
    sendBlockhash?: boolean;
    signatures?: Nullable<Array<{
        publicKey: string;
        signature: Buffer;
    }>>;
    lookupTableAddresses?: string[];
    retry?: boolean;
};
/**
 * Handles sending Solana transactions, either directly via `sendAndConfirmTransaction`,
 * or via IdentityService's relay.
 */
export declare class TransactionHandler {
    private connection;
    private readonly useRelay;
    private readonly identityService;
    private readonly feePayerKeypairs;
    private readonly skipPreflight;
    private readonly retryTimeoutMs;
    private readonly pollingFrequencyMs;
    private readonly sendingFrequencyMs;
    private readonly fallbackConnections;
    /**
     * Creates an instance of TransactionHandler.
     */
    constructor({ connection, useRelay, identityService, feePayerKeypairs, skipPreflight, retryTimeoutMs, pollingFrequencyMs, sendingFrequencyMs, fallbackConnections }: {
        connection: Connection;
        useRelay: boolean;
        identityService?: IdentityService | null;
        feePayerKeypairs?: Keypair[] | null;
        skipPreflight?: boolean;
        retryTimeoutMs?: number;
        pollingFrequencyMs?: number;
        sendingFrequencyMs?: number;
        fallbackConnections?: Connection[] | null;
    });
    /**
     * Primary method to send a Solana transaction.
     */
    handleTransaction({ instructions, errorMapping, recentBlockhash, logger, skipPreflight, feePayerOverride, sendBlockhash, signatures, lookupTableAddresses, retry }: HandleTransactionParams): Promise<{
        res: string | null;
        errorCode: string | number | null;
        error: string | null;
    }>;
    _relayTransaction(instructions: TransactionInstruction[], recentBlockhash: string | null, skipPreflight: boolean | null, feePayerOverride: Nullable<PublicKey> | undefined, sendBlockhash: boolean, signatures: Array<{
        publicKey: string;
        signature: Buffer;
    }> | null, lookupTableAddresses: string[], retry: boolean): Promise<{
        res: string | null;
        error: null;
        errorCode: null;
    } | {
        res: null;
        error: any;
        errorCode: number | null;
    }>;
    _locallyConfirmTransaction(instructions: TransactionInstruction[], recentBlockhash: string | null, logger: Logger, feePayerOverride: Nullable<string | PublicKey> | undefined, signatures: {
        publicKey: string;
        signature: Buffer;
    }[] | null | undefined, lookupTableAddresses: string[], retry?: boolean): Promise<{
        res: string;
        error: null;
        errorCode: null;
    } | {
        res: null;
        error: string | null;
        errorCode: number | null;
    }>;
    _awaitTransactionSignatureConfirmation(txid: string, logger: Logger): Promise<unknown>;
    /**
     * Attempts to parse an error code out of a message of the form:
     * "... custom program error: 0x1", where the return in this case would be the number 1.
     * Returns null for unparsable strings.
     */
    _parseSolanaErrorCode(errorMessage: string): number | null;
}
export {};
