/** * @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'; /** * Records that a user owns an item or feature, named by `sku`, a product code such as * `'wrld_pass'`. This tracks ownership only. No money moves and the ledger is untouched. The * grant always succeeds. It overwrites any previous record for that user and sku, and it has * no prerequisite. * * An outer layer enforces that only `system` and `operator` callers may grant. * * @example * const outcome = await grantEntitlement( * { kind: 'grantEntitlement', idempotencyKey: 'idem_0', * actor: { kind: 'system', service: 'fulfillment' }, userId: 'usr_owner', sku: 'wrld_pass' }, * unit, ctx, * ); * // outcome.status === 'committed'; unit.entitlements.owns('usr_owner', 'wrld_pass') === true. * * @see {@link https://economy-lab-docs.pages.dev/economy/reference/operations/grant-entitlement/ * Grant entitlement} for ownership records and grant attributes. */ export declare function grantEntitlement(operation: Operation, unit: Unit, ctx: Ctx): Promise; /** * Removes a user's ownership of an item or feature, named by `sku`. If the user does not own * it, this returns a `NOT_ENTITLED` rejection rather than throwing. Otherwise it drops the * ownership record. No money moves either way, because ownership has no balance. * * @see {@link https://economy-lab-docs.pages.dev/economy/reference/operations/revoke-entitlement/ * Revoke entitlement} for the revoke flow and the `NOT_ENTITLED` rejection. */ export declare function revokeEntitlement(operation: Operation, unit: Unit, ctx: Ctx): Promise;