コンテンツにスキップ

evaluateSpendingPolicy

このコンテンツはまだ日本語訳がありません。

evaluateSpendingPolicy(policy, intent, state, nowSeconds): PolicyDecision

Defined in: src/policy/spending-policy.ts:108

Evaluate a SpendingPolicy against a decoded PaymentIntent.

Pure, deterministic, no I/O. Deny-closed; the first failing check wins. All amount comparisons are bigint; all address equality uses getAddress() on both sides. Reads state, never mutates it — see mergeSpendState. detail strings never contain the nonce or any signature.

Parameters

policy

SpendingPolicy

intent

PaymentIntent

state

SpendState

nowSeconds

bigint

Returns

PolicyDecision

Example

const decision = evaluateSpendingPolicy(policy, intent, state, BigInt(Math.floor(Date.now() / 1000)));
if (!decision.ok) console.warn(decision.rejection.reason);