1.5.3 • Published 7 years ago
ssz v1.5.3
ssz-js
Simple Serialize (SSZ) in pure Javascript
Install:
$ npm install sszInstall mocha globally:
$ npm install -g mochaRun tests:
$ npm testUsage
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
dataBuffer 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
xBuffer Value to deep copy
Returns Buffer the deep copy of x
Contributors
Very special thank you to Darren Langley for helping build this.