import { TxTreeNode } from "../tree/txTree";
import { TreeNonces, TreePartialSigs } from "../tree/signingSession";
import { Vtxo } from "./indexer";
import { Intent } from "../intent";
export type Output = {
    address: string;
    amount: bigint;
};
export declare enum SettlementEventType {
    BatchStarted = "batch_started",
    BatchFinalization = "batch_finalization",
    BatchFinalized = "batch_finalized",
    BatchFailed = "batch_failed",
    TreeSigningStarted = "tree_signing_started",
    TreeNonces = "tree_nonces",
    TreeTx = "tree_tx",
    TreeSignature = "tree_signature"
}
export type BatchFinalizationEvent = {
    type: SettlementEventType.BatchFinalization;
    id: string;
    commitmentTx: string;
};
export type BatchFinalizedEvent = {
    type: SettlementEventType.BatchFinalized;
    id: string;
    commitmentTxid: string;
};
export type BatchFailedEvent = {
    type: SettlementEventType.BatchFailed;
    id: string;
    reason: string;
};
export type TreeSigningStartedEvent = {
    type: SettlementEventType.TreeSigningStarted;
    id: string;
    cosignersPublicKeys: string[];
    unsignedCommitmentTx: string;
};
export type TreeNoncesEvent = {
    type: SettlementEventType.TreeNonces;
    id: string;
    topic: string[];
    txid: string;
    nonces: TreeNonces;
};
export type BatchStartedEvent = {
    type: SettlementEventType.BatchStarted;
    id: string;
    intentIdHashes: string[];
    batchExpiry: bigint;
};
export type TreeTxEvent = {
    type: SettlementEventType.TreeTx;
    id: string;
    topic: string[];
    batchIndex: number;
    chunk: TxTreeNode;
};
export type TreeSignatureEvent = {
    type: SettlementEventType.TreeSignature;
    id: string;
    topic: string[];
    batchIndex: number;
    txid: string;
    signature: string;
};
export type SettlementEvent = BatchFinalizationEvent | BatchFinalizedEvent | BatchFailedEvent | TreeSigningStartedEvent | TreeNoncesEvent | BatchStartedEvent | TreeTxEvent | TreeSignatureEvent;
export interface ScheduledSession {
    duration: bigint;
    fees: FeeInfo;
    nextEndTime: bigint;
    nextStartTime: bigint;
    period: bigint;
}
export interface IntentFeeInfo {
    offchainInput: string;
    offchainOutput: string;
    onchainInput: bigint;
    onchainOutput: bigint;
}
export interface FeeInfo {
    intentFee: IntentFeeInfo;
    txFeeRate: string;
}
export interface PendingTx {
    arkTxid: string;
    finalArkTx: string;
    signedCheckpointTxs: string[];
}
export interface DeprecatedSigner {
    cutoffDate: bigint;
    pubkey: string;
}
export type ServiceStatus = Record<string, string>;
export interface ArkInfo {
    boardingExitDelay: bigint;
    checkpointTapscript: string;
    deprecatedSigners: DeprecatedSigner[];
    digest: string;
    dust: bigint;
    fees: FeeInfo;
    forfeitAddress: string;
    forfeitPubkey: string;
    network: string;
    scheduledSession: ScheduledSession;
    serviceStatus: ServiceStatus;
    sessionDuration: bigint;
    signerPubkey: string;
    unilateralExitDelay: bigint;
    utxoMaxAmount: bigint;
    utxoMinAmount: bigint;
    version: string;
    vtxoMaxAmount: bigint;
    vtxoMinAmount: bigint;
}
export interface SignedIntent<T extends Intent.Message> {
    proof: string;
    message: T;
}
export interface TxNotification {
    txid: string;
    tx: string;
    spentVtxos: Vtxo[];
    spendableVtxos: Vtxo[];
    checkpointTxs?: Record<string, {
        txid: string;
        tx: string;
    }>;
}
export interface ArkProvider {
    getInfo(): Promise<ArkInfo>;
    submitTx(signedArkTx: string, checkpointTxs: string[]): Promise<{
        arkTxid: string;
        finalArkTx: string;
        signedCheckpointTxs: string[];
    }>;
    finalizeTx(arkTxid: string, finalCheckpointTxs: string[]): Promise<void>;
    registerIntent(intent: SignedIntent<Intent.RegisterMessage>): Promise<string>;
    deleteIntent(intent: SignedIntent<Intent.DeleteMessage>): Promise<void>;
    confirmRegistration(intentId: string): Promise<void>;
    submitTreeNonces(batchId: string, pubkey: string, nonces: TreeNonces): Promise<void>;
    submitTreeSignatures(batchId: string, pubkey: string, signatures: TreePartialSigs): Promise<void>;
    submitSignedForfeitTxs(signedForfeitTxs: string[], signedCommitmentTx?: string): Promise<void>;
    getEventStream(signal: AbortSignal, topics: string[]): AsyncIterableIterator<SettlementEvent>;
    getTransactionsStream(signal: AbortSignal): AsyncIterableIterator<{
        commitmentTx?: TxNotification;
        arkTx?: TxNotification;
    }>;
    getPendingTxs(intent: SignedIntent<Intent.GetPendingTxMessage>): Promise<PendingTx[]>;
}
/**
 * REST-based Ark provider implementation.
 * @see https://buf.build/arkade-os/arkd/docs/main:ark.v1#ark.v1.ArkService
 * @example
 * ```typescript
 * const provider = new RestArkProvider('https://ark.example.com');
 * const info = await provider.getInfo();
 * ```
 */
export declare class RestArkProvider implements ArkProvider {
    serverUrl: string;
    constructor(serverUrl: string);
    getInfo(): Promise<ArkInfo>;
    submitTx(signedArkTx: string, checkpointTxs: string[]): Promise<{
        arkTxid: string;
        finalArkTx: string;
        signedCheckpointTxs: string[];
    }>;
    finalizeTx(arkTxid: string, finalCheckpointTxs: string[]): Promise<void>;
    registerIntent(intent: SignedIntent<Intent.RegisterMessage>): Promise<string>;
    deleteIntent(intent: SignedIntent<Intent.DeleteMessage>): Promise<void>;
    confirmRegistration(intentId: string): Promise<void>;
    submitTreeNonces(batchId: string, pubkey: string, nonces: TreeNonces): Promise<void>;
    submitTreeSignatures(batchId: string, pubkey: string, signatures: TreePartialSigs): Promise<void>;
    submitSignedForfeitTxs(signedForfeitTxs: string[], signedCommitmentTx?: string): Promise<void>;
    getEventStream(signal: AbortSignal, topics: string[]): AsyncIterableIterator<SettlementEvent>;
    getTransactionsStream(signal: AbortSignal): AsyncIterableIterator<{
        commitmentTx?: TxNotification;
        arkTx?: TxNotification;
    }>;
    getPendingTxs(intent: SignedIntent<Intent.GetPendingTxMessage>): Promise<PendingTx[]>;
    protected parseSettlementEvent(data: ProtoTypes.GetEventStreamResponse): SettlementEvent | null;
    protected parseTransactionNotification(data: ProtoTypes.GetTransactionsStreamResponse): {
        commitmentTx?: TxNotification;
        arkTx?: TxNotification;
    } | null;
}
declare namespace ProtoTypes {
    interface BatchStartedEvent {
        id: string;
        intentIdHashes: string[];
        batchExpiry: number;
    }
    interface BatchFailed {
        id: string;
        reason: string;
    }
    export interface BatchFinalizationEvent {
        id: string;
        commitmentTx: string;
    }
    interface BatchFinalizedEvent {
        id: string;
        commitmentTxid: string;
    }
    interface TreeSigningStartedEvent {
        id: string;
        cosignersPubkeys: string[];
        unsignedCommitmentTx: string;
    }
    interface TreeNoncesAggregatedEvent {
        id: string;
        treeNonces: Record<string, string>;
    }
    interface TreeNoncesEvent {
        id: string;
        topic: string[];
        txid: string;
        nonces: Record<string, string>;
    }
    interface TreeTxEvent {
        id: string;
        topic: string[];
        batchIndex: number;
        txid: string;
        tx: string;
        children: Record<string, string>;
    }
    interface TreeSignatureEvent {
        id: string;
        topic: string[];
        batchIndex: number;
        txid: string;
        signature: string;
    }
    interface Heartbeat {
    }
    export interface VtxoData {
        outpoint: {
            txid: string;
            vout: number;
        };
        amount: string;
        script: string;
        createdAt: string;
        expiresAt: string | null;
        commitmentTxids: string[];
        isPreconfirmed: boolean;
        isSwept: boolean;
        isUnrolled: boolean;
        isSpent: boolean;
        spentBy: string;
        settledBy?: string;
        arkTxid?: string;
    }
    export interface GetEventStreamResponse {
        batchStarted?: BatchStartedEvent;
        batchFailed?: BatchFailed;
        batchFinalization?: BatchFinalizationEvent;
        batchFinalized?: BatchFinalizedEvent;
        treeSigningStarted?: TreeSigningStartedEvent;
        treeNoncesAggregated?: TreeNoncesAggregatedEvent;
        treeNonces?: TreeNoncesEvent;
        treeTx?: TreeTxEvent;
        treeSignature?: TreeSignatureEvent;
        heartbeat?: Heartbeat;
    }
    export interface GetTransactionsStreamResponse {
        commitmentTx?: {
            txid: string;
            tx: string;
            spentVtxos: VtxoData[];
            spendableVtxos: VtxoData[];
            checkpointTxs?: Record<string, {
                txid: string;
                tx: string;
            }>;
        };
        arkTx?: {
            txid: string;
            tx: string;
            spentVtxos: VtxoData[];
            spendableVtxos: VtxoData[];
            checkpointTxs?: Record<string, {
                txid: string;
                tx: string;
            }>;
        };
        heartbeat?: Heartbeat;
    }
    export interface EventData {
        batchStarted?: BatchStartedEvent;
        batchFailed?: BatchFailed;
        batchFinalization?: BatchFinalizationEvent;
        batchFinalized?: BatchFinalizedEvent;
        treeSigningStarted?: TreeSigningStartedEvent;
        treeNoncesAggregated?: TreeNoncesAggregatedEvent;
        treeTx?: TreeTxEvent;
        treeSignature?: TreeSignatureEvent;
    }
    export interface TransactionData {
        commitmentTx?: {
            txid: string;
            tx: string;
            spentVtxos: VtxoData[];
            spendableVtxos: VtxoData[];
            checkpointTxs?: Record<string, {
                txid: string;
                tx: string;
            }>;
        };
        arkTx?: {
            txid: string;
            tx: string;
            spentVtxos: VtxoData[];
            spendableVtxos: VtxoData[];
            checkpointTxs?: Record<string, {
                txid: string;
                tx: string;
            }>;
        };
    }
    export {};
}
export declare function isFetchTimeoutError(err: any): boolean;
export {};
