subAccountFromID method

Uint8List subAccountFromID(
  1. int id
)

Implementation

Uint8List subAccountFromID(int id) {
  if (id < 0) throw ArgumentError("Number cannot be negative");

  if (id > 0x1FFFFFFFFFFFFFFF)
    throw ArgumentError("Number is too large to fit in 32 bytes.");

  final buffer = ByteData(32);
  if (id >= 0) {
    final high = (id >> 32) & 0xFFFFFFFF;
    final low = id & 0xFFFFFFFF;

    buffer.setUint32(24, high);
    buffer.setUint32(28, low);
  }
  return buffer.buffer.asUint8List();
}