UtxoState

UTXO state lifecycle matching Midnight SDK behavior.

Three-State Model:

  • AVAILABLE: UTXO is unspent and can be used in new transactions

  • PENDING: UTXO is locked for a pending transaction (not yet confirmed)

  • SPENT: UTXO has been spent in a confirmed transaction

State Transitions:

  • New UTXO: → AVAILABLE

  • Create transaction: AVAILABLE → PENDING

  • Transaction SUCCESS: PENDING → SPENT

  • Transaction FAILURE: PENDING → AVAILABLE (unlock)

  • Transaction PARTIAL_SUCCESS: PENDING → SPENT (if segment succeeded)

Balance Calculation: Only AVAILABLE UTXOs are included in balance calculations. PENDING and SPENT UTXOs are excluded.

Security: The PENDING state prevents double-spending by locking UTXOs during transaction creation.

Entries

Link copied to clipboard

UTXO is unspent and available for use in new transactions. Included in balance calculations.

Link copied to clipboard

UTXO is locked for a pending transaction (not yet confirmed). Excluded from balance calculations to prevent double-spending.

Link copied to clipboard

UTXO has been spent in a confirmed transaction. Excluded from balance calculations.

Properties

Link copied to clipboard

Returns a representation of an immutable list of all enum entries, in the order they're declared.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun valueOf(value: String): UtxoState

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared.