import * as t from "io-ts/lib/index.js"; import { Contract } from "./contract.js"; import { TimeInterval } from "./environment.js"; import { Input } from "./inputs.js"; import { Party } from "./participants.js"; import { AccountId, Payee } from "./payee.js"; import { MarloweState } from "./state.js"; import { Token } from "./token.js"; /** * The Payment type represents the intention to transfer funds from the internal {@link AccountId} * to a {@link Payee}. This type is created as a result of executing a {@link index.Pay} statement and is * included as part of the output of {@link TransactionOutput |computing a transaction}. * * The {@link Payee} indicates whether the recipient of the payment is an internal account or external * participant. When we call {@link computeTransaction}, if the payment is internal, the funds are * transferred between internal state accounts. If the payment is external, the funds are removed from * the state account, and the contract makes the payment to the party. * @see Section 2.1.9 and appendix E.13 of the {@link https://github.com/input-output-hk/marlowe/releases/download/v3/Marlowe.pdf | Marlowe spec} * @category Transaction */ export interface Payment { payment_from: AccountId; to: Payee; amount: bigint; token: Token; } /** * TODO: Comment * @category Transaction */ export declare const PaymentGuard: t.Type; /** * A marlowe transaction can consist of multiple inputs applied in a time interval * @category Transaction */ export interface Transaction { tx_interval: TimeInterval; tx_inputs: Input[]; } /** * TODO: Comment * @category Transaction */ export declare const TransactionGuard: t.Type; /** * In the marlowe specification we formally prove that computing a transaction of multiple inputs * in a time interval has the same semantics as computing multiple transactions of a single input. * Having an array of this data structure helps the developer to reason about what inputs were applied * to a contract, without caring if they were applied in a single transaction or in multiple ones. * @category Transaction */ export interface SingleInputTx { interval: TimeInterval; /** If the input is undefined, the transaction was used to reduce a non quiesent contract. This can happen to advance a timeout or if the contract doesn't start with a When */ input?: Input; } /** * TODO: Comment * @category Transaction Warning */ export interface NonPositiveDeposit { party: Party; asked_to_deposit: bigint; of_token: Token; in_account: AccountId; } /** * TODO: Comment * @category Transaction Warning */ export declare const NonPositiveDepositGuard: t.Type; /** * TODO: Comment * @category Transaction Warning */ export interface NonPositivePay { account: AccountId; asked_to_pay: bigint; of_token: Token; to_payee: Payee; } /** * TODO: Comment * @category Transaction Warning */ export declare const NonPositivePayGuard: t.Type; /** * TODO: Comment * @category Transaction Warning */ export interface PartialPay { account: AccountId; asked_to_pay: bigint; of_token: Token; to_payee: Payee; but_only_paid: bigint; } /** * TODO: Comment * @category Transaction Warning */ export declare const PartialPayGuard: t.Type; /** * TODO: Comment * @category Transaction Warning */ export interface Shadowing { value_id: string; had_value: bigint; is_now_assigned: bigint; } /** * TODO: Comment * @category Transaction Warning */ export declare const ShadowingGuard: t.Type; /** * TODO: Comment * @category Transaction Warning */ export type AssertionFailed = "assertion_failed"; /** * TODO: Comment * @category Transaction Warning */ export declare const AssertionFailedGuard: t.Type; /** * TODO: Comment * @category Transaction Warning */ export type TransactionWarning = NonPositiveDeposit | NonPositivePay | PartialPay | Shadowing | AssertionFailed; /** * TODO: Comment * @category Transaction Warning */ export declare const TransactionWarningGuard: t.Type; /** * TODO: Comment * @category Transaction Error */ export interface InvalidInterval { invalidInterval: { from: bigint; to: bigint; }; } /** * TODO: Comment * @category Transaction Error */ export declare const InvalidIntervalGuard: t.Type; /** * TODO: Comment * @category Transaction Error */ export interface IntervalInPast { intervalInPastError: { from: bigint; to: bigint; minTime: bigint; }; } /** * TODO: Comment * @category Transaction Error */ export declare const IntervalInPastGuard: t.Type; /** * TODO: Comment * @category Transaction Error */ export type IntervalError = InvalidInterval | IntervalInPast; export declare const IntervalErrorGuard: t.Type; /** * TODO: Comment * @category Transaction Error */ export type AmbiguousTimeIntervalError = "TEAmbiguousTimeIntervalError"; /** * TODO: Comment * @category Transaction Error */ export declare const AmbiguousTimeIntervalErrorGuard: t.Type; /** * TODO: Comment * @category Transaction Error */ export type ApplyNoMatchError = "TEApplyNoMatchError"; /** * TODO: Comment * @category Transaction Error */ export declare const ApplyNoMatchErrorGuard: t.Type; /** * TODO: Comment * @category Transaction Error */ export type UselessTransaction = "TEUselessTransaction"; /** * TODO: Comment * @category Transaction Error */ export declare const UselessTransactionGuard: t.Type; /** * TODO: Comment * @category Transaction Error */ export type HashMismatchError = "TEHashMismatch"; /** * TODO: Comment * @category Transaction Error */ export declare const HashMismatchErrorGuard: t.Type; /** * TODO: Comment * @category Transaction Error */ export interface TEIntervalError { error: "TEIntervalError"; context: IntervalError; } /** * TODO: Comment * @category Transaction Error */ export declare const TEIntervalErrorGuard: t.Type; /** * TODO: Comment * @category Transaction Error */ export type TransactionError = AmbiguousTimeIntervalError | ApplyNoMatchError | UselessTransaction | TEIntervalError | HashMismatchError; /** * TODO: Comment * @category Transaction Error */ export declare const TransactionErrorGuard: t.Type; /** * TODO: Comment * @category Transaction */ export interface TransactionSuccess { warnings: TransactionWarning[]; payments: Payment[]; state: MarloweState; contract: Contract; } /** * TODO: Comment * @category Transaction */ export declare const TransactionSuccessGuard: t.Type; /** * TODO: Comment * @category Transaction */ export type TransactionOutput = TransactionSuccess | { transaction_error: TransactionError; }; /** * TODO: Comment * @category Transaction */ export declare const TransactionOutputGuard: t.Type; //# sourceMappingURL=transaction.d.ts.map