add Simple Threshold
Adds a simple threshold policy to a context rule.
A simple threshold policy requires a specific number of signers to authorize a transaction. All signers have equal weight (1 vote each).
Encodes the threshold parameter and delegates to addPolicy.
IMPORTANT: This operation requires the connected wallet to have authorization on the smart account. The user will be prompted for biometric authentication to sign the transaction.
Contract limits:
Maximum OZConstants.MAX_POLICIES policies per context rule
Policy address must be a valid C-address
Threshold must be greater than zero
Return
TransactionResult indicating success or failure
Parameters
The context rule ID to add the policy to (0 for Default rule)
The policy contract address (C-address)
Number of signers required to authorize (1 to signer count)
Optional list of signers for multi-signer authorization. When empty (default), uses single-signer auth with the connected passkey. When non-empty, coordinates signatures from all listed signers.
Optional submission method override. When null (default), uses the configured submission method (relayer if available, RPC otherwise).
Throws
if validation fails
if transaction submission fails
Example:
// Add a 2-of-3 simple threshold policy
val result = policyManager.addSimpleThreshold(
contextRuleId = 0u,
policyAddress = "CBCD1234...",
threshold = 2u
)
if (result.success) {
println("Policy added: ${result.hash ?: ""}")
} else {
println("Failed to add policy: ${result.error ?: ""}")
}