UnshieldedOffer

data class UnshieldedOffer(val inputs: List<UtxoSpend>, val outputs: List<UtxoOutput>, val signatures: List<ByteArray> = emptyList())

Represents an unshielded offer in a Midnight transaction.

An offer pairs the UTXOs being spent (inputs) with the new UTXOs being created (outputs), plus the signatures authorizing each input.

Purpose:

  • Contains inputs (UTXOs being spent)

  • Contains outputs (new UTXOs being created)

  • Will contain signatures (added during signing)

Important:

  • Inputs and outputs are automatically SORTED by the ledger

  • Signatures must match the sorted input order

Usage in Transaction:

val offer = UnshieldedOffer(
inputs = listOf(
UtxoSpend(intentHash = "0x123...", outputNo = 0, value = 150M, ...)
),
outputs = listOf(
UtxoOutput(value = 100M, owner = "recipient...", ...), // Send
UtxoOutput(value = 50M, owner = "sender...", ...) // Change
)
)

// Later, during signing: add signatures
val signed = offer.copy(signatures = listOf(...))

Constructors

Link copied to clipboard
constructor(inputs: List<UtxoSpend>, outputs: List<UtxoOutput>, signatures: List<ByteArray> = emptyList())

Properties

Link copied to clipboard

List of UTXOs being spent (at least one required)

Link copied to clipboard

List of new UTXOs being created (at least one required)

Link copied to clipboard

List of Schnorr signatures (one per input, added during signing)

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Validate transaction is balanced for all token types.

Link copied to clipboard

Check if all inputs are signed.

Link copied to clipboard
fun totalInput(tokenType: String): BigInteger

Calculate total input value for a specific token type.

Link copied to clipboard
fun totalOutput(tokenType: String): BigInteger

Calculate total output value for a specific token type.