hexStripZeros

Learn about the hexStripZeros utils method

Introduction

The hexStripZeros method is used to remove leading zeros from a hex string. This method is often used to clean up hex strings for EVM operations.

Usage

This method should be used when removing leading zeros from a hex string. For example, you can use this method to remove the leading zeros from the hex string '0x0000000000000000000001'. The result would be '0x1'.

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

const { Utils } = require("alchemy-sdk");

let hexString = "0x0000000000000000000001";
let strippedHex = Utils.hexStripZeros(hexString); 
console.log(strippedHex); // 0x1