Skip to main content
These functions read state directly from chain. No backend dependency: the policy object and the audit events are the source of truth.

readPolicyObject

Reads the live multi-asset policy — the authoritative caps, allowed actions, scope, expiry, and state.
readPolicy(client, policyId) returns a flatter PolicySnapshot (single budget asset) with agentId, perTxCap, perDayCap, spentToday, allowedPackages, expiresAtMs, revoked, paused, version.

vaultBalances

Every coin balance the multi-asset vault holds. Balances live in dynamic fields keyed by coin type; this enumerates them and reads each amount. Returns [] if the vault has no assets.

readAuditLog

The on-chain activity log: AllowedAction, WithdrawalAttested, PolicyRevoked, PolicyUpdated events emitted by corePkg, in descending order.

decodePolicyAbort

Extracts a policy MoveAbort from a thrown error or a devInspect failure status, and maps the abort code to a stable reason. Only aborts raised by the policy module are decoded; returns null for any other failure (so you can tell a policy denial apart from a liquidity or gas failure).

guardedSubmit

Dry-run, record a denial without spending gas, and submit only when allowed.