import { ISigner } from "applesauce-signers";
import { BehaviorSubject } from "rxjs";
import { NostrEvent } from "nostr-tools";
import { EventTemplate, IAccount, SerializedAccount } from "./types.js";
/** An error thrown when a signer is used with the wrong pubkey */
export declare class SignerMismatchError extends Error {
}
/** A base class for all accounts */
export declare class BaseAccount<Signer extends ISigner, SignerData, Metadata extends unknown> implements IAccount<Signer, SignerData, Metadata> {
    pubkey: string;
    signer: Signer;
    id: string;
    get type(): string;
    /** Disable request queueing */
    disableQueue?: boolean;
    metadata$: BehaviorSubject<Metadata | undefined>;
    get metadata(): Metadata | undefined;
    set metadata(metadata: Metadata);
    get nip04(): ISigner["nip04"] | undefined;
    get nip44(): ISigner["nip44"] | undefined;
    constructor(pubkey: string, signer: Signer);
    toJSON(): SerializedAccount<SignerData, Metadata>;
    /** A method that wraps any signer interaction, this allows the account to wait for unlock or queue requests */
    protected operation<T extends unknown>(operation: () => Promise<T>): Promise<T>;
    /** Adds the common fields to the serialized output of a toJSON method */
    protected saveCommonFields(json: Omit<SerializedAccount<SignerData, Metadata>, "id" | "type" | "metadata" | "pubkey">): SerializedAccount<SignerData, Metadata>;
    /** Sets an accounts id and metadata. NOTE: This should only be used in fromJSON methods */
    static loadCommonFields<T extends IAccount>(account: T, json: SerializedAccount<any, any>): T;
    /** Gets the pubkey from the signer */
    getPublicKey(): Promise<string>;
    /** sign the event and make sure its signed with the correct pubkey */
    signEvent(template: EventTemplate): Promise<NostrEvent>;
    /** Aborts all pending requests in the queue */
    abortQueue(reason: Error): void;
    /** internal queue */
    protected queueLength: number;
    protected lock: Promise<any> | null;
    protected abort: AbortController | null;
    protected reduceQueue(): void;
    protected waitForQueue<T extends unknown>(operation: () => Promise<T>): Promise<T>;
}
