Skip to main content

TxInput

TxInput represents UTxOs that are available for spending

export interface TxInput {
  address: Address<SC>
  copy(): TxInput<SC>
  datum: undefined | TxOutputDatum
  dump(): any
  id: TxOutputId
  isEqual(other: TxInput<any>): boolean
  kind: "TxInput"
  output: TxOutput<SC>
  recover(network: {getUtxo(id: TxOutputId): Promise<TxInput<SpendingCredential>>}): Promise<void>
  toCbor(full: boolean): number[]
  toUplcData(): ConstrData
  value: Value
}

Properties

address

txInput.address satisfies Address<SC>

copy

Deep copy of the TxInput so that Network interfaces don't allow accidental mutation of the underlying data

txInput.copy satisfies () => TxInput<SC>

datum

txInput.datum satisfies undefined | TxOutputDatum

dump

txInput.dump satisfies () => any

id

txInput.id satisfies TxOutputId

isEqual

txInput.isEqual satisfies (other: TxInput<any>) => boolean

kind

txInput.kind satisfies "TxInput"

output

Throws an error if the TxInput hasn't been recovered

txInput.output satisfies TxOutput<SC>

recover

The output itself isn't stored in the ledger, so must be recovered after deserializing blocks/transactions

txInput.recover satisfies (network: {getUtxo(id: TxOutputId): Promise<TxInput<SpendingCredential>>}) => Promise<void>

toCbor

Ledger format is without original output (so full = false) full = true is however useful for complete deserialization of the TxInput (and then eg. using it in off-chain applications)

txInput.toCbor satisfies (full: boolean) => number[]

toUplcData

Full representation (as used in ScriptContext)

txInput.toUplcData satisfies () => ConstrData

value

txInput.value satisfies Value