import { EthereumAddress, StreamID, TheGraphClient, WeiAmount } from '@streamr/utils';
import { Overrides } from 'ethers';
import { NetworkPeerDescriptor } from '../Config';
import { DestroySignal } from '../DestroySignal';
import { RpcProviderSource } from '../RpcProviderSource';
import { Identity } from '../identity/Identity';
import { LoggerFactory } from '../utils/LoggerFactory';
import { ChainEventPoller } from './ChainEventPoller';
import { ContractFactory } from './ContractFactory';
interface EarningsData {
    sponsorshipAddresses: EthereumAddress[];
    sum: WeiAmount;
    maxAllowedEarnings: WeiAmount;
}
/**
 * @deprecated
 * @hidden
 */
export interface StakeEvent {
    sponsorship: EthereumAddress;
}
/**
 * @deprecated
 * @hidden
 */
export interface ReviewRequestEvent {
    sponsorship: EthereumAddress;
    targetOperator: EthereumAddress;
    partition: number;
    votingPeriodStartTimestamp: number;
    votingPeriodEndTimestamp: number;
}
/**
 * @deprecated
 * @hidden
 */
export interface OperatorEvents {
    staked: (payload: StakeEvent) => void;
    unstaked: (payload: StakeEvent) => void;
    reviewRequested: (payload: ReviewRequestEvent) => void;
}
export declare const VOTE_KICK = "0x0000000000000000000000000000000000000000000000000000000000000001";
export declare const VOTE_NO_KICK = "0x0000000000000000000000000000000000000000000000000000000000000000";
export declare class ParseError extends Error {
    readonly reasonText: string;
    constructor(reasonText: string);
}
export declare function parsePartitionFromReviewRequestMetadata(metadataAsString: string | undefined): number | never;
/**
 * @deprecated
 * @hidden
 */
export interface GetOperatorSponsorshipsResult {
    sponsorshipAddress: EthereumAddress;
    streamId: StreamID;
    operatorCount: number;
}
/**
 * @deprecated
 * @hidden
 */
export interface Flag {
    id: string;
    flaggingTimestamp: number;
    targetOperator: EthereumAddress;
    sponsorship: EthereumAddress;
}
/**
 * @deprecated This in an internal class
 * @hidden
 */
export declare class Operator {
    private readonly contractAddress;
    private contract?;
    private readonly contractReadonly;
    private readonly contractFactory;
    private readonly rpcProviderSource;
    private readonly theGraphClient;
    private readonly identity;
    private readonly getEthersOverrides;
    private readonly eventEmitter;
    constructor(contractAddress: EthereumAddress, contractFactory: ContractFactory, rpcProviderSource: RpcProviderSource, chainEventPoller: ChainEventPoller, theGraphClient: TheGraphClient, identity: Identity, destroySignal: DestroySignal, loggerFactory: LoggerFactory, getEthersOverrides: () => Promise<Overrides>);
    private initEventGateways;
    writeHeartbeat(nodeDescriptor: NetworkPeerDescriptor): Promise<void>;
    getTimestampOfLastHeartbeat(): Promise<number | undefined>;
    getContractAddress(): Promise<EthereumAddress>;
    getSponsorships(): Promise<GetOperatorSponsorshipsResult[]>;
    getExpiredFlags(sponsorshipAddresses: EthereumAddress[], maxAgeInMs: number): Promise<Flag[]>;
    getOperatorsInSponsorship(sponsorshipAddress: EthereumAddress): Promise<EthereumAddress[]>;
    flag(sponsorship: EthereumAddress, operator: EthereumAddress, partition: number): Promise<void>;
    /**
     * Find the sum of earnings in Sponsorships (that the Operator must withdraw before the sum reaches a limit),
     * SUBJECT TO the constraints:
     *  - only take at most maxSponsorshipsInWithdraw addresses (those with most earnings), or all if undefined
     *  - only take sponsorships that have more than minSponsorshipEarningsInWithdraw, or all if undefined
     */
    getEarnings(minSponsorshipEarningsInWithdraw: WeiAmount, maxSponsorshipsInWithdraw: number): Promise<EarningsData>;
    withdrawEarningsFromSponsorships(sponsorshipAddresses: EthereumAddress[]): Promise<void>;
    triggerAnotherOperatorWithdraw(targetOperatorAddress: EthereumAddress, sponsorshipAddresses: EthereumAddress[]): Promise<void>;
    getStakedOperators(): Promise<EthereumAddress[]>;
    pullStakedStreams(requiredBlockNumber: number): AsyncGenerator<{
        sponsorship: EthereumAddress;
        streamId: StreamID;
    }, undefined, undefined>;
    hasOpenFlag(sponsorshipAddress: EthereumAddress): Promise<boolean>;
    getStreamId(sponsorshipAddress: EthereumAddress): Promise<StreamID>;
    voteOnFlag(sponsorshipAddress: EthereumAddress, targetOperator: EthereumAddress, kick: boolean): Promise<void>;
    closeFlag(sponsorshipAddress: EthereumAddress, targetOperatorAddress: EthereumAddress): Promise<void>;
    fetchRedundancyFactor(): Promise<number | undefined>;
    getCurrentBlockNumber(): Promise<number>;
    on<E extends keyof OperatorEvents>(eventName: E, listener: OperatorEvents[E]): void;
    off<E extends keyof OperatorEvents>(eventName: E, listener: OperatorEvents[E]): void;
    private connectToContract;
}
export {};
