
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
@layerzerolabs/lz-v2-utilities
Advanced tools
The LayerZero V2 Utilities package provides a set of essential utilities and modules to facilitate the development and integration of applications with various blockchain networks. It includes functions for packet encoding/decoding, precrime configuration parsing, error parsing, and more.
To install the LayerZero V2 Utilities package, you can use npm or yarn:
npm install @layerzerolabs/lz-v2-utilities
or
yarn add @layerzerolabs/lz-v2-utilities
Encodes and decodes packets using the V1 codec.
import { PacketV1Codec } from "@layerzerolabs/lz-v2-utilities";
const packet = {
version: 1,
nonce: '1',
srcEid: 10121,
sender: '0x7Cff4181f857B06114643D495648A95b3E0B0B81',
dstEid: 10108,
receiver: '0x6552e1c444f6a2ce35b22de6a554da8c32c5650db0e0158df2eb0daa51289968',
guid: '0x6552e1c444f6a2ce35b22de6a554da8c32c5650db0e0158df2eb0daa51289968',
message: '0xff',
payload: '',
};
// Encode the packet
const encodedHex = PacketV1Codec.encode(packet);
console.log(`Encoded Packet: ${encodedHex}`);
// Decode the packet
const decodedPacket = PacketV1Codec.from(encodedHex).toPacket();
console.log(`Decoded Packet: ${JSON.stringify(decodedPacket)}`);
Parses the precrime configuration string.
import { parsePrecrimeConfig } from "@layerzerolabs/lz-v2-utilities";
const configHex = '0x0002000000000000000500010000000100000000000000000000000000000000000000000000000000000000000111110000000000000000000000000000000000000000000000000000000000011111';
const config = parsePrecrimeConfig(configHex);
console.log(`Parsed Precrime Config: ${JSON.stringify(config)}`);
Parses the error data.
import { parseError } from "@layerzerolabs/lz-v2-utilities";
import { Interface } from "@ethersproject/abi";
const errorData = "0x08c379a0...";
const intf = new Interface(["function myFunction()"]);
const parsedError = parseError(errorData, intf);
console.log(`Parsed Error: ${parsedError}`);
Pads a hexadecimal address to 32 bytes.
import { hexZeroPadTo32 } from "@layerzerolabs/lz-v2-utilities";
const address = "0x1234567890abcdef1234567890abcdef12345678";
const paddedAddress = hexZeroPadTo32(address);
console.log(`Padded Address: ${paddedAddress}`);
Builds OptionsType.TYPE_1.
import { optionsType1 } from "@layerzerolabs/lz-v2-utilities";
const extraGas = 200000;
const options = optionsType1(extraGas);
console.log(`Options Type 1: ${options}`);
FAQs
LayerZero Utility V2
We found that @layerzerolabs/lz-v2-utilities demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.