/**
 * Types for Oracle data structures
 */
/**
 * Represents a price point in history
 */
interface PricePoint {
    timestamp: string;
    price: number;
}
/**
 * Information about a feed's configuration
 */
interface FeedInfo {
    creator: string;
    min_stake: number;
    slashing_threshold: number;
    aggregation_window: number;
    challenge_window: number;
    paused: boolean;
}
/**
 * Represents a data provider
 */
interface Provider {
    address: string;
    stakedCredits: number;
    proposedPrice?: number | null;
}
/**
 * Represents an address that has been slashed
 */
interface SlashedAddress {
    address: string;
    date: string;
}
/**
 * Represents a complete Oracle feed
 */
interface Feed {
    id: string;
    name: string;
    infos: FeedInfo | null;
    totalStaked: number;
    submitters: Provider[];
    priceHistory: PricePoint[];
    slashedAddresses: SlashedAddress[];
    currentPrice: number | null;
    providerCount?: number;
    proposalMedian?: number | null;
    proposalProposer?: string | null;
    proposalBlock?: number | null;
    proposalSlashed?: boolean | null;
    aggregateDone?: boolean | null;
    slasher?: string | null;
    slasherReward?: number | null;
    lastProposeBlock?: number | null;
}

/**
 * Configuration options for the API client
 */
interface ApiClientConfig {
    /**
     * Base URL for the Aleo Explorer API
     */
    baseUrl?: string;
    /**
     * Network to use (testnet or mainnet)
     */
    network?: "testnet" | "mainnet";
}
/**
 * Client for interacting with Aleo contracts via the Explorer API
 */
declare class AleoExplorerClient {
    private baseUrl;
    private network;
    /**
     * Creates a new instance of the AleoExplorerClient
     *
     * @param config Configuration options
     */
    constructor(config?: ApiClientConfig);
    /**
     * Fetches data from the API
     *
     * @param endpoint API endpoint
     * @returns Response data as text
     */
    private fetchData;
    /**
     * Fetches a mapping value from a contract
     *
     * @param program Program name
     * @param mapping Mapping name
     * @param key Key to look up
     * @returns Mapping value as text
     */
    getMappingValue(program: string, mapping: string, key: string): Promise<string | null>;
    /**
     * Gets a feed provider list
     *
     * @param feedId ID of the feed
     * @param maxProviders Maximum number of providers to fetch
     * @returns Array of provider addresses
     */
    getFeedProviders(feedId: string, maxProviders?: number): Promise<string[]>;
    /**
     * Gets the stake amount for a provider in a feed
     *
     * @param address Provider address
     * @param feedId Feed ID
     * @returns Stake amount (in credits)
     */
    getProviderStake(address: string, feedId: string): Promise<number>;
    /**
     * Gets the proposed price for a provider in a feed
     *
     * @param address Provider address
     * @param feedId Feed ID
     * @returns Proposed price or null if no proposal
     */
    getProviderProposedPrice(address: string, feedId: string): Promise<number | null>;
    /**
     * Gets the total staked amount for a feed
     *
     * @param feedId Feed ID
     * @returns Total staked amount
     */
    getTotalStaked(feedId: string): Promise<number>;
    /**
     * Gets the current price for a feed
     *
     * @param feedId Feed ID
     * @returns Current price or null if not available
     */
    getCurrentPrice(feedId: string): Promise<number | null>;
    /**
     * Gets configuration information for a feed
     *
     * @param feedId Feed ID
     * @returns Feed configuration information
     */
    getFeedInfo(feedId: string): Promise<{
        creator: string;
        min_stake: number;
        slashing_threshold: number;
        aggregation_window: number;
        challenge_window: number;
        paused: boolean;
    } | null>;
    /**
     * Gets the count of providers for a feed
     *
     * @param feedId Feed ID
     * @returns Provider count
     */
    getProviderCount(feedId: string): Promise<number | null>;
    /**
     * Gets the proposal median for a feed
     *
     * @param feedId Feed ID
     * @returns Proposal median or null if not available
     */
    getProposalMedian(feedId: string): Promise<number | null>;
    /**
     * Gets the proposal proposer for a feed
     *
     * @param feedId Feed ID
     * @returns Proposer address or null if not available
     */
    getProposalProposer(feedId: string): Promise<string | null>;
    /**
     * Gets the proposal block for a feed
     *
     * @param feedId Feed ID
     * @returns Proposal block number or null if not available
     */
    getProposalBlock(feedId: string): Promise<number | null>;
    /**
     * Checks if the proposal was slashed for a feed
     *
     * @param feedId Feed ID
     * @returns True if slashed, false if not, null if not available
     */
    getProposalSlashed(feedId: string): Promise<boolean | null>;
    /**
     * Checks if the aggregate is done for a feed
     *
     * @param feedId Feed ID
     * @returns True if done, false if not, null if not available
     */
    getAggregateDone(feedId: string): Promise<boolean | null>;
    /**
     * Gets the slasher for a feed
     *
     * @param feedId Feed ID
     * @returns Slasher address or null if not available
     */
    getSlasher(feedId: string): Promise<string | null>;
    /**
     * Gets the slasher reward for a feed
     *
     * @param feedId Feed ID
     * @returns Slasher reward or null if not available
     */
    getSlasherReward(feedId: string): Promise<number | null>;
    /**
     * Gets the last propose block for a feed
     *
     * @param feedId Feed ID
     * @returns Last propose block number or null if not available
     */
    getLastProposeBlock(feedId: string): Promise<number | null>;
}

/**
 * Feed service for retrieving complete feed data
 */
declare class FeedService {
    private client;
    private aggregateProgramId;
    /**
     * Creates a new instance of the FeedService
     *
     * @param client AleoExplorerClient instance or config
     */
    constructor(client?: AleoExplorerClient | {
        baseUrl?: string;
        network?: "testnet" | "mainnet";
    });
    /**
     * Get the price history of a feed
     * @param feedId Feed ID
     * @param maxTransactions Maximum number of transactions to analyze (max 1000 per request)
     * @returns Array of PricePoint (timestamp (UNIX timestamp), price)
     */
    getPriceHistory(feedId: string): Promise<PricePoint[]>;
    /**
     * Gets complete data for a feed
     *
     * @param feedId ID of the feed
     * @param maxProviders Maximum number of providers to check
     * @returns Complete feed data
     */
    getFeedFullData(feedId: string, maxProviders?: number): Promise<Feed>;
    /**
     * Get the slashed addresses history for a feed
     * @param feedId Feed ID
     * @param maxTransactions Maximum number of transactions to analyze (max 1000 per request)
     * @returns Array of { address, date, type }
     */
    getSlashedAddresses(feedId: string): Promise<{
        address: string;
        date: string;
        type: "aggregator" | "provider";
    }[]>;
}

/**
 * Converts an Aleo bech32m address to an Aleo field.
 *
 * An Aleo address is encoded in bech32m. Decoding gives the
 * underlying bytes (representing the public key or hash).
 * These bytes are interpreted as a big integer to form the field.
 *
 * The interpretation seems to be Little-Endian for conversion to field.
 *
 * @param address The Aleo address in bech32m format (e.g., "aleo1...")
 * @returns The Aleo field representation (as bigint)
 * @throws Error if the address is invalid or if decoding fails.
 */
declare function convertAddressToField(address: string): bigint;

/**
 * Utility functions for parsing contract responses
 */
/**
 * Parses a u128, u64 or u32 from an API response
 *
 * @param raw The raw string response from the API
 * @param type The type of integer to parse
 * @returns The parsed integer value or 0 if parsing fails
 */
declare function parseUint(raw: string | null, type: 'u128' | 'u64' | 'u32'): number;
/**
 * Parses a boolean from an API response
 *
 * @param raw The raw string response from the API
 * @returns The parsed boolean value or null if parsing fails
 */
declare function parseBool(raw: string | null): boolean | null;
/**
 * Parses a field (number) from an API response
 *
 * @param raw The raw string response from the API
 * @returns The parsed field value or null if parsing fails
 */
declare function parseField(raw: string | null): number | null;
/**
 * Parses an Aleo address from an API response
 *
 * @param raw The raw string response from the API
 * @returns The parsed address or null if parsing fails
 */
declare function parseAddress(raw: string | null): string | null;

export { AleoExplorerClient, type ApiClientConfig, type Feed, type FeedInfo, FeedService, type PricePoint, type Provider, type SlashedAddress, convertAddressToField, parseAddress, parseBool, parseField, parseUint };
