@ethereumjs/util
A collection of utility functions for Ethereum
Last updated 4 years ago by holgerd77 .
MPL-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @ethereumjs/util 
SYNC missed versions from official npm registry.

@ethereumjs/util

NPM Package GitHub Issues Actions Status Code Coverage Discord

A collection of utility functions for Ethereum. It can be used in Node.js and in the browser with browserify.

INSTALL

npm install @ethereumjs/util

USAGE

import assert from 'assert'
import { isValidChecksumAddress, unpadBuffer } from '@ethereumjs/util'

assert.ok(isValidChecksumAddress('0x2F015C60E0be116B1f0CD534704Db9c92118FB6A'))

assert.ok(unpadBuffer(Buffer.from('000000006600', 'hex')).equals(Buffer.from('6600', 'hex')))

API

Documentation

Read the API docs.

Modules

  • account
    • Account class
    • Private/public key and address-related functionality (creation, validation, conversion)
  • address
    • Address class and type
  • bytes
    • Byte-related helper and conversion functions
  • constants
    • Exposed constants
      • e.g. KECCAK256_NULL_S for string representation of Keccak-256 hash of null
  • hash
  • signature
    • Signing, signature validation, conversion, recovery
  • types
    • Helpful TypeScript types
  • internal
    • Internalized helper methods

BigInt Support

Starting with v8 the usage of BN.js for big numbers has been removed from the library and replaced with the usage of the native JS BigInt data type (introduced in ES2020).

Please note that number-related API signatures have changed along with this version update and the minimal build target has been updated to ES2020.

ethjs-util methods

The following methods are available by an internalized version of the ethjs-util package (MIT license), see internal.ts. The original package is not maintained any more and the original functionality will be replaced by own implementations over time (starting with the v7.1.3 release, October 2021).

  • arrayContainsArray
  • getBinarySize
  • stripHexPrefix
  • isHexPrefixed
  • isHexString
  • padToEven
  • fromAscii
  • fromUtf8
  • toUtf8
  • toAscii
  • getKeys

They can be imported by name:

import { stripHexPrefix } from '@ethereumjs/util'

EthereumJS

See our organizational documentation for an introduction to EthereumJS as well as information on current standards and best practices.

If you want to join for work or do improvements on the libraries have a look at our contribution guidelines.

LICENSE

MPL-2.0

Current Tags

  • 10.0.0-alpha.1                                ...           alpha (2 years ago)
  • 8.0.0-beta.3                                ...           beta (4 years ago)
  • 10.1.3                                ...           latest (3 months ago)
  • 10.1.1-nightly.2                                ...           nightly (10 months ago)
  • 10.0.0-rc.1                                ...           rc (2 years ago)

27 Versions

  • 10.1.3                                ...           3 months ago
  • 10.1.2                                ...           6 months ago
  • 10.1.1                                ...           10 months ago
  • 10.1.1-nightly.2                                ...           10 months ago
  • 10.1.1-nightly.1                                ...           a year ago
  • 10.1.0                                ...           a year ago
  • 10.0.0                                ...           2 years ago
  • 10.0.0-rc.1                                ...           2 years ago
  • 10.0.0-alpha.1                                ...           2 years ago
  • 9.1.0                                ...           2 years ago
  • 9.0.3                                ...           3 years ago
  • 9.0.2                                ...           3 years ago
  • 9.0.1                                ...           3 years ago
  • 9.0.0                                ...           3 years ago
  • 9.0.0-rc.1                                ...           3 years ago
  • 8.1.0                                ...           3 years ago
  • 8.0.6                                ...           4 years ago
  • 8.0.5                                ...           4 years ago
  • 8.0.4                                ...           4 years ago
  • 8.0.3                                ...           4 years ago
  • 8.0.2                                ...           4 years ago
  • 8.0.1                                ...           4 years ago
  • 8.0.0                                ...           4 years ago
  • 8.0.0-rc.1                                ...           4 years ago
  • 8.0.0-beta.3                                ...           4 years ago
  • 8.0.0-beta.2                                ...           4 years ago
  • 8.0.0-beta.1                                ...           4 years ago

© 2010 - cnpmjs.org x YWFE | Home | YWFE