cfx-util
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

SYNOPSIS

NPM Package Actions Status

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

INSTALL

yarn add cfx-util or npm install cfx-util

USAGE

import assert from 'assert'
import { isValidChecksumAddress, unpad, BN } from 'cfx-util'
 
const address = '0x2F015C60E0be116B1f0CD534704Db9c92118FB6A'
assert.ok(isValidChecksumAddress(address))
 
assert.equal(unpad('0000000006600'), '6600')
 
assert.equal(new BN('dead', 16).add(new BN('101010', 2)), 57047)

API

Documentation

Modules

  • account
    • Private/public key and address-related functionality (creation, validation, conversion)
  • 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
    • Hash functions
  • object
    • Helper function for creating a binary object (DEPRECATED)
  • signature
    • Signing, signature validation, conversion, recovery
  • externals
    • Helper methods from ethjs-util
    • Re-exports of BN, rlp, secp256k1

ethjs-util methods

The following methods are available provided by ethjs-util:

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

Re-Exports

Additionally cfx-util re-exports a few commonly-used libraries. These include:

LICENSE

MPL-2.0

Readme

Keywords

Package Sidebar

Install

npm i cfx-util

Weekly Downloads

61

Version

0.0.4

License

MPL-2.0

Unpacked Size

107 kB

Total Files

36

Last publish

Collaborators

  • yqrashawn