Docs/API/currentPolicy

currentPolicy

functionPolicy versioning (HCS-2)

The current (latest) policy version on the registry, or null if empty.

signature
currentPolicy(registryTopicId, mirrorBaseUrl, trustedPayer?): Promise<PolicyVersion | null>

Parameters

NameTypeDescription
registryTopicIdreqstringThe HCS-2 registry topic.
mirrorBaseUrlreqstringMirror node REST base.
trustedPayeroptstringOnly trust versions from this account.

Returns

Promise<PolicyVersion | null>

The latest version, or null.

Example

example
const policy = await currentPolicy(policyTopicId, MIRROR, ownerAccountId);
// → { version: 2, perTask: 20, perDay: 50, reason: 'raise daily cap', ... }
VERIFIABLE SPEND-CONTROL   ·   ENFORCED ON-CHAIN   ·   AGENTS CAN PAY — NOW THEY CAN’T OVERSPEND   ·   CURB × HEDERA   ·   VERIFIABLE SPEND-CONTROL   ·   ENFORCED ON-CHAIN   ·   AGENTS CAN PAY — NOW THEY CAN’T OVERSPEND   ·   CURB × HEDERA   ·