import { entity, sdk, StorageProvider, table, WalletStorageManager } from "../../../index.client";
import { EntityBase } from ".";
export declare class ProvenTxReq extends EntityBase<table.ProvenTxReq> {
    static fromStorageTxid(storage: entity.EntityStorage, txid: string, trx?: sdk.TrxToken): Promise<ProvenTxReq | undefined>;
    static fromStorageId(storage: entity.EntityStorage, id: number, trx?: sdk.TrxToken): Promise<ProvenTxReq>;
    static fromTxid(txid: string, rawTx: number[], inputBEEF?: number[]): ProvenTxReq;
    history: ProvenTxReqHistory;
    notify: ProvenTxReqNotify;
    packApiHistory(): void;
    packApiNotify(): void;
    unpackApiHistory(): void;
    unpackApiNotify(): void;
    get apiHistory(): string;
    get apiNotify(): string;
    set apiHistory(v: string);
    set apiNotify(v: string);
    updateApi(): void;
    unpackApi(): void;
    refreshFromStorage(storage: entity.EntityStorage | WalletStorageManager): Promise<void>;
    constructor(api?: table.ProvenTxReq);
    /**
     * Returns history to only what followed since date.
     */
    historySince(since: Date): ProvenTxReqHistory;
    historyPretty(since?: Date, indent?: number): string;
    getHistorySummary(): ProvenTxReqHistorySummaryApi;
    parseHistoryNote(note: string, summary?: ProvenTxReqHistorySummaryApi): string;
    addNotifyTransactionId(id: number): void;
    addHistoryNote<T extends {
        what: string;
    }>(note: string | T, when?: Date, noDupes?: boolean): void;
    /**
     * Updates database record with current state of this entity.

     * @param storage
     * @param trx
     */
    updateStorage(storage: entity.EntityStorage, trx?: sdk.TrxToken): Promise<void>;
    /**
     * Update storage with changes to non-static properties:
     *   updated_at
     *   provenTxId
     *   status
     *   history
     *   notify
     *   notified
     *   attempts
     *   batch
     *
     * @param storage
     * @param trx
     */
    updateStorageDynamicProperties(storage: WalletStorageManager | StorageProvider, trx?: sdk.TrxToken): Promise<void>;
    insertOrMerge(storage: entity.EntityStorage, trx?: sdk.TrxToken): Promise<ProvenTxReq>;
    /**
     * See `ProvenTxReqStatusApi`
     */
    get status(): sdk.ProvenTxReqStatus;
    set status(v: sdk.ProvenTxReqStatus);
    get provenTxReqId(): number;
    set provenTxReqId(v: number);
    get created_at(): Date;
    set created_at(v: Date);
    get updated_at(): Date;
    set updated_at(v: Date);
    get txid(): string;
    set txid(v: string);
    get inputBEEF(): number[] | undefined;
    set inputBEEF(v: number[] | undefined);
    get rawTx(): number[];
    set rawTx(v: number[]);
    get attempts(): number;
    set attempts(v: number);
    get provenTxId(): number | undefined;
    set provenTxId(v: number | undefined);
    get notified(): boolean;
    set notified(v: boolean);
    get batch(): string | undefined;
    set batch(v: string | undefined);
    get id(): number;
    set id(v: number);
    get entityName(): string;
    get entityTable(): string;
    /**
     * 'convergent' equality must satisfy (A sync B) equals (B sync A)
     */
    equals(ei: table.ProvenTxReq, syncMap?: entity.SyncMap | undefined): boolean;
    static mergeFind(storage: entity.EntityStorage, userId: number, ei: table.ProvenTxReq, syncMap: entity.SyncMap, trx?: sdk.TrxToken): Promise<{
        found: boolean;
        eo: ProvenTxReq;
        eiId: number;
    }>;
    mapNotifyTransactionIds(syncMap: entity.SyncMap): void;
    mergeNotifyTransactionIds(ei: table.ProvenTxReq, syncMap?: entity.SyncMap): void;
    mergeHistory(ei: table.ProvenTxReq, syncMap?: entity.SyncMap, noDupes?: boolean): void;
    static isTerminalStatus(status: sdk.ProvenTxReqStatus): boolean;
    mergeNew(storage: entity.EntityStorage, userId: number, syncMap: entity.SyncMap, trx?: sdk.TrxToken): Promise<void>;
    /**
     * When merging `ProvenTxReq`, care is taken to avoid short-cirtuiting notification: `status` must not transition to `completed` without
     * passing through `notifying`. Thus a full convergent merge passes through these sequence steps:
     * 1. Remote storage completes before local storage.
     * 2. The remotely completed req and ProvenTx sync to local storage.
     * 3. The local storage transitions to `notifying`, after merging the remote attempts and history.
     * 4. The local storage notifies, transitioning to `completed`.
     * 5. Having been updated, the local req, but not ProvenTx sync to remote storage, but do not merge because the earlier `completed` wins.
     * 6. Convergent equality is achieved (completing work - history and attempts are equal)
     *
     * On terminal failure: `doubleSpend` trumps `invalid` as it contains more data.
     */
    mergeExisting(storage: entity.EntityStorage, since: Date | undefined, ei: table.ProvenTxReq, syncMap: entity.SyncMap, trx?: sdk.TrxToken): Promise<boolean>;
}
export interface ProvenTxReqHistorySummaryApi {
    setToCompleted: boolean;
    setToCallback: boolean;
    setToUnmined: boolean;
    setToDoubleSpend: boolean;
    setToSending: boolean;
    setToUnconfirmed: boolean;
}
export interface ProvenTxReqHistory {
    /**
     * Keys are Date().toISOString()
     * Values are a description of what happened.
     */
    notes?: Record<string, string>;
}
export interface ProvenTxReqNotify {
    transactionIds?: number[];
}
//# sourceMappingURL=ProvenTxReq.d.ts.map