import { IAccount } from '../../models/TAccount'; import { TEth } from '../../models/TEth'; import { TxWriter } from '../../txs/TxWriter'; import { ITimelockTx, ITimelockTxParams, ITimelockService, ETimelockTxStatus } from './ITimelockService'; import { TTxWriteMethodKeys } from '../../utils/types'; import type { TimelockController } from '../../prebuilt/openzeppelin/TimelockController'; import type { ContractBase } from '../../contracts/ContractBase'; import { TxDataBuilder } from '../../txs/TxDataBuilder'; declare const CONFIG: { dir: string; }; type TTimelockController = ContractBase & Pick; export declare class TimelockService implements ITimelockService { private timelock; private options?; constructor(timelock: TTimelockController, options?: { simulate?: boolean; execute?: boolean; dir?: string; }); getPendingByTitle(title: string): Promise<{ status: ETimelockTxStatus; schedule: ITimelockTx; }>; getPendingFromTx(txHash: TEth.Hex): Promise<{ status: ETimelockTxStatus; schedule: ITimelockTx; }>; executePendingByTitle(sender: IAccount, title: string): Promise<{ tx: TxWriter; schedule: ITimelockTx; }>; executePending(sender: IAccount, txParams: ITimelockTx): Promise<{ tx: TxWriter; schedule: ITimelockTx; }>; /** Schedules-Wait-Execute a task distinguished by the unique task name * * 1. if schedule doesn't exist, create it * 2. if schedule date NOT yet ready, exit * 3. if schedule date IS ready, execute it * 4. if executed, exit */ process>(uniqueTaskName: string, sender: IAccount, contract: T, method: TMethodName, ...params: T[TMethodName] extends (sender: IAccount, ...args: infer A) => any ? A : never): Promise<{ prevStatus: ETimelockTxStatus; status: ETimelockTxStatus; schedule: ITimelockTx; tx?: TEth.Hex; }>; processData(sender: IAccount, builder: TxDataBuilder): Promise<{ prevStatus: ETimelockTxStatus; status: ETimelockTxStatus; schedule: ITimelockTx; tx?: TEth.Hex; }>; /** Schedules-Wait-Execute a task distinguished by the unique task name * * 1. if schedule doesn't exist, create it * 2. if schedule date NOT yet ready, exit * 3. if schedule date IS ready, execute it * 4. if executed, exit */ processBatch>(uniqueTaskName: string, sender: IAccount, batch: Pick[]): Promise<{ prevStatus: ETimelockTxStatus; status: ETimelockTxStatus; schedule: ITimelockTx; tx?: TEth.Hex; }>; private processTxParams; scheduleCall>(sender: IAccount, contract: T, method: TMethodName, ...params: T[TMethodName] extends (sender: IAccount, ...args: infer A) => any ? A : never): Promise; /** * E.g. `.scheduleCallBatch(title, sender, [ c1.$data().foo(sender), c2.$data().bar(sender, param1) ])` */ scheduleCallBatch(title: string, sender: IAccount, batch: Pick[]): Promise; executeCall>(sender: IAccount, contract: T, method: TMethodName, ...params: T[TMethodName] extends (sender: IAccount, ...args: infer A) => any ? A : never): Promise<{ tx: TxWriter; schedule: ITimelockTx; }>; /** * E.g. `.scheduleCallBatch(title, sender, [ c1.$data().foo(sender), c2.$data().bar(sender, param1) ])` */ executeCallBatch(title: string, sender: IAccount, batch: Pick[]): Promise<{ tx: TxWriter; schedule: ITimelockTx; }>; schedule(params: ITimelockTxParams): Promise; execute(params: ITimelockTxParams): Promise<{ tx: TxWriter; schedule: ITimelockTx; }>; cancel(sender: IAccount, id: TEth.Hex, opts?: { storage?: boolean; }): Promise<{ tx: TxWriter; schedule: ITimelockTx; }>; clearSchedules(): Promise; updateSchedule(txInfo: Partial): Promise; debugMoveToSchedule(txInfo: ITimelockTx): Promise; private getMinDelay; /** * Gets the operation ID (same as the contract's method) */ private getOperationHash; /** * Gets the operation KEY: unique only within pending operations */ private getOperationKey; /** * Create operations SALT: overall unique ID */ private getOperationSalt; private getPendingByKey; private getUniqueByKey; private getScheduleStatus; private getCurrentTime; private getTxParamsNormalized; private getTxParamsNormalizedFromContract; private getTxParamsNormalizedFromContractBatch; private getStore; static config(config: Partial): void; } export {};