addInput method

dynamic addInput(
  1. Uint8List hash,
  2. int index, {
  3. int? sequence,
  4. Uint8List? scriptSig,
})

Add input to Transaction Return index number of input

Implementation

addInput(Uint8List hash, int index, {int? sequence, Uint8List? scriptSig}) {
  if (hash.length != 32) {
    throw ArgumentError('The length of argument must be 32', 'hash');
  }
  sequence ??= Transaction.defaultSequence;
  scriptSig ??= emptyScript;

  // Add the input
  ins.add(Input(
    hash: hash,
    index: index,
    script: scriptSig,
    sequence: sequence!,
    witness: emptyWitness,
  ));
  // and return the input's index
  return ins.length - 1;
}