🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@ethersproject/solidity

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ethersproject/solidity

Solidity coder for non-standard (tight) packing.

5.8.0
latest
Source
npm
Version published
Weekly downloads
1.1M
-34.04%
Maintainers
1
Weekly downloads
 
Created

What is @ethersproject/solidity?

@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.

What are @ethersproject/solidity's main functionalities?

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);

Other packages similar to @ethersproject/solidity

Keywords

Ethereum

FAQs

Package last updated on 26 Feb 2025

Did you know?

Socket

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.

Install

Related posts