toBytes method

Uint8List toBytes()

returns a serialized byte version of the witness items list

Implementation

Uint8List toBytes() {
  Uint8List stackBytes = Uint8List(0);

  for (String item in stack) {
    Uint8List itemBytes = prependVarint(hexToBytes(item));
    stackBytes = Uint8List.fromList([...stackBytes, ...itemBytes]);
  }

  return stackBytes;
}