/** * @pwngh/economy-lab * * Copyright (c) Preston Neal * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */ import type { Ctx, Operation, Outcome } from '../contract.js'; import type { Unit } from '../ports.js'; /** * Undoes an in-flight payout: the manual version of the worker's give-up undo, and the operation a * verified payout-failed webhook applies. The move to FAILED (so the worker never pays it) and the * undo posting (reserve back to the seller's earned account) commit together: the credits return * only if the saga also stops. This is why it does not use the generic `reverse`, which leaves * saga state alone, so a reversed-but-still-RESERVED saga would be paid out anyway. * * RESERVED, or SUBMITTED aged past `config.maxPayoutAgeMs`, moves to FAILED and posts the undo. * SETTLED and still-live SUBMITTED both throw `INVALID_TRANSITION`: returning a reserve already * disbursed, or one the provider may still settle, risks a double-pay. One exception: an operation * carrying `providerReported` (set only by the payout-failed webhook mapper) may reverse a * still-live SUBMITTED payout, because the rail itself has said it will not settle it. * * @see {@link https://economy-lab-docs.pages.dev/economy/reference/operations/reverse-payout/ * Reverse payout} for manually unwinding an in-flight payout saga. */ export declare function reversePayout(operation: Operation, unit: Unit, ctx: Ctx): Promise;