Zero-allocation binary reader for Solana account data.

Reads little-endian integers, pubkeys, booleans, and COption fields from a Uint8Array with automatic offset tracking. All reads advance the internal cursor.

1.1.0

Constructors

Accessors

Methods

  • Read a boolean (1 byte, 0 = false, non-zero = true).

    Returns boolean

    1.1.0

  • Read a Solana COption — 4-byte discriminator (0 = None, 1 = Some) followed by the inner value.

    Important: The reader function is ALWAYS called to advance the offset past the fixed-size data region (C ABI: data is always present, only the tag indicates validity).

    Type Parameters

    • T

    Parameters

    • reader: (() => T)

      Function to read the inner value.

        • (): T
        • Returns T

    Returns null | T

    The inner value or null if tag is 0 (None).

    1.1.0

  • Seek to an absolute offset.

    Parameters

    • offset: number

    Returns void

    1.1.0

  • Read a raw byte slice of the given length.

    Parameters

    • length: number

    Returns Uint8Array<ArrayBufferLike>

    1.1.0