2.0.6 • Published 2 years ago

@zoltu/rlp-encoder v2.0.6

Weekly downloads
5
License
Unlicense
Repository
github
Last release
2 years ago

RLP Encoder

A 0-depnedency simple RLP encoder that only encodes Uint8Arrays and arrays of them (including nested). It is up to the user to appropriately convert their numbers, bigints, strings, etc. into Uint8Arrays since the RLP specification does not prescribe how such things are encoded prior to being RLP encoded.

Usage

npm install @zoltu/rlp-encoder
const input = [
	[new Uint8Array([0x6b, 0x65, 0x79, 0x31]), new Uint8Array([0x76, 0x61, 0x6c, 0x31])],
	[new Uint8Array([0x6b, 0x65, 0x79, 0x32]), new Uint8Array([0x76, 0x61, 0x6c, 0x32])],
	[new Uint8Array([0x6b, 0x65, 0x79, 0x33]), new Uint8Array([0x76, 0x61, 0x6c, 0x33])],
	[new Uint8Array([0x6b, 0x65, 0x79, 0x34]), new Uint8Array([0x76, 0x61, 0x6c, 0x34])],
]
const actual = rlpEncode(input) // [0xec, 0xca, 0x84, 0x6b, 0x65, 0x79, 0x31, 0x84, 0x76, 0x61, 0x6c, 0x31, 0xca, 0x84, 0x6b, 0x65, 0x79, 0x32, 0x84, 0x76, 0x61, 0x6c, 0x32, 0xca, 0x84, 0x6b, 0x65, 0x79, 0x33, 0x84, 0x76, 0x61, 0x6c, 0x33, 0xca, 0x84, 0x6b, 0x65, 0x79, 0x34, 0x84, 0x76, 0x61, 0x6c, 0x34] as Uint8Array
2.0.5

2 years ago

2.0.4

2 years ago

2.0.6

2 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

1.1.0

4 years ago

2.0.0

4 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago