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 implements IAccount { pubkey: string; signer: Signer; id: string; get type(): string; /** Disable request queueing */ disableQueue?: boolean; metadata$: BehaviorSubject; 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; /** A method that wraps any signer interaction, this allows the account to wait for unlock or queue requests */ protected operation(operation: () => Promise): Promise; /** Adds the common fields to the serialized output of a toJSON method */ protected saveCommonFields(json: Omit, "id" | "type" | "metadata" | "pubkey">): SerializedAccount; /** Sets an accounts id and metadata. NOTE: This should only be used in fromJSON methods */ static loadCommonFields(account: T, json: SerializedAccount): T; /** Gets the pubkey from the signer */ getPublicKey(): Promise; /** sign the event and make sure its signed with the correct pubkey */ signEvent(template: EventTemplate): Promise; /** Aborts all pending requests in the queue */ abortQueue(reason: Error): void; /** internal queue */ protected queueLength: number; protected lock: Promise | null; protected abort: AbortController | null; protected reduceQueue(): void; protected waitForQueue(operation: () => Promise): Promise; }