Pezkuwi API
    Preparing search index...

    Class Option<T>

    Option

    An Option is an optional field. Basically the first byte indicates that there is is value to follow. If the byte is 1 there is an actual value. So the Option implements that - decodes, checks for optionality and wraps the required structure with a value if/as required/found.

    Type Parameters

    • T extends Codec

    Hierarchy (View Summary)

    Implements

    • IOption<T>
    Index
    • Type Parameters

      • T extends Codec

      Parameters

      • registry: Registry
      • typeName: string | CodecClass<T, any[]>
      • Optionalvalue: unknown
      • __namedParameters: DefinitionSetter<CodecClass<T, any[]>> = {}

      Returns Option<T>

    createdAtHash?: IU8a

    The block at which this value was retrieved/created (set to non-empty when retrieved from storage)

    initialU8aLength?: number

    The length of the initial encoded value (Only available when the value was constructed from a Uint8Array input)

    isStorageFallback?: boolean

    (internal usage) Indicates that the value was created via a fallback. This is used when with data specified in the metadata when the storage entry is empty.

    With metadata fallback values (available as defaults on most storage entries) any empty storage item should erturn the default. (This is the same as the implementation on the Bizinikiwi runtime)

    registry: Registry

    The registry associated with this object

    • Parameters

      • Optionalother: unknown

      Returns boolean

      Compares the value of the input to see if there is a match

    • Parameters

      • OptionalisExtended: boolean
      • OptionaldisableAscii: boolean

      Returns AnyJson

      Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information

    • Parameters

      • OptionaldisableAscii: boolean

      Returns AnyJson

      Converts the value in a best-fit primitive form

    • Parameters

      • OptionalisBare: boolean

      Returns string

      Returns the base runtime type name for this instance

    • Parameters

      • OptionalisBare: boolean

        true when the value has none of the type-specific prefixes (internal)

      Returns Uint8Array

      Encodes the value as a Uint8Array as per the SCALE specifications

    • Type Parameters

      • O

      Parameters

      • defaultValue: O

        The value to return if the option isNone

      Returns T | O

      Returns the value that the Option represents (if available) or defaultValue if none