This package has been deprecated

Author message:

Use @chainsafesytems/ssz instead

ssz

1.5.3 • Public • Published

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

src/index.js:13-116

Simply Serializes (SSZ)

Parameters

  • value (Buffer | array | number | object) Value to serialize: hash32 (Buffer) | address (Buffer) | int8/16/32 | bytes (Buffer) | array | object
  • type (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

src/index.js:125-252

Simply Deserializes (SSZ)

Parameters

  • data Buffer bytes (buffer) to deserialize
  • type (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

src/index.js:261-265

Checks if 2 simply serialized objects are equal (SSZ)

Parameters

  • x Buffer simply serialized object
  • y Buffer simply serialized object

Returns Bool the byte output

deepcopy

src/index.js:273-276

Returns a deep copy of a simply serialized object (SSZ)

Parameters

Returns Buffer the deep copy of x

Contributors

Very special thank you to Darren Langley for helping build this.

Package Sidebar

Install

npm i ssz

Weekly Downloads

10

Version

1.5.3

License

MIT

Unpacked Size

67.6 kB

Total Files

14

Last publish

Collaborators

  • sadiq1971
  • ansermino
  • gregthegreek
  • priom
  • wemeetagain
  • mpetrunic
  • mikerah