Skip to content
This repository was archived by the owner on Jun 17, 2021. It is now read-only.

Commit 76c6771

Browse files
committed
update readme with examples and docs
1 parent ae4c300 commit 76c6771

File tree

3 files changed

+62
-9
lines changed

3 files changed

+62
-9
lines changed

README.md

Lines changed: 58 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,70 @@
55
[![Coverage Status](https://img.shields.io/coveralls/ethereumjs/ethereumjs-util.svg?style=flat-square)](https://coveralls.io/r/ethereumjs/ethereumjs-util)
66
[![Gitter](https://img.shields.io/gitter/room/ethereum/ethereumjs-lib.svg?style=flat-square)](https://gitter.im/ethereum/ethereumjs-lib) or #ethereumjs on freenode
77

8-
A collection of utility functions for ethereum. It can be used in node.js or can be in the browser with browserify.
8+
A collection of utility functions for Ethereum. It can be used in Node.js and in the browser with [browserify](http://browserify.org/).
9+
10+
# INSTALL
11+
12+
`npm install ethereumjs-util`
13+
14+
# USAGE
15+
16+
```js
17+
import assert from 'assert'
18+
import { isValidChecksumAddress, unpad, BN } from 'ethereumjs-util'
19+
20+
const address = '0x2F015C60E0be116B1f0CD534704Db9c92118FB6A'
21+
assert.ok(isValidChecksumAddress(address))
22+
23+
assert.equal(unpad('0000000006600'), '6600')
24+
25+
assert.equal(new BN('dead', 16).add(new BN('101010', 2)), 57047)
26+
```
927

1028
# API
1129

12-
[./docs/](./docs/README.md)
30+
## Documentation
31+
32+
### Modules
33+
34+
- [account](docs/modules/_account_.md)
35+
- Private/public key and address-related functionality (creation, validation, conversion)
36+
- [bytes](docs/modules/_bytes_.md)
37+
- Byte-related helper and conversion functions
38+
- [constants](docs/modules/_constants_.md)
39+
- Exposed constants
40+
- e.g. KECCAK256_NULL_S for string representation of Keccak-256 hash of null
41+
- [hash](docs/modules/_hash_.md)
42+
- Hash functions
43+
- [object](docs/modules/_object_.md)
44+
- Helper function for creating a binary object (`DEPRECATED`)
45+
- [signature](docs/modules/_signature_.md)
46+
- Signing, signature validation, conversion, recovery
47+
- [externals](docs/modules/_externals_.md)
48+
- Helper methods from `ethjs-util`
49+
- Re-exports of `BN`, `rlp`, `secp256k1`
50+
51+
### ethjs-util methods
52+
53+
The following methods are available provided by [ethjs-util](https://github.com/ethjs/ethjs-util):
1354

14-
Most of the string manipulation methods are provided by [ethjs-util](https://github.com/ethjs/ethjs-util)
55+
- arrayContainsArray
56+
- toBuffer
57+
- getBinarySize
58+
- stripHexPrefix
59+
- isHexPrefixed
60+
- isHexString
61+
- padToEven
62+
- intToHex
63+
- fromAscii
64+
- fromUtf8
65+
- toUtf8
66+
- toAscii
67+
- getKeys
1568

16-
---
69+
### Re-Exports
1770

18-
Additionally ethereumjs-util re-exports a few commonly-used libraries. These include:
71+
Additionally `ethereumjs-util` re-exports a few commonly-used libraries. These include:
1972

2073
- `BN` ([bn.js](https://github.com/indutny/bn.js))
2174
- `rlp` ([rlp](https://github.com/ethereumjs/rlp))

docs/modules/_externals_.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
# Module: "externals"
44

55
Re-exports commonly used modules:
6-
* Adds [`ethjsUtil`](https://github.com/ethjs/ethjs-util) methods.
7-
* Exports [`BN`](https://github.com/indutny/bn.js), [`rlp`](https://github.com/ethereumjs/rlp), [`secp256k1`](https://github.com/cryptocoinjs/secp256k1-node/)`.
6+
* Adds [`ethjs-util`](https://github.com/ethjs/ethjs-util) methods.
7+
* Exports [`BN`](https://github.com/indutny/bn.js), [`rlp`](https://github.com/ethereumjs/rlp), [`secp256k1`](https://github.com/cryptocoinjs/secp256k1-node/).

src/externals.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Re-exports commonly used modules:
3-
* * Adds [`ethjsUtil`](https://github.com/ethjs/ethjs-util) methods.
4-
* * Exports [`BN`](https://github.com/indutny/bn.js), [`rlp`](https://github.com/ethereumjs/rlp), [`secp256k1`](https://github.com/cryptocoinjs/secp256k1-node/)`.
3+
* * Adds [`ethjs-util`](https://github.com/ethjs/ethjs-util) methods.
4+
* * Exports [`BN`](https://github.com/indutny/bn.js), [`rlp`](https://github.com/ethereumjs/rlp), [`secp256k1`](https://github.com/cryptocoinjs/secp256k1-node/).
55
* @packageDocumentation
66
*/
77

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy