toScVal

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

The on-chain representation is:

  • Default: ScVal::Vec([Symbol("Default")])

  • CallContract: ScVal::Vec([Symbol("CallContract"), Address(contractAddress)])

  • CreateContract: ScVal::Vec([Symbol("CreateContract"), Bytes(wasmHash)])

Return

The SCVal representation of this context rule type

Throws

if address conversion fails

Example:

val ruleType = ContextRuleType.CallContract("CBCD1234...")
val scVal = ruleType.toScVal()
// ScVal::Vec([Symbol("CallContract"), Address("CBCD1234...")])