/**
 * Transactions Resource
 *
 * Handles transaction history fetching and management.
 * Uses IndexerClient for HTTP queries and KeyVault for crypto operations.
 */
import type { IndexerClient } from '../api/indexer-client';
import type { ShieldStatusResponse as ApiShieldStatus, TransferStatusResponse as ApiTransferStatus, UnshieldStatusResponse as ApiUnshieldStatus } from '../api/types';
import type { KeyVault } from '../keyvault/types';
import type { SDKStores } from '../state/stores';
import { type PendingTransaction, type TransactionsResponse } from '../types';
import type { Logger } from '../utils/logger';
export interface PollResult {
    pending: PendingTransaction[];
    resolved: PendingTransaction[];
}
export interface Note {
    commitment: string;
    value: string;
    tokenAddress: string;
    tokenId: string;
    random: string;
    owner: string;
    spent: boolean;
    isOpaque: boolean;
    createdAt: number;
}
export declare class TransactionsResource {
    private indexer;
    private keyVault;
    private getMpk;
    private stores;
    private log;
    private previousPendingHashes;
    private _onTransactionResolved?;
    constructor(indexer: IndexerClient, keyVault: KeyVault, stores: SDKStores, getMpk: () => string | null, logger?: Logger);
    /**
     * Register a callback invoked when a pending transaction resolves
     * (status changes from pending to completed/failed).
     *
     * Used internally to trigger balance syncs when transactions confirm.
     */
    setOnTransactionResolved(handler: (tx: PendingTransaction) => void): void;
    private get transactionStore();
    /**
     * Build a tokenId → token info map from registered tokens. The underlying
     * `getRegisteredTokens` call is cached + deduped at the IndexerClient
     * layer, so this stays cheap to call repeatedly.
     */
    private resolveTokenMap;
    /**
     * Map raw API Transaction[] to PendingTransaction[].
     */
    private mapToTransactions;
    /**
     * Fetch grouped wallet transactions from the indexer.
     *
     * Returns transactions grouped by txHash with UTXO-level note details.
     * Also maps the raw data to `PendingTransaction[]` and merges them into
     * the transaction store for reactive UI updates.
     *
     * Requires authentication (returns empty if no MPK is available).
     *
     * @param params - Optional filters (txType, tokenId, direction, limit, cursor for pagination)
     * @returns Paginated transaction response
     *
     * @example
     * ```typescript
     * const history = await sdk.transactions.fetchHistory({ limit: 20, direction: 'incoming' });
     * for (const tx of history.data) {
     *   console.log(tx.txHash, tx.type, tx.status);
     * }
     * // They're also merged into the transaction store automatically.
     * ```
     */
    fetchHistory(params?: {
        txType?: string;
        tokenId?: number;
        direction?: string;
        limit?: number;
        cursor?: string;
    }): Promise<TransactionsResponse>;
    getByHash(txHash: string): PendingTransaction | undefined;
    /**
     * Poll status endpoints for all pending transactions.
     * Updates the Zustand store to reflect resolved transactions.
     *
     * Returns the number of resolved transactions.
     */
    refreshPendingTransactions(): Promise<number>;
    /**
     * Poll status for a single pending transaction and update the store.
     * Returns true if the transaction status changed from pending.
     */
    private pollTransactionStatus;
    /**
     * Poll pending transactions and return both the current pending list and
     * any transactions that resolved since the last poll.
     *
     * The first call always returns an empty `resolved` array (no previous state).
     *
     * @returns `{ pending, resolved }` — current pending txs and newly resolved ones
     *
     * @example
     * ```typescript
     * const { pending, resolved } = await sdk.transactions.poll();
     * for (const tx of resolved) {
     *   console.log(`${tx.txHash} is now ${tx.status}`);
     * }
     * ```
     */
    poll(): Promise<PollResult>;
    getNotes(tokenAddress?: string): Promise<Note[]>;
    /**
     * Get the status of a shield by its on-chain request ID.
     */
    getShieldStatus(requestId: string): Promise<ApiShieldStatus>;
    /**
     * Get the status of a transfer by its queue ID.
     */
    getTransferStatus(id: string): Promise<ApiTransferStatus>;
    /**
     * Get the status of a unshield by its queue ID.
     */
    getUnshieldStatus(id: string): Promise<ApiUnshieldStatus>;
}
//# sourceMappingURL=Transactions.d.ts.map