/// <reference types="react" />
import { ContractTransaction, ethers } from "ethers";
import { Map, Set, Record } from "immutable";
import { Provider } from "@ethersproject/providers";
import { AppAnalytics } from "../analytics/AppAnalytics";
export declare const ErrorTxSignatureRejected = "rejected transaction signature";
export declare type TxStatus = "new" | "signature" | "pending" | "complete" | "rejected" | "error";
export declare type TransactionInput = {
    tx?: Promise<ethers.ContractTransaction>;
    link?: string;
    meta?: any;
};
export declare type TransactionData = {
    link?: string;
    meta?: any;
    status?: TxStatus;
    error?: string;
    tx?: ContractTransaction;
    receipt?: ethers.providers.TransactionReceipt;
};
export interface State {
    transactions: Map<string, Record<TransactionData>>;
    statuses: Map<TxStatus, Set<string>>;
}
export declare class TxHandler {
    private analytics;
    private provider;
    private state;
    private callbacks;
    constructor();
    setAnalytics(analytics: AppAnalytics): void;
    setProvider(provider: Provider): void;
    getState(): State;
    register(callback: (state: State) => void): string;
    unregister(id: string): void;
    submitTransaction(id: string, input: TransactionInput): Promise<void>;
    clearTransaction(id: string): void;
    private handleTransaction;
    private onStateChange;
    private updateState;
}
export declare const TxHandlerContext: import("react").Context<TxHandler>;
