Policy Install Params
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:
SimpleThreshold: M-of-N authorization (threshold of signers must sign)
WeightedThreshold: Weighted voting with configurable threshold
SpendingLimit: Maximum amount per time period (in ledgers)
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
Simple threshold policy requiring at least M-of-N signers to authorize.
Spending limit policy restricting total amount per time period.
Weighted threshold policy with configurable signer weights.