PolicyInstallParams

sealed class PolicyInstallParams

Policy type definitions for smart account context rules.

Policies define authorization rules that must be satisfied for transactions to execute. Multiple policy types are supported:

Policies are installed on specific context rules and evaluated during transaction authorization.

Example usage:

// Create a 2-of-3 simple threshold policy
val simplePolicy = PolicyInstallParams.SimpleThreshold(threshold = 2u)

// Create a weighted threshold policy (100 points required)
val weightedPolicy = PolicyInstallParams.WeightedThreshold(
signerWeights = mapOf(
delegatedSigner1 to 50u,
delegatedSigner2 to 30u,
externalSigner to 20u
),
threshold = 100u
)

// Create a spending limit (1000 tokens per day, in stroops)
val spendingPolicy = PolicyInstallParams.SpendingLimit(
spendingLimit = Util.amountToStroops("1000"),
periodLedgers = Util.LEDGERS_PER_DAY.toUInt()
)

Note: For most use cases, prefer the convenience methods on OZPolicyManager (addSimpleThreshold, addWeightedThreshold, addSpendingLimit) which handle parameter encoding internally. Use these sealed class variants directly only when calling OZPolicyManager.addPolicy with custom parameters.

Inheritors

Types

Link copied to clipboard
data class SimpleThreshold(val threshold: UInt) : PolicyInstallParams

Simple threshold policy requiring at least M-of-N signers to authorize.

Link copied to clipboard
data class SpendingLimit(val spendingLimit: BigInteger, val periodLedgers: UInt) : PolicyInstallParams

Spending limit policy restricting total amount per time period.

Link copied to clipboard
data class WeightedThreshold(val signerWeights: Map<SmartAccountSigner, UInt>, val threshold: UInt) : PolicyInstallParams

Weighted threshold policy with configurable signer weights.