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

Commit 0d87acf

Browse files
authored
Merge pull request #145 from alcuadrado/typescript-migration
TypeScript migration
2 parents eb7ae3c + 3cbfb5e commit 0d87acf

39 files changed

+2921
-1502
lines changed

.babelrc

Lines changed: 0 additions & 4 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
dist/
2+
.idea/
3+
test-build/
14

25
# Created by https://www.gitignore.io/api/osx,node
36

.nycrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "@ethereumjs/config-nyc"
3+
}

.prettierignore

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

CHANGELOG.md

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,83 @@
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
## [1.3.7] - 2018-07-25
10-
- Fix bug causing ``FakeTransaction.from`` to not retrieve sender address from tx signature, see PR [#118](https://github.com/ethereumjs/ethereumjs-tx/pull/118)
10+
11+
- Fix bug causing `FakeTransaction.from` to not retrieve sender address from tx signature, see PR [#118](https://github.com/ethereumjs/ethereumjs-tx/pull/118)
1112

1213
[1.3.7]: https://github.com/ethereumjs/ethereumjs-tx/compare/v1.3.6...v1.3.7
1314

1415
## [1.3.6] - 2018-07-02
15-
- Fixes issue [#108](https://github.com/ethereumjs/ethereumjs-tx/issues/108) with the ``FakeTransaction.hash()`` function by reverting the introduced signature handling changes in Fake transaction hash creation from PR [#94](https://github.com/ethereumjs/ethereumjs-tx/pull/94) introduced in ``v1.3.5``. The signature is now again only created and added to the hash when ``from`` address is set and ``from`` is not defaulting to the zero adress any more, see PR [#110](https://github.com/ethereumjs/ethereumjs-tx/pull/110)
16+
17+
- Fixes issue [#108](https://github.com/ethereumjs/ethereumjs-tx/issues/108) with the `FakeTransaction.hash()` function by reverting the introduced signature handling changes in Fake transaction hash creation from PR [#94](https://github.com/ethereumjs/ethereumjs-tx/pull/94) introduced in `v1.3.5`. The signature is now again only created and added to the hash when `from` address is set and `from` is not defaulting to the zero adress any more, see PR [#110](https://github.com/ethereumjs/ethereumjs-tx/pull/110)
1618
- Added additional tests to cover issue described above
1719

1820
[1.3.6]: https://github.com/ethereumjs/ethereumjs-tx/compare/v1.3.5...v1.3.6
1921

2022
## [1.3.5] - 2018-06-22
21-
- Include signature by default in ``FakeTransaction.hash``, PR [#97](https://github.com/ethereumjs/ethereumjs-tx/pull/97)
22-
- Fix ``FakeTransaction`` signature failure bug, PR [#94](https://github.com/ethereumjs/ethereumjs-tx/pull/94)
23+
24+
- Include signature by default in `FakeTransaction.hash`, PR [#97](https://github.com/ethereumjs/ethereumjs-tx/pull/97)
25+
- Fix `FakeTransaction` signature failure bug, PR [#94](https://github.com/ethereumjs/ethereumjs-tx/pull/94)
2326

2427
[1.3.5]: https://github.com/ethereumjs/ethereumjs-tx/compare/v1.3.4...v1.3.5
2528

2629
## [1.3.4] - 2018-03-06
27-
- Fix a bug producing hash collisions on ``FakeTransaction`` for different senders, PR [#81](https://github.com/ethereumjs/ethereumjs-tx/pull/81)
28-
- Switched from deprecated ``es2015`` to ``env`` babel preset, PR [#86](https://github.com/ethereumjs/ethereumjs-tx/pull/86)
30+
31+
- Fix a bug producing hash collisions on `FakeTransaction` for different senders, PR [#81](https://github.com/ethereumjs/ethereumjs-tx/pull/81)
32+
- Switched from deprecated `es2015` to `env` babel preset, PR [#86](https://github.com/ethereumjs/ethereumjs-tx/pull/86)
2933
- Dropped Node 4 support
3034

3135
[1.3.4]: https://github.com/ethereumjs/ethereumjs-tx/compare/v1.3.3...v1.3.4
3236

3337
## [1.3.3] - 2017-07-12
34-
- Allow zeros in ``v``,``r``,``s`` signature values
35-
- Dropped ``browserify`` transform from ``package.json``
38+
39+
- Allow zeros in `v`,`r`,`s` signature values
40+
- Dropped `browserify` transform from `package.json`
3641
- (combined v1.3.3 and v1.3.2 release notes)
3742

3843
[1.3.3]: https://github.com/ethereumjs/ethereumjs-tx/compare/v1.3.1...v1.3.3
3944

4045
## [1.3.1] - 2017-05-13
41-
- Added ``ES5`` build
46+
47+
- Added `ES5` build
4248

4349
[1.3.1]: https://github.com/ethereumjs/ethereumjs-tx/compare/v1.3.0...v1.3.1
4450

4551
## [1.3.0] - 2017-04-24
4652

47-
- ``EIP155``: allow ``v`` value to be greater than one byte (replay attack protection)
48-
- Added ``browserify`` ``ES2015`` transform to ``package.json``
53+
- `EIP155`: allow `v` value to be greater than one byte (replay attack protection)
54+
- Added `browserify` `ES2015` transform to `package.json`
4955
- Improved documentation
5056
- (combined v1.3.0, v1.2.5 and v1.2.4 release notes)
5157

5258
[1.3.0]: https://github.com/ethereumjs/ethereumjs-tx/compare/v1.2.3...v1.3.0
5359

5460
## [1.2.3] - 2017-01-30
55-
- ``EIP155`` hash implementation
61+
62+
- `EIP155` hash implementation
5663
- README example and doc fixes
5764

5865
[1.2.3]: https://github.com/ethereumjs/ethereumjs-tx/compare/v1.2.2...v1.2.3
5966

6067
## [1.2.2] - 2016-12-15
61-
- Moved ``chainId`` param to ``txParams``, parse ``sig`` for ``chainId`` (``EIP155`` refactor)
68+
69+
- Moved `chainId` param to `txParams`, parse `sig` for `chainId` (`EIP155` refactor)
6270
- Test improvements
6371
- (combined v1.2.2 and v1.2.1 release notes)
6472

6573
[1.2.2]: https://github.com/ethereumjs/ethereumjs-tx/compare/v1.2.0...v1.2.2
6674

6775
## [1.2.0] - 2016-12-14
68-
- Added ``EIP155`` changes
69-
- Renamed ``chain_id`` to ``chainId``
76+
77+
- Added `EIP155` changes
78+
- Renamed `chain_id` to `chainId`
7079
- Node 4/5 compatibility
71-
- ``ES6`` standards
80+
- `ES6` standards
7281

7382
[1.2.0]: https://github.com/ethereumjs/ethereumjs-tx/compare/v1.1.4...v1.2.0
7483

README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
1-
# SYNOPSIS
1+
# SYNOPSIS
2+
23
[![NPM Package](https://img.shields.io/npm/v/ethereumjs-tx.svg?style=flat-square)](https://www.npmjs.org/package/ethereumjs-tx)
34
[![Build Status](https://travis-ci.org/ethereumjs/ethereumjs-tx.svg?branch=master)](https://travis-ci.org/ethereumjs/ethereumjs-tx)
45
[![Coverage Status](https://img.shields.io/coveralls/ethereumjs/ethereumjs-tx.svg?style=flat-square)](https://coveralls.io/r/ethereumjs/ethereumjs-tx)
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+
[![Gitter](https://img.shields.io/gitter/room/ethereum/ethereumjs-lib.svg?style=flat-square)](https://gitter.im/ethereum/ethereumjs-lib) or #ethereumjs on freenode
67

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

910
# INSTALL
11+
1012
`npm install ethereumjs-tx`
1113

1214
# USAGE
1315

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

1618
```javascript
1719
const EthereumTx = require('ethereumjs-tx')
18-
const privateKey = Buffer.from('e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109', 'hex')
20+
const privateKey = Buffer.from(
21+
'e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109',
22+
'hex',
23+
)
1924

2025
const txParams = {
2126
nonce: '0x00',
22-
gasPrice: '0x09184e72a000',
27+
gasPrice: '0x09184e72a000',
2328
gasLimit: '0x2710',
24-
to: '0x0000000000000000000000000000000000000000',
25-
value: '0x00',
29+
to: '0x0000000000000000000000000000000000000000',
30+
value: '0x00',
2631
data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057',
2732
// EIP 155 chainId - mainnet: 1, ropsten: 3
28-
chainId: 3
33+
chainId: 3,
2934
}
3035

3136
const tx = new EthereumTx(txParams)
@@ -35,12 +40,14 @@ const serializedTx = tx.serialize()
3540

3641
**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.
3742

43+
# BROWSER
3844

39-
# BROWSER
4045
For a browser build please see https://github.com/ethereumjs/browser-builds.
4146

4247
# API
43-
[./docs/](./docs/index.md)
48+
49+
[./docs/](./docs/README.md)
4450

4551
# LICENSE
46-
[MPL-2.0](https://tldrlegal.com/license/mozilla-public-license-2.0-(mpl-2))
52+
53+
[MPL-2.0](<https://tldrlegal.com/license/mozilla-public-license-2.0-(mpl-2)>)

docs/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# ethereumjs-tx
2+
3+
## Index
4+
5+
### Classes
6+
7+
- [FakeTransaction](classes/faketransaction.md)
8+
- [Transaction](classes/transaction.md)
9+
10+
### Interfaces
11+
12+
- [FakeTxData](interfaces/faketxdata.md)
13+
- [TransactionOptions](interfaces/transactionoptions.md)
14+
- [TransformableToBuffer](interfaces/transformabletobuffer.md)
15+
- [TxData](interfaces/txdata.md)
16+
17+
### Type aliases
18+
19+
- [BufferLike](#bufferlike)
20+
- [PrefixedHexString](#prefixedhexstring)
21+
22+
---
23+
24+
## Type aliases
25+
26+
<a id="bufferlike"></a>
27+
28+
### BufferLike
29+
30+
**Ƭ BufferLike**: _`Buffer` \| [TransformableToBuffer](interfaces/transformabletobuffer.md) \| [PrefixedHexString](#prefixedhexstring) \| `number`_
31+
32+
_Defined in [types.ts:19](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L19)_
33+
34+
A Buffer, hex string prefixed with `0x`, Number, or an object with a toBuffer method such as BN.
35+
36+
---
37+
38+
<a id="prefixedhexstring"></a>
39+
40+
### PrefixedHexString
41+
42+
**Ƭ PrefixedHexString**: _`string`_
43+
44+
_Defined in [types.ts:14](https://github.com/alcuadrado/ethereumjs-tx/blob/84f5b82/src/types.ts#L14)_
45+
46+
A hex string prefixed with `0x`.
47+
48+
---

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