Skip to content
This repository was archived by the owner on Apr 6, 2020. It is now read-only.

Commit f0234ab

Browse files
authored
Merge pull request #157 from ethereumjs/new-release-v200
New release v2.0.0
2 parents 5b72ca6 + 451b2da commit f0234ab

11 files changed

+268
-134
lines changed

CHANGELOG.md

+62
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,68 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
(modification: no type change headlines) and this project adheres to
77
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).
88

9+
## [2.0.0] - 2019-06-03
10+
11+
**TypeScript / Module Import / Node Support**
12+
13+
First `TypeScript` based release of the library, see
14+
PR [#145](https://github.com/ethereumjs/ethereumjs-tx/pull/145) for details.
15+
16+
This comes along with some changes on the API, Node import of the exposed
17+
classes now goes like this:
18+
19+
```javascript
20+
const EthereumTx = require('ethereumjs-transaction').Transaction
21+
const FakeEthereumTx = require('ethereumjs-transaction').FakeTransaction
22+
```
23+
24+
The library now also comes with a **type declaration file** distributed along
25+
with the package published.
26+
27+
Along with this release we drop official support for `Node` versions `4`,`5`
28+
and `6`. Officially tested versions are now `Node` `8`, `10` and `11`
29+
(see PRs [#138](https://github.com/ethereumjs/ethereumjs-tx/pull/138) and
30+
[#146](https://github.com/ethereumjs/ethereumjs-tx/pull/146)).
31+
32+
**Hardfork Support / Official Test Updates**
33+
34+
Along with a long overdue update of the official Ethereum Transaction tests
35+
(see PRs [#131](https://github.com/ethereumjs/ethereumjs-tx/pull/131) and
36+
[#138](https://github.com/ethereumjs/ethereumjs-tx/pull/138) for
37+
`FakeTransaction`) and
38+
an introduction of setting chain and hardfork by using our shared
39+
[ethereumjs-common](https://github.com/ethereumjs/ethereumjs-common) class
40+
(see PR [#131](https://github.com/ethereumjs/ethereumjs-tx/pull/130)) the
41+
transaction library now supports all HFs up to the `Petersburg` hardfork,
42+
see [constructor option docs](https://github.com/ethereumjs/ethereumjs-tx/blob/master/docs/interfaces/transactionoptions.md) for information on instantiation and default values (current hardfork default: `petersburg`).
43+
44+
API Changes:
45+
46+
- Removal of the `data.chainId` parameter, use the `opts.chain` parameter or a custom `Common` instance
47+
48+
**Default EIP-155 Support**
49+
50+
Along with defaulting to a post-`Spurious Dragon` HF replay protection from
51+
[EIP-155](https://eips.ethereum.org/EIPS/eip-155) is now activated by default. Transactions are subsequently also by default signed with `EIP-155` replay protection,
52+
see PRs [#153](https://github.com/ethereumjs/ethereumjs-tx/pull/153),
53+
[#147](https://github.com/ethereumjs/ethereumjs-tx/pull/147) and
54+
[#143](https://github.com/ethereumjs/ethereumjs-tx/pull/143).
55+
56+
This comes with some changes in how different `v` values passed on instantation
57+
or changed on runtime are handled:
58+
59+
- The constructor throws if the `v` value is present, indicates that `EIP-155`
60+
was enabled, and the chain id it indicates doesn't match the one of the
61+
internal `common` object
62+
- No default `v` is set. If a transaction isn't signed, it would be an empty
63+
buffer
64+
- If `v` is changed after construction its value is validated in its setter
65+
66+
For activating non-`EIP-155` behavior instantiate the transaction with a
67+
pre-`Spurious Dragon` hardfork option.
68+
69+
[2.0.0]: https://github.com/ethereumjs/ethereumjs-tx/compare/v1.3.7...v2.0.0
70+
971
## [1.3.7] - 2018-07-25
1072

1173
- Fix bug causing `FakeTransaction.from` to not retrieve sender address from tx signature, see PR [#118](https://github.com/ethereumjs/ethereumjs-tx/pull/118)

README.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111

1212
# USAGE
1313

14-
- [example](https://github.com/ethereumjs/ethereumjs-tx/blob/master/examples/transactions.js)
14+
- [example](https://github.com/ethereumjs/ethereumjs-tx/blob/master/examples/transactions.ts)
1515

1616
```javascript
17-
const EthereumTx = require('ethereumjs-tx')
17+
const EthereumTx = require('ethereumjs-tx').Transaction
1818
const privateKey = Buffer.from(
1919
'e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109',
2020
'hex',
@@ -34,11 +34,14 @@ tx.sign(privateKey)
3434
const serializedTx = tx.serialize()
3535
```
3636

37-
**Note:** this package expects ECMAScript 6 (ES6) as a minimum environment. From browsers lacking ES6 support, please use a shim (like [es6-shim](https://github.com/paulmillr/es6-shim)) before including any of the builds from this repo.
37+
# Chain and Hardfork Support
3838

39-
# BROWSER
39+
This library uses the [ethereumjs-common](https://github.com/ethereumjs/ethereumjs-common)
40+
package to support different chain and hardfork options, see API documentation
41+
for details.
4042

41-
For a browser build please see https://github.com/ethereumjs/browser-builds.
43+
Currently all hardforks up to `petersburg` are supported, `EIP-155` replay protection
44+
is activated since the `spuriousDragon` hardfork.
4245

4346
# API
4447

docs/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
**Ƭ BufferLike**: _`Buffer` \| [TransformableToBuffer](interfaces/transformabletobuffer.md) \| [PrefixedHexString](#prefixedhexstring) \| `number`_
3131

32-
_Defined in [types.ts:19](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L19)_
32+
_Defined in [types.ts:19](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L19)_
3333

3434
A Buffer, hex string prefixed with `0x`, Number, or an object with a toBuffer method such as BN.
3535

@@ -41,7 +41,7 @@ A Buffer, hex string prefixed with `0x`, Number, or an object with a toBuffer me
4141

4242
**Ƭ PrefixedHexString**: _`string`_
4343

44-
_Defined in [types.ts:14](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L14)_
44+
_Defined in [types.ts:14](https://github.com/ethereumjs/ethereumjs-tx/blob/5b72ca6/src/types.ts#L14)_
4545

4646
A hex string prefixed with `0x`.
4747

0 commit comments

Comments
 (0)