SignedTx.fromBytes constructor

SignedTx.fromBytes(
  1. Iterable<int> data
)

Implementation

factory SignedTx.fromBytes(Iterable<int> data) {
  final input = Uint8List.fromList(data.toList());
  final reader = BinaryReader(input.buffer.asByteData());
  final signaturesCount = reader.readCompactU16Value();

  final signaturesData = reader.readFixedArray(
    signaturesCount,
    () => reader.readFixedArray(signatureLength, reader.readU8),
  );

  final messageBytes = reader.buf.buffer.asUint8List(reader.offset);

  final compiledMessage = CompiledMessage(ByteArray(messageBytes));

  final signatures = signaturesData
      .mapIndexed(
        (i, s) => Signature(s, publicKey: compiledMessage.accountKeys[i]),
      )
      .toList();

  return SignedTx(
    signatures: signatures,
    compiledMessage: compiledMessage,
  );
}