export function bytesToUint256LittleEndian(bytes: Uint8Array): bigint {
  let value: bigint = 0n;

  for (let i = bytes.length - 1; i >= 0; i--) {
    value = (value << 8n) | BigInt(bytes[i]);
  }

  return value;
}

export function uint256ToBytesLittleEndian(value: bigint): Uint8Array {
  const bytes = new Uint8Array(32);
  for (let i = 0; i < 32; i++) {
    bytes[i] = Number((value >> (8n * BigInt(i))) & 0xffn);
  }
  return bytes;
}
