Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
@ethersproject/constants
Advanced tools
@ethersproject/constants is a package that provides a collection of common constants used in Ethereum development. These constants include predefined values for addresses, hashes, and other frequently used Ethereum-related data.
Addresses
Provides a constant for the zero address, which is often used as a placeholder or default address in Ethereum applications.
const { AddressZero } = require('@ethersproject/constants');
console.log(AddressZero); // Output: '0x0000000000000000000000000000000000000000'
Hashes
Provides a constant for the zero hash, which is a hash filled with zeros and is often used as a default or placeholder hash.
const { HashZero } = require('@ethersproject/constants');
console.log(HashZero); // Output: '0x0000000000000000000000000000000000000000000000000000000000000000'
Ether Units
Provides a constant for the number of wei per ether, which is useful for converting between ether and wei units.
const { WeiPerEther } = require('@ethersproject/constants');
console.log(WeiPerEther.toString()); // Output: '1000000000000000000'
Negative One
Provides a constant for the value negative one, which can be useful in various calculations and comparisons.
const { NegativeOne } = require('@ethersproject/constants');
console.log(NegativeOne.toString()); // Output: '-1'
web3-utils is a utility library for Ethereum that provides various functions and constants for Ethereum development. It includes similar constants like zero address and zero hash, as well as additional utility functions for encoding, decoding, and converting data.
ethjs-util is a utility library for Ethereum that provides a collection of utility functions and constants. It includes constants like zero address and zero hash, and offers additional utility functions for working with Ethereum data types and values.
ethereumjs-util is a utility library for Ethereum that provides a wide range of utility functions and constants. It includes constants like zero address and zero hash, and offers comprehensive support for various Ethereum-related operations, including cryptographic functions and data conversions.
This sub-module is part of the ethers project.
It contains many frequently used constants when dealing with Ethereum.
For more information, see the documentation.
Most users will prefer to use the umbrella package, but for those with more specific needs, individual components can be imported.
const {
AddressZero,
HashZero,
EtherSymbol,
NegativeOne,
Zero,
One,
Two,
WeiPerEther,
MaxUint256
} = require("@ethersproject/constants");
MIT License
FAQs
Common Ethereum constants used for ethers.
The npm package @ethersproject/constants receives a total of 533,716 weekly downloads. As such, @ethersproject/constants popularity was classified as popular.
We found that @ethersproject/constants demonstrated a not healthy version release cadence and project activity because the last version was released 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
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.