1.5.3 • Published 6 years ago
ssz v1.5.3
ssz-js
Simple Serialize (SSZ) in pure Javascript
Install:
$ npm install ssz
Install mocha globally:
$ npm install -g mocha
Run tests:
$ npm test
Usage
Table of Contents
serialize
Simply Serializes (SSZ)
Parameters
value
(Buffer | array | number | object) Value to serialize: hash32 (Buffer) | address (Buffer) | int8/16/32 | bytes (Buffer) | array | objecttype
(string | object) A type string ('hash32', 'address', 'int8', 'int16', 'int32', 'bytes', 'bool', 'hash96', 'hash97'), or type array 'hash32', or type object containing fields property
Returns Buffer the byte output
deserialize
Simply Deserializes (SSZ)
Parameters
data
Buffer bytes (buffer) to deserializetype
(string | object) A type string ('hash32', 'address', 'int8', 'int16', 'int32', 'bytes', 'bool', 'hash96', 'hash97'), or type array 'hash32', or type object containing fields property
Returns (Buffer | array | number | object) deserialized value : hash32 (Buffer) | address (Buffer) | int8/16/32/64/256 | uint8/16/32/64/256 | bytes (Buffer) | array | object
eq
Checks if 2 simply serialized objects are equal (SSZ)
Parameters
Returns Bool the byte output
deepcopy
Returns a deep copy of a simply serialized object (SSZ)
Parameters
x
Buffer Value to deep copy
Returns Buffer the deep copy of x
Contributors
Very special thank you to Darren Langley for helping build this.