import type { DiscoveryProvider } from '../services/discoveryProvider';
import type { AttestationMeta } from '../services/solana/rewards';
import type { Logger, Nullable } from '../utils';
import type { ServiceProvider } from './ServiceProvider';
import { Base, BaseConstructorArgs } from './base';
/**
 * Combined error type for `SubmitAndEvaluate`
 */
export declare const SubmitAndEvaluateError: Readonly<{
    INCORRECT_OWNER: string;
    SIGN_COLLISION: string;
    WRONG_SIGNER: string;
    NOT_ENOUGH_SIGNERS: string;
    SECP256_INSTRUCTION_MISSING: string;
    INSTRUCTION_LOAD_ERROR: string;
    REPEATED_SENDERS: string;
    SIGNATURE_VERIFICATION_FAILED: string;
    OPERATOR_COLLISION: string;
    ALREADY_SENT: string;
    INCORRECT_MESSAGES: string;
    MESSAGE_OVERFLOW: string;
    MATH_OVERFLOW: string;
    INVALID_RECIPIENT: string;
    UNKNOWN: string;
    fromErrorCode: (code: number) => string;
    INSUFFICIENT_DISCOVERY_NODE_COUNT: "INSUFFICIENT_DISCOVERY_NODE_COUNT";
    UNKNOWN_ERROR: "UNKNOWN_ERROR";
    CHALLENGE_INCOMPLETE: "CHALLENGE_INCOMPLETE";
    ALREADY_DISBURSED: "ALREADY_DISBURSED";
    INVALID_ORACLE: "INVALID_ORACLE";
    MISSING_CHALLENGES: "MISSING_CHALLENGES";
    INVALID_INPUT: "INVALID_INPUT";
    USER_NOT_FOUND: "USER_NOT_FOUND";
    HCAPTCHA: "HCAPTCHA";
    COGNITO_FLOW: "COGNITO_FLOW";
    DISCOVERY_NODE_ATTESTATION_ERROR: "DISCOVERY_NODE_ATTESTATION_ERROR";
    DISCOVERY_NODE_UNKNOWN_RESPONSE: "DISCOVERY_NODE_UNKNOWN_RESPONSE";
    AAO_ATTESTATION_ERROR: "AAO_ATTESTATION_ERROR";
    AAO_ATTESTATION_REJECTION: "AAO_ATTESTATION_REJECTION";
    AAO_ATTESTATION_UNKNOWN_RESPONSE: "AAO_ATTESTATION_UNKNOWN_RESPONSE";
}>;
export declare const AttestationPhases: Readonly<{
    SANITY_CHECKS: "SANITY_CHECKS";
    AGGREGATE_ATTESTATIONS: "AGGREGATE_ATTESTATIONS";
    SUBMIT_ATTESTATIONS: "SUBMIT_ATTESTATIONS";
    EVALUATE_ATTESTATIONS: "EVALUATE_ATTESTATIONS";
}>;
type SubmitAndEvaluateConfig = {
    challengeId: string;
    encodedUserId: string;
    handle: string;
    recipientEthAddress: string;
    specifier: string;
    oracleEthAddress: string;
    amount: number;
    quorumSize: number;
    AAOEndpoint: string;
    endpoints: Nullable<string[]>;
    instructionsPerTransaction?: number;
    maxAggregationAttempts?: number;
    logger: Logger;
    feePayerOverride: string | null;
};
type AggregateAttestationsConfig = {
    challengeId: string;
    encodedUserId: string;
    handle: string;
    specifier: string;
    oracleEthAddress: string;
    amount: number;
    quorumSize: number;
    AAOEndpoint: string;
    maxAttempts: number;
    endpoints: Nullable<string[]>;
    logger: Logger;
};
type GetChallengeAttestationConfig = {
    challengeId: string;
    encodedUserId: string;
    specifier: string;
    oracleEthAddress: string;
    discoveryProviderEndpoint: string;
    logger: Logger;
};
type GetAAOAttestationConfig = {
    challengeId: string;
    specifier: string;
    handle: string;
    amount: number;
    AAOEndpoint: string;
    oracleEthAddress: string;
    logger?: Logger;
};
type SendAttestationResultConfig = {
    status: string;
    userId: string;
    challengeId: string;
    amount: number;
    source: string;
    specifier: string;
    error?: string;
    phase?: string;
    reason?: string;
};
type CreateSenderPublicConfig = {
    senderEthAddress: string;
    operatorEthAddress: string;
    endpoints?: string[];
    numAttestations?: number;
    feePayerOverride?: string;
};
export declare class Rewards extends Base {
    ServiceProvider: ServiceProvider;
    constructor(ServiceProvider: ServiceProvider, ...args: BaseConstructorArgs);
    /**
     * Top level method to aggregate attestations, submit them to RewardsManager, and evalute the result.
     */
    submitAndEvaluate({ challengeId, encodedUserId, handle, recipientEthAddress, specifier, oracleEthAddress, amount, quorumSize, AAOEndpoint, instructionsPerTransaction, maxAggregationAttempts, endpoints, logger, feePayerOverride }: SubmitAndEvaluateConfig): Promise<{
        success: boolean;
        error: null;
        aaoErrorCode: null;
        phase: null;
        nodesToReselect: null;
    } | {
        success: boolean;
        error: string;
        aaoErrorCode: number | null | undefined;
        phase: "SANITY_CHECKS" | "AGGREGATE_ATTESTATIONS" | "SUBMIT_ATTESTATIONS" | "EVALUATE_ATTESTATIONS" | undefined;
        nodesToReselect: string[] | null;
    }>;
    /**
     * Aggregates attestations from Discovery Nodes and AAO.
     */
    aggregateAttestations({ challengeId, encodedUserId, handle, specifier, oracleEthAddress, amount, quorumSize, AAOEndpoint, maxAttempts, endpoints, logger }: AggregateAttestationsConfig): Promise<{
        discoveryNodeAttestations: null;
        aaoAttestation: null;
        error: "INSUFFICIENT_DISCOVERY_NODE_COUNT";
        aaoErrorCode: null;
        erroringNodes: null;
    } | {
        discoveryNodeAttestations: null;
        aaoAttestation: null;
        error: "CHALLENGE_INCOMPLETE" | "ALREADY_DISBURSED" | "INVALID_ORACLE" | "MISSING_CHALLENGES" | "INVALID_INPUT" | "USER_NOT_FOUND" | "HCAPTCHA" | "COGNITO_FLOW" | "DISCOVERY_NODE_ATTESTATION_ERROR" | "DISCOVERY_NODE_UNKNOWN_RESPONSE" | "AAO_ATTESTATION_ERROR" | "AAO_ATTESTATION_REJECTION" | "AAO_ATTESTATION_UNKNOWN_RESPONSE" | "UNKNOWN_ERROR";
        aaoErrorCode: number | null | undefined;
        erroringNodes: null;
    } | {
        discoveryNodeAttestations: null;
        aaoAttestation: null;
        error: string;
        erroringNodes: string[];
        aaoErrorCode?: undefined;
    } | {
        discoveryNodeAttestations: Nullable<{
            ethAddress: string;
            signature: string;
        }>[];
        aaoAttestation: AttestationMeta;
        error: null;
        aaoErrorCode: null;
        erroringNodes: null;
    }>;
    /**
     * Retrieves a Discovery Node attestation for a given userId.
     */
    getChallengeAttestation({ challengeId, encodedUserId, specifier, oracleEthAddress, discoveryProviderEndpoint, logger }: GetChallengeAttestationConfig): Promise<{
        success: {
            ethAddress: string;
            signature: string;
        };
        error: null;
    } | {
        success: null;
        error: "CHALLENGE_INCOMPLETE" | "ALREADY_DISBURSED" | "INVALID_ORACLE" | "MISSING_CHALLENGES" | "INVALID_INPUT" | "USER_NOT_FOUND" | "HCAPTCHA" | "COGNITO_FLOW" | "DISCOVERY_NODE_ATTESTATION_ERROR" | "DISCOVERY_NODE_UNKNOWN_RESPONSE" | "AAO_ATTESTATION_ERROR" | "AAO_ATTESTATION_REJECTION" | "AAO_ATTESTATION_UNKNOWN_RESPONSE" | "UNKNOWN_ERROR";
    }>;
    getUndisbursedChallenges({ limit, offset, completedBlockNumber, encodedUserId, logger }?: {
        limit?: number;
        offset?: number;
        completedBlockNumber?: string;
        encodedUserId?: number;
        logger?: Logger;
    }): Promise<{
        success: Awaited<ReturnType<DiscoveryProvider['getUndisbursedChallenges']>>;
    } | {
        error: string;
    }>;
    /**
     * Retrieves an AAO attestation for a given user handle.
     */
    getAAOAttestation({ challengeId, specifier, handle, amount, AAOEndpoint, oracleEthAddress, logger }: GetAAOAttestationConfig): Promise<{
        success: null;
        aaoErrorCode: number | undefined;
        error: "CHALLENGE_INCOMPLETE" | "ALREADY_DISBURSED" | "INVALID_ORACLE" | "MISSING_CHALLENGES" | "INVALID_INPUT" | "USER_NOT_FOUND" | "HCAPTCHA" | "COGNITO_FLOW" | "DISCOVERY_NODE_ATTESTATION_ERROR" | "DISCOVERY_NODE_UNKNOWN_RESPONSE" | "AAO_ATTESTATION_ERROR" | "AAO_ATTESTATION_REJECTION" | "AAO_ATTESTATION_UNKNOWN_RESPONSE" | "UNKNOWN_ERROR";
    } | {
        success: {
            signature: string;
            ethAddress: string;
        };
        aaoErrorCode: null;
        error: null;
    } | {
        success: null;
        aaoErrorCode: null;
        error: "AAO_ATTESTATION_ERROR";
    }>;
    _getDiscoveryAttestationsWithRetries({ endpoints, challengeId, encodedUserId, specifier, oracleEthAddress, logger, maxAttempts }: {
        endpoints: string[];
        challengeId: string;
        encodedUserId: string;
        specifier: string;
        oracleEthAddress: string;
        logger: Logger;
        maxAttempts: number;
    }): Promise<{
        success: Nullable<{
            ethAddress: string;
            signature: string;
        }>;
        error: Nullable<string>;
        endpoint: string;
    }[]>;
    /**
     * Creates a new discovery node sender for rewards. A sender may
     * attest in user challenge completion to issue rewards.
     *
     * This method queries other discovery nodes asking for attestation of
     * a given new senderEthAddress (delegate wallet) and operatorEthAddress (owner wallet).
     * Those attestations are bundled
     */
    createSenderPublic({ senderEthAddress, operatorEthAddress, endpoints, numAttestations, feePayerOverride }: CreateSenderPublicConfig): Promise<{
        res: string | null;
        errorCode: string | number | null;
        error: string | null;
    } | {
        success: null;
        error: "REQUEST_FOR_ATTESTATION_FAILED";
    }>;
    /**
     * Logs results of an attestation to identity.
     */
    sendAttestationResult({ status, userId, challengeId, amount, error, phase, source, specifier, reason }: SendAttestationResultConfig): Promise<void>;
}
export {};
