match static method

WitnessInput? match(
  1. RawInput raw,
  2. List<Uint8List> witness
)

Matches a raw input with witness data to a corresponding WitnessInput or specialised sub-class object. If this is not a witness input, null is returned.

Implementation

static WitnessInput? match(RawInput raw, List<Uint8List> witness)
  => raw.scriptSig.isEmpty && witness.isNotEmpty
    ? (
      // Is a witness input, so match with the specific input type
      P2WPKHInput.match(raw, witness)
      ?? TaprootKeyInput.match(raw, witness)
      ?? TaprootScriptInput.match(raw, witness)
      ?? WitnessInput(
        prevOut: raw.prevOut,
        witness: witness,
        sequence: raw.sequence,
      )
    )
    : null;