Skip to content
This repository has been archived by the owner on Jan 11, 2022. It is now read-only.

Typescript rewrite #37

Merged
merged 25 commits into from
Dec 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e81acfd
rlp with types
GrandSchtroumpf Nov 4, 2018
fe3de99
remove build artifacts from git
krzkaczor Nov 4, 2018
3a46949
Merge pull request #38 from ethereumjs/kk/typescript-fixes
krzkaczor Nov 5, 2018
b4ce46a
rewrote tests to typescript, improved typings
krzkaczor Nov 6, 2018
664057b
migrate to NYC
krzkaczor Nov 7, 2018
d1272cc
Merge pull request #39 from ethereumjs/kk/typescript-tests
holgerd77 Nov 8, 2018
ae43927
add liting and formatting tools and configs
krzkaczor Nov 10, 2018
7fee55a
tslint fixes
krzkaczor Nov 13, 2018
a747c77
reformat the project
krzkaczor Nov 13, 2018
507fbd3
Merge pull request #41 from ethereumjs/kk/linting+prettier
holgerd77 Nov 13, 2018
f4069f4
Add test for issue#35
GrandSchtroumpf Nov 14, 2018
46ff94e
Merge pull request #43 from ethereumjs/issue#35
GrandSchtroumpf Nov 14, 2018
99984a1
remove dependencies on yarn
krzkaczor Nov 19, 2018
3bd7c4d
remove js files
krzkaczor Nov 19, 2018
943abb8
Merge pull request #44 from ethereumjs/kk/cleanup
holgerd77 Nov 19, 2018
e579986
use config extracted to ethereum-config package
krzkaczor Nov 26, 2018
227f0be
fix package manifest, proper build
krzkaczor Nov 26, 2018
9a082d0
update to new ethereumjs-config packages
krzkaczor Dec 8, 2018
5423792
add real packages as dependencies, reformat codebase
krzkaczor Dec 13, 2018
21b1654
fix build task, add build on CI
krzkaczor Dec 13, 2018
f512289
Merge pull request #45 from ethereumjs/kk/config-export
krzkaczor Dec 13, 2018
9107735
remove custom util functions, use already existing ones
krzkaczor Dec 13, 2018
1122ba4
Merge pull request #48 from ethereumjs/kk/remove-utils
krzkaczor Dec 13, 2018
db7984a
remove standard code style bardge, normalize headers in readme
krzkaczor Dec 13, 2018
a3c8ded
Merge pull request #49 from ethereumjs/kk/readme-update
holgerd77 Dec 14, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,5 @@ package-lock.json



dist
.nyc_output
3 changes: 3 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@ethereumjs/config-nyc"
}
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
.vscode
package.json
dist
.nyc_output
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ matrix:
- os: linux
node_js: "6"
env: TEST_SUITE=lint
- os: linux
node_js: "6"
env: TEST_SUITE=build
script: npm run $TEST_SUITE
25 changes: 16 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Changelog

All notable changes to this project will be documented in this file.

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


## [v2.1.0] - 2018-06-28

- Updated supported Node versions, PR [#13](https://github.com/ethereumjs/rlp/pull/13)
- Switched to ``safe-buffer`` for backwards compatibility, PR [#18](https://github.com/ethereumjs/rlp/pull/18)
- Switched to `safe-buffer` for backwards compatibility, PR [#18](https://github.com/ethereumjs/rlp/pull/18)
- Increased test coverage, PR [#22](https://github.com/ethereumjs/rlp/pull/22)
- Example code tweaks, PR [#12](https://github.com/ethereumjs/rlp/pull/12)
- Fix test runs on Windows, Issue [#7](https://github.com/ethereumjs/rlp/issues/7)
Expand All @@ -17,33 +18,39 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
[v2.1.0]: https://github.com/ethereumjs/rlp/compare/2.0.0...v2.1.0

## [2.0.0] - 2015-09-23
- User ``Buffer`` values as input for encoding

- User `Buffer` values as input for encoding

[2.0.0]: https://github.com/ethereumjs/rlp/compare/1.1.2...2.0.0

## [1.1.2] - 2015-09-22

- Fix zero encoding

[1.1.2]: https://github.com/ethereumjs/rlp/compare/1.1.1...1.1.2

## [1.1.1] - 2015-09-21
- Fixes for ``bin``

- Fixes for `bin`

[1.1.1]: https://github.com/ethereumjs/rlp/compare/1.1.0...1.1.1

## [1.1.0] - 2015-09-21
- Added ``getLength()`` method
- Added hex prefix stripping (``isHexPrefix()`` / ``stripHexPrefix()``)

- Added `getLength()` method
- Added hex prefix stripping (`isHexPrefix()` / `stripHexPrefix()`)
- Code formatting clean-ups

[1.1.0]: https://github.com/ethereumjs/rlp/compare/1.0.1...1.1.0

## [1.0.1] - 2015-06-27

- Code formatting clean-ups

[1.0.1]: https://github.com/ethereumjs/rlp/compare/1.0.0...1.0.1

## [1.0.0] - 2015-06-06

- Added check for invalid 0
- Hardened rlp

Expand All @@ -53,4 +60,4 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

- [0.0.14](https://github.com/ethereumjs/rlp/compare/0.0.13...0.0.14) - 2015-03-31
- [0.0.13](https://github.com/ethereumjs/rlp/compare/0.0.12...0.0.13) - 2015-03-30
- [0.0.12](https://github.com/ethereumjs/rlp/compare/0.0.11...0.0.12) - 2014-12-26
- [0.0.12](https://github.com/ethereumjs/rlp/compare/0.0.11...0.0.12) - 2014-12-26
52 changes: 23 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,47 @@
SYNOPSIS
=====
# SYNOPSIS

[![NPM Package](https://img.shields.io/npm/v/rlp.svg?style=flat-square)](https://www.npmjs.org/package/rlp)
[![Build Status](https://img.shields.io/travis/ethereumjs/rlp.svg?branch=master&style=flat-square)](https://travis-ci.org/ethereumjs/rlp)
[![Coverage Status](https://img.shields.io/coveralls/ethereumjs/rlp.svg?style=flat-square)](https://coveralls.io/r/ethereumjs/rlp)
[![Gitter](https://img.shields.io/gitter/room/ethereum/ethereumjs-lib.svg?style=flat-square)](https://gitter.im/ethereum/ethereumjs-lib) or #ethereumjs on freenode

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


[Recursive Length](https://github.com/ethereum/wiki/wiki/RLP) Prefix Encoding for node.js.

INSTALL
======
`npm install rlp`
## INSTALL

`npm install rlp`

install with `-g` if you want to use the cli.

USAGE
=======
## USAGE

```javascript
var RLP = require('rlp');
var assert = require('assert');

var nestedList = [ [], [[]], [ [], [[]] ] ];
var encoded = RLP.encode(nestedList);
var decoded = RLP.decode(encoded);
assert.deepEqual(nestedList, decoded);

var RLP = require('rlp')
var assert = require('assert')

var nestedList = [[], [[]], [[], [[]]]]
var encoded = RLP.encode(nestedList)
var decoded = RLP.decode(encoded)
assert.deepEqual(nestedList, decoded)
```

API
=====
## API

`rlp.encode(plain)` - RLP encodes an `Array`, `Buffer` or `String` and returns a `Buffer`.

`rlp.decode(encoded, [skipRemainderCheck=false])` - Decodes an RLP encoded `Buffer`, `Array` or `String` and returns a `Buffer` or an `Array` of `Buffers`. If `skipRemainderCheck` is enabled, `rlp` will just decode the first rlp sequence in the buffer. By default, it would throw an error if there are more bytes in Buffer than used by rlp sequence.

CLI
===
`rlp decode <hex string>`
`rlp encode <json String>`
## CLI

`rlp decode <hex string>`
`rlp encode <json String>`

## TESTS

Test uses mocha. To run tests and linting: `npm test`. To auto fix linting problems use: `npm run test:fix`.

TESTS
=====
Test uses mocha. To run `npm test`
## CODE COVERAGE

CODE COVERAGE
=============
Install dev dependencies
`npm install`

Expand Down
2 changes: 1 addition & 1 deletion bin/rlp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node

const rlp = require('../index.js')
const rlp = require('./dist/index.js')
const command = process.argv[2]
var raw = process.argv[3]

Expand Down
Loading