Web3JS

Constants, Types, & Utilities

An overview of the constants, types, & utils packages

The Web3.js plugin for ZKsync exposes top-level packages for constants, types, and utilities. Keep reading to learn more about these packages and the capabilities they encapsulate.

Constants

The constants package includes well-known addresses, such as the address of the L1 ETH token.

import { constants } from "web3-plugin-zksync";

console.log("L1 ETH address:", constants.ETH_ADDRESS);

Types

The types package defines enums, interfaces, and types that are used for interacting with the ZKsync Era network.

import { types } from "web3-plugin-zksync";

console.log("Networks:", types.Network);

Utilities

The utils package exposes helpful functions and contract definitions that can be used with the Web3.js plugin for ZKsync.

import { constants, utils } from "web3-plugin-zksync";

console.log(
  "Is constants.ETH_ADDRESS ETH address:",
  utils.isETH(constants.ETH_ADDRESS),
);
console.log("Main contract methods:", utils.ZkSyncMainContract.methods);

Made with ❤️ by the ZKsync Community