NativeUnionVal

sealed class NativeUnionVal

Represents a union value for Soroban contract specifications. Used when passing union type values to contract functions.

Union types in Stellar contracts can have two forms:

  1. Void case - just a tag name (e.g., "Success", "Error")

  2. Tuple case - a tag name with associated values (e.g., "Data" with values ["field1", "field2"])

Usage

// Void case (no associated values)
val success = NativeUnionVal.VoidCase("Success")

// Tuple case (with associated values)
val data = NativeUnionVal.TupleCase("Data", listOf("field1", "field2"))

Inheritors

Types

Link copied to clipboard
data class TupleCase(val tag: String, val values: List<Any?>) : NativeUnionVal

Represents a tuple union case with associated values.

Link copied to clipboard
data class VoidCase(val tag: String) : NativeUnionVal

Represents a void union case (no associated values).

Properties

Link copied to clipboard

Returns true if this is a tuple case (has associated values).

Link copied to clipboard

Returns true if this is a void case (no associated values).

Link copied to clipboard
abstract val tag: String

The union case name/tag