InvVect.deserialize constructor

InvVect.deserialize(
  1. Uint8List data,
  2. int offset
)

Deserialize from bytes

Implementation

factory InvVect.deserialize(Uint8List data, int offset) {
  if (data.length < offset + 36) {
    throw ArgumentError('Invalid data length for InvVect');
  }

  // Read type (4 bytes, little endian)
  final type = data[offset] |
               (data[offset + 1] << 8) |
               (data[offset + 2] << 16) |
               (data[offset + 3] << 24);

  // Read hash (32 bytes)
  final hashBytes = data.sublist(offset + 4, offset + 36);
  final hash = Hash.fromBytes(hashBytes);

  return InvVect(type: type, hash: hash);
}