Typeberry by Fluffy Labs - v0.4.0
    Preparing search index...

    Class Encoder

    JAM encoder.

    Index

    Methods

    • Attach context to the encoder.

      The context object can be used to pass some "global" parameters down to custom encoders.

      Parameters

      • Optionalcontext: unknown

      Returns void

    • Encode a 16-bit integer.

      The encoding will always occupy 2 bytes in little-endian ordering. Negative numbers are represented as a two-complement.

      Parameters

      • num: number

      Returns void

    • Encode a 24-bit integer.

      The encoding will always occupy 3 bytes in little-endian ordering. Negative numbers are represented as a two-complement.

      Parameters

      • num: number

      Returns void

    • Encode a 32-bit integer.

      The encoding will always occupy 4 bytes in little-endian ordering. Negative numbers are represented as a two-complement.

      Parameters

      • num: number

      Returns void

    • Encode a 64-bit integer.

      The encoding will always occupy 8 bytes in little-endian ordering. Negative numbers are represented as a two-complement.

      Parameters

      • num: bigint

      Returns void

    • Encode a 8-bit integer.

      The encoding will always occupy 1 byte in little-endian ordering. Negative numbers are represented as a two-complement.

      Parameters

      • num: number

      Returns void

    • Encode just a single object.

      NOTE that if you need to encode a tuple glueing together outputs of that function is going to be sub-optimal!

      This is only for one-shot encodings.

      Type Parameters

      • T

      Parameters

      • encode: Encode<T>
      • object: T
      • Optionalcontext: unknown

      Returns BytesBlob