TransactionInput.fromReader constructor

TransactionInput.fromReader(
  1. ByteDataReader reader, {
  2. UnlockingScriptBuilder? scriptBuilder = null,
})

Constructs a new Transaction input from a ByteDataReader that has been initialized with the raw transaction input data.

This method is useful when iteratively reading the transaction inputs in a raw transaction, which is also how it is currently being used.

Implementation

TransactionInput.fromReader(ByteDataReader reader, {UnlockingScriptBuilder? scriptBuilder = null}) {

    _prevTxnId = HEX.encode(reader.read(32, copy: true).reversed.toList());
    _prevTxnOutputIndex = reader.readUint32(Endian.little);

    var len = readVarIntNum(reader);
    var scriptSig = SVScript.fromBuffer(reader.read(len, copy: true));
    _unlockingScriptBuilder= scriptBuilder ??= DefaultUnlockBuilder.fromScript(scriptSig);
    _sequenceNumber = reader.readUint32(Endian.little);
}