/**
 * Helper function for serialize byte arrays
 *
 * @param arrays Any number of byte array arguments
 */
export function serializeBytes(...arrays) {
  const length = arrays.reduce((prev, curr) => prev + curr.length, 0);
  const buffer = new Uint8Array(length);
  let offset = 0;
  arrays.forEach(arr => {
    buffer.set(arr, offset);
    offset += arr.length;
  });
  return buffer;
}