Skip to main content

Policy Simulator

The PolicySimulator evaluates transactions against policies locally, without deploying anything on-chain or interacting with Lit Protocol. It’s designed for testing and development.

Usage

Constructor

Options

MockState

Methods

evaluate(policy, txParams)

Evaluate a transaction against all rules in a policy.
Returns: Promise<EvaluationReport> The simulator evaluates all tiers:
  • Tier 1: Fully simulated (exact match with on-chain behavior)
  • Tier 2: Simulated with mock state
  • Tier 3: Best-effort simulation (slippage checks use provided data, simulation rule always passes)

evaluateRule(rule, txParams)

Evaluate a single rule against transaction parameters.
Returns: Promise<RuleResult>

reset()

Reset the simulator’s internal state (spend tracking, cooldown timestamps).

Examples

Testing Spend Limits

Testing Cooldowns

The simulator is designed for development and testing. Tier 3 rules are evaluated on a best-effort basis since the full Lit Protocol environment is not available locally.