rlp

  • Version 3.0.0
  • Published
  • 49.7 kB
  • No dependencies
  • MPL-2.0 license

Install

npm i rlp
yarn add rlp
pnpm add rlp

Overview

Recursive Length Prefix Encoding Module

Index

Variables

variable RLP

const RLP: { encode: typeof encode; decode: typeof decode };

    variable utils

    const utils: {
    bytesToHex: typeof bytesToHex;
    concatBytes: typeof concatBytes;
    hexToBytes: typeof hexToBytes;
    utf8ToBytes: typeof utf8ToBytes;
    };

      Functions

      function bytesToHex

      bytesToHex: (uint8a: Uint8Array) => string;

        function concatBytes

        concatBytes: (...arrays: Uint8Array[]) => Uint8Array;
        • Concatenates two Uint8Arrays into one.

        function decode

        decode: {
        (input: Input, stream?: false): Uint8Array | NestedUint8Array;
        (input: Input, stream?: true): Decoded;
        };
        • RLP Decoding based on https://eth.wiki/en/fundamentals/rlp

          Parameter input

          Will be converted to Uint8Array

          Parameter stream

          Is the input a stream (false by default)

          Returns

          decoded Array of Uint8Arrays containing the original message

        function encode

        encode: (input: Input) => Uint8Array;
        • RLP Encoding based on https://eth.wiki/en/fundamentals/rlp This function takes in data, converts it to Uint8Array if not, and adds a length for recursion.

          Parameter input

          Will be converted to Uint8Array

          Returns

          Uint8Array of encoded data

        function hexToBytes

        hexToBytes: (hex: string) => Uint8Array;

          function utf8ToBytes

          utf8ToBytes: (utf: string) => Uint8Array;

            Interfaces

            interface Decoded

            interface Decoded {}

              property data

              data: Uint8Array | NestedUint8Array;

                property remainder

                remainder: Uint8Array;

                  Type Aliases

                  type Input

                  type Input = string | number | bigint | Uint8Array | Array<Input> | null | undefined;

                    type NestedUint8Array

                    type NestedUint8Array = Array<Uint8Array | NestedUint8Array>;

                      Package Files (1)

                      Dependencies (0)

                      No dependencies.

                      Dev Dependencies (12)

                      Peer Dependencies (0)

                      No peer dependencies.

                      Badge

                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/rlp.

                      • Markdown
                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/rlp)
                      • HTML
                        <a href="https://www.jsdocs.io/package/rlp"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>