import * as t from "io-ts/lib/index.js"; import { Observation, Value, ValueId } from "./value-and-observation.js"; import { AccountId, Payee } from "./payee.js"; import { Token } from "./token.js"; import { Action } from "./actions.js"; import { BuiltinByteString } from "./inputs.js"; /** * Search [[lower-name-builders]] * @hidden */ export declare const close = "close"; /** * TODO: Comment * @category Contract */ export type Close = "close"; /** * TODO: Comment * @category Contract */ export declare const CloseGuard: t.Type; /** * @hidden */ export declare const pay: (pay: Value, token: Token, from_account: AccountId, to: Payee, then: Contract) => { pay: Value; token: Token; from_account: import("./participants.js").Party; to: Payee; then: Contract; }; /** * TODO: Comment * @category Contract */ export interface Pay { pay: Value; token: Token; from_account: AccountId; to: Payee; then: Contract; } /** * TODO: Comment * @category Contract */ export declare const PayGuard: t.RecursiveType, Pay, Pay, unknown>; /** * TODO: Comment * @category Contract */ export interface If { /** * TODO: Comment */ if: Observation; /** * TODO: Comment */ then: Contract; /** * TODO: Comment */ else: Contract; } /** * TODO: Comment * @category Contract */ export declare const IfGuard: t.Type; /** * The `Let` constructor allows a contract to record a value using an identifier `let`. The * expression `be` is evaluated, and the result is stored in the `boundValues` of the {@link MarloweState} * with the `let` identifier. The contract then continues with `then`. * * As well as allowing us to use abbreviations, this mechanism also means that we can capture and save * volatile values that might be changing with time, e.g. the current price of oil, or the current time, * at a particular point in the execution of the contract, to be used later on in contract execution. * @see Section 2.1.7 and appendix E.10 of the {@link https://github.com/input-output-hk/marlowe/releases/download/v3/Marlowe.pdf | Marlowe spec} * @category Contract */ export interface Let { let: ValueId; be: Value; then: Contract; } /** * {@link !io-ts-usage | Dynamic type guard} for the {@link Let | let type}. * @category Contract */ export declare const LetGuard: t.Type; /** * TODO: Comment * @category Contract */ export interface Assert { /** * TODO: Comment */ assert: Observation; /** * TODO: Comment */ then: Contract; } /** * TODO: Comment * @category Contract */ export declare const AssertGuard: t.Type; /** * TODO: Comment * @category Contract */ export interface When { /** * TODO: Comment */ when: Case[]; /** * TODO: Comment */ timeout: Timeout; /** * TODO: Comment */ timeout_continuation: Contract; } /** * TODO: Comment * @category Contract */ export declare const WhenGuard: t.Type; /** * A pattern match between an Action and a Contract. * To be used inside of a {@link When} statement. * @category Contract */ export interface NormalCase { /** * TODO: Comment */ case: Action; /** * TODO: Comment */ then: Contract; } /** * {@link !io-ts-usage | Dynamic type guard} for the {@link NormalCase | normal case type}. * @category Contract */ export declare const NormalCaseGuard: t.Type; /** * A pattern match between an Action and a Merkleized Contract. * To be used inside of a {@link When} statement. * @see {@link https://docs.marlowe.iohk.io/docs/platform-and-architecture/large-contracts} * @category Contract */ export interface MerkleizedCase { case: Action; /** * A hash of the contract that will be executed if the case is matched. * Never construct this value yourself, the runtime should calculate hashing. */ merkleized_then: BuiltinByteString; } /** * {@link !io-ts-usage | Dynamic type guard} for the {@link MerkleizedCase | merkleized case type}. * @category Contract */ export declare const MerkleizedCaseGuard: t.Type; /** * @category Contract */ export type Case = NormalCase | MerkleizedCase; /** * {@link !io-ts-usage | Dynamic type guard} for the {@link Case | case type}. * @category Contract */ export declare const CaseGuard: t.Type; /** * TODO: Comment * @category Contract */ export type Timeout = bigint; /** * TODO: Comment * @category Contract */ export declare const TimeoutGuard: t.Type; /** * @experimental */ export declare const datetoTimeout: (date: Date) => Timeout; /** * @experimental */ export declare const timeoutToDate: (timeout: Timeout) => Date; /** * TODO: Comment * @category Contract */ export type Contract = Close | Pay | If | When | Let | Assert; /** * TODO: Comment * @category Contract */ export declare const ContractGuard: t.Type; /** * Pattern match object on the Contract type * @category Contract * @hidden */ export type ContractMatcher = { close: (contract: Close) => T; pay: (contract: Pay) => T; if: (contract: If) => T; when: (contract: When) => T; let: (contract: Let) => T; assert: (contract: Assert) => T; }; /** * Pattern matching on the Contract type * @hidden * @category Contract */ export declare function matchContract(matcher: ContractMatcher): (contract: Contract) => T; export declare function matchContract(matcher: Partial>): (contract: Contract) => T | undefined; /** * This function calculates the next timeout of a contract after a given minTime. * @param minTime Normally the current time, but it represents any time for which you want to see what is the next timeout after that. * @param contract The contract to analyze * @returns The next timeout after minTime, or undefined if there is no timeout after minTime. * @category Introspection */ export declare function getNextTimeout(contract: Contract, minTime: Timeout): Timeout | undefined; //# sourceMappingURL=contract.d.ts.map