import { ChainId } from "../../model/primitives.js"; import { OperationPreview, PreviewOperationInput, PreviewOperationOptions } from "../../model/previews.js"; import { SDKReturn } from "../../model/result.js"; import "../../model/index.js"; import { PreviewOperationError } from "../../onchain/preview/preview/previewOperation.js"; import { HealthFactorThresholds } from "../../onchain/validation/bundles/checkHealthFactors.js"; import { CheckOperationInput, CheckOperationOptions, OperationValidationError } from "../../onchain/validation/checkOperation.js"; import { CheckSimulationInput, SimulationValidationError } from "../../onchain/validation/checkSimulation.js"; import "../../onchain/index.js"; //#region src/sdk/preview/types.d.ts /** * Parsed-operation check on the namespace: the standalone input minus `sdk`, * plus the chain to resolve it on. `OperationPreview` only names the chain * inside a token, so `chainId` is required. **/ export type CheckOperationProps = Omit & { chainId: ChainId; }; /** * On-chain preview of a raw operation calldata, and checks of a parsed or * simulated one. **/ export interface IPreview { /** * Decodes a raw operation and assembles an operation-specific, * human-displayable preview. **/ previewOperation(input: PreviewOperationInput, options?: PreviewOperationOptions): Promise>; /** * Whether a parsed operation may be signed by `sender`: protocol state first, * then what the wallet has to approve, hold or sign. **/ checkOperation(props: CheckOperationProps, options?: CheckOperationOptions): Promise; /** * Whether a simulated operation clears the caller's own thresholds. * * Async because the namespace refreshes chain state first; the standalone * checker is sync. **/ checkSimulation(props: CheckSimulationInput, options?: HealthFactorThresholds): Promise; } /** * `sdk.preview` per mode: an on-chain read, absent when the SDK reads no chain. **/ export interface IPreviewByMode { onchain: IPreview; offchain: undefined; both: IPreview; } //#endregion