Class CLValueMap

Represents a Map value in the Casper type system. This class manages key-value pairs, providing efficient access and manipulation.

Hierarchy

  • CLValueMap

Constructors

Properties

The data stored in the map as an array of CLValueTuple2.

indexedData: Map<string, CLValue> = ...

An indexed representation of the map data for faster lookups.

type: CLTypeMap

The type of the map.

Methods

  • Appends a new key-value pair to the map.

    Returns

    null if successful, or an Error if the types are invalid or the key already exists.

    Parameters

    • key: CLValue

      The key CLValue to append.

    • val: CLValue

      The value CLValue to append.

    Returns null | Error

  • Converts the map to its byte representation.

    Returns

    A Uint8Array representing the bytes of the map, including its size and key-value pairs.

    Returns Uint8Array

  • Finds a value in the map by key.

    Returns

    A tuple containing the found value (or undefined) and a boolean indicating if the key was found.

    Parameters

    • key: string

      The key to search for.

    Returns [undefined | CLValue, boolean]

  • Finds any value in the map that matches one of the provided keys.

    Returns

    A tuple containing the first found value (or undefined) and a boolean indicating if any key was found.

    Parameters

    • keys: string[]

      An array of keys to search for.

    Returns [undefined | CLValue, boolean]

  • Gets a value from the map by key.

    Returns

    The found CLValue or undefined if the key doesn't exist.

    Parameters

    • key: string

      The key to search for.

    Returns undefined | CLValue

  • Returns the number of entries in the map.

    Returns

    The number of entries in the map.

    Returns number

  • Converts the instance to a JSON-compatible map.

    Returns

    A Map object representing the instance's key-value pairs.

    This method iterates over the data property, extracting key-value pairs from each tuple and storing them in a new Map.

    Returns any

  • Provides a string representation of the map.

    Returns

    A string representation of the map entries.

    Returns string

  • Creates a CLValueMap instance from a Uint8Array. Parses the byte array to interpret the size of the map and each key-value pair.

    Returns

    An object containing the new CLValueMap instance and any remaining bytes.

    Parameters

    • bytes: Uint8Array

      The Uint8Array containing the byte representation of the Map value.

    • mapType: CLTypeMap

      The CLTypeMap representing the type of the map.

    Returns IResultWithBytes<CLValueMap>

Generated using TypeDoc