/// <reference types="node" />
import { BlockHeader } from 'web3-eth';
import BigNumber from 'bignumber.js';
import { ActionBase, IPromptOptions } from 'cli-ux';
import { IOptionFlag } from '@oclif/command/lib/flags';
import { IConfig } from '@oclif/config';
import Command from '@oclif/command';
import { OutputFlags } from '@oclif/parser';
import type { EventEmitter } from 'events';
import type { BlockchainEvent, BlockchainEventsWithProvider, EventProcessorOptions, EventsHandler, Logger, StorageEvents, HandlersObject, InitCommandOption } from './definitions';
import { ProviderManager } from './providers';
import { CliInitDbOptions } from './definitions';
import { Sequelize } from 'sequelize';
export declare const BytesInMb: number;
export declare function bnFloor(v: string | number | BigNumber): BigNumber;
export declare function bytesToMegabytes(bytes: BigNumber | string | number): BigNumber;
export declare function errorHandler(fn: (...args: any[]) => Promise<void>, logger: Logger): (...args: any[]) => Promise<void>;
export declare function isEventWithProvider(event: BlockchainEvent): event is BlockchainEventsWithProvider;
export declare function isValidEvent(value: string, handlers: Record<string, unknown>): value is keyof typeof handlers;
export declare function buildHandler<T extends StorageEvents, O extends EventProcessorOptions>(handlers: HandlersObject<T, O>, events: string[]): EventsHandler<T, O>;
/**
 * Utility function for decoding Solidity's byte32 array.
 * @param fileReference
 */
export declare function decodeByteArray(fileReference: string[]): string;
/**
 * Duplicate object using JSON method. Functions are stripped.
 * @param obj
 */
export declare function duplicateObject<T>(obj: T): T;
/**
 * Create a Promise that is resolved when the specified event is emitted.
 * It is rejected if 'error' event is triggered.
 *
 * Be aware about the different mechanisms of EventEmitter and Promises!
 * Promise can be only ONCE fulfilled/rejected while EventEmitter can emit as many events
 * as it likes! Hence this utility resolves only upon first specified event or error.
 *
 * @param emitted
 * @param event
 */
export declare function runAndAwaitFirstEvent<T = void>(emitted: EventEmitter, event: string, fn: () => void): Promise<T>;
export declare function sleep<T>(ms: number, arg?: T): Promise<T | undefined>;
/**
 * Prompt for flag if not provided wrapper
 * @param {IOptionFlag<any>} flag Oclif flag object
 * @return IOptionFlag<any> & { prompt: string | boolean }
 */
export declare function promptForFlag(flag: IOptionFlag<any>): IOptionFlag<any>;
/**
 * Base class for Pinner service commands
 * It have predefined some basic flags and config processing
 * Also have some helpers for initializing DB, storing Offer ID and some ui (spinner, prompt for flag)
 * @abstract
 * @class BaseCommand
 */
export default abstract class BaseCommand extends Command {
    protected initOptions: InitCommandOption;
    protected defaultInitOptions: InitCommandOption;
    protected configuration: Record<string, any>;
    protected parsedArgs: any;
    protected dbPath?: string;
    protected sequelize?: Sequelize;
    static flags: {
        db: IOptionFlag<string | undefined>;
        config: IOptionFlag<string | undefined>;
        log: IOptionFlag<string>;
        skipPrompt: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
        'log-filter': IOptionFlag<string | undefined>;
        'log-path': IOptionFlag<string | undefined>;
    };
    constructor(argv: string[], config: IConfig, options?: InitCommandOption);
    protected prompt(message: string, options?: IPromptOptions): Promise<any>;
    protected confirm(message: string): Promise<boolean>;
    protected get spinner(): ActionBase;
    protected set offerId(offerId: string);
    protected get offerId(): string;
    protected getProviderManager(): Promise<ProviderManager>;
    protected baseConfig(flags: OutputFlags<typeof BaseCommand.flags>): void;
    protected resolveDbPath(db: string): string;
    protected promptForFlags(flagsSchema: Record<any, any> | undefined, parsed: Record<string, any>): Promise<Record<string, any>>;
    protected initDB(path: string, options?: CliInitDbOptions & {
        skipPrompt?: boolean;
    }): Promise<Sequelize>;
    protected parseWithPrompt(command: any): Promise<Record<string, any>>;
    protected init(): Promise<void>;
}
export declare function composeGc(fns: Array<(block: BlockHeader) => Promise<void>>): (block: BlockHeader) => Promise<void>;
