Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@ethersproject/solidity
Advanced tools
@ethersproject/solidity is a part of the ethers.js library, which provides utilities for interacting with the Ethereum blockchain. This specific package focuses on Solidity-related functionalities, such as hashing and encoding data according to Solidity's rules.
Solidity Keccak256
This feature allows you to compute the Keccak256 hash of Solidity-encoded data. The example demonstrates hashing a string 'Hello, world!' using Solidity's encoding rules.
const { keccak256 } = require('@ethersproject/solidity');
const hash = keccak256(['string'], ['Hello, world!']);
console.log(hash);
Solidity Pack
This feature allows you to pack multiple Solidity types into a single byte array. The example shows how to pack a uint256 and an address into a byte array.
const { pack } = require('@ethersproject/solidity');
const packedData = pack(['uint256', 'address'], [12345, '0x742d35Cc6634C0532925a3b844Bc454e4438f44e']);
console.log(packedData);
Solidity AbiCoder
This feature provides an ABI coder for encoding and decoding Solidity data types. The example demonstrates encoding a uint256 and a string into ABI format.
const { AbiCoder } = require('@ethersproject/solidity');
const abiCoder = new AbiCoder();
const encoded = abiCoder.encode(['uint256', 'string'], [12345, 'Hello, world!']);
console.log(encoded);
web3-utils is a utility library that is part of the web3.js library. It provides similar functionalities for hashing, encoding, and decoding data according to Solidity's rules. Compared to @ethersproject/solidity, web3-utils is part of a larger library that includes many other utilities for interacting with the Ethereum blockchain.
ethjs-abi is a standalone library for encoding and decoding Ethereum ABI data. It offers similar functionalities to @ethersproject/solidity's AbiCoder but is more focused on ABI encoding/decoding. It is lightweight and can be used independently of other libraries.
solidity-sha3 is a library specifically designed for computing Solidity-compatible SHA3 (Keccak256) hashes. It provides a simple interface for hashing data according to Solidity's rules. While it focuses solely on hashing, it offers a similar feature to @ethersproject/solidity's keccak256 function.
This sub-module is part of the ethers project.
It contains functions to perform Solidity-specific packed (i.e. non-standard) encoding operations.
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 {
pack,
keccak256,
sha256
} = require("@ethersproject/solidity");
MIT License
FAQs
Solidity coder for non-standard (tight) packing.
The npm package @ethersproject/solidity receives a total of 258,718 weekly downloads. As such, @ethersproject/solidity popularity was classified as popular.
We found that @ethersproject/solidity 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.