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

    Variable revokeEntitlementConst

    revokeEntitlement: (
        fields: FieldsOf<K>,
    ) => {
        actor: Principal;
        idempotencyKey: string;
        kind: "revokeEntitlement";
        reason?: string;
        sku: string;
        userId: string;
    } = ...

    Builds a revokeEntitlement operation: drops a user's ownership record for a SKU, the mirror of a grant. No money moves and no ledger legs post; once committed, read.entitled for that user and SKU returns false. Restricted to a system or operator actor — a revoke names a user the caller need not own and posts no debit the ownership rule could catch. Rejects only with NOT_ENTITLED when the user does not currently own the SKU (the rejection's detail carries the userId and sku). A retry under the same idempotencyKey returns the first result as duplicate.

    Type Declaration

      • (
            fields: FieldsOf<K>,
        ): {
            actor: Principal;
            idempotencyKey: string;
            kind: "revokeEntitlement";
            reason?: string;
            sku: string;
            userId: string;
        }
      • Parameters

        • fields: FieldsOf<K>

        Returns {
            actor: Principal;
            idempotencyKey: string;
            kind: "revokeEntitlement";
            reason?: string;
            sku: string;
            userId: string;
        }

    const outcome = await economy.submit(revokeEntitlement({
    idempotencyKey: idempotencyKey('revoke', 'usr_owner', 'wrld_pass'),
    actor: systemActor('fulfillment'),
    userId: 'usr_owner',
    sku: 'wrld_pass',
    reason: 'chargeback',
    }));