@pwngh/economy-lab
    Preparing search index...

    Variable adjustConst

    adjust: (
        fields: FieldsOf<K>,
    ) => {
        account: AccountRef;
        actor: Principal;
        amount: Amount;
        idempotencyKey: string;
        kind: "adjust";
        reason: string;
    } = ...

    Builds an adjust operation: the operator's manual correction for cases no ordinary operation covers, such as closing a reconciliation gap. It moves one account by the signed amount — negative corrects downward — with the offsetting entry posted to OPENING_EQUITY so the books stay balanced; revenue and trust are untouched. Operator-only: the handler refuses even a system caller, and the required reason is stored on the posting's metadata and hashed into the tamper-evident chain. The amount must be CREDIT and non-zero (the one operation whose amount may be negative). It has no rejected path; a retry under the same idempotencyKey returns the earlier correction as duplicate rather than posting twice.

    Type Declaration

      • (
            fields: FieldsOf<K>,
        ): {
            account: AccountRef;
            actor: Principal;
            amount: Amount;
            idempotencyKey: string;
            kind: "adjust";
            reason: string;
        }
      • Parameters

        • fields: FieldsOf<K>

        Returns {
            account: AccountRef;
            actor: Principal;
            amount: Amount;
            idempotencyKey: string;
            kind: "adjust";
            reason: string;
        }

    const outcome = await economy.submit(adjust({
    idempotencyKey: idempotencyKey('recon', '2026-07-22', 'usr_a1'),
    actor: operatorActor('op_7'),
    account: spendable('usr_a1'),
    amount: toAmount('CREDIT', -25_000n), // lower by 250 credits
    reason: 'reconciliation: double-posted top-up',
    }));