/** * @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'; /** * Operator-only manual correction, for cases no ordinary operation covers (e.g. closing a gap * found during reconciliation). Moves `operation.account` by the signed `operation.amount` * (negative corrects downward) and books the opposite entry to platform opening-equity so the two * cancel and the books stay balanced. Returns a `committed` Outcome. * * Bad input throws a fault, not a `rejected` Outcome: actor must be operator, amount a non-zero * CREDIT, reason non-empty. * * @example * const outcome = await adjust( * { kind: 'adjust', idempotencyKey: 'idem_0', * actor: { kind: 'operator', operatorId: 'op_1' }, * account: spendable('usr_alice'), amount: toAmount('CREDIT', 250n), * reason: 'reconciliation: missing genesis lot' }, * unit, ctx, * ); * // outcome.status === 'committed'; spendable(usr_alice) rose by 250, balanced to OPENING_EQUITY. * * @see {@link https://economy-lab-docs.pages.dev/economy/reference/operations/adjust/ Adjust} for * when and how operators book manual corrections. */ export declare function adjust(operation: Operation, unit: Unit, ctx: Ctx): Promise;