toAccountId method

Uint8List toAccountId()

Implementation

Uint8List toAccountId() {
  final hash = SHA224();
  hash.update('\x0Aaccount-id'.plainToU8a());
  hash.update(toUint8List());
  hash.update(subAccount ?? _emptySubAccount);
  final data = hash.digest();
  final view = ByteData(4);
  view.setUint32(0, getCrc32(data.buffer));
  final checksum = view.buffer.asUint8List();
  final bytes = Uint8List.fromList(data);
  return Uint8List.fromList([...checksum, ...bytes]);
}