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

Commit 153b7c3

Browse files
authored
Merge pull request #170 from ethereumjs/typescript
Migrate to typescript
2 parents fb864da + 0c322f6 commit 153b7c3

13 files changed

+1799
-1420
lines changed

.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
.vscode
3+
package.json
4+
dist
5+
.nyc_output
6+
test/testdata
7+
docs

CHANGELOG.md

Lines changed: 56 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,117 @@
11
# Changelog
2+
23
All notable changes to this project will be documented in this file.
34

4-
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5-
(modification: no type change headlines) and this project adheres to
5+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
6+
(modification: no type change headlines) and this project adheres to
67
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).
78

8-
99
## [6.0.0] - 2018-10-08
10-
- Support for ``EIP-155`` replay protection by adding an optional ``chainId`` parameter
11-
to ``ecsign()``, ``ecrecover()``, ``toRpcSig()`` and ``isValidSignature()``, if present the
12-
new signature format relying on the ``chainId`` is used, see PR [#143](https://github.com/ethereumjs/ethereumjs-util/pull/143)
13-
- New ``generateAddress2()`` for ``CREATE2`` opcode (``EIP-1014``) address creation
10+
11+
- Support for `EIP-155` replay protection by adding an optional `chainId` parameter
12+
to `ecsign()`, `ecrecover()`, `toRpcSig()` and `isValidSignature()`, if present the
13+
new signature format relying on the `chainId` is used, see PR [#143](https://github.com/ethereumjs/ethereumjs-util/pull/143)
14+
- New `generateAddress2()` for `CREATE2` opcode (`EIP-1014`) address creation
1415
(Constantinople HF), see PR [#146](https://github.com/ethereumjs/ethereumjs-util/pull/146)
15-
- [BREAKING] Fixed signature to comply with Geth and Parity in ``toRpcSig()`` changing
16-
``v`` from 0/1 to 27/28, this changes the resulting signature buffer, see PR [#139](https://github.com/ethereumjs/ethereumjs-util/pull/139)
17-
- [BREAKING] Remove deprecated ``sha3``-named constants and methods (see ``v5.2.0`` release),
16+
- [BREAKING] Fixed signature to comply with Geth and Parity in `toRpcSig()` changing
17+
`v` from 0/1 to 27/28, this changes the resulting signature buffer, see PR [#139](https://github.com/ethereumjs/ethereumjs-util/pull/139)
18+
- [BREAKING] Remove deprecated `sha3`-named constants and methods (see `v5.2.0` release),
1819
see PR [#154](https://github.com/ethereumjs/ethereumjs-util/pull/154)
1920

2021
[6.0.0]: https://github.com/ethereumjs/ethereumjs-util/compare/v5.2.0...v6.0.0
2122

2223
## [5.2.0] - 2018-04-27
23-
- Rename all ``sha3`` hash related constants and functions to ``keccak``, see
24+
25+
- Rename all `sha3` hash related constants and functions to `keccak`, see
2426
[this](https://github.com/ethereum/EIPs/issues/59) EIP discussion for context
2527
(tl;dr: Ethereum uses a slightly different hash algorithm then in the official
26-
``SHA-3`` standard)
28+
`SHA-3` standard)
2729
- Renamed constants:
28-
- ``SHA3_NULL_S`` -> ``KECCAK256_NULL_S``
29-
- ``SHA3_NULL`` -> ``KECCAK256_NULL``
30-
- ``SHA3_RLP_ARRAY_S`` -> ``KECCAK256_RLP_ARRAY_S``
31-
- ``SHA3_RLP_ARRAY`` -> ``KECCAK256_RLP_ARRAY``
32-
- ``SHA3_RLP_S`` -> ``KECCAK256_RLP_S``
33-
- ``SHA3_RLP`` -> ``KECCAK256_RLP``
30+
- `SHA3_NULL_S` -> `KECCAK256_NULL_S`
31+
- `SHA3_NULL` -> `KECCAK256_NULL`
32+
- `SHA3_RLP_ARRAY_S` -> `KECCAK256_RLP_ARRAY_S`
33+
- `SHA3_RLP_ARRAY` -> `KECCAK256_RLP_ARRAY`
34+
- `SHA3_RLP_S` -> `KECCAK256_RLP_S`
35+
- `SHA3_RLP` -> `KECCAK256_RLP`
3436
- Renamed functions:
35-
- ``sha3()`` -> ``keccak()`` (number of bits determined in arguments)
36-
- New ``keccak256()`` alias function for ``keccak(a, 256)``
37-
- The usage of the ``sha``-named versions is now ``DEPRECATED`` and the related
38-
constants and functions will be removed on the next major release ``v6.0.0``
37+
- `sha3()` -> `keccak()` (number of bits determined in arguments)
38+
- New `keccak256()` alias function for `keccak(a, 256)`
39+
- The usage of the `sha`-named versions is now `DEPRECATED` and the related
40+
constants and functions will be removed on the next major release `v6.0.0`
3941

4042
[5.2.0]: https://github.com/ethereumjs/ethereumjs-util/compare/v5.1.5...v5.2.0
4143

4244
## [5.1.5] - 2018-02-28
43-
- Fix ``browserify`` issue leading to 3rd-party build problems, PR [#119](https://github.com/ethereumjs/ethereumjs-util/pull/119)
45+
46+
- Fix `browserify` issue leading to 3rd-party build problems, PR [#119](https://github.com/ethereumjs/ethereumjs-util/pull/119)
4447

4548
[5.1.5]: https://github.com/ethereumjs/ethereumjs-util/compare/v5.1.4...v5.1.5
4649

4750
## [5.1.4] - 2018-02-03
48-
- Moved to ``ES5`` Node distribution version for easier toolchain integration, PR [#114](https://github.com/ethereumjs/ethereumjs-util/pull/114)
49-
- Updated ``isPrecompile()`` with Byzantium precompile address range, PR [#115](https://github.com/ethereumjs/ethereumjs-util/pull/115)
51+
52+
- Moved to `ES5` Node distribution version for easier toolchain integration, PR [#114](https://github.com/ethereumjs/ethereumjs-util/pull/114)
53+
- Updated `isPrecompile()` with Byzantium precompile address range, PR [#115](https://github.com/ethereumjs/ethereumjs-util/pull/115)
5054

5155
[5.1.4]: https://github.com/ethereumjs/ethereumjs-util/compare/v5.1.3...v5.1.4
5256

5357
## [5.1.3] - 2018-01-03
54-
- ``ES6`` syntax updates
55-
- Dropped Node ``5`` support
56-
- Moved babel to dev dependencies, switched to ``env`` preset
57-
- Usage of ``safe-buffer`` instead of Node ``Buffer``
58-
- Do not allow capital ``0X`` as valid address in ``isValidAddress()``
59-
- New methods ``zeroAddress()`` and ``isZeroAddress()``
58+
59+
- `ES6` syntax updates
60+
- Dropped Node `5` support
61+
- Moved babel to dev dependencies, switched to `env` preset
62+
- Usage of `safe-buffer` instead of Node `Buffer`
63+
- Do not allow capital `0X` as valid address in `isValidAddress()`
64+
- New methods `zeroAddress()` and `isZeroAddress()`
6065
- Updated dependencies
6166

6267
[5.1.3]: https://github.com/ethereumjs/ethereumjs-util/compare/v5.1.2...v5.1.3
6368

6469
## [5.1.2] - 2017-05-31
65-
- Add browserify for ``ES2015`` compatibility
70+
71+
- Add browserify for `ES2015` compatibility
6672
- Fix hex validation
6773

6874
[5.1.2]: https://github.com/ethereumjs/ethereumjs-util/compare/v5.1.1...v5.1.2
6975

7076
## [5.1.1] - 2017-02-10
71-
- Use hex utils from ``ethjs-util``
77+
78+
- Use hex utils from `ethjs-util`
7279
- Move secp vars into functions
7380
- Dependency updates
7481

7582
[5.1.1]: https://github.com/ethereumjs/ethereumjs-util/compare/v5.1.0...v5.1.1
7683

7784
## [5.1.0] - 2017-02-04
78-
- Fix ``toRpcSig()`` function
79-
- Updated Buffer creation (``Buffer.from``)
85+
86+
- Fix `toRpcSig()` function
87+
- Updated Buffer creation (`Buffer.from`)
8088
- Dependency updates
8189
- Fix npm error
82-
- Use ``keccak`` package instead of ``keccakjs``
83-
- Helpers for ``eth_sign`` RPC call
90+
- Use `keccak` package instead of `keccakjs`
91+
- Helpers for `eth_sign` RPC call
8492

8593
[5.1.0]: https://github.com/ethereumjs/ethereumjs-util/compare/v5.0.1...v5.1.0
8694

8795
## [5.0.1] - 2016-11-08
88-
- Fix ``bufferToHex()``
96+
97+
- Fix `bufferToHex()`
8998

9099
[5.0.1]: https://github.com/ethereumjs/ethereumjs-util/compare/v5.0.0...v5.0.1
91100

92101
## [5.0.0] - 2016-11-08
93-
- Added ``isValidSignature()`` (ECDSA signature validation)
94-
- Change ``v`` param in ``ecrecover()`` from ``Buffer`` to ``int`` (breaking change!)
102+
103+
- Added `isValidSignature()` (ECDSA signature validation)
104+
- Change `v` param in `ecrecover()` from `Buffer` to `int` (breaking change!)
95105
- Fix property alias for setting with initial parameters
96-
- Reject invalid signature lengths for ``fromRpcSig()``
97-
- Fix ``sha3()`` ``width`` param (byte -> bit)
98-
- Fix overflow bug in ``bufferToInt()``
106+
- Reject invalid signature lengths for `fromRpcSig()`
107+
- Fix `sha3()` `width` param (byte -> bit)
108+
- Fix overflow bug in `bufferToInt()`
99109

100110
[5.0.0]: https://github.com/ethereumjs/ethereumjs-util/compare/v4.5.0...v5.0.0
101111

102112
## [4.5.0] - 2016-17-12
103-
- Introduced ``toMessageSig()`` and ``fromMessageSig()``
113+
114+
- Introduced `toMessageSig()` and `fromMessageSig()`
104115

105116
[4.5.0]: https://github.com/ethereumjs/ethereumjs-util/compare/v4.4.1...v4.5.0
106117

@@ -113,4 +124,4 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
113124
- [4.2.0](https://github.com/ethereumjs/ethereumjs-util/compare/v4.1.0...v4.2.0) - 2016-03-18
114125
- [4.1.0](https://github.com/ethereumjs/ethereumjs-util/compare/v4.0.0...v4.1.0) - 2016-03-08
115126
- [4.0.0](https://github.com/ethereumjs/ethereumjs-util/compare/v3.0.0...v4.0.0) - 2016-02-02
116-
- [3.0.0](https://github.com/ethereumjs/ethereumjs-util/compare/v2.0.0...v3.0.0) - 2016-01-20
127+
- [3.0.0](https://github.com/ethereumjs/ethereumjs-util/compare/v2.0.0...v3.0.0) - 2016-01-20

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
# SYNOPSIS
2+
23
[![NPM Package](https://img.shields.io/npm/v/ethereumjs-util.svg?style=flat-square)](https://www.npmjs.org/package/ethereumjs-util)
34
[![Build Status](https://img.shields.io/travis/ethereumjs/ethereumjs-util.svg?branch=master&style=flat-square)](https://travis-ci.org/ethereumjs/ethereumjs-util)
45
[![Coverage Status](https://img.shields.io/coveralls/ethereumjs/ethereumjs-util.svg?style=flat-square)](https://coveralls.io/r/ethereumjs/ethereumjs-util)
5-
[![Gitter](https://img.shields.io/gitter/room/ethereum/ethereumjs-lib.svg?style=flat-square)](https://gitter.im/ethereum/ethereumjs-lib) or #ethereumjs on freenode
6-
7-
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
8-
6+
[![Gitter](https://img.shields.io/gitter/room/ethereum/ethereumjs-lib.svg?style=flat-square)](https://gitter.im/ethereum/ethereumjs-lib) or #ethereumjs on freenode
97

8+
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
109

1110
A collection of utility functions for ethereum. It can be used in node.js or can be in the browser with browserify.
1211

1312
# API
14-
[./docs/](./docs/index.md)
13+
14+
[./docs/](./docs/README.md)
1515

1616
Most of the string manipulation methods are provided by [ethjs-util](https://github.com/ethjs/ethjs-util)
1717

18+
---
19+
20+
Additionally ethereumjs-util re-exports a few commonly-used libraries. These include:
21+
22+
- `BN` ([bn.js](https://github.com/indutny/bn.js))
23+
- `rlp` ([rlp](https://github.com/ethereumjs/rlp))
24+
- `secp256k1` ([secp256k1](https://github.com/cryptocoinjs/secp256k1-node/))
25+
1826
# LICENSE
27+
1928
MPL-2.0

0 commit comments

Comments
 (0)