ContextRuleType

sealed class ContextRuleType

Type of context rule that determines which operations it applies to.

Context rules use pattern matching to determine when signers and policies should be enforced. Three types of context matching are supported:

  • Default: Matches any operation (fallback rule)

  • CallContract: Matches invocations to a specific contract address

  • CreateContract: Matches contract deployments using a specific WASM hash

Example usage:

// Default rule applies to all operations
val defaultRule = ContextRuleType.Default

// Rule for calling a specific token contract
val tokenRule = ContextRuleType.CallContract("CBCD1234...")

// Rule for deploying contracts with a specific WASM hash
val deployRule = ContextRuleType.CreateContract(wasmHashData)

Inheritors

Types

Link copied to clipboard
data class CallContract(val contractAddress: String) : ContextRuleType

Matches invocations to a specific contract address.

Link copied to clipboard
data class CreateContract(val wasmHash: ByteArray) : ContextRuleType

Matches contract deployments using a specific WASM hash.

Link copied to clipboard

Matches any operation (fallback/default rule).

Functions

Link copied to clipboard

Converts the context rule type to its on-chain ScVal representation.