Input constructor

Input({
  1. Uint8List? hash,
  2. int? index,
  3. Uint8List? script,
  4. int? sequence,
  5. int? value,
  6. Uint8List? prevOutScript,
  7. Uint8List? redeemScript,
  8. Uint8List? witnessScript,
  9. List<Uint8List?>? pubkeys,
  10. List<Uint8List?>? signatures,
  11. List<Uint8List?>? witness,
  12. String? signType,
  13. String? prevOutType,
  14. String? redeemScriptType,
  15. String? witnessScriptType,
  16. int? maxSignatures,
})

Implementation

Input(
    {this.hash,
    this.index,
    this.script,
    this.sequence,
    this.value,
    this.prevOutScript,
    this.redeemScript,
    this.witnessScript,
    this.pubkeys,
    this.signatures,
    this.witness,
    this.signType,
    this.prevOutType,
    this.redeemScriptType,
    this.witnessScriptType,
    this.maxSignatures}) {
  hasWitness = false; // Default value
  if (hash != null && !isHash256bit(hash!)) {
    throw ArgumentError('Invalid input hash');
  }
  if (index != null && !isUint(index!, 32)) {
    throw ArgumentError('Invalid input index');
  }
  if (sequence != null && !isUint(sequence!, 32)) {
    throw ArgumentError('Invalid input sequence');
  }
  if (value != null && !isShatoshi(value!)) {
    throw ArgumentError('Invalid ouput value');
  }
}