Learn about the stripZeros
utils method
Introduction
The stripZeros
method is used to remove leading zeros from a hex string and return the output in a Uint8Array
form.
Usage
This method should be used when you want to remove leading zeros from a hex string and want the output in a Uint8Array
form.
Here's a simple code example to demonstrate how to use this method:
const { Utils } = require("alchemy-sdk");
let hexString = "0x00000000000000000005";
let strippedUint8Array = Utils.stripZeros(hexString);
console.log(strippedUint8Array); // Uint8Array(1) [ 5 ]