Script.decompile constructor

Script.decompile(
  1. Uint8List script, {
  2. bool requireMinimal = true,
})

Decompiles the script and may return a sub-class representing the script type. May return OutOfData if the script has an invalid pushdata. If requireMinimal is true (default), the script push push data minimally or PushDataNotMinimal will be thrown.

Implementation

factory Script.decompile(Uint8List script, { bool requireMinimal = true }) {

  final List<ScriptOp> ops = [];
  final reader = BytesReader(script);

  // Read all the operations into the list
  while (!reader.atEnd) {
    ops.add(ScriptOp.fromReader(reader, requireMinimal: requireMinimal));
  }

  return Script(ops);

}