import { AxiosError, AxiosInstance } from 'axios';
import { Logger } from './logger.js';
import type { SetRequired } from 'type-fest';
import { CastId, CastsApi, ErrorResponse, HubInfoResponse as OpenapiHubInfoResponse, InfoApi, LinksApi, CastAdd, ReactionsApi, ReactionsApiGetReactionByIdRequest, ReactionType, Reaction, LinkAdd, UserDataApi, UserDataType, UserDataAdd, FIDsApi, StorageApi, StorageLimit, UsernamesApi, UserNameProof, VerificationsApi, Verification, OnChainEventType, OnChainEventSigner, OnChainEventsApi, OnChainEventSignerMigrated, OnChainEventIdRegister, OnChainEventStorageRent, HubEventsApi, HubEvent, SubmitMessageApi, CastRemove, LinkRemove, ReactionRemove, VerificationRemove, ValidateMessageResponse, ValidateMessageApi } from './openapi/index.js';
import { Embed, Signer } from '@farcaster/core';
export type OnChainEventsReturnType<T> = T extends OnChainEventType.Signer ? OnChainEventSigner : T extends OnChainEventType.SignerMigrated ? OnChainEventSignerMigrated : T extends OnChainEventType.IdRegister ? OnChainEventIdRegister : T extends OnChainEventType.StorageRent ? OnChainEventStorageRent : never;
export type HubInfo<T> = T extends true ? SetRequired<OpenapiHubInfoResponse, 'dbStats'> : OpenapiHubInfoResponse;
export declare const DEFAULT_HUB_URL = "https://nemes.farcaster.xyz:2281";
export interface HubRestAPIClientConfig {
    axiosInstance?: AxiosInstance;
    hubUrl?: string;
    logger?: Logger;
}
export interface PaginationOptions {
    pageSize?: number;
    reverse?: boolean;
}
export declare class HubRestAPIClient {
    private readonly logger;
    readonly apis: {
        casts: CastsApi;
        fids: FIDsApi;
        hubEvents: HubEventsApi;
        info: InfoApi;
        links: LinksApi;
        onChainEvents: OnChainEventsApi;
        reactions: ReactionsApi;
        storage: StorageApi;
        submitMessage: SubmitMessageApi;
        userData: UserDataApi;
        usernames: UsernamesApi;
        verifications: VerificationsApi;
        validateMessage: ValidateMessageApi;
    };
    /**
     * Instantiates a HubRestAPIClient
     */
    constructor({ axiosInstance, hubUrl, logger, }?: HubRestAPIClientConfig);
    /**
     * Takes in a hex private key or Signer object and returns a Signer object.
     * If the input is a hex private key, it will be converted to a Signer object.
     *
     * @param signer The signer's hex private key or Signer object
     */
    private formatSigner;
    /**
     * Get the Hub's info.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/info.html#info)
     */
    getHubInfo<T extends boolean | undefined>({ includeDbStats, }?: {
        includeDbStats?: T;
    }): Promise<HubInfo<T>>;
    /**
     * Submits a Cast.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/submitmessage.html#submitmessage)
     * @param cast The cast to submit
     * @param fid The FID of the signer
     * @param signer The signer's hex private key or Signer object
     */
    submitCast(cast: {
        text: string;
        embeds?: Embed[];
        embedsDeprecated?: string[];
        mentions?: number[];
        mentionsPositions?: number[];
        parentCastId?: CastId;
        parentUrl?: string;
    }, fid: number, signer: string | Signer): Promise<CastAdd>;
    /**
     * Deletes a Cast.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/submitmessage.html#submitmessage)
     * @param castHash The hash of the cast to delete
     * @param fid The FID of the signer
     * @param signer The signer's hex private key or Signer object
     */
    removeCast(castHash: string, fid: number, signer: string | Signer): Promise<CastRemove>;
    /**
     * Submits a Link. Used to follow users.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/submitmessage.html#submitmessage)
     * @param link The link to submit
     * @param fid The FID of the signer
     * @param signer The signer's hex private key or Signer object
     */
    submitLink(link: {
        type: string;
        displayTimestamp?: number;
        targetFid?: number;
    }, fid: number, signer: string | Signer): Promise<LinkAdd>;
    /**
     * Follows a User. Wraps submitLink.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/submitmessage.html#submitmessage)
     * @param targetFid The FID of the user to follow
     * @param fid The FID of the signer
     * @param signer The signer's hex private key or Signer object
     */
    followUser(targetFid: number, fid: number, signer: string | Signer): Promise<LinkAdd>;
    /**
     * Removes a Link. Used to unfollow users
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/submitmessage.html#submitmessage)
     * @param link The link to remove
     * @param fid The FID of the signer
     * @param signer The signer's hex private key or Signer object
     */
    removeLink(link: {
        type: string;
        displayTimestamp?: number;
        targetFid?: number;
    }, fid: number, signer: string | Signer): Promise<LinkRemove>;
    /**
     * Un-follows a User. Wraps removeLink.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/submitmessage.html#submitmessage)
     * @param targetFid The FID of the user to unfollow
     * @param fid The FID of the signer
     * @param signer The signer's hex private key or Signer object
     */
    unfollowUser(targetFid: number, fid: number, signer: string | Signer): Promise<LinkRemove>;
    /**
     * Submits a Reaction. Used to like or recast.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/submitmessage.html#submitmessage)
     * @param reaction The reaction to submit
     * @param fid The FID of the signer
     * @param signer The signer's hex private key or Signer object
     */
    submitReaction(reaction: {
        type: 'like' | 'recast';
        target: CastId | {
            url: string;
        };
    }, fid: number, signer: string | Signer): Promise<Reaction>;
    /**
     * Removes a Reaction. Used to un-like or un-recast.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/submitmessage.html#submitmessage)
     * @param reaction The reaction to remove
     * @param fid The FID of the signer
     * @param signer The signer's hex private key or Signer object
     */
    removeReaction(reaction: {
        type: 'like' | 'recast';
        target: CastId | {
            url: string;
        };
    }, fid: number, signer: string | Signer): Promise<ReactionRemove>;
    /**
     * Submits a Verification.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/submitmessage.html#submitmessage)
     * @param verification The verification to submit
     * @param fid The FID of the signer
     * @param signer The signer's hex private key or Signer object
     */
    submitVerification(verification: {
        verifiedAddressMnemonicOrPrivateKey: string;
        verificationType: 'EOA' | 'contract';
        network: 'MAINNET' | 'TESTNET' | 'DEVNET';
        chainId: number;
    }, fid: number, signer: string | Signer): Promise<Verification>;
    /**
     * Removes a Verification.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/submitmessage.html#submitmessage)
     * @param address The address to remove the verification for
     * @param fid The FID of the signer
     * @param signer The signer's hex private key or Signer object
     */
    removeVerification(address: string, fid: number, signer: string | Signer): Promise<VerificationRemove>;
    /**
     * Get a cast by its FID and Hash.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/casts.html#castbyid)
     * @param fid The FID of the cast's creator
     * @param hash The hash of the cast
     */
    getCastById({ fid, hash }: CastId): Promise<CastAdd | null>;
    /**
     * Fetch all casts for authored by an FID.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/casts.html#castsbyfid)
     * @param fid The FID of the cast's creator
     * @param options
     */
    listCastsByFid(fid: number, options?: PaginationOptions): AsyncGenerator<CastAdd, void, undefined>;
    /**
     * Fetch all casts that mention an FID.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/casts.html#castsbymention)
     * @param fid The FID that is mentioned in a cast
     * @param options
     */
    listCastsByMention(fid: number, options?: PaginationOptions): AsyncGenerator<CastAdd, void, undefined>;
    /**
     * Fetch all casts by parent cast's FID and Hash OR by the parent's URL.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/casts.html#castsbyparent)
     * @param parent
     * @param options
     */
    listCastsByParent(parent: CastId | {
        url: string;
    }, options?: PaginationOptions): AsyncGenerator<CastAdd, void, undefined>;
    /**
     * Get a reaction by its created FID and target Cast.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/reactions.html#reactionbyid)
     * @param id The source and target of the reaction, and the reaction type
     * @returns
     */
    getReactionById(id: ReactionsApiGetReactionByIdRequest): Promise<Reaction | null>;
    /**
     * Get all reactions by an FID.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/reactions.html#reactionsbyfid)
     * @param fid The FID of the reaction's creator
     * @param reactionType The type of reaction
     * @param options
     */
    listReactionsByFid(fid: number, reactionType: ReactionType, options?: PaginationOptions): AsyncGenerator<Reaction, void, undefined>;
    /**
     * Get all reactions to a cast.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/reactions.html#reactionsbycast)
     * @param targetFid The FID of the cast's creator
     * @param targetHash The hash of the cast
     * @param reactionType The type of reaction
     * @param options
     */
    listReactionsByCast(targetFid: number, targetHash: string, reactionType: ReactionType, options?: PaginationOptions): AsyncGenerator<Reaction, void, undefined>;
    /**
     * Get all reactions to cast's target URL.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/reactions.html#reactionsbytarget)
     * @param url The URL of the parent cast
     * @param reactionType The type of reaction
     * @param options
     */
    listReactionsByTarget(url: string, reactionType: ReactionType, options?: PaginationOptions): AsyncGenerator<Reaction, void, undefined>;
    /**
     * Get a link by its FID and target FID.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/links.html#linkbyid)
     * @param sourceFid The FID of the link's creator
     * @param targetFid The FID of the link's target
     */
    getLinkById(sourceFid: number, targetFid: number): Promise<LinkAdd | null>;
    /**
     * Get all links from a source FID.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/links.html#linksbyfid)
     * @param fid The FID of the link's originator
     * @param options
     */
    listLinksByFid(fid: number, options?: PaginationOptions): AsyncGenerator<LinkAdd, void, undefined>;
    /**
     * Get all links to a target FID.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/links.html#linksbytargetfid)
     * @param targetFid
     * @param options
     */
    listLinksByTargetFid(targetFid: number, options?: PaginationOptions): AsyncGenerator<LinkAdd, void, undefined>;
    /**
     * Get a specific type of UserData for a FID.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/userdata.html#userdatabyfid)
     * @param fid The FID that's being requested
     * @param userDataType The type of UserData requested
     * @returns
     */
    getSpecificUserDataByFid(fid: number, userDataType: UserDataType): Promise<UserDataAdd | null>;
    /**
     * Get all UserData for a FID. Returns an empty iterator if FID has no user data or does not exist.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/userdata.html#userdatabyfid)
     * @param fid The FID that's being requested
     * @returns
     */
    listAllUserDataByFid(fid: number, options?: PaginationOptions): AsyncGenerator<UserDataAdd, void, undefined>;
    /**
     * Get a list of all the FIDs.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/fids.html#fids)
     * @param options
     */
    listFids(options?: PaginationOptions): AsyncGenerator<number, void, undefined>;
    /**
     * Get an FID's storage limits.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/storagelimits.html#storagelimitsbyfid)
     * @param fid The FID that's being requested
     * @returns
     */
    getStorageLimitsByFid(fid: number): Promise<StorageLimit[]>;
    /**
     * Get an proof for a username by the Farcaster username.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/usernameproof.html#usernameproofbyname)
     * @param username The Farcaster username or ENS address
     * @returns
     */
    getUsernameProof(username: string): Promise<UserNameProof | null>;
    /**
     * Get a list of proofs provided by an FID.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/usernameproof.html#usernameproofsbyfid)
     * @param fid The FID being requested
     * @returns
     */
    listUsernameProofsForFid(fid: number): Promise<UserNameProof[]>;
    /**
     * Get a list of verifications provided by an FID.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/verification.html)
     * @param fid The FID being requested
     * @param options The optional ETH address to filter by
     */
    listVerificationsByFid(fid: number, options?: PaginationOptions & {
        address?: string;
    }): AsyncGenerator<Verification, void, undefined>;
    /**
     * Get a list of on-chain events by an FID.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/onchain.html#onchaineventsbyfid)
     * @param fid The FID being requested
     * @param eventType The event type being requested
     * @returns
     */
    listOnChainEventsByFid<T extends OnChainEventType>(fid: number, eventType: T): Promise<Array<OnChainEventsReturnType<T>>>;
    /**
     * Get a specific on-chain signer event by FID and signer.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/onchain.html#onchainsignersbyfid)
     * @param fid The FID being requested
     * @param signer The key of signer
     * @returns
     */
    getOnChainSignerEventBySigner(fid: number, signer: string): Promise<OnChainEventSigner | null>;
    /**
     * Get a specific on-chain ID registration event by address.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/onchain.html#onchainidregistryeventbyaddress)
     * @param address The ETH address being requested
     * @returns
     */
    getOnChainIdRegistryEventByAddress(address: string): Promise<OnChainEventIdRegister | null>;
    /**
     * Get a hub event by its Id.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/events.html#eventbyid)
     * @param eventId The Hub Id of the event
     * @returns
     */
    getHubEventById(eventId: number): Promise<HubEvent | null>;
    /**
     * Get a page of Hub events.
     * See [farcaster documentation](https://www.thehubble.xyz/docs/httpapi/events.html#events)
     * @param fromEventId An optional Hub Id to start getting events from.
     */
    listHubEvents(fromEventId?: number): AsyncGenerator<HubEvent, void, undefined>;
    /**
     * Validate a signed protobuf-serialized message with the Hub.
     * This can be used to verify that the hub will consider the message valid.
     * Or to validate message that cannot be submitted (e.g. Frame actions).
     * See [farcaster documentation](https://github.com/farcasterxyz/hub-monorepo/blob/main/apps/hubble/www/docs/docs/httpapi/message.md#validatemessage)
     * @param encodedMessage A signed protobuf-serialized message to validate.
     */
    validateMessage(encodedMessage: string): Promise<ValidateMessageResponse>;
    /**
     * Utility for parsing errors returned by a hub's REST API server. Returns true
     * if the given error is caused by an error response from the server, and
     * narrows the type of `error` accordingly.
     */
    static isApiErrorResponse(error: any): error is SetRequired<AxiosError<ErrorResponse>, 'response'>;
}
