Skip to main content

TxInput

export interface TxInput<SC extends SpendingCredential = SpendingCredential> {
  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
}
TxInput represents UTxOs that are available for spending

Properties

address

address: Address<SC>

copy

copy(): TxInput<SC>
Deep copy of the TxInput so that Network interfaces don't allow accidental mutation of the underlying data

datum

datum: undefined | TxOutputDatum

dump

dump(): any

id

id: TxOutputId

isEqual

isEqual(other: TxInput<any>): boolean

kind

kind: "TxInput"

output

output: TxOutput<SC>
Throws an error if the TxInput hasn't been recovered

recover

recover(network: {getUtxo(id: TxOutputId): Promise<TxInput<SpendingCredential>>}): Promise<void>
The output itself isn't stored in the ledger, so must be recovered after deserializing blocks/transactions

toCbor

toCbor(full?: boolean): number[]
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)

toUplcData

toUplcData(): ConstrData
Full representation (as used in ScriptContext)

value

value: Value