Parameters for a policy. The active member depends on the policy
type:
{ recipients } (RecipientEntry) — allowed_recipients,
denied_recipients and denied_proposers. Note denied_proposers keys
its addresses under recipients for legacy reasons but is enforced
against the transaction's sender (proposer), not its recipient.
{ restrictions } (ContractParamRestriction) —
contract_param_restriction. Each entry is evaluated independently and
ANDed: a single failing restriction is a policy breach.
Policy evaluation note: at most one policy may exist per type + chain, but
a '*'-chain policy and a specific-chain policy of the same type both apply on
that chain — each is evaluated independently and any breach fails the
transaction, so neither overrides the other. Likewise an allowed_recipients
and a denied_recipients policy both apply, so an address present in both
lists is effectively denied.
The union is not discriminated in TypeScript, so narrow it with an in
check:
Example: Narrowing a policy's params
constpolicy = awaitsalt.getAccountPolicy('policy-id'); if ('limits'inpolicy.params) { for (constlimitofpolicy.params.limits) { console.log(`${limit.address}: max ${limit.amount} per transaction`); } }
Parameters for a policy. The active member depends on the policy
type:{ recipients }(RecipientEntry) —allowed_recipients,denied_recipientsanddenied_proposers. Notedenied_proposerskeys its addresses underrecipientsfor legacy reasons but is enforced against the transaction's sender (proposer), not its recipient.{ approvers }(ApproverEntry) —nominated_approvers(not yet implemented — see PolicyType).{ limits }(LimitEntry) —transaction_limit_token_denominated.{ restrictions }(ContractParamRestriction) —contract_param_restriction. Each entry is evaluated independently and ANDed: a single failing restriction is a policy breach.Policy evaluation note: at most one policy may exist per
type+chain, but a'*'-chain policy and a specific-chain policy of the same type both apply on that chain — each is evaluated independently and any breach fails the transaction, so neither overrides the other. Likewise anallowed_recipientsand adenied_recipientspolicy both apply, so an address present in both lists is effectively denied.The union is not discriminated in TypeScript, so narrow it with an
incheck: