isBytes

Learn about the isBytes utils method.

Learn about the isBytes utils method.

Introduction

The isBytes method is used to check if a value is a byte array.

Usage

This method should be used when you want to check if a value is a byte array. For example, you can use this method to check if the value [0x01, 0x02, 0x03] is a byte array.

Here’s a simple code example to demonstrate how to use this method:

Javascript
1const { Utils } = require("alchemy-sdk");
2
3let byteArray = [0x01, 0x02, 0x03];
4
5let isByteArray = Utils.isBytes(byteArray);
6console.log(isByteArray); // true